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