reconify-python 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- reconify/__init__.py +36 -0
- reconify/client.py +264 -0
- reconify/errors.py +132 -0
- reconify/models.py +1067 -0
- reconify/pagination.py +111 -0
- reconify/py.typed +0 -0
- reconify/resources/__init__.py +124 -0
- reconify/resources/alerts.py +58 -0
- reconify/resources/base.py +96 -0
- reconify/resources/events.py +79 -0
- reconify/resources/ingestion.py +94 -0
- reconify/resources/issues.py +207 -0
- reconify/resources/ledger.py +205 -0
- reconify/resources/reconciliations.py +236 -0
- reconify/resources/search.py +37 -0
- reconify/resources/setup.py +311 -0
- reconify/resources/transactions.py +58 -0
- reconify/resources/wallets.py +79 -0
- reconify/transport.py +299 -0
- reconify_python-0.1.0.dist-info/METADATA +125 -0
- reconify_python-0.1.0.dist-info/RECORD +23 -0
- reconify_python-0.1.0.dist-info/WHEEL +4 -0
- reconify_python-0.1.0.dist-info/licenses/LICENSE +21 -0
reconify/pagination.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"""Synchronous and asynchronous helpers for Reconify page responses."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import AsyncIterator, Awaitable, Callable, Iterator
|
|
6
|
+
from typing import Any, TypeVar
|
|
7
|
+
|
|
8
|
+
T = TypeVar("T")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def iter_cursor_pages(
|
|
12
|
+
fetch: Callable[..., Any],
|
|
13
|
+
*,
|
|
14
|
+
item_field: str,
|
|
15
|
+
query: dict[str, Any] | None = None,
|
|
16
|
+
) -> Iterator[T]:
|
|
17
|
+
"""Yield items while passing the server's opaque ``nextCursor`` onward."""
|
|
18
|
+
|
|
19
|
+
params = dict(query or {})
|
|
20
|
+
params.pop("offset", None) if params.get("after") is not None else None
|
|
21
|
+
while True:
|
|
22
|
+
page = fetch(params)
|
|
23
|
+
items = getattr(page, item_field, None) or []
|
|
24
|
+
yield from items
|
|
25
|
+
cursor = getattr(page, "next_cursor", None)
|
|
26
|
+
if not cursor:
|
|
27
|
+
return
|
|
28
|
+
params["after"] = cursor
|
|
29
|
+
if getattr(page, "limit", None) is not None and "limit" not in params:
|
|
30
|
+
params["limit"] = page.limit
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
async def aiter_cursor_pages(
|
|
34
|
+
fetch: Callable[..., Awaitable[Any]],
|
|
35
|
+
*,
|
|
36
|
+
item_field: str,
|
|
37
|
+
query: dict[str, Any] | None = None,
|
|
38
|
+
) -> AsyncIterator[T]:
|
|
39
|
+
"""Async counterpart to :func:`iter_cursor_pages`."""
|
|
40
|
+
|
|
41
|
+
params = dict(query or {})
|
|
42
|
+
if params.get("after") is not None:
|
|
43
|
+
params.pop("offset", None)
|
|
44
|
+
while True:
|
|
45
|
+
page = await fetch(params)
|
|
46
|
+
items = getattr(page, item_field, None) or []
|
|
47
|
+
for item in items:
|
|
48
|
+
yield item
|
|
49
|
+
cursor = getattr(page, "next_cursor", None)
|
|
50
|
+
if not cursor:
|
|
51
|
+
return
|
|
52
|
+
params["after"] = cursor
|
|
53
|
+
if getattr(page, "limit", None) is not None and "limit" not in params:
|
|
54
|
+
params["limit"] = page.limit
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def iter_offset_pages(
|
|
58
|
+
fetch: Callable[..., Any],
|
|
59
|
+
*,
|
|
60
|
+
item_field: str,
|
|
61
|
+
query: dict[str, Any] | None = None,
|
|
62
|
+
) -> Iterator[T]:
|
|
63
|
+
"""Yield items using the server-reported offset and total."""
|
|
64
|
+
|
|
65
|
+
params = dict(query or {})
|
|
66
|
+
params.pop("after", None)
|
|
67
|
+
if params.get("offset") is None:
|
|
68
|
+
params["offset"] = 0
|
|
69
|
+
while True:
|
|
70
|
+
page = fetch(params)
|
|
71
|
+
items = list(getattr(page, item_field, None) or [])
|
|
72
|
+
yield from items
|
|
73
|
+
if not items:
|
|
74
|
+
return
|
|
75
|
+
offset = getattr(page, "offset", params["offset"])
|
|
76
|
+
total = getattr(page, "total", None)
|
|
77
|
+
next_offset = offset + len(items)
|
|
78
|
+
if total is not None and next_offset >= total:
|
|
79
|
+
return
|
|
80
|
+
params["offset"] = next_offset
|
|
81
|
+
if getattr(page, "limit", None) is not None and "limit" not in params:
|
|
82
|
+
params["limit"] = page.limit
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
async def aiter_offset_pages(
|
|
86
|
+
fetch: Callable[..., Awaitable[Any]],
|
|
87
|
+
*,
|
|
88
|
+
item_field: str,
|
|
89
|
+
query: dict[str, Any] | None = None,
|
|
90
|
+
) -> AsyncIterator[T]:
|
|
91
|
+
"""Async counterpart to :func:`iter_offset_pages`."""
|
|
92
|
+
|
|
93
|
+
params = dict(query or {})
|
|
94
|
+
params.pop("after", None)
|
|
95
|
+
if params.get("offset") is None:
|
|
96
|
+
params["offset"] = 0
|
|
97
|
+
while True:
|
|
98
|
+
page = await fetch(params)
|
|
99
|
+
items = list(getattr(page, item_field, None) or [])
|
|
100
|
+
for item in items:
|
|
101
|
+
yield item
|
|
102
|
+
if not items:
|
|
103
|
+
return
|
|
104
|
+
offset = getattr(page, "offset", params["offset"])
|
|
105
|
+
total = getattr(page, "total", None)
|
|
106
|
+
next_offset = offset + len(items)
|
|
107
|
+
if total is not None and next_offset >= total:
|
|
108
|
+
return
|
|
109
|
+
params["offset"] = next_offset
|
|
110
|
+
if getattr(page, "limit", None) is not None and "limit" not in params:
|
|
111
|
+
params["limit"] = page.limit
|
reconify/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"""Resource clients grouped by public API surface."""
|
|
2
|
+
|
|
3
|
+
from .alerts import Alerts, AsyncAlerts
|
|
4
|
+
from .events import AsyncEvents, Events
|
|
5
|
+
from .ingestion import AsyncIngestion, Ingestion
|
|
6
|
+
from .issues import AsyncIssues, Issues
|
|
7
|
+
from .ledger import AsyncLedger, Ledger
|
|
8
|
+
from .reconciliations import AsyncReconciliations, Reconciliations
|
|
9
|
+
from .search import AsyncSearch, Search
|
|
10
|
+
from .setup import AsyncSetup, Setup
|
|
11
|
+
from .transactions import AsyncTransactions, Transactions
|
|
12
|
+
from .wallets import AsyncWallets, Wallets
|
|
13
|
+
|
|
14
|
+
SYNC_RESOURCE_CLASSES = {
|
|
15
|
+
"alerts": Alerts,
|
|
16
|
+
"events": Events,
|
|
17
|
+
"ingestion": Ingestion,
|
|
18
|
+
"issues": Issues,
|
|
19
|
+
"ledger": Ledger,
|
|
20
|
+
"reconciliations": Reconciliations,
|
|
21
|
+
"search": Search,
|
|
22
|
+
"setup": Setup,
|
|
23
|
+
"transactions": Transactions,
|
|
24
|
+
"wallets": Wallets,
|
|
25
|
+
}
|
|
26
|
+
ASYNC_RESOURCE_CLASSES = {
|
|
27
|
+
"alerts": AsyncAlerts,
|
|
28
|
+
"events": AsyncEvents,
|
|
29
|
+
"ingestion": AsyncIngestion,
|
|
30
|
+
"issues": AsyncIssues,
|
|
31
|
+
"ledger": AsyncLedger,
|
|
32
|
+
"reconciliations": AsyncReconciliations,
|
|
33
|
+
"search": AsyncSearch,
|
|
34
|
+
"setup": AsyncSetup,
|
|
35
|
+
"transactions": AsyncTransactions,
|
|
36
|
+
"wallets": AsyncWallets,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
OPERATION_SPECS = {
|
|
40
|
+
"list_alert_rules": ("alerts", "GET", "/alerts/rules"),
|
|
41
|
+
"put_alert_rule": ("alerts", "PUT", "/alerts/rules"),
|
|
42
|
+
"list_events": ("events", "GET", "/events"),
|
|
43
|
+
"get_event": ("events", "GET", "/events/{id}"),
|
|
44
|
+
"reveal_event_field": ("events", "GET", "/events/{id}/reveal"),
|
|
45
|
+
"ingest_integrity_events": ("ingestion", "POST", "/integrity/events"),
|
|
46
|
+
"list_integrity_sources_for_reconciliation": ("reconciliations", "GET", "/integrity/sources"),
|
|
47
|
+
"ingest_integrity_test_events": ("ingestion", "POST", "/integrity/test-events"),
|
|
48
|
+
"list_issues": ("issues", "GET", "/issues"),
|
|
49
|
+
"get_issue_summary": ("issues", "GET", "/issues/summary"),
|
|
50
|
+
"get_issue": ("issues", "GET", "/issues/{id}"),
|
|
51
|
+
"update_issue": ("issues", "PATCH", "/issues/{id}"),
|
|
52
|
+
"list_issue_deliveries": ("issues", "GET", "/issues/{id}/deliveries"),
|
|
53
|
+
"retry_issue_delivery": ("issues", "POST", "/issues/{id}/deliveries/{deliveryId}/retry"),
|
|
54
|
+
"add_issue_note": ("issues", "POST", "/issues/{id}/notes"),
|
|
55
|
+
"resolve_issue": ("issues", "POST", "/issues/{id}/resolve"),
|
|
56
|
+
"list_ledger_sources": ("ledger", "GET", "/ledger/sources"),
|
|
57
|
+
"create_ledger_source": ("ledger", "POST", "/ledger/sources"),
|
|
58
|
+
"delete_ledger_source": ("ledger", "DELETE", "/ledger/sources/{id}"),
|
|
59
|
+
"get_ledger_source": ("ledger", "GET", "/ledger/sources/{id}"),
|
|
60
|
+
"update_ledger_source": ("ledger", "PATCH", "/ledger/sources/{id}"),
|
|
61
|
+
"list_source_periods": ("ledger", "GET", "/ledger/sources/{id}/periods"),
|
|
62
|
+
"list_transactions": ("ledger", "GET", "/ledger/sources/{id}/transactions"),
|
|
63
|
+
"ingest_transactions": ("ledger", "POST", "/ledger/sources/{id}/transactions"),
|
|
64
|
+
"list_reconciliation_schedules": ("reconciliations", "GET", "/reconciliation-schedules"),
|
|
65
|
+
"create_reconciliation_schedule": ("reconciliations", "POST", "/reconciliation-schedules"),
|
|
66
|
+
"delete_reconciliation_schedule": (
|
|
67
|
+
"reconciliations",
|
|
68
|
+
"DELETE",
|
|
69
|
+
"/reconciliation-schedules/{id}",
|
|
70
|
+
),
|
|
71
|
+
"get_reconciliation_schedule": ("reconciliations", "GET", "/reconciliation-schedules/{id}"),
|
|
72
|
+
"update_reconciliation_schedule": (
|
|
73
|
+
"reconciliations",
|
|
74
|
+
"PATCH",
|
|
75
|
+
"/reconciliation-schedules/{id}",
|
|
76
|
+
),
|
|
77
|
+
"list_reconciliations": ("reconciliations", "GET", "/reconciliations"),
|
|
78
|
+
"create_reconciliation": ("reconciliations", "POST", "/reconciliations"),
|
|
79
|
+
"get_reconciliation": ("reconciliations", "GET", "/reconciliations/{id}"),
|
|
80
|
+
"search_integrity_resources": ("search", "GET", "/search"),
|
|
81
|
+
"list_setup_integrations": ("setup", "GET", "/setup/integrations"),
|
|
82
|
+
"get_setup_integration": ("setup", "GET", "/setup/integrations/{id}"),
|
|
83
|
+
"list_setup_sources": ("setup", "GET", "/setup/sources"),
|
|
84
|
+
"create_setup_source": ("setup", "POST", "/setup/sources"),
|
|
85
|
+
"get_setup_source": ("setup", "GET", "/setup/sources/{id}"),
|
|
86
|
+
"update_setup_source": ("setup", "PATCH", "/setup/sources/{id}"),
|
|
87
|
+
"disable_setup_source": ("setup", "DELETE", "/setup/sources/{id}"),
|
|
88
|
+
"create_test_session": ("setup", "POST", "/setup/test-sessions"),
|
|
89
|
+
"get_test_session": ("setup", "GET", "/setup/test-sessions/{id}"),
|
|
90
|
+
"get_test_session_result": ("setup", "GET", "/setup/test-sessions/{id}/result"),
|
|
91
|
+
"retry_test_session": ("setup", "POST", "/setup/test-sessions/{id}/retry"),
|
|
92
|
+
"submit_test_session_events": ("setup", "POST", "/setup/test-sessions/{id}/submit"),
|
|
93
|
+
"list_wallet_transactions": ("transactions", "GET", "/transactions"),
|
|
94
|
+
"get_wallet_transaction": ("transactions", "GET", "/transactions/{id}"),
|
|
95
|
+
"list_wallets": ("wallets", "GET", "/wallets"),
|
|
96
|
+
"get_wallet": ("wallets", "GET", "/wallets/{id}"),
|
|
97
|
+
"get_wallet_balance": ("wallets", "GET", "/wallets/{id}/balance"),
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
__all__ = [
|
|
101
|
+
"Alerts",
|
|
102
|
+
"AsyncAlerts",
|
|
103
|
+
"AsyncEvents",
|
|
104
|
+
"AsyncIngestion",
|
|
105
|
+
"AsyncIssues",
|
|
106
|
+
"AsyncLedger",
|
|
107
|
+
"AsyncReconciliations",
|
|
108
|
+
"AsyncSearch",
|
|
109
|
+
"AsyncSetup",
|
|
110
|
+
"AsyncTransactions",
|
|
111
|
+
"AsyncWallets",
|
|
112
|
+
"Events",
|
|
113
|
+
"Ingestion",
|
|
114
|
+
"Issues",
|
|
115
|
+
"Ledger",
|
|
116
|
+
"Reconciliations",
|
|
117
|
+
"Search",
|
|
118
|
+
"Setup",
|
|
119
|
+
"Transactions",
|
|
120
|
+
"Wallets",
|
|
121
|
+
"ASYNC_RESOURCE_CLASSES",
|
|
122
|
+
"OPERATION_SPECS",
|
|
123
|
+
"SYNC_RESOURCE_CLASSES",
|
|
124
|
+
]
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""Alerts API resource client."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from ..models import AlertRuleRequest, AlertRulesOutputBody, StatusOutputBody
|
|
8
|
+
from .base import AsyncResource, SyncResource
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Alerts(SyncResource):
|
|
12
|
+
def list_alert_rules(self, raw: bool = False, **query: Any) -> Any:
|
|
13
|
+
return self._request(
|
|
14
|
+
"GET",
|
|
15
|
+
"/alerts/rules",
|
|
16
|
+
params=query,
|
|
17
|
+
body=None,
|
|
18
|
+
response_model=AlertRulesOutputBody,
|
|
19
|
+
raw=raw,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
def put_alert_rule(self, body: AlertRuleRequest, raw: bool = False, **query: Any) -> Any:
|
|
23
|
+
return self._request(
|
|
24
|
+
"PUT",
|
|
25
|
+
"/alerts/rules",
|
|
26
|
+
params=query,
|
|
27
|
+
body=body,
|
|
28
|
+
response_model=StatusOutputBody,
|
|
29
|
+
raw=raw,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class AsyncAlerts(AsyncResource):
|
|
34
|
+
async def list_alert_rules(self, raw: bool = False, **query: Any) -> Any:
|
|
35
|
+
return await self._request(
|
|
36
|
+
"GET",
|
|
37
|
+
"/alerts/rules",
|
|
38
|
+
params=query,
|
|
39
|
+
body=None,
|
|
40
|
+
response_model=AlertRulesOutputBody,
|
|
41
|
+
raw=raw,
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
async def put_alert_rule(self, body: AlertRuleRequest, raw: bool = False, **query: Any) -> Any:
|
|
45
|
+
return await self._request(
|
|
46
|
+
"PUT",
|
|
47
|
+
"/alerts/rules",
|
|
48
|
+
params=query,
|
|
49
|
+
body=body,
|
|
50
|
+
response_model=StatusOutputBody,
|
|
51
|
+
raw=raw,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
OPERATION_SPECS = {
|
|
56
|
+
"list_alert_rules": ("alerts", "GET", "/alerts/rules"),
|
|
57
|
+
"put_alert_rule": ("alerts", "PUT", "/alerts/rules"),
|
|
58
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"""Shared implementation for resource clients."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
from typing import Any
|
|
7
|
+
from urllib.parse import quote
|
|
8
|
+
|
|
9
|
+
from ..errors import ReconifyValidationError
|
|
10
|
+
from ..transport import AsyncTransport, SyncTransport
|
|
11
|
+
|
|
12
|
+
_PATH_PARAMETER_RE = re.compile(r"\{([^}]+)\}")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _snake(value: str) -> str:
|
|
16
|
+
return re.sub(r"(?<!^)(?=[A-Z])", "_", value).lower()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class SyncResource:
|
|
20
|
+
def __init__(self, transport: SyncTransport) -> None:
|
|
21
|
+
self._transport = transport
|
|
22
|
+
|
|
23
|
+
def _request(
|
|
24
|
+
self,
|
|
25
|
+
method: str,
|
|
26
|
+
path: str,
|
|
27
|
+
*,
|
|
28
|
+
params: dict[str, Any],
|
|
29
|
+
body: Any = None,
|
|
30
|
+
response_model: Any = None,
|
|
31
|
+
raw: bool = False,
|
|
32
|
+
headers: dict[str, str] | None = None,
|
|
33
|
+
) -> Any:
|
|
34
|
+
path_params = set(_PATH_PARAMETER_RE.findall(path))
|
|
35
|
+
wire_params = dict(params)
|
|
36
|
+
for name in path_params:
|
|
37
|
+
python_name = _snake(name)
|
|
38
|
+
if python_name not in wire_params or wire_params[python_name] is None:
|
|
39
|
+
raise ReconifyValidationError(f"Missing required path parameter: {python_name}")
|
|
40
|
+
path = path.replace("{" + name + "}", quote(str(wire_params.pop(python_name)), safe=""))
|
|
41
|
+
request_headers = dict(headers or {})
|
|
42
|
+
timeout = wire_params.pop("timeout", None)
|
|
43
|
+
if wire_params.get("integrity_test_session"):
|
|
44
|
+
request_headers["X-Integrity-Test-Session"] = wire_params.pop("integrity_test_session")
|
|
45
|
+
if wire_params.get("after") is not None:
|
|
46
|
+
wire_params.pop("offset", None)
|
|
47
|
+
return self._transport.request(
|
|
48
|
+
method,
|
|
49
|
+
path,
|
|
50
|
+
query=wire_params,
|
|
51
|
+
body=body,
|
|
52
|
+
headers=request_headers,
|
|
53
|
+
model=response_model,
|
|
54
|
+
raw=raw,
|
|
55
|
+
timeout=timeout,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class AsyncResource:
|
|
60
|
+
def __init__(self, transport: AsyncTransport) -> None:
|
|
61
|
+
self._transport = transport
|
|
62
|
+
|
|
63
|
+
async def _request(
|
|
64
|
+
self,
|
|
65
|
+
method: str,
|
|
66
|
+
path: str,
|
|
67
|
+
*,
|
|
68
|
+
params: dict[str, Any],
|
|
69
|
+
body: Any = None,
|
|
70
|
+
response_model: Any = None,
|
|
71
|
+
raw: bool = False,
|
|
72
|
+
headers: dict[str, str] | None = None,
|
|
73
|
+
) -> Any:
|
|
74
|
+
path_params = set(_PATH_PARAMETER_RE.findall(path))
|
|
75
|
+
wire_params = dict(params)
|
|
76
|
+
for name in path_params:
|
|
77
|
+
python_name = _snake(name)
|
|
78
|
+
if python_name not in wire_params or wire_params[python_name] is None:
|
|
79
|
+
raise ReconifyValidationError(f"Missing required path parameter: {python_name}")
|
|
80
|
+
path = path.replace("{" + name + "}", quote(str(wire_params.pop(python_name)), safe=""))
|
|
81
|
+
request_headers = dict(headers or {})
|
|
82
|
+
timeout = wire_params.pop("timeout", None)
|
|
83
|
+
if wire_params.get("integrity_test_session"):
|
|
84
|
+
request_headers["X-Integrity-Test-Session"] = wire_params.pop("integrity_test_session")
|
|
85
|
+
if wire_params.get("after") is not None:
|
|
86
|
+
wire_params.pop("offset", None)
|
|
87
|
+
return await self._transport.request(
|
|
88
|
+
method,
|
|
89
|
+
path,
|
|
90
|
+
query=wire_params,
|
|
91
|
+
body=body,
|
|
92
|
+
headers=request_headers,
|
|
93
|
+
model=response_model,
|
|
94
|
+
raw=raw,
|
|
95
|
+
timeout=timeout,
|
|
96
|
+
)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""Events API resource client."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from ..models import EventDetail, EventPage, EventRevealOutputBody
|
|
8
|
+
from .base import AsyncResource, SyncResource
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Events(SyncResource):
|
|
12
|
+
def list_events(self, raw: bool = False, **query: Any) -> Any:
|
|
13
|
+
return self._request(
|
|
14
|
+
"GET",
|
|
15
|
+
"/events",
|
|
16
|
+
params=query,
|
|
17
|
+
body=None,
|
|
18
|
+
response_model=EventPage,
|
|
19
|
+
raw=raw,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
def get_event(self, id: str, raw: bool = False, **query: Any) -> Any:
|
|
23
|
+
return self._request(
|
|
24
|
+
"GET",
|
|
25
|
+
"/events/{id}",
|
|
26
|
+
params={**query, "id": id},
|
|
27
|
+
body=None,
|
|
28
|
+
response_model=EventDetail,
|
|
29
|
+
raw=raw,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
def reveal_event_field(self, id: str, raw: bool = False, **query: Any) -> Any:
|
|
33
|
+
return self._request(
|
|
34
|
+
"GET",
|
|
35
|
+
"/events/{id}/reveal",
|
|
36
|
+
params={**query, "id": id},
|
|
37
|
+
body=None,
|
|
38
|
+
response_model=EventRevealOutputBody,
|
|
39
|
+
raw=raw,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class AsyncEvents(AsyncResource):
|
|
44
|
+
async def list_events(self, raw: bool = False, **query: Any) -> Any:
|
|
45
|
+
return await self._request(
|
|
46
|
+
"GET",
|
|
47
|
+
"/events",
|
|
48
|
+
params=query,
|
|
49
|
+
body=None,
|
|
50
|
+
response_model=EventPage,
|
|
51
|
+
raw=raw,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
async def get_event(self, id: str, raw: bool = False, **query: Any) -> Any:
|
|
55
|
+
return await self._request(
|
|
56
|
+
"GET",
|
|
57
|
+
"/events/{id}",
|
|
58
|
+
params={**query, "id": id},
|
|
59
|
+
body=None,
|
|
60
|
+
response_model=EventDetail,
|
|
61
|
+
raw=raw,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
async def reveal_event_field(self, id: str, raw: bool = False, **query: Any) -> Any:
|
|
65
|
+
return await self._request(
|
|
66
|
+
"GET",
|
|
67
|
+
"/events/{id}/reveal",
|
|
68
|
+
params={**query, "id": id},
|
|
69
|
+
body=None,
|
|
70
|
+
response_model=EventRevealOutputBody,
|
|
71
|
+
raw=raw,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
OPERATION_SPECS = {
|
|
76
|
+
"list_events": ("events", "GET", "/events"),
|
|
77
|
+
"get_event": ("events", "GET", "/events/{id}"),
|
|
78
|
+
"reveal_event_field": ("events", "GET", "/events/{id}/reveal"),
|
|
79
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""Ingestion API resource client."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from ..models import BatchResponse, IngestEventsInputBody
|
|
8
|
+
from .base import AsyncResource, SyncResource
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Ingestion(SyncResource):
|
|
12
|
+
def ingest_integrity_events(
|
|
13
|
+
self,
|
|
14
|
+
body: IngestEventsInputBody,
|
|
15
|
+
integrity_test_session: str | None = None,
|
|
16
|
+
raw: bool = False,
|
|
17
|
+
**query: Any,
|
|
18
|
+
) -> Any:
|
|
19
|
+
return self._request(
|
|
20
|
+
"POST",
|
|
21
|
+
"/integrity/events",
|
|
22
|
+
params=query,
|
|
23
|
+
body=body,
|
|
24
|
+
response_model=BatchResponse,
|
|
25
|
+
raw=raw,
|
|
26
|
+
headers={"X-Integrity-Test-Session": integrity_test_session}
|
|
27
|
+
if integrity_test_session
|
|
28
|
+
else None,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
def ingest_integrity_test_events(
|
|
32
|
+
self,
|
|
33
|
+
body: IngestEventsInputBody,
|
|
34
|
+
integrity_test_session: str | None = None,
|
|
35
|
+
raw: bool = False,
|
|
36
|
+
**query: Any,
|
|
37
|
+
) -> Any:
|
|
38
|
+
return self._request(
|
|
39
|
+
"POST",
|
|
40
|
+
"/integrity/test-events",
|
|
41
|
+
params=query,
|
|
42
|
+
body=body,
|
|
43
|
+
response_model=BatchResponse,
|
|
44
|
+
raw=raw,
|
|
45
|
+
headers={"X-Integrity-Test-Session": integrity_test_session}
|
|
46
|
+
if integrity_test_session
|
|
47
|
+
else None,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class AsyncIngestion(AsyncResource):
|
|
52
|
+
async def ingest_integrity_events(
|
|
53
|
+
self,
|
|
54
|
+
body: IngestEventsInputBody,
|
|
55
|
+
integrity_test_session: str | None = None,
|
|
56
|
+
raw: bool = False,
|
|
57
|
+
**query: Any,
|
|
58
|
+
) -> Any:
|
|
59
|
+
return await self._request(
|
|
60
|
+
"POST",
|
|
61
|
+
"/integrity/events",
|
|
62
|
+
params=query,
|
|
63
|
+
body=body,
|
|
64
|
+
response_model=BatchResponse,
|
|
65
|
+
raw=raw,
|
|
66
|
+
headers={"X-Integrity-Test-Session": integrity_test_session}
|
|
67
|
+
if integrity_test_session
|
|
68
|
+
else None,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
async def ingest_integrity_test_events(
|
|
72
|
+
self,
|
|
73
|
+
body: IngestEventsInputBody,
|
|
74
|
+
integrity_test_session: str | None = None,
|
|
75
|
+
raw: bool = False,
|
|
76
|
+
**query: Any,
|
|
77
|
+
) -> Any:
|
|
78
|
+
return await self._request(
|
|
79
|
+
"POST",
|
|
80
|
+
"/integrity/test-events",
|
|
81
|
+
params=query,
|
|
82
|
+
body=body,
|
|
83
|
+
response_model=BatchResponse,
|
|
84
|
+
raw=raw,
|
|
85
|
+
headers={"X-Integrity-Test-Session": integrity_test_session}
|
|
86
|
+
if integrity_test_session
|
|
87
|
+
else None,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
OPERATION_SPECS = {
|
|
92
|
+
"ingest_integrity_events": ("ingestion", "POST", "/integrity/events"),
|
|
93
|
+
"ingest_integrity_test_events": ("ingestion", "POST", "/integrity/test-events"),
|
|
94
|
+
}
|