bytekit-sdk 0.3.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 (227) hide show
  1. bytekit/__init__.py +8 -0
  2. bytekit/api/__init__.py +1 -0
  3. bytekit/api/account/__init__.py +1 -0
  4. bytekit/api/account/get_account.py +157 -0
  5. bytekit/api/bulk/__init__.py +1 -0
  6. bytekit/api/bulk/create_bulk.py +204 -0
  7. bytekit/api/bulk/delete_bulk.py +177 -0
  8. bytekit/api/bulk/get_bulk.py +157 -0
  9. bytekit/api/bulk/list_bulk_screenshots.py +152 -0
  10. bytekit/api/fetch/__init__.py +1 -0
  11. bytekit/api/fetch/get_fetch.py +254 -0
  12. bytekit/api/fetch/post_fetch.py +178 -0
  13. bytekit/api/fetch_bulk/__init__.py +1 -0
  14. bytekit/api/fetch_bulk/create_fetch_bulk.py +180 -0
  15. bytekit/api/fetch_bulk/get_fetch_bulk.py +157 -0
  16. bytekit/api/monitors/__init__.py +1 -0
  17. bytekit/api/monitors/create_monitor.py +180 -0
  18. bytekit/api/monitors/delete_monitor.py +155 -0
  19. bytekit/api/monitors/get_monitor.py +157 -0
  20. bytekit/api/monitors/list_monitor_captures.py +188 -0
  21. bytekit/api/monitors/list_monitors.py +193 -0
  22. bytekit/api/monitors/update_monitor.py +191 -0
  23. bytekit/api/scrape/__init__.py +1 -0
  24. bytekit/api/scrape/create_scrape.py +197 -0
  25. bytekit/api/scrape/get_scrape.py +231 -0
  26. bytekit/api/scrape_bulk/__init__.py +1 -0
  27. bytekit/api/scrape_bulk/create_scrape_bulk.py +188 -0
  28. bytekit/api/scrape_bulk/get_scrape_bulk.py +157 -0
  29. bytekit/api/screenshots/__init__.py +1 -0
  30. bytekit/api/screenshots/create_screenshot.py +208 -0
  31. bytekit/api/screenshots/get_screenshot.py +177 -0
  32. bytekit/api/search/__init__.py +1 -0
  33. bytekit/api/search/create_search.py +225 -0
  34. bytekit/api/sitemap/__init__.py +1 -0
  35. bytekit/api/sitemap/create_sitemap.py +192 -0
  36. bytekit/api/sitemap/get_sitemap.py +157 -0
  37. bytekit/api/usage/__init__.py +1 -0
  38. bytekit/api/usage/get_usage.py +126 -0
  39. bytekit/api/usage/get_usage_by_endpoint.py +215 -0
  40. bytekit/api/usage/get_usage_daily.py +203 -0
  41. bytekit/api/webhooks/__init__.py +1 -0
  42. bytekit/api/webhooks/list_webhook_deliveries.py +214 -0
  43. bytekit/api/webhooks/retry_webhook_delivery.py +165 -0
  44. bytekit/client.py +418 -0
  45. bytekit/errors.py +18 -0
  46. bytekit/models/__init__.py +401 -0
  47. bytekit/models/account_bearer_response.py +207 -0
  48. bytekit/models/account_bearer_response_api_key.py +134 -0
  49. bytekit/models/account_bearer_response_api_key_environment.py +8 -0
  50. bytekit/models/account_bearer_response_auto_topup.py +83 -0
  51. bytekit/models/account_bearer_response_plan.py +150 -0
  52. bytekit/models/account_bearer_response_subscription.py +85 -0
  53. bytekit/models/account_bearer_response_subscription_plan.py +99 -0
  54. bytekit/models/account_bearer_response_subscription_status.py +10 -0
  55. bytekit/models/account_session_response.py +164 -0
  56. bytekit/models/account_session_response_notifications.py +51 -0
  57. bytekit/models/account_session_response_plan.py +150 -0
  58. bytekit/models/bandwidth_balance.py +91 -0
  59. bytekit/models/capture_response.py +216 -0
  60. bytekit/models/capture_response_outcome.py +10 -0
  61. bytekit/models/clip.py +83 -0
  62. bytekit/models/cookie.py +90 -0
  63. bytekit/models/create_bulk_body.py +155 -0
  64. bytekit/models/create_bulk_body_defaults.py +423 -0
  65. bytekit/models/create_bulk_body_defaults_device.py +9 -0
  66. bytekit/models/create_bulk_body_defaults_device_scale_factor_type_1.py +9 -0
  67. bytekit/models/create_bulk_body_defaults_device_scale_factor_type_2_type_1.py +9 -0
  68. bytekit/models/create_bulk_body_defaults_device_scale_factor_type_3_type_1.py +9 -0
  69. bytekit/models/create_bulk_body_defaults_formats_item.py +12 -0
  70. bytekit/models/create_bulk_body_defaults_type.py +9 -0
  71. bytekit/models/create_bulk_body_defaults_viewport_type_0.py +67 -0
  72. bytekit/models/create_bulk_body_defaults_wait_until.py +10 -0
  73. bytekit/models/create_bulk_body_items_item.py +380 -0
  74. bytekit/models/create_bulk_body_items_item_device.py +9 -0
  75. bytekit/models/create_bulk_body_items_item_formats_item.py +12 -0
  76. bytekit/models/create_bulk_body_items_item_scenario.py +10 -0
  77. bytekit/models/create_bulk_body_items_item_type.py +9 -0
  78. bytekit/models/create_bulk_body_items_item_viewport_type_0.py +67 -0
  79. bytekit/models/create_bulk_body_items_item_wait_until.py +10 -0
  80. bytekit/models/create_bulk_response_202.py +164 -0
  81. bytekit/models/create_bulk_response_202_status.py +10 -0
  82. bytekit/models/create_fetch_bulk_body.py +161 -0
  83. bytekit/models/create_fetch_bulk_body_defaults.py +91 -0
  84. bytekit/models/create_fetch_bulk_body_defaults_format.py +9 -0
  85. bytekit/models/create_fetch_bulk_body_metadata.py +44 -0
  86. bytekit/models/create_fetch_bulk_body_urls_item_type_1.py +102 -0
  87. bytekit/models/create_fetch_bulk_body_urls_item_type_1_format.py +9 -0
  88. bytekit/models/create_fetch_bulk_response_202.py +44 -0
  89. bytekit/models/create_scrape_bulk_body.py +179 -0
  90. bytekit/models/create_scrape_bulk_body_custom.py +52 -0
  91. bytekit/models/create_scrape_bulk_body_defaults.py +167 -0
  92. bytekit/models/create_scrape_bulk_body_defaults_formats_item.py +12 -0
  93. bytekit/models/create_scrape_bulk_body_defaults_headers.py +44 -0
  94. bytekit/models/create_scrape_bulk_body_items_item.py +226 -0
  95. bytekit/models/create_scrape_bulk_body_items_item_custom.py +50 -0
  96. bytekit/models/create_scrape_bulk_body_items_item_formats_item.py +12 -0
  97. bytekit/models/create_scrape_bulk_body_items_item_headers.py +44 -0
  98. bytekit/models/create_scrape_bulk_body_items_item_metadata.py +44 -0
  99. bytekit/models/create_scrape_bulk_response_202.py +166 -0
  100. bytekit/models/create_scrape_bulk_response_202_status.py +10 -0
  101. bytekit/models/create_search_body.py +140 -0
  102. bytekit/models/create_search_body_date_range.py +13 -0
  103. bytekit/models/create_search_body_type.py +10 -0
  104. bytekit/models/create_search_response_200.py +119 -0
  105. bytekit/models/create_search_response_200_results_item.py +161 -0
  106. bytekit/models/create_search_response_200_results_item_image.py +113 -0
  107. bytekit/models/create_search_response_502.py +46 -0
  108. bytekit/models/create_search_response_502_error.py +8 -0
  109. bytekit/models/credit_balance.py +91 -0
  110. bytekit/models/delete_bulk_response_200.py +164 -0
  111. bytekit/models/delete_bulk_response_200_status.py +11 -0
  112. bytekit/models/error.py +83 -0
  113. bytekit/models/error_error.py +100 -0
  114. bytekit/models/error_status.py +8 -0
  115. bytekit/models/fetch_request.py +276 -0
  116. bytekit/models/fetch_request_cache_ttl_type_1.py +8 -0
  117. bytekit/models/fetch_request_custom.py +48 -0
  118. bytekit/models/fetch_request_format.py +9 -0
  119. bytekit/models/fetch_request_markdown_images.py +11 -0
  120. bytekit/models/fetch_request_markdown_links.py +11 -0
  121. bytekit/models/fetch_request_markdown_mode.py +10 -0
  122. bytekit/models/get_bulk_response_200.py +164 -0
  123. bytekit/models/get_bulk_response_200_status.py +11 -0
  124. bytekit/models/get_fetch_bulk_response_200.py +44 -0
  125. bytekit/models/get_fetch_cache_ttl_type_1.py +8 -0
  126. bytekit/models/get_fetch_format.py +9 -0
  127. bytekit/models/get_scrape_bulk_response_200.py +164 -0
  128. bytekit/models/get_scrape_bulk_response_200_status.py +11 -0
  129. bytekit/models/get_usage_by_endpoint_response_200.py +114 -0
  130. bytekit/models/get_usage_by_endpoint_response_200_rows_item.py +90 -0
  131. bytekit/models/get_usage_by_endpoint_response_200_rows_item_endpoint.py +17 -0
  132. bytekit/models/get_usage_by_endpoint_response_200_totals.py +67 -0
  133. bytekit/models/get_usage_daily_response_200.py +97 -0
  134. bytekit/models/get_usage_daily_response_200_data_item.py +219 -0
  135. bytekit/models/get_usage_response_200.py +344 -0
  136. bytekit/models/get_usage_response_200_plan_type.py +10 -0
  137. bytekit/models/list_bulk_screenshots_response_200.py +44 -0
  138. bytekit/models/list_monitor_captures_response_200.py +101 -0
  139. bytekit/models/list_monitors_response_200.py +101 -0
  140. bytekit/models/list_monitors_status.py +12 -0
  141. bytekit/models/list_webhook_deliveries_response_200.py +101 -0
  142. bytekit/models/list_webhook_deliveries_status.py +11 -0
  143. bytekit/models/metadata.py +44 -0
  144. bytekit/models/monitor_create_request.py +219 -0
  145. bytekit/models/monitor_create_request_interval_type.py +11 -0
  146. bytekit/models/monitor_create_request_notify_on.py +9 -0
  147. bytekit/models/monitor_create_request_options.py +44 -0
  148. bytekit/models/monitor_create_request_scrape_options.py +44 -0
  149. bytekit/models/monitor_create_request_type.py +9 -0
  150. bytekit/models/monitor_create_request_webhook_headers.py +44 -0
  151. bytekit/models/monitor_create_response.py +423 -0
  152. bytekit/models/monitor_response.py +411 -0
  153. bytekit/models/monitor_response_interval_type.py +11 -0
  154. bytekit/models/monitor_response_metadata_type_0.py +44 -0
  155. bytekit/models/monitor_response_status.py +12 -0
  156. bytekit/models/monitor_response_type.py +9 -0
  157. bytekit/models/monitor_response_webhook_headers_type_0.py +44 -0
  158. bytekit/models/monitor_update_request.py +223 -0
  159. bytekit/models/monitor_update_request_interval_type.py +11 -0
  160. bytekit/models/monitor_update_request_notify_on.py +9 -0
  161. bytekit/models/monitor_update_request_options.py +44 -0
  162. bytekit/models/monitor_update_request_scrape_options.py +44 -0
  163. bytekit/models/monitor_update_request_status.py +9 -0
  164. bytekit/models/monitor_update_request_webhook_headers.py +44 -0
  165. bytekit/models/scrape_error_envelope.py +113 -0
  166. bytekit/models/scrape_error_envelope_error.py +93 -0
  167. bytekit/models/scrape_error_envelope_error_code.py +18 -0
  168. bytekit/models/scrape_error_envelope_schema_version.py +8 -0
  169. bytekit/models/scrape_error_envelope_status.py +8 -0
  170. bytekit/models/scrape_formats.py +183 -0
  171. bytekit/models/scrape_markdown_tokens.py +75 -0
  172. bytekit/models/scrape_metadata.py +262 -0
  173. bytekit/models/scrape_queued_envelope.py +124 -0
  174. bytekit/models/scrape_queued_envelope_schema_version.py +8 -0
  175. bytekit/models/scrape_queued_envelope_status.py +8 -0
  176. bytekit/models/scrape_request.py +485 -0
  177. bytekit/models/scrape_request_cache_ttl_type_1.py +8 -0
  178. bytekit/models/scrape_request_custom.py +48 -0
  179. bytekit/models/scrape_request_events_item.py +10 -0
  180. bytekit/models/scrape_request_formats_item.py +12 -0
  181. bytekit/models/scrape_request_headers.py +44 -0
  182. bytekit/models/scrape_request_markdown_images.py +11 -0
  183. bytekit/models/scrape_request_markdown_links.py +11 -0
  184. bytekit/models/scrape_request_markdown_mode.py +10 -0
  185. bytekit/models/scrape_request_token_encoding.py +9 -0
  186. bytekit/models/scrape_request_x_internal_scrape_path.py +8 -0
  187. bytekit/models/scrape_scored_image.py +128 -0
  188. bytekit/models/scrape_scored_link.py +94 -0
  189. bytekit/models/scrape_stats.py +75 -0
  190. bytekit/models/scrape_success_envelope.py +345 -0
  191. bytekit/models/scrape_success_envelope_cache.py +10 -0
  192. bytekit/models/scrape_success_envelope_custom.py +48 -0
  193. bytekit/models/scrape_success_envelope_schema_version.py +8 -0
  194. bytekit/models/scrape_success_envelope_status.py +8 -0
  195. bytekit/models/scrape_table.py +96 -0
  196. bytekit/models/scrape_table_kind.py +10 -0
  197. bytekit/models/scrape_warning.py +88 -0
  198. bytekit/models/scrape_warning_code.py +17 -0
  199. bytekit/models/screenshot_request.py +445 -0
  200. bytekit/models/screenshot_request_device.py +9 -0
  201. bytekit/models/screenshot_request_device_scale_factor_type_1.py +9 -0
  202. bytekit/models/screenshot_request_device_scale_factor_type_2_type_1.py +9 -0
  203. bytekit/models/screenshot_request_device_scale_factor_type_3_type_1.py +9 -0
  204. bytekit/models/screenshot_request_format.py +9 -0
  205. bytekit/models/screenshot_request_headers.py +44 -0
  206. bytekit/models/screenshot_request_wait_until.py +10 -0
  207. bytekit/models/screenshot_response.py +264 -0
  208. bytekit/models/screenshot_response_status.py +11 -0
  209. bytekit/models/sitemap_request.py +210 -0
  210. bytekit/models/sitemap_request_process_type_0.py +90 -0
  211. bytekit/models/sitemap_request_process_type_0_options.py +44 -0
  212. bytekit/models/sitemap_request_strategy.py +10 -0
  213. bytekit/models/sitemap_response.py +418 -0
  214. bytekit/models/sitemap_response_cache.py +10 -0
  215. bytekit/models/sitemap_response_metadata_type_0.py +44 -0
  216. bytekit/models/sitemap_response_process_type_0.py +44 -0
  217. bytekit/models/sitemap_response_sources_type_0.py +44 -0
  218. bytekit/models/sitemap_response_status.py +11 -0
  219. bytekit/models/viewport.py +67 -0
  220. bytekit/models/webhook_delivery_response.py +270 -0
  221. bytekit/models/webhook_delivery_response_event_type.py +14 -0
  222. bytekit/models/webhook_delivery_response_status.py +11 -0
  223. bytekit/py.typed +0 -0
  224. bytekit/types.py +54 -0
  225. bytekit_sdk-0.3.0.dist-info/METADATA +141 -0
  226. bytekit_sdk-0.3.0.dist-info/RECORD +227 -0
  227. bytekit_sdk-0.3.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,155 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union, cast
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.error import Error
9
+ from ...types import Response
10
+
11
+
12
+ def _get_kwargs(
13
+ id: str,
14
+ ) -> dict[str, Any]:
15
+ _kwargs: dict[str, Any] = {
16
+ "method": "delete",
17
+ "url": "/v1/monitors/{id}".format(
18
+ id=id,
19
+ ),
20
+ }
21
+
22
+ return _kwargs
23
+
24
+
25
+ def _parse_response(
26
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
27
+ ) -> Optional[Union[Any, Error]]:
28
+ if response.status_code == 204:
29
+ response_204 = cast(Any, None)
30
+ return response_204
31
+ if response.status_code == 404:
32
+ response_404 = Error.from_dict(response.json())
33
+
34
+ return response_404
35
+ if client.raise_on_unexpected_status:
36
+ raise errors.UnexpectedStatus(response.status_code, response.content)
37
+ else:
38
+ return None
39
+
40
+
41
+ def _build_response(
42
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
43
+ ) -> Response[Union[Any, Error]]:
44
+ return Response(
45
+ status_code=HTTPStatus(response.status_code),
46
+ content=response.content,
47
+ headers=response.headers,
48
+ parsed=_parse_response(client=client, response=response),
49
+ )
50
+
51
+
52
+ def sync_detailed(
53
+ id: str,
54
+ *,
55
+ client: Union[AuthenticatedClient, Client],
56
+ ) -> Response[Union[Any, Error]]:
57
+ """Cancel monitor
58
+
59
+ Args:
60
+ id (str):
61
+
62
+ Raises:
63
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
64
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
65
+
66
+ Returns:
67
+ Response[Union[Any, Error]]
68
+ """
69
+
70
+ kwargs = _get_kwargs(
71
+ id=id,
72
+ )
73
+
74
+ response = client.get_httpx_client().request(
75
+ **kwargs,
76
+ )
77
+
78
+ return _build_response(client=client, response=response)
79
+
80
+
81
+ def sync(
82
+ id: str,
83
+ *,
84
+ client: Union[AuthenticatedClient, Client],
85
+ ) -> Optional[Union[Any, Error]]:
86
+ """Cancel monitor
87
+
88
+ Args:
89
+ id (str):
90
+
91
+ Raises:
92
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
93
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
94
+
95
+ Returns:
96
+ Union[Any, Error]
97
+ """
98
+
99
+ return sync_detailed(
100
+ id=id,
101
+ client=client,
102
+ ).parsed
103
+
104
+
105
+ async def asyncio_detailed(
106
+ id: str,
107
+ *,
108
+ client: Union[AuthenticatedClient, Client],
109
+ ) -> Response[Union[Any, Error]]:
110
+ """Cancel monitor
111
+
112
+ Args:
113
+ id (str):
114
+
115
+ Raises:
116
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
117
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
118
+
119
+ Returns:
120
+ Response[Union[Any, Error]]
121
+ """
122
+
123
+ kwargs = _get_kwargs(
124
+ id=id,
125
+ )
126
+
127
+ response = await client.get_async_httpx_client().request(**kwargs)
128
+
129
+ return _build_response(client=client, response=response)
130
+
131
+
132
+ async def asyncio(
133
+ id: str,
134
+ *,
135
+ client: Union[AuthenticatedClient, Client],
136
+ ) -> Optional[Union[Any, Error]]:
137
+ """Cancel monitor
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
+ Union[Any, Error]
148
+ """
149
+
150
+ return (
151
+ await asyncio_detailed(
152
+ id=id,
153
+ client=client,
154
+ )
155
+ ).parsed
@@ -0,0 +1,157 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.error import Error
9
+ from ...models.monitor_response import MonitorResponse
10
+ from ...types import Response
11
+
12
+
13
+ def _get_kwargs(
14
+ id: str,
15
+ ) -> dict[str, Any]:
16
+ _kwargs: dict[str, Any] = {
17
+ "method": "get",
18
+ "url": "/v1/monitors/{id}".format(
19
+ id=id,
20
+ ),
21
+ }
22
+
23
+ return _kwargs
24
+
25
+
26
+ def _parse_response(
27
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
28
+ ) -> Optional[Union[Error, MonitorResponse]]:
29
+ if response.status_code == 200:
30
+ response_200 = MonitorResponse.from_dict(response.json())
31
+
32
+ return response_200
33
+ if response.status_code == 404:
34
+ response_404 = Error.from_dict(response.json())
35
+
36
+ return response_404
37
+ if client.raise_on_unexpected_status:
38
+ raise errors.UnexpectedStatus(response.status_code, response.content)
39
+ else:
40
+ return None
41
+
42
+
43
+ def _build_response(
44
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
45
+ ) -> Response[Union[Error, MonitorResponse]]:
46
+ return Response(
47
+ status_code=HTTPStatus(response.status_code),
48
+ content=response.content,
49
+ headers=response.headers,
50
+ parsed=_parse_response(client=client, response=response),
51
+ )
52
+
53
+
54
+ def sync_detailed(
55
+ id: str,
56
+ *,
57
+ client: Union[AuthenticatedClient, Client],
58
+ ) -> Response[Union[Error, MonitorResponse]]:
59
+ """Get monitor
60
+
61
+ Args:
62
+ id (str):
63
+
64
+ Raises:
65
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
66
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
67
+
68
+ Returns:
69
+ Response[Union[Error, MonitorResponse]]
70
+ """
71
+
72
+ kwargs = _get_kwargs(
73
+ id=id,
74
+ )
75
+
76
+ response = client.get_httpx_client().request(
77
+ **kwargs,
78
+ )
79
+
80
+ return _build_response(client=client, response=response)
81
+
82
+
83
+ def sync(
84
+ id: str,
85
+ *,
86
+ client: Union[AuthenticatedClient, Client],
87
+ ) -> Optional[Union[Error, MonitorResponse]]:
88
+ """Get monitor
89
+
90
+ Args:
91
+ id (str):
92
+
93
+ Raises:
94
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
95
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
96
+
97
+ Returns:
98
+ Union[Error, MonitorResponse]
99
+ """
100
+
101
+ return sync_detailed(
102
+ id=id,
103
+ client=client,
104
+ ).parsed
105
+
106
+
107
+ async def asyncio_detailed(
108
+ id: str,
109
+ *,
110
+ client: Union[AuthenticatedClient, Client],
111
+ ) -> Response[Union[Error, MonitorResponse]]:
112
+ """Get monitor
113
+
114
+ Args:
115
+ id (str):
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
+ Response[Union[Error, MonitorResponse]]
123
+ """
124
+
125
+ kwargs = _get_kwargs(
126
+ id=id,
127
+ )
128
+
129
+ response = await client.get_async_httpx_client().request(**kwargs)
130
+
131
+ return _build_response(client=client, response=response)
132
+
133
+
134
+ async def asyncio(
135
+ id: str,
136
+ *,
137
+ client: Union[AuthenticatedClient, Client],
138
+ ) -> Optional[Union[Error, MonitorResponse]]:
139
+ """Get monitor
140
+
141
+ Args:
142
+ id (str):
143
+
144
+ Raises:
145
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
146
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
147
+
148
+ Returns:
149
+ Union[Error, MonitorResponse]
150
+ """
151
+
152
+ return (
153
+ await asyncio_detailed(
154
+ id=id,
155
+ client=client,
156
+ )
157
+ ).parsed
@@ -0,0 +1,188 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.list_monitor_captures_response_200 import ListMonitorCapturesResponse200
9
+ from ...types import UNSET, Response, Unset
10
+
11
+
12
+ def _get_kwargs(
13
+ id: str,
14
+ *,
15
+ limit: Union[Unset, int] = 25,
16
+ cursor: Union[Unset, str] = UNSET,
17
+ ) -> dict[str, Any]:
18
+ params: dict[str, Any] = {}
19
+
20
+ params["limit"] = limit
21
+
22
+ params["cursor"] = cursor
23
+
24
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
25
+
26
+ _kwargs: dict[str, Any] = {
27
+ "method": "get",
28
+ "url": "/v1/monitors/{id}/captures".format(
29
+ id=id,
30
+ ),
31
+ "params": params,
32
+ }
33
+
34
+ return _kwargs
35
+
36
+
37
+ def _parse_response(
38
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
39
+ ) -> Optional[ListMonitorCapturesResponse200]:
40
+ if response.status_code == 200:
41
+ response_200 = ListMonitorCapturesResponse200.from_dict(response.json())
42
+
43
+ return response_200
44
+ if client.raise_on_unexpected_status:
45
+ raise errors.UnexpectedStatus(response.status_code, response.content)
46
+ else:
47
+ return None
48
+
49
+
50
+ def _build_response(
51
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
52
+ ) -> Response[ListMonitorCapturesResponse200]:
53
+ return Response(
54
+ status_code=HTTPStatus(response.status_code),
55
+ content=response.content,
56
+ headers=response.headers,
57
+ parsed=_parse_response(client=client, response=response),
58
+ )
59
+
60
+
61
+ def sync_detailed(
62
+ id: str,
63
+ *,
64
+ client: Union[AuthenticatedClient, Client],
65
+ limit: Union[Unset, int] = 25,
66
+ cursor: Union[Unset, str] = UNSET,
67
+ ) -> Response[ListMonitorCapturesResponse200]:
68
+ """List monitor captures
69
+
70
+ Args:
71
+ id (str):
72
+ limit (Union[Unset, int]): Default: 25.
73
+ cursor (Union[Unset, str]):
74
+
75
+ Raises:
76
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
77
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
78
+
79
+ Returns:
80
+ Response[ListMonitorCapturesResponse200]
81
+ """
82
+
83
+ kwargs = _get_kwargs(
84
+ id=id,
85
+ limit=limit,
86
+ cursor=cursor,
87
+ )
88
+
89
+ response = client.get_httpx_client().request(
90
+ **kwargs,
91
+ )
92
+
93
+ return _build_response(client=client, response=response)
94
+
95
+
96
+ def sync(
97
+ id: str,
98
+ *,
99
+ client: Union[AuthenticatedClient, Client],
100
+ limit: Union[Unset, int] = 25,
101
+ cursor: Union[Unset, str] = UNSET,
102
+ ) -> Optional[ListMonitorCapturesResponse200]:
103
+ """List monitor captures
104
+
105
+ Args:
106
+ id (str):
107
+ limit (Union[Unset, int]): Default: 25.
108
+ cursor (Union[Unset, str]):
109
+
110
+ Raises:
111
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
112
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
113
+
114
+ Returns:
115
+ ListMonitorCapturesResponse200
116
+ """
117
+
118
+ return sync_detailed(
119
+ id=id,
120
+ client=client,
121
+ limit=limit,
122
+ cursor=cursor,
123
+ ).parsed
124
+
125
+
126
+ async def asyncio_detailed(
127
+ id: str,
128
+ *,
129
+ client: Union[AuthenticatedClient, Client],
130
+ limit: Union[Unset, int] = 25,
131
+ cursor: Union[Unset, str] = UNSET,
132
+ ) -> Response[ListMonitorCapturesResponse200]:
133
+ """List monitor captures
134
+
135
+ Args:
136
+ id (str):
137
+ limit (Union[Unset, int]): Default: 25.
138
+ cursor (Union[Unset, str]):
139
+
140
+ Raises:
141
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
142
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
143
+
144
+ Returns:
145
+ Response[ListMonitorCapturesResponse200]
146
+ """
147
+
148
+ kwargs = _get_kwargs(
149
+ id=id,
150
+ limit=limit,
151
+ cursor=cursor,
152
+ )
153
+
154
+ response = await client.get_async_httpx_client().request(**kwargs)
155
+
156
+ return _build_response(client=client, response=response)
157
+
158
+
159
+ async def asyncio(
160
+ id: str,
161
+ *,
162
+ client: Union[AuthenticatedClient, Client],
163
+ limit: Union[Unset, int] = 25,
164
+ cursor: Union[Unset, str] = UNSET,
165
+ ) -> Optional[ListMonitorCapturesResponse200]:
166
+ """List monitor captures
167
+
168
+ Args:
169
+ id (str):
170
+ limit (Union[Unset, int]): Default: 25.
171
+ cursor (Union[Unset, 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
+ ListMonitorCapturesResponse200
179
+ """
180
+
181
+ return (
182
+ await asyncio_detailed(
183
+ id=id,
184
+ client=client,
185
+ limit=limit,
186
+ cursor=cursor,
187
+ )
188
+ ).parsed
@@ -0,0 +1,193 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.list_monitors_response_200 import ListMonitorsResponse200
9
+ from ...models.list_monitors_status import ListMonitorsStatus
10
+ from ...types import UNSET, Response, Unset
11
+
12
+
13
+ def _get_kwargs(
14
+ *,
15
+ limit: Union[Unset, int] = 25,
16
+ cursor: Union[Unset, str] = UNSET,
17
+ status: Union[Unset, ListMonitorsStatus] = ListMonitorsStatus.ACTIVE,
18
+ ) -> dict[str, Any]:
19
+ params: dict[str, Any] = {}
20
+
21
+ params["limit"] = limit
22
+
23
+ params["cursor"] = cursor
24
+
25
+ json_status: Union[Unset, str] = UNSET
26
+ if not isinstance(status, Unset):
27
+ json_status = status.value
28
+
29
+ params["status"] = json_status
30
+
31
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
32
+
33
+ _kwargs: dict[str, Any] = {
34
+ "method": "get",
35
+ "url": "/v1/monitors",
36
+ "params": params,
37
+ }
38
+
39
+ return _kwargs
40
+
41
+
42
+ def _parse_response(
43
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
44
+ ) -> Optional[ListMonitorsResponse200]:
45
+ if response.status_code == 200:
46
+ response_200 = ListMonitorsResponse200.from_dict(response.json())
47
+
48
+ return response_200
49
+ if client.raise_on_unexpected_status:
50
+ raise errors.UnexpectedStatus(response.status_code, response.content)
51
+ else:
52
+ return None
53
+
54
+
55
+ def _build_response(
56
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
57
+ ) -> Response[ListMonitorsResponse200]:
58
+ return Response(
59
+ status_code=HTTPStatus(response.status_code),
60
+ content=response.content,
61
+ headers=response.headers,
62
+ parsed=_parse_response(client=client, response=response),
63
+ )
64
+
65
+
66
+ def sync_detailed(
67
+ *,
68
+ client: Union[AuthenticatedClient, Client],
69
+ limit: Union[Unset, int] = 25,
70
+ cursor: Union[Unset, str] = UNSET,
71
+ status: Union[Unset, ListMonitorsStatus] = ListMonitorsStatus.ACTIVE,
72
+ ) -> Response[ListMonitorsResponse200]:
73
+ """List monitors
74
+
75
+ Args:
76
+ limit (Union[Unset, int]): Default: 25.
77
+ cursor (Union[Unset, str]):
78
+ status (Union[Unset, ListMonitorsStatus]): Default: ListMonitorsStatus.ACTIVE.
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[ListMonitorsResponse200]
86
+ """
87
+
88
+ kwargs = _get_kwargs(
89
+ limit=limit,
90
+ cursor=cursor,
91
+ status=status,
92
+ )
93
+
94
+ response = client.get_httpx_client().request(
95
+ **kwargs,
96
+ )
97
+
98
+ return _build_response(client=client, response=response)
99
+
100
+
101
+ def sync(
102
+ *,
103
+ client: Union[AuthenticatedClient, Client],
104
+ limit: Union[Unset, int] = 25,
105
+ cursor: Union[Unset, str] = UNSET,
106
+ status: Union[Unset, ListMonitorsStatus] = ListMonitorsStatus.ACTIVE,
107
+ ) -> Optional[ListMonitorsResponse200]:
108
+ """List monitors
109
+
110
+ Args:
111
+ limit (Union[Unset, int]): Default: 25.
112
+ cursor (Union[Unset, str]):
113
+ status (Union[Unset, ListMonitorsStatus]): Default: ListMonitorsStatus.ACTIVE.
114
+
115
+ Raises:
116
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
117
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
118
+
119
+ Returns:
120
+ ListMonitorsResponse200
121
+ """
122
+
123
+ return sync_detailed(
124
+ client=client,
125
+ limit=limit,
126
+ cursor=cursor,
127
+ status=status,
128
+ ).parsed
129
+
130
+
131
+ async def asyncio_detailed(
132
+ *,
133
+ client: Union[AuthenticatedClient, Client],
134
+ limit: Union[Unset, int] = 25,
135
+ cursor: Union[Unset, str] = UNSET,
136
+ status: Union[Unset, ListMonitorsStatus] = ListMonitorsStatus.ACTIVE,
137
+ ) -> Response[ListMonitorsResponse200]:
138
+ """List monitors
139
+
140
+ Args:
141
+ limit (Union[Unset, int]): Default: 25.
142
+ cursor (Union[Unset, str]):
143
+ status (Union[Unset, ListMonitorsStatus]): Default: ListMonitorsStatus.ACTIVE.
144
+
145
+ Raises:
146
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
147
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
148
+
149
+ Returns:
150
+ Response[ListMonitorsResponse200]
151
+ """
152
+
153
+ kwargs = _get_kwargs(
154
+ limit=limit,
155
+ cursor=cursor,
156
+ status=status,
157
+ )
158
+
159
+ response = await client.get_async_httpx_client().request(**kwargs)
160
+
161
+ return _build_response(client=client, response=response)
162
+
163
+
164
+ async def asyncio(
165
+ *,
166
+ client: Union[AuthenticatedClient, Client],
167
+ limit: Union[Unset, int] = 25,
168
+ cursor: Union[Unset, str] = UNSET,
169
+ status: Union[Unset, ListMonitorsStatus] = ListMonitorsStatus.ACTIVE,
170
+ ) -> Optional[ListMonitorsResponse200]:
171
+ """List monitors
172
+
173
+ Args:
174
+ limit (Union[Unset, int]): Default: 25.
175
+ cursor (Union[Unset, str]):
176
+ status (Union[Unset, ListMonitorsStatus]): Default: ListMonitorsStatus.ACTIVE.
177
+
178
+ Raises:
179
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
180
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
181
+
182
+ Returns:
183
+ ListMonitorsResponse200
184
+ """
185
+
186
+ return (
187
+ await asyncio_detailed(
188
+ client=client,
189
+ limit=limit,
190
+ cursor=cursor,
191
+ status=status,
192
+ )
193
+ ).parsed