kalir-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.
- kalir/__init__.py +11 -0
- kalir/api/__init__.py +1 -0
- kalir/api/assets/__init__.py +1 -0
- kalir/api/assets/create_asset.py +193 -0
- kalir/api/assets/delete_asset.py +182 -0
- kalir/api/assets/get_asset.py +186 -0
- kalir/api/assets/list_assets.py +165 -0
- kalir/api/assets/update_asset.py +206 -0
- kalir/api/events/__init__.py +1 -0
- kalir/api/events/get_event.py +194 -0
- kalir/api/events/ingest_event.py +215 -0
- kalir/api/events/list_events.py +259 -0
- kalir/api/exposures/__init__.py +1 -0
- kalir/api/exposures/count_exposures.py +165 -0
- kalir/api/exposures/get_infostealer_summary.py +181 -0
- kalir/api/exposures/list_exposures.py +225 -0
- kalir/api/incidents/__init__.py +1 -0
- kalir/api/incidents/get_incident.py +194 -0
- kalir/api/incidents/list_incidents.py +265 -0
- kalir/api/incidents/update_incident_status.py +207 -0
- kalir/api/intel/__init__.py +1 -0
- kalir/api/intel/get_ransomware_stats.py +165 -0
- kalir/api/intel/list_ransomware_victims.py +165 -0
- kalir/api/mentions/__init__.py +1 -0
- kalir/api/mentions/list_mentions.py +283 -0
- kalir/api/overview/__init__.py +1 -0
- kalir/api/overview/get_overview.py +184 -0
- kalir/api/phishing/__init__.py +1 -0
- kalir/api/phishing/list_phishing.py +245 -0
- kalir/api/reports/__init__.py +1 -0
- kalir/api/reports/create_report.py +193 -0
- kalir/api/reports/download_report.py +186 -0
- kalir/api/reports/list_reports.py +165 -0
- kalir/api/rules/__init__.py +1 -0
- kalir/api/rules/create_rule.py +193 -0
- kalir/api/rules/delete_rule.py +183 -0
- kalir/api/rules/get_rule.py +187 -0
- kalir/api/rules/list_rules.py +165 -0
- kalir/api/rules/replace_rule.py +207 -0
- kalir/api/takedowns/__init__.py +1 -0
- kalir/api/takedowns/count_takedowns.py +165 -0
- kalir/api/takedowns/create_takedown.py +193 -0
- kalir/api/takedowns/delete_takedown.py +183 -0
- kalir/api/takedowns/get_takedown.py +187 -0
- kalir/api/takedowns/list_takedowns.py +165 -0
- kalir/api/takedowns/replace_takedown.py +210 -0
- kalir/api/takedowns/update_takedown.py +210 -0
- kalir/api/webhooks/__init__.py +1 -0
- kalir/api/webhooks/create_webhook.py +222 -0
- kalir/api/webhooks/delete_webhook.py +190 -0
- kalir/api/webhooks/get_webhook.py +194 -0
- kalir/api/webhooks/get_webhook_delivery.py +194 -0
- kalir/api/webhooks/list_webhook_deliveries.py +239 -0
- kalir/api/webhooks/list_webhook_event_types.py +165 -0
- kalir/api/webhooks/list_webhooks.py +172 -0
- kalir/api/webhooks/retry_webhook_delivery.py +190 -0
- kalir/api/webhooks/rotate_webhook_secret.py +202 -0
- kalir/api/webhooks/send_webhook_test.py +202 -0
- kalir/api/webhooks/update_webhook.py +229 -0
- kalir/client.py +271 -0
- kalir/errors.py +14 -0
- kalir/models/__init__.py +195 -0
- kalir/models/asset.py +162 -0
- kalir/models/asset_create.py +122 -0
- kalir/models/asset_create_asset_type.py +14 -0
- kalir/models/asset_create_metadata.py +64 -0
- kalir/models/count_exposures_response_200.py +78 -0
- kalir/models/count_takedowns_response_200.py +96 -0
- kalir/models/create_report_body.py +96 -0
- kalir/models/create_report_body_type.py +10 -0
- kalir/models/create_webhook_response_201.py +111 -0
- kalir/models/error.py +84 -0
- kalir/models/error_error.py +106 -0
- kalir/models/error_error_type.py +15 -0
- kalir/models/event.py +151 -0
- kalir/models/event_asset.py +87 -0
- kalir/models/event_ingest.py +146 -0
- kalir/models/event_ingest_asset.py +87 -0
- kalir/models/event_ingest_evidence.py +64 -0
- kalir/models/event_ingest_source.py +87 -0
- kalir/models/exposure.py +137 -0
- kalir/models/exposure_webhook_event.py +152 -0
- kalir/models/exposure_webhook_event_data.py +115 -0
- kalir/models/exposure_webhook_event_data_exposure.py +149 -0
- kalir/models/exposure_webhook_event_data_infection.py +136 -0
- kalir/models/exposure_webhook_event_type.py +8 -0
- kalir/models/get_incident_response_200.py +174 -0
- kalir/models/get_infostealer_summary_response_200.py +100 -0
- kalir/models/get_ransomware_stats_response_200.py +156 -0
- kalir/models/get_ransomware_stats_response_200_top_countries_7d_item.py +64 -0
- kalir/models/get_ransomware_stats_response_200_top_groups_7d_item.py +64 -0
- kalir/models/incident.py +170 -0
- kalir/models/incident_severity.py +10 -0
- kalir/models/incident_status.py +10 -0
- kalir/models/incident_webhook_event.py +152 -0
- kalir/models/incident_webhook_event_data.py +115 -0
- kalir/models/incident_webhook_event_data_previous.py +88 -0
- kalir/models/incident_webhook_event_type.py +9 -0
- kalir/models/infostealer_domain_summary.py +122 -0
- kalir/models/infostealer_domain_summary_snapshot.py +201 -0
- kalir/models/infostealer_domain_summary_snapshot_top_employee_urls_item.py +87 -0
- kalir/models/infostealer_domain_summary_snapshot_top_families_item.py +87 -0
- kalir/models/list_assets_response_200.py +100 -0
- kalir/models/list_events_response_200.py +109 -0
- kalir/models/list_exposures_response_200.py +127 -0
- kalir/models/list_incidents_bucket.py +10 -0
- kalir/models/list_incidents_response_200.py +149 -0
- kalir/models/list_incidents_response_200_counts.py +106 -0
- kalir/models/list_incidents_status.py +12 -0
- kalir/models/list_mentions_response_200.py +122 -0
- kalir/models/list_mentions_source.py +8 -0
- kalir/models/list_phishing_response_200.py +122 -0
- kalir/models/list_phishing_verdict.py +11 -0
- kalir/models/list_ransomware_victims_response_200.py +109 -0
- kalir/models/list_ransomware_victims_response_200_victims_item.py +64 -0
- kalir/models/list_reports_response_200.py +109 -0
- kalir/models/list_rules_response_200.py +100 -0
- kalir/models/list_takedowns_response_200.py +109 -0
- kalir/models/list_webhook_deliveries_response_200.py +122 -0
- kalir/models/list_webhook_event_types_response_200.py +100 -0
- kalir/models/list_webhook_event_types_response_200_data_item.py +87 -0
- kalir/models/list_webhooks_response_200.py +100 -0
- kalir/models/mention.py +194 -0
- kalir/models/mention_source.py +8 -0
- kalir/models/overview.py +231 -0
- kalir/models/overview_assets.py +96 -0
- kalir/models/overview_exposures.py +105 -0
- kalir/models/overview_incidents.py +114 -0
- kalir/models/overview_phishing.py +87 -0
- kalir/models/overview_risk_level.py +10 -0
- kalir/models/overview_takedowns.py +87 -0
- kalir/models/pagination.py +105 -0
- kalir/models/phishing_domain.py +186 -0
- kalir/models/phishing_domain_verdict.py +11 -0
- kalir/models/report.py +182 -0
- kalir/models/report_parameters.py +181 -0
- kalir/models/report_parameters_date_range.py +11 -0
- kalir/models/report_parameters_language.py +8 -0
- kalir/models/report_parameters_sections_item.py +15 -0
- kalir/models/report_status.py +10 -0
- kalir/models/rotate_webhook_secret_response_200.py +87 -0
- kalir/models/rule.py +174 -0
- kalir/models/rule_input.py +134 -0
- kalir/models/rule_input_actions_item.py +64 -0
- kalir/models/takedown.py +163 -0
- kalir/models/takedown_create.py +113 -0
- kalir/models/takedown_update.py +96 -0
- kalir/models/update_incident_status_body.py +90 -0
- kalir/models/update_incident_status_body_status.py +10 -0
- kalir/models/webhook_delivery.py +274 -0
- kalir/models/webhook_delivery_payload.py +64 -0
- kalir/models/webhook_delivery_status.py +9 -0
- kalir/models/webhook_endpoint.py +216 -0
- kalir/models/webhook_endpoint_input.py +124 -0
- kalir/models/webhook_endpoint_input_event_types_item.py +11 -0
- kalir/models/webhook_incident.py +232 -0
- kalir/models/webhook_incident_severity.py +10 -0
- kalir/py.typed +1 -0
- kalir/types.py +53 -0
- kalir/webhooks.py +63 -0
- kalir_python-0.1.0.dist-info/METADATA +76 -0
- kalir_python-0.1.0.dist-info/RECORD +163 -0
- kalir_python-0.1.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
from ...models.error import Error
|
|
12
|
+
from ...models.list_phishing_response_200 import ListPhishingResponse200
|
|
13
|
+
from ...models.list_phishing_verdict import ListPhishingVerdict
|
|
14
|
+
from ...types import UNSET, Unset
|
|
15
|
+
from typing import cast
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _get_kwargs(
|
|
20
|
+
*,
|
|
21
|
+
verdict: ListPhishingVerdict | Unset = UNSET,
|
|
22
|
+
limit: int | Unset = 50,
|
|
23
|
+
offset: int | Unset = 0,
|
|
24
|
+
|
|
25
|
+
) -> dict[str, Any]:
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
params: dict[str, Any] = {}
|
|
31
|
+
|
|
32
|
+
json_verdict: str | Unset = UNSET
|
|
33
|
+
if not isinstance(verdict, Unset):
|
|
34
|
+
json_verdict = verdict.value
|
|
35
|
+
|
|
36
|
+
params["verdict"] = json_verdict
|
|
37
|
+
|
|
38
|
+
params["limit"] = limit
|
|
39
|
+
|
|
40
|
+
params["offset"] = offset
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
_kwargs: dict[str, Any] = {
|
|
47
|
+
"method": "get",
|
|
48
|
+
"url": "/v1/phishing",
|
|
49
|
+
"params": params,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
return _kwargs
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | ListPhishingResponse200 | None:
|
|
58
|
+
if response.status_code == 200:
|
|
59
|
+
response_200 = ListPhishingResponse200.from_dict(response.json())
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
return response_200
|
|
64
|
+
|
|
65
|
+
if response.status_code == 400:
|
|
66
|
+
response_400 = Error.from_dict(response.json())
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
return response_400
|
|
71
|
+
|
|
72
|
+
if response.status_code == 401:
|
|
73
|
+
response_401 = Error.from_dict(response.json())
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
return response_401
|
|
78
|
+
|
|
79
|
+
if response.status_code == 429:
|
|
80
|
+
response_429 = Error.from_dict(response.json())
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
return response_429
|
|
85
|
+
|
|
86
|
+
if client.raise_on_unexpected_status:
|
|
87
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
88
|
+
else:
|
|
89
|
+
return None
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Error | ListPhishingResponse200]:
|
|
93
|
+
return Response(
|
|
94
|
+
status_code=HTTPStatus(response.status_code),
|
|
95
|
+
content=response.content,
|
|
96
|
+
headers=response.headers,
|
|
97
|
+
parsed=_parse_response(client=client, response=response),
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def sync_detailed(
|
|
102
|
+
*,
|
|
103
|
+
client: AuthenticatedClient,
|
|
104
|
+
verdict: ListPhishingVerdict | Unset = UNSET,
|
|
105
|
+
limit: int | Unset = 50,
|
|
106
|
+
offset: int | Unset = 0,
|
|
107
|
+
|
|
108
|
+
) -> Response[Error | ListPhishingResponse200]:
|
|
109
|
+
""" List domains impersonating you
|
|
110
|
+
|
|
111
|
+
Surfaced detections only (suppressed false positives are excluded). Confirmed phishing sorts first.
|
|
112
|
+
|
|
113
|
+
Args:
|
|
114
|
+
verdict (ListPhishingVerdict | Unset):
|
|
115
|
+
limit (int | Unset): Default: 50.
|
|
116
|
+
offset (int | Unset): Default: 0.
|
|
117
|
+
|
|
118
|
+
Raises:
|
|
119
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
120
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
Response[Error | ListPhishingResponse200]
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
kwargs = _get_kwargs(
|
|
128
|
+
verdict=verdict,
|
|
129
|
+
limit=limit,
|
|
130
|
+
offset=offset,
|
|
131
|
+
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
response = client.get_httpx_client().request(
|
|
135
|
+
**kwargs,
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
return _build_response(client=client, response=response)
|
|
139
|
+
|
|
140
|
+
def sync(
|
|
141
|
+
*,
|
|
142
|
+
client: AuthenticatedClient,
|
|
143
|
+
verdict: ListPhishingVerdict | Unset = UNSET,
|
|
144
|
+
limit: int | Unset = 50,
|
|
145
|
+
offset: int | Unset = 0,
|
|
146
|
+
|
|
147
|
+
) -> Error | ListPhishingResponse200 | None:
|
|
148
|
+
""" List domains impersonating you
|
|
149
|
+
|
|
150
|
+
Surfaced detections only (suppressed false positives are excluded). Confirmed phishing sorts first.
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
verdict (ListPhishingVerdict | Unset):
|
|
154
|
+
limit (int | Unset): Default: 50.
|
|
155
|
+
offset (int | Unset): Default: 0.
|
|
156
|
+
|
|
157
|
+
Raises:
|
|
158
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
159
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
Error | ListPhishingResponse200
|
|
163
|
+
"""
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
return sync_detailed(
|
|
167
|
+
client=client,
|
|
168
|
+
verdict=verdict,
|
|
169
|
+
limit=limit,
|
|
170
|
+
offset=offset,
|
|
171
|
+
|
|
172
|
+
).parsed
|
|
173
|
+
|
|
174
|
+
async def asyncio_detailed(
|
|
175
|
+
*,
|
|
176
|
+
client: AuthenticatedClient,
|
|
177
|
+
verdict: ListPhishingVerdict | Unset = UNSET,
|
|
178
|
+
limit: int | Unset = 50,
|
|
179
|
+
offset: int | Unset = 0,
|
|
180
|
+
|
|
181
|
+
) -> Response[Error | ListPhishingResponse200]:
|
|
182
|
+
""" List domains impersonating you
|
|
183
|
+
|
|
184
|
+
Surfaced detections only (suppressed false positives are excluded). Confirmed phishing sorts first.
|
|
185
|
+
|
|
186
|
+
Args:
|
|
187
|
+
verdict (ListPhishingVerdict | Unset):
|
|
188
|
+
limit (int | Unset): Default: 50.
|
|
189
|
+
offset (int | Unset): Default: 0.
|
|
190
|
+
|
|
191
|
+
Raises:
|
|
192
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
193
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
194
|
+
|
|
195
|
+
Returns:
|
|
196
|
+
Response[Error | ListPhishingResponse200]
|
|
197
|
+
"""
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
kwargs = _get_kwargs(
|
|
201
|
+
verdict=verdict,
|
|
202
|
+
limit=limit,
|
|
203
|
+
offset=offset,
|
|
204
|
+
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
response = await client.get_async_httpx_client().request(
|
|
208
|
+
**kwargs
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
return _build_response(client=client, response=response)
|
|
212
|
+
|
|
213
|
+
async def asyncio(
|
|
214
|
+
*,
|
|
215
|
+
client: AuthenticatedClient,
|
|
216
|
+
verdict: ListPhishingVerdict | Unset = UNSET,
|
|
217
|
+
limit: int | Unset = 50,
|
|
218
|
+
offset: int | Unset = 0,
|
|
219
|
+
|
|
220
|
+
) -> Error | ListPhishingResponse200 | None:
|
|
221
|
+
""" List domains impersonating you
|
|
222
|
+
|
|
223
|
+
Surfaced detections only (suppressed false positives are excluded). Confirmed phishing sorts first.
|
|
224
|
+
|
|
225
|
+
Args:
|
|
226
|
+
verdict (ListPhishingVerdict | Unset):
|
|
227
|
+
limit (int | Unset): Default: 50.
|
|
228
|
+
offset (int | Unset): Default: 0.
|
|
229
|
+
|
|
230
|
+
Raises:
|
|
231
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
232
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
233
|
+
|
|
234
|
+
Returns:
|
|
235
|
+
Error | ListPhishingResponse200
|
|
236
|
+
"""
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
return (await asyncio_detailed(
|
|
240
|
+
client=client,
|
|
241
|
+
verdict=verdict,
|
|
242
|
+
limit=limit,
|
|
243
|
+
offset=offset,
|
|
244
|
+
|
|
245
|
+
)).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
""" Contains endpoint functions for accessing the API """
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
from ...models.create_report_body import CreateReportBody
|
|
12
|
+
from ...models.error import Error
|
|
13
|
+
from ...models.report import Report
|
|
14
|
+
from typing import cast
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _get_kwargs(
|
|
19
|
+
*,
|
|
20
|
+
body: CreateReportBody,
|
|
21
|
+
|
|
22
|
+
) -> dict[str, Any]:
|
|
23
|
+
headers: dict[str, Any] = {}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
_kwargs: dict[str, Any] = {
|
|
31
|
+
"method": "post",
|
|
32
|
+
"url": "/v1/reports",
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
_kwargs["json"] = body.to_dict()
|
|
36
|
+
|
|
37
|
+
headers["Content-Type"] = "application/json"
|
|
38
|
+
|
|
39
|
+
_kwargs["headers"] = headers
|
|
40
|
+
return _kwargs
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | Report | None:
|
|
45
|
+
if response.status_code == 201:
|
|
46
|
+
response_201 = Report.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
return response_201
|
|
51
|
+
|
|
52
|
+
if response.status_code == 401:
|
|
53
|
+
response_401 = Error.from_dict(response.json())
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
return response_401
|
|
58
|
+
|
|
59
|
+
if response.status_code == 429:
|
|
60
|
+
response_429 = Error.from_dict(response.json())
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
return response_429
|
|
65
|
+
|
|
66
|
+
if client.raise_on_unexpected_status:
|
|
67
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
68
|
+
else:
|
|
69
|
+
return None
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Error | Report]:
|
|
73
|
+
return Response(
|
|
74
|
+
status_code=HTTPStatus(response.status_code),
|
|
75
|
+
content=response.content,
|
|
76
|
+
headers=response.headers,
|
|
77
|
+
parsed=_parse_response(client=client, response=response),
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def sync_detailed(
|
|
82
|
+
*,
|
|
83
|
+
client: AuthenticatedClient,
|
|
84
|
+
body: CreateReportBody,
|
|
85
|
+
|
|
86
|
+
) -> Response[Error | Report]:
|
|
87
|
+
""" Generate a report
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
body (CreateReportBody):
|
|
91
|
+
|
|
92
|
+
Raises:
|
|
93
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
94
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
Response[Error | Report]
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
kwargs = _get_kwargs(
|
|
102
|
+
body=body,
|
|
103
|
+
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
response = client.get_httpx_client().request(
|
|
107
|
+
**kwargs,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
return _build_response(client=client, response=response)
|
|
111
|
+
|
|
112
|
+
def sync(
|
|
113
|
+
*,
|
|
114
|
+
client: AuthenticatedClient,
|
|
115
|
+
body: CreateReportBody,
|
|
116
|
+
|
|
117
|
+
) -> Error | Report | None:
|
|
118
|
+
""" Generate a report
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
body (CreateReportBody):
|
|
122
|
+
|
|
123
|
+
Raises:
|
|
124
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
125
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
Error | Report
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
return sync_detailed(
|
|
133
|
+
client=client,
|
|
134
|
+
body=body,
|
|
135
|
+
|
|
136
|
+
).parsed
|
|
137
|
+
|
|
138
|
+
async def asyncio_detailed(
|
|
139
|
+
*,
|
|
140
|
+
client: AuthenticatedClient,
|
|
141
|
+
body: CreateReportBody,
|
|
142
|
+
|
|
143
|
+
) -> Response[Error | Report]:
|
|
144
|
+
""" Generate a report
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
body (CreateReportBody):
|
|
148
|
+
|
|
149
|
+
Raises:
|
|
150
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
151
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
152
|
+
|
|
153
|
+
Returns:
|
|
154
|
+
Response[Error | Report]
|
|
155
|
+
"""
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
kwargs = _get_kwargs(
|
|
159
|
+
body=body,
|
|
160
|
+
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
response = await client.get_async_httpx_client().request(
|
|
164
|
+
**kwargs
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
return _build_response(client=client, response=response)
|
|
168
|
+
|
|
169
|
+
async def asyncio(
|
|
170
|
+
*,
|
|
171
|
+
client: AuthenticatedClient,
|
|
172
|
+
body: CreateReportBody,
|
|
173
|
+
|
|
174
|
+
) -> Error | Report | None:
|
|
175
|
+
""" Generate a report
|
|
176
|
+
|
|
177
|
+
Args:
|
|
178
|
+
body (CreateReportBody):
|
|
179
|
+
|
|
180
|
+
Raises:
|
|
181
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
182
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
183
|
+
|
|
184
|
+
Returns:
|
|
185
|
+
Error | Report
|
|
186
|
+
"""
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
return (await asyncio_detailed(
|
|
190
|
+
client=client,
|
|
191
|
+
body=body,
|
|
192
|
+
|
|
193
|
+
)).parsed
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, cast
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response, UNSET
|
|
9
|
+
from ... import errors
|
|
10
|
+
|
|
11
|
+
from ...models.error import Error
|
|
12
|
+
from typing import cast
|
|
13
|
+
from uuid import UUID
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
id: UUID,
|
|
19
|
+
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
_kwargs: dict[str, Any] = {
|
|
28
|
+
"method": "get",
|
|
29
|
+
"url": "/v1/reports/{id}/download".format(id=quote(str(id), safe=""),),
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
return _kwargs
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | None:
|
|
38
|
+
if response.status_code == 401:
|
|
39
|
+
response_401 = Error.from_dict(response.json())
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
return response_401
|
|
44
|
+
|
|
45
|
+
if response.status_code == 404:
|
|
46
|
+
response_404 = Error.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
return response_404
|
|
51
|
+
|
|
52
|
+
if response.status_code == 429:
|
|
53
|
+
response_429 = Error.from_dict(response.json())
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
return response_429
|
|
58
|
+
|
|
59
|
+
if client.raise_on_unexpected_status:
|
|
60
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
61
|
+
else:
|
|
62
|
+
return None
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Error]:
|
|
66
|
+
return Response(
|
|
67
|
+
status_code=HTTPStatus(response.status_code),
|
|
68
|
+
content=response.content,
|
|
69
|
+
headers=response.headers,
|
|
70
|
+
parsed=_parse_response(client=client, response=response),
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def sync_detailed(
|
|
75
|
+
id: UUID,
|
|
76
|
+
*,
|
|
77
|
+
client: AuthenticatedClient,
|
|
78
|
+
|
|
79
|
+
) -> Response[Error]:
|
|
80
|
+
""" Download the generated PDF
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
id (UUID):
|
|
84
|
+
|
|
85
|
+
Raises:
|
|
86
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
87
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
Response[Error]
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
kwargs = _get_kwargs(
|
|
95
|
+
id=id,
|
|
96
|
+
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
response = client.get_httpx_client().request(
|
|
100
|
+
**kwargs,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
return _build_response(client=client, response=response)
|
|
104
|
+
|
|
105
|
+
def sync(
|
|
106
|
+
id: UUID,
|
|
107
|
+
*,
|
|
108
|
+
client: AuthenticatedClient,
|
|
109
|
+
|
|
110
|
+
) -> Error | None:
|
|
111
|
+
""" Download the generated PDF
|
|
112
|
+
|
|
113
|
+
Args:
|
|
114
|
+
id (UUID):
|
|
115
|
+
|
|
116
|
+
Raises:
|
|
117
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
118
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
Error
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
return sync_detailed(
|
|
126
|
+
id=id,
|
|
127
|
+
client=client,
|
|
128
|
+
|
|
129
|
+
).parsed
|
|
130
|
+
|
|
131
|
+
async def asyncio_detailed(
|
|
132
|
+
id: UUID,
|
|
133
|
+
*,
|
|
134
|
+
client: AuthenticatedClient,
|
|
135
|
+
|
|
136
|
+
) -> Response[Error]:
|
|
137
|
+
""" Download the generated PDF
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
id (UUID):
|
|
141
|
+
|
|
142
|
+
Raises:
|
|
143
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
144
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
Response[Error]
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
kwargs = _get_kwargs(
|
|
152
|
+
id=id,
|
|
153
|
+
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
response = await client.get_async_httpx_client().request(
|
|
157
|
+
**kwargs
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
return _build_response(client=client, response=response)
|
|
161
|
+
|
|
162
|
+
async def asyncio(
|
|
163
|
+
id: UUID,
|
|
164
|
+
*,
|
|
165
|
+
client: AuthenticatedClient,
|
|
166
|
+
|
|
167
|
+
) -> Error | None:
|
|
168
|
+
""" Download the generated PDF
|
|
169
|
+
|
|
170
|
+
Args:
|
|
171
|
+
id (UUID):
|
|
172
|
+
|
|
173
|
+
Raises:
|
|
174
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
175
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
176
|
+
|
|
177
|
+
Returns:
|
|
178
|
+
Error
|
|
179
|
+
"""
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
return (await asyncio_detailed(
|
|
183
|
+
id=id,
|
|
184
|
+
client=client,
|
|
185
|
+
|
|
186
|
+
)).parsed
|