kalir-python 0.1.0__tar.gz

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 (164) hide show
  1. kalir_python-0.1.0/PKG-INFO +76 -0
  2. kalir_python-0.1.0/README.md +66 -0
  3. kalir_python-0.1.0/kalir/__init__.py +11 -0
  4. kalir_python-0.1.0/kalir/api/__init__.py +1 -0
  5. kalir_python-0.1.0/kalir/api/assets/__init__.py +1 -0
  6. kalir_python-0.1.0/kalir/api/assets/create_asset.py +193 -0
  7. kalir_python-0.1.0/kalir/api/assets/delete_asset.py +182 -0
  8. kalir_python-0.1.0/kalir/api/assets/get_asset.py +186 -0
  9. kalir_python-0.1.0/kalir/api/assets/list_assets.py +165 -0
  10. kalir_python-0.1.0/kalir/api/assets/update_asset.py +206 -0
  11. kalir_python-0.1.0/kalir/api/events/__init__.py +1 -0
  12. kalir_python-0.1.0/kalir/api/events/get_event.py +194 -0
  13. kalir_python-0.1.0/kalir/api/events/ingest_event.py +215 -0
  14. kalir_python-0.1.0/kalir/api/events/list_events.py +259 -0
  15. kalir_python-0.1.0/kalir/api/exposures/__init__.py +1 -0
  16. kalir_python-0.1.0/kalir/api/exposures/count_exposures.py +165 -0
  17. kalir_python-0.1.0/kalir/api/exposures/get_infostealer_summary.py +181 -0
  18. kalir_python-0.1.0/kalir/api/exposures/list_exposures.py +225 -0
  19. kalir_python-0.1.0/kalir/api/incidents/__init__.py +1 -0
  20. kalir_python-0.1.0/kalir/api/incidents/get_incident.py +194 -0
  21. kalir_python-0.1.0/kalir/api/incidents/list_incidents.py +265 -0
  22. kalir_python-0.1.0/kalir/api/incidents/update_incident_status.py +207 -0
  23. kalir_python-0.1.0/kalir/api/intel/__init__.py +1 -0
  24. kalir_python-0.1.0/kalir/api/intel/get_ransomware_stats.py +165 -0
  25. kalir_python-0.1.0/kalir/api/intel/list_ransomware_victims.py +165 -0
  26. kalir_python-0.1.0/kalir/api/mentions/__init__.py +1 -0
  27. kalir_python-0.1.0/kalir/api/mentions/list_mentions.py +283 -0
  28. kalir_python-0.1.0/kalir/api/overview/__init__.py +1 -0
  29. kalir_python-0.1.0/kalir/api/overview/get_overview.py +184 -0
  30. kalir_python-0.1.0/kalir/api/phishing/__init__.py +1 -0
  31. kalir_python-0.1.0/kalir/api/phishing/list_phishing.py +245 -0
  32. kalir_python-0.1.0/kalir/api/reports/__init__.py +1 -0
  33. kalir_python-0.1.0/kalir/api/reports/create_report.py +193 -0
  34. kalir_python-0.1.0/kalir/api/reports/download_report.py +186 -0
  35. kalir_python-0.1.0/kalir/api/reports/list_reports.py +165 -0
  36. kalir_python-0.1.0/kalir/api/rules/__init__.py +1 -0
  37. kalir_python-0.1.0/kalir/api/rules/create_rule.py +193 -0
  38. kalir_python-0.1.0/kalir/api/rules/delete_rule.py +183 -0
  39. kalir_python-0.1.0/kalir/api/rules/get_rule.py +187 -0
  40. kalir_python-0.1.0/kalir/api/rules/list_rules.py +165 -0
  41. kalir_python-0.1.0/kalir/api/rules/replace_rule.py +207 -0
  42. kalir_python-0.1.0/kalir/api/takedowns/__init__.py +1 -0
  43. kalir_python-0.1.0/kalir/api/takedowns/count_takedowns.py +165 -0
  44. kalir_python-0.1.0/kalir/api/takedowns/create_takedown.py +193 -0
  45. kalir_python-0.1.0/kalir/api/takedowns/delete_takedown.py +183 -0
  46. kalir_python-0.1.0/kalir/api/takedowns/get_takedown.py +187 -0
  47. kalir_python-0.1.0/kalir/api/takedowns/list_takedowns.py +165 -0
  48. kalir_python-0.1.0/kalir/api/takedowns/replace_takedown.py +210 -0
  49. kalir_python-0.1.0/kalir/api/takedowns/update_takedown.py +210 -0
  50. kalir_python-0.1.0/kalir/api/webhooks/__init__.py +1 -0
  51. kalir_python-0.1.0/kalir/api/webhooks/create_webhook.py +222 -0
  52. kalir_python-0.1.0/kalir/api/webhooks/delete_webhook.py +190 -0
  53. kalir_python-0.1.0/kalir/api/webhooks/get_webhook.py +194 -0
  54. kalir_python-0.1.0/kalir/api/webhooks/get_webhook_delivery.py +194 -0
  55. kalir_python-0.1.0/kalir/api/webhooks/list_webhook_deliveries.py +239 -0
  56. kalir_python-0.1.0/kalir/api/webhooks/list_webhook_event_types.py +165 -0
  57. kalir_python-0.1.0/kalir/api/webhooks/list_webhooks.py +172 -0
  58. kalir_python-0.1.0/kalir/api/webhooks/retry_webhook_delivery.py +190 -0
  59. kalir_python-0.1.0/kalir/api/webhooks/rotate_webhook_secret.py +202 -0
  60. kalir_python-0.1.0/kalir/api/webhooks/send_webhook_test.py +202 -0
  61. kalir_python-0.1.0/kalir/api/webhooks/update_webhook.py +229 -0
  62. kalir_python-0.1.0/kalir/client.py +271 -0
  63. kalir_python-0.1.0/kalir/errors.py +14 -0
  64. kalir_python-0.1.0/kalir/models/__init__.py +195 -0
  65. kalir_python-0.1.0/kalir/models/asset.py +162 -0
  66. kalir_python-0.1.0/kalir/models/asset_create.py +122 -0
  67. kalir_python-0.1.0/kalir/models/asset_create_asset_type.py +14 -0
  68. kalir_python-0.1.0/kalir/models/asset_create_metadata.py +64 -0
  69. kalir_python-0.1.0/kalir/models/count_exposures_response_200.py +78 -0
  70. kalir_python-0.1.0/kalir/models/count_takedowns_response_200.py +96 -0
  71. kalir_python-0.1.0/kalir/models/create_report_body.py +96 -0
  72. kalir_python-0.1.0/kalir/models/create_report_body_type.py +10 -0
  73. kalir_python-0.1.0/kalir/models/create_webhook_response_201.py +111 -0
  74. kalir_python-0.1.0/kalir/models/error.py +84 -0
  75. kalir_python-0.1.0/kalir/models/error_error.py +106 -0
  76. kalir_python-0.1.0/kalir/models/error_error_type.py +15 -0
  77. kalir_python-0.1.0/kalir/models/event.py +151 -0
  78. kalir_python-0.1.0/kalir/models/event_asset.py +87 -0
  79. kalir_python-0.1.0/kalir/models/event_ingest.py +146 -0
  80. kalir_python-0.1.0/kalir/models/event_ingest_asset.py +87 -0
  81. kalir_python-0.1.0/kalir/models/event_ingest_evidence.py +64 -0
  82. kalir_python-0.1.0/kalir/models/event_ingest_source.py +87 -0
  83. kalir_python-0.1.0/kalir/models/exposure.py +137 -0
  84. kalir_python-0.1.0/kalir/models/exposure_webhook_event.py +152 -0
  85. kalir_python-0.1.0/kalir/models/exposure_webhook_event_data.py +115 -0
  86. kalir_python-0.1.0/kalir/models/exposure_webhook_event_data_exposure.py +149 -0
  87. kalir_python-0.1.0/kalir/models/exposure_webhook_event_data_infection.py +136 -0
  88. kalir_python-0.1.0/kalir/models/exposure_webhook_event_type.py +8 -0
  89. kalir_python-0.1.0/kalir/models/get_incident_response_200.py +174 -0
  90. kalir_python-0.1.0/kalir/models/get_infostealer_summary_response_200.py +100 -0
  91. kalir_python-0.1.0/kalir/models/get_ransomware_stats_response_200.py +156 -0
  92. kalir_python-0.1.0/kalir/models/get_ransomware_stats_response_200_top_countries_7d_item.py +64 -0
  93. kalir_python-0.1.0/kalir/models/get_ransomware_stats_response_200_top_groups_7d_item.py +64 -0
  94. kalir_python-0.1.0/kalir/models/incident.py +170 -0
  95. kalir_python-0.1.0/kalir/models/incident_severity.py +10 -0
  96. kalir_python-0.1.0/kalir/models/incident_status.py +10 -0
  97. kalir_python-0.1.0/kalir/models/incident_webhook_event.py +152 -0
  98. kalir_python-0.1.0/kalir/models/incident_webhook_event_data.py +115 -0
  99. kalir_python-0.1.0/kalir/models/incident_webhook_event_data_previous.py +88 -0
  100. kalir_python-0.1.0/kalir/models/incident_webhook_event_type.py +9 -0
  101. kalir_python-0.1.0/kalir/models/infostealer_domain_summary.py +122 -0
  102. kalir_python-0.1.0/kalir/models/infostealer_domain_summary_snapshot.py +201 -0
  103. kalir_python-0.1.0/kalir/models/infostealer_domain_summary_snapshot_top_employee_urls_item.py +87 -0
  104. kalir_python-0.1.0/kalir/models/infostealer_domain_summary_snapshot_top_families_item.py +87 -0
  105. kalir_python-0.1.0/kalir/models/list_assets_response_200.py +100 -0
  106. kalir_python-0.1.0/kalir/models/list_events_response_200.py +109 -0
  107. kalir_python-0.1.0/kalir/models/list_exposures_response_200.py +127 -0
  108. kalir_python-0.1.0/kalir/models/list_incidents_bucket.py +10 -0
  109. kalir_python-0.1.0/kalir/models/list_incidents_response_200.py +149 -0
  110. kalir_python-0.1.0/kalir/models/list_incidents_response_200_counts.py +106 -0
  111. kalir_python-0.1.0/kalir/models/list_incidents_status.py +12 -0
  112. kalir_python-0.1.0/kalir/models/list_mentions_response_200.py +122 -0
  113. kalir_python-0.1.0/kalir/models/list_mentions_source.py +8 -0
  114. kalir_python-0.1.0/kalir/models/list_phishing_response_200.py +122 -0
  115. kalir_python-0.1.0/kalir/models/list_phishing_verdict.py +11 -0
  116. kalir_python-0.1.0/kalir/models/list_ransomware_victims_response_200.py +109 -0
  117. kalir_python-0.1.0/kalir/models/list_ransomware_victims_response_200_victims_item.py +64 -0
  118. kalir_python-0.1.0/kalir/models/list_reports_response_200.py +109 -0
  119. kalir_python-0.1.0/kalir/models/list_rules_response_200.py +100 -0
  120. kalir_python-0.1.0/kalir/models/list_takedowns_response_200.py +109 -0
  121. kalir_python-0.1.0/kalir/models/list_webhook_deliveries_response_200.py +122 -0
  122. kalir_python-0.1.0/kalir/models/list_webhook_event_types_response_200.py +100 -0
  123. kalir_python-0.1.0/kalir/models/list_webhook_event_types_response_200_data_item.py +87 -0
  124. kalir_python-0.1.0/kalir/models/list_webhooks_response_200.py +100 -0
  125. kalir_python-0.1.0/kalir/models/mention.py +194 -0
  126. kalir_python-0.1.0/kalir/models/mention_source.py +8 -0
  127. kalir_python-0.1.0/kalir/models/overview.py +231 -0
  128. kalir_python-0.1.0/kalir/models/overview_assets.py +96 -0
  129. kalir_python-0.1.0/kalir/models/overview_exposures.py +105 -0
  130. kalir_python-0.1.0/kalir/models/overview_incidents.py +114 -0
  131. kalir_python-0.1.0/kalir/models/overview_phishing.py +87 -0
  132. kalir_python-0.1.0/kalir/models/overview_risk_level.py +10 -0
  133. kalir_python-0.1.0/kalir/models/overview_takedowns.py +87 -0
  134. kalir_python-0.1.0/kalir/models/pagination.py +105 -0
  135. kalir_python-0.1.0/kalir/models/phishing_domain.py +186 -0
  136. kalir_python-0.1.0/kalir/models/phishing_domain_verdict.py +11 -0
  137. kalir_python-0.1.0/kalir/models/report.py +182 -0
  138. kalir_python-0.1.0/kalir/models/report_parameters.py +181 -0
  139. kalir_python-0.1.0/kalir/models/report_parameters_date_range.py +11 -0
  140. kalir_python-0.1.0/kalir/models/report_parameters_language.py +8 -0
  141. kalir_python-0.1.0/kalir/models/report_parameters_sections_item.py +15 -0
  142. kalir_python-0.1.0/kalir/models/report_status.py +10 -0
  143. kalir_python-0.1.0/kalir/models/rotate_webhook_secret_response_200.py +87 -0
  144. kalir_python-0.1.0/kalir/models/rule.py +174 -0
  145. kalir_python-0.1.0/kalir/models/rule_input.py +134 -0
  146. kalir_python-0.1.0/kalir/models/rule_input_actions_item.py +64 -0
  147. kalir_python-0.1.0/kalir/models/takedown.py +163 -0
  148. kalir_python-0.1.0/kalir/models/takedown_create.py +113 -0
  149. kalir_python-0.1.0/kalir/models/takedown_update.py +96 -0
  150. kalir_python-0.1.0/kalir/models/update_incident_status_body.py +90 -0
  151. kalir_python-0.1.0/kalir/models/update_incident_status_body_status.py +10 -0
  152. kalir_python-0.1.0/kalir/models/webhook_delivery.py +274 -0
  153. kalir_python-0.1.0/kalir/models/webhook_delivery_payload.py +64 -0
  154. kalir_python-0.1.0/kalir/models/webhook_delivery_status.py +9 -0
  155. kalir_python-0.1.0/kalir/models/webhook_endpoint.py +216 -0
  156. kalir_python-0.1.0/kalir/models/webhook_endpoint_input.py +124 -0
  157. kalir_python-0.1.0/kalir/models/webhook_endpoint_input_event_types_item.py +11 -0
  158. kalir_python-0.1.0/kalir/models/webhook_incident.py +232 -0
  159. kalir_python-0.1.0/kalir/models/webhook_incident_severity.py +10 -0
  160. kalir_python-0.1.0/kalir/py.typed +1 -0
  161. kalir_python-0.1.0/kalir/types.py +53 -0
  162. kalir_python-0.1.0/kalir/webhooks.py +63 -0
  163. kalir_python-0.1.0/pyproject.toml +30 -0
  164. kalir_python-0.1.0/pyproject.toml.orig +26 -0
@@ -0,0 +1,76 @@
1
+ Metadata-Version: 2.4
2
+ Name: kalir-python
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the Kalir Public API — digital risk intelligence and signed webhooks.
5
+ License-Expression: MIT
6
+ Requires-Dist: httpx>=0.23.1,<0.29.0
7
+ Requires-Dist: attrs>=22.2.0
8
+ Requires-Python: >=3.11
9
+ Description-Content-Type: text/markdown
10
+
11
+ # kalir-python
12
+
13
+ Official Python SDK for the [Kalir](https://kalir.io) Public API: your organization's digital-risk intelligence (incidents, credential and infostealer exposure, phishing impersonation, dark-web and Telegram mentions) plus signed webhooks. Typed with `attrs`, built on `httpx`, sync and async.
14
+
15
+ ```bash
16
+ pip install kalir-python
17
+ ```
18
+
19
+ ## Quickstart
20
+
21
+ Create an API key at **app.kalir.io → Developers → API Keys**.
22
+
23
+ ```python
24
+ from kalir import AuthenticatedClient
25
+ from kalir.api.overview import get_overview
26
+ from kalir.api.phishing import list_phishing
27
+ from kalir.api.incidents import list_incidents
28
+ from kalir.models import ListIncidentsBucket, ListPhishingVerdict
29
+
30
+ client = AuthenticatedClient(base_url="https://api.kalir.io", token="klr_…")
31
+
32
+ with client as c:
33
+ overview = get_overview.sync(client=c)
34
+ print(overview.risk_score, overview.incidents.open_critical)
35
+
36
+ phishing = list_phishing.sync(client=c, verdict=ListPhishingVerdict.CONFIRMED)
37
+ for d in phishing.data:
38
+ print(d.domain, "impersonates", d.impersonates)
39
+
40
+ incidents = list_incidents.sync(client=c, bucket=ListIncidentsBucket.OPEN, limit=20)
41
+ ```
42
+
43
+ Every endpoint has four functions: `sync`, `sync_detailed` (status + headers), `asyncio` and `asyncio_detailed`.
44
+
45
+ ```python
46
+ async with AuthenticatedClient(base_url="https://api.kalir.io", token="klr_…") as c:
47
+ overview = await get_overview.asyncio(client=c)
48
+ ```
49
+
50
+ ## Errors
51
+
52
+ Error responses share one envelope: `{"error": {"type", "message", "status", "retry_after"}}`. Use the `*_detailed` functions to inspect `status_code`, or pass `raise_on_unexpected_status=True` to the client.
53
+
54
+ ## Webhooks
55
+
56
+ ```python
57
+ from kalir.webhooks import construct_event, WebhookSignatureError
58
+
59
+ @app.post("/kalir-webhooks") # Flask
60
+ def kalir_webhooks():
61
+ try:
62
+ event = construct_event(
63
+ request.get_data(), # raw body
64
+ request.headers.get("X-Kalir-Signature"),
65
+ KALIR_WEBHOOK_SECRET, # whsec_…
66
+ )
67
+ except WebhookSignatureError:
68
+ return "", 400
69
+ if event["type"] == "incident.created":
70
+ ...
71
+ return "", 200
72
+ ```
73
+
74
+ Respond `2xx` within 15 seconds. Failed deliveries are retried with exponential backoff for ~20 hours; deduplicate on the `X-Kalir-Event-Id` header.
75
+
76
+ Full reference: <https://app.kalir.io/developers/docs>
@@ -0,0 +1,66 @@
1
+ # kalir-python
2
+
3
+ Official Python SDK for the [Kalir](https://kalir.io) Public API: your organization's digital-risk intelligence (incidents, credential and infostealer exposure, phishing impersonation, dark-web and Telegram mentions) plus signed webhooks. Typed with `attrs`, built on `httpx`, sync and async.
4
+
5
+ ```bash
6
+ pip install kalir-python
7
+ ```
8
+
9
+ ## Quickstart
10
+
11
+ Create an API key at **app.kalir.io → Developers → API Keys**.
12
+
13
+ ```python
14
+ from kalir import AuthenticatedClient
15
+ from kalir.api.overview import get_overview
16
+ from kalir.api.phishing import list_phishing
17
+ from kalir.api.incidents import list_incidents
18
+ from kalir.models import ListIncidentsBucket, ListPhishingVerdict
19
+
20
+ client = AuthenticatedClient(base_url="https://api.kalir.io", token="klr_…")
21
+
22
+ with client as c:
23
+ overview = get_overview.sync(client=c)
24
+ print(overview.risk_score, overview.incidents.open_critical)
25
+
26
+ phishing = list_phishing.sync(client=c, verdict=ListPhishingVerdict.CONFIRMED)
27
+ for d in phishing.data:
28
+ print(d.domain, "impersonates", d.impersonates)
29
+
30
+ incidents = list_incidents.sync(client=c, bucket=ListIncidentsBucket.OPEN, limit=20)
31
+ ```
32
+
33
+ Every endpoint has four functions: `sync`, `sync_detailed` (status + headers), `asyncio` and `asyncio_detailed`.
34
+
35
+ ```python
36
+ async with AuthenticatedClient(base_url="https://api.kalir.io", token="klr_…") as c:
37
+ overview = await get_overview.asyncio(client=c)
38
+ ```
39
+
40
+ ## Errors
41
+
42
+ Error responses share one envelope: `{"error": {"type", "message", "status", "retry_after"}}`. Use the `*_detailed` functions to inspect `status_code`, or pass `raise_on_unexpected_status=True` to the client.
43
+
44
+ ## Webhooks
45
+
46
+ ```python
47
+ from kalir.webhooks import construct_event, WebhookSignatureError
48
+
49
+ @app.post("/kalir-webhooks") # Flask
50
+ def kalir_webhooks():
51
+ try:
52
+ event = construct_event(
53
+ request.get_data(), # raw body
54
+ request.headers.get("X-Kalir-Signature"),
55
+ KALIR_WEBHOOK_SECRET, # whsec_…
56
+ )
57
+ except WebhookSignatureError:
58
+ return "", 400
59
+ if event["type"] == "incident.created":
60
+ ...
61
+ return "", 200
62
+ ```
63
+
64
+ Respond `2xx` within 15 seconds. Failed deliveries are retried with exponential backoff for ~20 hours; deduplicate on the `X-Kalir-Event-Id` header.
65
+
66
+ Full reference: <https://app.kalir.io/developers/docs>
@@ -0,0 +1,11 @@
1
+
2
+ """ A client library for accessing Kalir Public API """
3
+ from .client import AuthenticatedClient, Client
4
+ from .webhooks import WebhookSignatureError, construct_event
5
+
6
+ __all__ = (
7
+ "AuthenticatedClient",
8
+ "Client",
9
+ "WebhookSignatureError",
10
+ "construct_event",
11
+ )
@@ -0,0 +1 @@
1
+ """ Contains methods for accessing the API """
@@ -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.asset import Asset
12
+ from ...models.asset_create import AssetCreate
13
+ from ...models.error import Error
14
+ from typing import cast
15
+
16
+
17
+
18
+ def _get_kwargs(
19
+ *,
20
+ body: AssetCreate,
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/assets",
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) -> Asset | Error | None:
45
+ if response.status_code == 201:
46
+ response_201 = Asset.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[Asset | Error]:
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: AssetCreate,
85
+
86
+ ) -> Response[Asset | Error]:
87
+ """ Create an asset
88
+
89
+ Args:
90
+ body (AssetCreate):
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[Asset | Error]
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: AssetCreate,
116
+
117
+ ) -> Asset | Error | None:
118
+ """ Create an asset
119
+
120
+ Args:
121
+ body (AssetCreate):
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
+ Asset | Error
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: AssetCreate,
142
+
143
+ ) -> Response[Asset | Error]:
144
+ """ Create an asset
145
+
146
+ Args:
147
+ body (AssetCreate):
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[Asset | Error]
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: AssetCreate,
173
+
174
+ ) -> Asset | Error | None:
175
+ """ Create an asset
176
+
177
+ Args:
178
+ body (AssetCreate):
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
+ Asset | Error
186
+ """
187
+
188
+
189
+ return (await asyncio_detailed(
190
+ client=client,
191
+ body=body,
192
+
193
+ )).parsed
@@ -0,0 +1,182 @@
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
+
14
+
15
+
16
+ def _get_kwargs(
17
+ id: str,
18
+
19
+ ) -> dict[str, Any]:
20
+
21
+
22
+
23
+
24
+
25
+
26
+ _kwargs: dict[str, Any] = {
27
+ "method": "delete",
28
+ "url": "/v1/assets/{id}".format(id=quote(str(id), safe=""),),
29
+ }
30
+
31
+
32
+ return _kwargs
33
+
34
+
35
+
36
+ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Any | Error | None:
37
+ if response.status_code == 204:
38
+ response_204 = cast(Any, None)
39
+ return response_204
40
+
41
+ if response.status_code == 401:
42
+ response_401 = Error.from_dict(response.json())
43
+
44
+
45
+
46
+ return response_401
47
+
48
+ if response.status_code == 429:
49
+ response_429 = Error.from_dict(response.json())
50
+
51
+
52
+
53
+ return response_429
54
+
55
+ if client.raise_on_unexpected_status:
56
+ raise errors.UnexpectedStatus(response.status_code, response.content)
57
+ else:
58
+ return None
59
+
60
+
61
+ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | Error]:
62
+ return Response(
63
+ status_code=HTTPStatus(response.status_code),
64
+ content=response.content,
65
+ headers=response.headers,
66
+ parsed=_parse_response(client=client, response=response),
67
+ )
68
+
69
+
70
+ def sync_detailed(
71
+ id: str,
72
+ *,
73
+ client: AuthenticatedClient,
74
+
75
+ ) -> Response[Any | Error]:
76
+ """ Delete an asset
77
+
78
+ Args:
79
+ id (str):
80
+
81
+ Raises:
82
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
83
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
84
+
85
+ Returns:
86
+ Response[Any | Error]
87
+ """
88
+
89
+
90
+ kwargs = _get_kwargs(
91
+ id=id,
92
+
93
+ )
94
+
95
+ response = client.get_httpx_client().request(
96
+ **kwargs,
97
+ )
98
+
99
+ return _build_response(client=client, response=response)
100
+
101
+ def sync(
102
+ id: str,
103
+ *,
104
+ client: AuthenticatedClient,
105
+
106
+ ) -> Any | Error | None:
107
+ """ Delete an asset
108
+
109
+ Args:
110
+ id (str):
111
+
112
+ Raises:
113
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
114
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
115
+
116
+ Returns:
117
+ Any | Error
118
+ """
119
+
120
+
121
+ return sync_detailed(
122
+ id=id,
123
+ client=client,
124
+
125
+ ).parsed
126
+
127
+ async def asyncio_detailed(
128
+ id: str,
129
+ *,
130
+ client: AuthenticatedClient,
131
+
132
+ ) -> Response[Any | Error]:
133
+ """ Delete an asset
134
+
135
+ Args:
136
+ id (str):
137
+
138
+ Raises:
139
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
140
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
141
+
142
+ Returns:
143
+ Response[Any | Error]
144
+ """
145
+
146
+
147
+ kwargs = _get_kwargs(
148
+ id=id,
149
+
150
+ )
151
+
152
+ response = await client.get_async_httpx_client().request(
153
+ **kwargs
154
+ )
155
+
156
+ return _build_response(client=client, response=response)
157
+
158
+ async def asyncio(
159
+ id: str,
160
+ *,
161
+ client: AuthenticatedClient,
162
+
163
+ ) -> Any | Error | None:
164
+ """ Delete an asset
165
+
166
+ Args:
167
+ id (str):
168
+
169
+ Raises:
170
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
171
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
172
+
173
+ Returns:
174
+ Any | Error
175
+ """
176
+
177
+
178
+ return (await asyncio_detailed(
179
+ id=id,
180
+ client=client,
181
+
182
+ )).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.asset import Asset
12
+ from ...models.error import Error
13
+ from typing import cast
14
+
15
+
16
+
17
+ def _get_kwargs(
18
+ id: str,
19
+
20
+ ) -> dict[str, Any]:
21
+
22
+
23
+
24
+
25
+
26
+
27
+ _kwargs: dict[str, Any] = {
28
+ "method": "get",
29
+ "url": "/v1/assets/{id}".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) -> Asset | Error | None:
38
+ if response.status_code == 200:
39
+ response_200 = Asset.from_dict(response.json())
40
+
41
+
42
+
43
+ return response_200
44
+
45
+ if response.status_code == 401:
46
+ response_401 = Error.from_dict(response.json())
47
+
48
+
49
+
50
+ return response_401
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[Asset | 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: str,
76
+ *,
77
+ client: AuthenticatedClient,
78
+
79
+ ) -> Response[Asset | Error]:
80
+ """ Get an asset
81
+
82
+ Args:
83
+ id (str):
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[Asset | 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: str,
107
+ *,
108
+ client: AuthenticatedClient,
109
+
110
+ ) -> Asset | Error | None:
111
+ """ Get an asset
112
+
113
+ Args:
114
+ id (str):
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
+ Asset | 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: str,
133
+ *,
134
+ client: AuthenticatedClient,
135
+
136
+ ) -> Response[Asset | Error]:
137
+ """ Get an asset
138
+
139
+ Args:
140
+ id (str):
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[Asset | 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: str,
164
+ *,
165
+ client: AuthenticatedClient,
166
+
167
+ ) -> Asset | Error | None:
168
+ """ Get an asset
169
+
170
+ Args:
171
+ id (str):
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
+ Asset | Error
179
+ """
180
+
181
+
182
+ return (await asyncio_detailed(
183
+ id=id,
184
+ client=client,
185
+
186
+ )).parsed