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,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.list_reports_response_200 import ListReportsResponse200
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/reports",
29
+ }
30
+
31
+
32
+ return _kwargs
33
+
34
+
35
+
36
+ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | ListReportsResponse200 | None:
37
+ if response.status_code == 200:
38
+ response_200 = ListReportsResponse200.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 | ListReportsResponse200]:
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 | ListReportsResponse200]:
78
+ """ List reports
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 | ListReportsResponse200]
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 | ListReportsResponse200 | None:
104
+ """ List reports
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 | ListReportsResponse200
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 | ListReportsResponse200]:
125
+ """ List reports
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 | ListReportsResponse200]
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 | ListReportsResponse200 | None:
151
+ """ List reports
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 | ListReportsResponse200
159
+ """
160
+
161
+
162
+ return (await asyncio_detailed(
163
+ client=client,
164
+
165
+ )).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.error import Error
12
+ from ...models.rule import Rule
13
+ from ...models.rule_input import RuleInput
14
+ from typing import cast
15
+
16
+
17
+
18
+ def _get_kwargs(
19
+ *,
20
+ body: RuleInput,
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/rules",
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 | Rule | None:
45
+ if response.status_code == 201:
46
+ response_201 = Rule.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 | Rule]:
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: RuleInput,
85
+
86
+ ) -> Response[Error | Rule]:
87
+ """ Create a rule
88
+
89
+ Args:
90
+ body (RuleInput):
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 | Rule]
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: RuleInput,
116
+
117
+ ) -> Error | Rule | None:
118
+ """ Create a rule
119
+
120
+ Args:
121
+ body (RuleInput):
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 | Rule
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: RuleInput,
142
+
143
+ ) -> Response[Error | Rule]:
144
+ """ Create a rule
145
+
146
+ Args:
147
+ body (RuleInput):
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 | Rule]
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: RuleInput,
173
+
174
+ ) -> Error | Rule | None:
175
+ """ Create a rule
176
+
177
+ Args:
178
+ body (RuleInput):
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 | Rule
186
+ """
187
+
188
+
189
+ return (await asyncio_detailed(
190
+ client=client,
191
+ body=body,
192
+
193
+ )).parsed
@@ -0,0 +1,183 @@
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": "delete",
29
+ "url": "/v1/rules/{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) -> Any | Error | None:
38
+ if response.status_code == 204:
39
+ response_204 = cast(Any, None)
40
+ return response_204
41
+
42
+ if response.status_code == 401:
43
+ response_401 = Error.from_dict(response.json())
44
+
45
+
46
+
47
+ return response_401
48
+
49
+ if response.status_code == 429:
50
+ response_429 = Error.from_dict(response.json())
51
+
52
+
53
+
54
+ return response_429
55
+
56
+ if client.raise_on_unexpected_status:
57
+ raise errors.UnexpectedStatus(response.status_code, response.content)
58
+ else:
59
+ return None
60
+
61
+
62
+ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Any | Error]:
63
+ return Response(
64
+ status_code=HTTPStatus(response.status_code),
65
+ content=response.content,
66
+ headers=response.headers,
67
+ parsed=_parse_response(client=client, response=response),
68
+ )
69
+
70
+
71
+ def sync_detailed(
72
+ id: UUID,
73
+ *,
74
+ client: AuthenticatedClient,
75
+
76
+ ) -> Response[Any | Error]:
77
+ """ Delete a rule
78
+
79
+ Args:
80
+ id (UUID):
81
+
82
+ Raises:
83
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
84
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
85
+
86
+ Returns:
87
+ Response[Any | Error]
88
+ """
89
+
90
+
91
+ kwargs = _get_kwargs(
92
+ id=id,
93
+
94
+ )
95
+
96
+ response = client.get_httpx_client().request(
97
+ **kwargs,
98
+ )
99
+
100
+ return _build_response(client=client, response=response)
101
+
102
+ def sync(
103
+ id: UUID,
104
+ *,
105
+ client: AuthenticatedClient,
106
+
107
+ ) -> Any | Error | None:
108
+ """ Delete a rule
109
+
110
+ Args:
111
+ id (UUID):
112
+
113
+ Raises:
114
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
115
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
116
+
117
+ Returns:
118
+ Any | Error
119
+ """
120
+
121
+
122
+ return sync_detailed(
123
+ id=id,
124
+ client=client,
125
+
126
+ ).parsed
127
+
128
+ async def asyncio_detailed(
129
+ id: UUID,
130
+ *,
131
+ client: AuthenticatedClient,
132
+
133
+ ) -> Response[Any | Error]:
134
+ """ Delete a rule
135
+
136
+ Args:
137
+ id (UUID):
138
+
139
+ Raises:
140
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
141
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
142
+
143
+ Returns:
144
+ Response[Any | Error]
145
+ """
146
+
147
+
148
+ kwargs = _get_kwargs(
149
+ id=id,
150
+
151
+ )
152
+
153
+ response = await client.get_async_httpx_client().request(
154
+ **kwargs
155
+ )
156
+
157
+ return _build_response(client=client, response=response)
158
+
159
+ async def asyncio(
160
+ id: UUID,
161
+ *,
162
+ client: AuthenticatedClient,
163
+
164
+ ) -> Any | Error | None:
165
+ """ Delete a rule
166
+
167
+ Args:
168
+ id (UUID):
169
+
170
+ Raises:
171
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
172
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
173
+
174
+ Returns:
175
+ Any | Error
176
+ """
177
+
178
+
179
+ return (await asyncio_detailed(
180
+ id=id,
181
+ client=client,
182
+
183
+ )).parsed
@@ -0,0 +1,187 @@
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.rule import Rule
13
+ from typing import cast
14
+ from uuid import UUID
15
+
16
+
17
+
18
+ def _get_kwargs(
19
+ id: UUID,
20
+
21
+ ) -> dict[str, Any]:
22
+
23
+
24
+
25
+
26
+
27
+
28
+ _kwargs: dict[str, Any] = {
29
+ "method": "get",
30
+ "url": "/v1/rules/{id}".format(id=quote(str(id), safe=""),),
31
+ }
32
+
33
+
34
+ return _kwargs
35
+
36
+
37
+
38
+ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Error | Rule | None:
39
+ if response.status_code == 200:
40
+ response_200 = Rule.from_dict(response.json())
41
+
42
+
43
+
44
+ return response_200
45
+
46
+ if response.status_code == 401:
47
+ response_401 = Error.from_dict(response.json())
48
+
49
+
50
+
51
+ return response_401
52
+
53
+ if response.status_code == 429:
54
+ response_429 = Error.from_dict(response.json())
55
+
56
+
57
+
58
+ return response_429
59
+
60
+ if client.raise_on_unexpected_status:
61
+ raise errors.UnexpectedStatus(response.status_code, response.content)
62
+ else:
63
+ return None
64
+
65
+
66
+ def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[Error | Rule]:
67
+ return Response(
68
+ status_code=HTTPStatus(response.status_code),
69
+ content=response.content,
70
+ headers=response.headers,
71
+ parsed=_parse_response(client=client, response=response),
72
+ )
73
+
74
+
75
+ def sync_detailed(
76
+ id: UUID,
77
+ *,
78
+ client: AuthenticatedClient,
79
+
80
+ ) -> Response[Error | Rule]:
81
+ """ Get a rule
82
+
83
+ Args:
84
+ id (UUID):
85
+
86
+ Raises:
87
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
88
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
89
+
90
+ Returns:
91
+ Response[Error | Rule]
92
+ """
93
+
94
+
95
+ kwargs = _get_kwargs(
96
+ id=id,
97
+
98
+ )
99
+
100
+ response = client.get_httpx_client().request(
101
+ **kwargs,
102
+ )
103
+
104
+ return _build_response(client=client, response=response)
105
+
106
+ def sync(
107
+ id: UUID,
108
+ *,
109
+ client: AuthenticatedClient,
110
+
111
+ ) -> Error | Rule | None:
112
+ """ Get a rule
113
+
114
+ Args:
115
+ id (UUID):
116
+
117
+ Raises:
118
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
119
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
120
+
121
+ Returns:
122
+ Error | Rule
123
+ """
124
+
125
+
126
+ return sync_detailed(
127
+ id=id,
128
+ client=client,
129
+
130
+ ).parsed
131
+
132
+ async def asyncio_detailed(
133
+ id: UUID,
134
+ *,
135
+ client: AuthenticatedClient,
136
+
137
+ ) -> Response[Error | Rule]:
138
+ """ Get a rule
139
+
140
+ Args:
141
+ id (UUID):
142
+
143
+ Raises:
144
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
145
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
146
+
147
+ Returns:
148
+ Response[Error | Rule]
149
+ """
150
+
151
+
152
+ kwargs = _get_kwargs(
153
+ id=id,
154
+
155
+ )
156
+
157
+ response = await client.get_async_httpx_client().request(
158
+ **kwargs
159
+ )
160
+
161
+ return _build_response(client=client, response=response)
162
+
163
+ async def asyncio(
164
+ id: UUID,
165
+ *,
166
+ client: AuthenticatedClient,
167
+
168
+ ) -> Error | Rule | None:
169
+ """ Get a rule
170
+
171
+ Args:
172
+ id (UUID):
173
+
174
+ Raises:
175
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
176
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
177
+
178
+ Returns:
179
+ Error | Rule
180
+ """
181
+
182
+
183
+ return (await asyncio_detailed(
184
+ id=id,
185
+ client=client,
186
+
187
+ )).parsed