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,113 @@
1
+ from collections.abc import Mapping
2
+ from typing import (
3
+ Any,
4
+ TypeVar,
5
+ Union,
6
+ )
7
+
8
+ from attrs import define as _attrs_define
9
+ from attrs import field as _attrs_field
10
+
11
+ from ..types import UNSET, Unset
12
+
13
+ T = TypeVar("T", bound="CreateSearchResponse200ResultsItemImage")
14
+
15
+
16
+ @_attrs_define
17
+ class CreateSearchResponse200ResultsItemImage:
18
+ """Image attached to the result. For `news` results this is the thumbnail (only `url`). For `images` results it is the
19
+ full image, additionally carrying its dimensions and a thumbnail URL + dimensions. Each field past `url` is present
20
+ only when the provider reports it.
21
+
22
+ Attributes:
23
+ url (str): URL of the image (thumbnail for `news`, full image for `images`).
24
+ width (Union[Unset, int]): Source image width in pixels (`images` only).
25
+ height (Union[Unset, int]): Source image height in pixels (`images` only).
26
+ thumbnail_url (Union[Unset, str]): URL of the thumbnail image (`images` only).
27
+ thumbnail_width (Union[Unset, int]): Thumbnail width in pixels (`images` only).
28
+ thumbnail_height (Union[Unset, int]): Thumbnail height in pixels (`images` only).
29
+ """
30
+
31
+ url: str
32
+ width: Union[Unset, int] = UNSET
33
+ height: Union[Unset, int] = UNSET
34
+ thumbnail_url: Union[Unset, str] = UNSET
35
+ thumbnail_width: Union[Unset, int] = UNSET
36
+ thumbnail_height: Union[Unset, int] = UNSET
37
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
38
+
39
+ def to_dict(self) -> dict[str, Any]:
40
+ url = self.url
41
+
42
+ width = self.width
43
+
44
+ height = self.height
45
+
46
+ thumbnail_url = self.thumbnail_url
47
+
48
+ thumbnail_width = self.thumbnail_width
49
+
50
+ thumbnail_height = self.thumbnail_height
51
+
52
+ field_dict: dict[str, Any] = {}
53
+ field_dict.update(self.additional_properties)
54
+ field_dict.update(
55
+ {
56
+ "url": url,
57
+ }
58
+ )
59
+ if width is not UNSET:
60
+ field_dict["width"] = width
61
+ if height is not UNSET:
62
+ field_dict["height"] = height
63
+ if thumbnail_url is not UNSET:
64
+ field_dict["thumbnail_url"] = thumbnail_url
65
+ if thumbnail_width is not UNSET:
66
+ field_dict["thumbnail_width"] = thumbnail_width
67
+ if thumbnail_height is not UNSET:
68
+ field_dict["thumbnail_height"] = thumbnail_height
69
+
70
+ return field_dict
71
+
72
+ @classmethod
73
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
74
+ d = dict(src_dict)
75
+ url = d.pop("url")
76
+
77
+ width = d.pop("width", UNSET)
78
+
79
+ height = d.pop("height", UNSET)
80
+
81
+ thumbnail_url = d.pop("thumbnail_url", UNSET)
82
+
83
+ thumbnail_width = d.pop("thumbnail_width", UNSET)
84
+
85
+ thumbnail_height = d.pop("thumbnail_height", UNSET)
86
+
87
+ create_search_response_200_results_item_image = cls(
88
+ url=url,
89
+ width=width,
90
+ height=height,
91
+ thumbnail_url=thumbnail_url,
92
+ thumbnail_width=thumbnail_width,
93
+ thumbnail_height=thumbnail_height,
94
+ )
95
+
96
+ create_search_response_200_results_item_image.additional_properties = d
97
+ return create_search_response_200_results_item_image
98
+
99
+ @property
100
+ def additional_keys(self) -> list[str]:
101
+ return list(self.additional_properties.keys())
102
+
103
+ def __getitem__(self, key: str) -> Any:
104
+ return self.additional_properties[key]
105
+
106
+ def __setitem__(self, key: str, value: Any) -> None:
107
+ self.additional_properties[key] = value
108
+
109
+ def __delitem__(self, key: str) -> None:
110
+ del self.additional_properties[key]
111
+
112
+ def __contains__(self, key: str) -> bool:
113
+ return key in self.additional_properties
@@ -0,0 +1,46 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar
3
+
4
+ from attrs import define as _attrs_define
5
+
6
+ from ..models.create_search_response_502_error import CreateSearchResponse502Error
7
+
8
+ T = TypeVar("T", bound="CreateSearchResponse502")
9
+
10
+
11
+ @_attrs_define
12
+ class CreateSearchResponse502:
13
+ """
14
+ Example:
15
+ {'error': 'search_provider_error'}
16
+
17
+ Attributes:
18
+ error (CreateSearchResponse502Error): Fixed vendor-masked error code. Always `search_provider_error`; the
19
+ upstream provider's identity and failure detail are withheld by design.
20
+ """
21
+
22
+ error: CreateSearchResponse502Error
23
+
24
+ def to_dict(self) -> dict[str, Any]:
25
+ error = self.error.value
26
+
27
+ field_dict: dict[str, Any] = {}
28
+
29
+ field_dict.update(
30
+ {
31
+ "error": error,
32
+ }
33
+ )
34
+
35
+ return field_dict
36
+
37
+ @classmethod
38
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
39
+ d = dict(src_dict)
40
+ error = CreateSearchResponse502Error(d.pop("error"))
41
+
42
+ create_search_response_502 = cls(
43
+ error=error,
44
+ )
45
+
46
+ return create_search_response_502
@@ -0,0 +1,8 @@
1
+ from enum import Enum
2
+
3
+
4
+ class CreateSearchResponse502Error(str, Enum):
5
+ SEARCH_PROVIDER_ERROR = "search_provider_error"
6
+
7
+ def __str__(self) -> str:
8
+ return str(self.value)
@@ -0,0 +1,91 @@
1
+ from collections.abc import Mapping
2
+ from typing import Any, TypeVar
3
+
4
+ from attrs import define as _attrs_define
5
+ from attrs import field as _attrs_field
6
+
7
+ T = TypeVar("T", bound="CreditBalance")
8
+
9
+
10
+ @_attrs_define
11
+ class CreditBalance:
12
+ """
13
+ Attributes:
14
+ used (int):
15
+ limit (int):
16
+ remaining (int):
17
+ topup_credits (int):
18
+ rollover_credits (int):
19
+ """
20
+
21
+ used: int
22
+ limit: int
23
+ remaining: int
24
+ topup_credits: int
25
+ rollover_credits: int
26
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
+
28
+ def to_dict(self) -> dict[str, Any]:
29
+ used = self.used
30
+
31
+ limit = self.limit
32
+
33
+ remaining = self.remaining
34
+
35
+ topup_credits = self.topup_credits
36
+
37
+ rollover_credits = self.rollover_credits
38
+
39
+ field_dict: dict[str, Any] = {}
40
+ field_dict.update(self.additional_properties)
41
+ field_dict.update(
42
+ {
43
+ "used": used,
44
+ "limit": limit,
45
+ "remaining": remaining,
46
+ "topup_credits": topup_credits,
47
+ "rollover_credits": rollover_credits,
48
+ }
49
+ )
50
+
51
+ return field_dict
52
+
53
+ @classmethod
54
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
55
+ d = dict(src_dict)
56
+ used = d.pop("used")
57
+
58
+ limit = d.pop("limit")
59
+
60
+ remaining = d.pop("remaining")
61
+
62
+ topup_credits = d.pop("topup_credits")
63
+
64
+ rollover_credits = d.pop("rollover_credits")
65
+
66
+ credit_balance = cls(
67
+ used=used,
68
+ limit=limit,
69
+ remaining=remaining,
70
+ topup_credits=topup_credits,
71
+ rollover_credits=rollover_credits,
72
+ )
73
+
74
+ credit_balance.additional_properties = d
75
+ return credit_balance
76
+
77
+ @property
78
+ def additional_keys(self) -> list[str]:
79
+ return list(self.additional_properties.keys())
80
+
81
+ def __getitem__(self, key: str) -> Any:
82
+ return self.additional_properties[key]
83
+
84
+ def __setitem__(self, key: str, value: Any) -> None:
85
+ self.additional_properties[key] = value
86
+
87
+ def __delitem__(self, key: str) -> None:
88
+ del self.additional_properties[key]
89
+
90
+ def __contains__(self, key: str) -> bool:
91
+ return key in self.additional_properties
@@ -0,0 +1,164 @@
1
+ import datetime
2
+ from collections.abc import Mapping
3
+ from typing import (
4
+ Any,
5
+ TypeVar,
6
+ Union,
7
+ cast,
8
+ )
9
+
10
+ from attrs import define as _attrs_define
11
+ from attrs import field as _attrs_field
12
+ from dateutil.parser import isoparse
13
+
14
+ from ..models.delete_bulk_response_200_status import DeleteBulkResponse200Status
15
+
16
+ T = TypeVar("T", bound="DeleteBulkResponse200")
17
+
18
+
19
+ @_attrs_define
20
+ class DeleteBulkResponse200:
21
+ """
22
+ Attributes:
23
+ id (str): Example: bulk_01j9abc123.
24
+ status (DeleteBulkResponse200Status):
25
+ total (int):
26
+ completed (int):
27
+ failed (int):
28
+ created_at (datetime.datetime):
29
+ completed_at (Union[None, datetime.datetime]):
30
+ total_credits_charged (int):
31
+ estimated_credits (Union[None, int]): Null in cancel responses (computed at submission time only).
32
+ webhook_url (str): Webhook endpoint URL (HTTPS only; http:// rejected with 400 invalid_url, reason
33
+ scheme_unsupported)
34
+ """
35
+
36
+ id: str
37
+ status: DeleteBulkResponse200Status
38
+ total: int
39
+ completed: int
40
+ failed: int
41
+ created_at: datetime.datetime
42
+ completed_at: Union[None, datetime.datetime]
43
+ total_credits_charged: int
44
+ estimated_credits: Union[None, int]
45
+ webhook_url: str
46
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
47
+
48
+ def to_dict(self) -> dict[str, Any]:
49
+ id = self.id
50
+
51
+ status = self.status.value
52
+
53
+ total = self.total
54
+
55
+ completed = self.completed
56
+
57
+ failed = self.failed
58
+
59
+ created_at = self.created_at.isoformat()
60
+
61
+ completed_at: Union[None, str]
62
+ if isinstance(self.completed_at, datetime.datetime):
63
+ completed_at = self.completed_at.isoformat()
64
+ else:
65
+ completed_at = self.completed_at
66
+
67
+ total_credits_charged = self.total_credits_charged
68
+
69
+ estimated_credits: Union[None, int]
70
+ estimated_credits = self.estimated_credits
71
+
72
+ webhook_url = self.webhook_url
73
+
74
+ field_dict: dict[str, Any] = {}
75
+ field_dict.update(self.additional_properties)
76
+ field_dict.update(
77
+ {
78
+ "id": id,
79
+ "status": status,
80
+ "total": total,
81
+ "completed": completed,
82
+ "failed": failed,
83
+ "created_at": created_at,
84
+ "completed_at": completed_at,
85
+ "total_credits_charged": total_credits_charged,
86
+ "estimated_credits": estimated_credits,
87
+ "webhook_url": webhook_url,
88
+ }
89
+ )
90
+
91
+ return field_dict
92
+
93
+ @classmethod
94
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
95
+ d = dict(src_dict)
96
+ id = d.pop("id")
97
+
98
+ status = DeleteBulkResponse200Status(d.pop("status"))
99
+
100
+ total = d.pop("total")
101
+
102
+ completed = d.pop("completed")
103
+
104
+ failed = d.pop("failed")
105
+
106
+ created_at = isoparse(d.pop("created_at"))
107
+
108
+ def _parse_completed_at(data: object) -> Union[None, datetime.datetime]:
109
+ if data is None:
110
+ return data
111
+ try:
112
+ if not isinstance(data, str):
113
+ raise TypeError()
114
+ completed_at_type_0 = isoparse(data)
115
+
116
+ return completed_at_type_0
117
+ except: # noqa: E722
118
+ pass
119
+ return cast(Union[None, datetime.datetime], data)
120
+
121
+ completed_at = _parse_completed_at(d.pop("completed_at"))
122
+
123
+ total_credits_charged = d.pop("total_credits_charged")
124
+
125
+ def _parse_estimated_credits(data: object) -> Union[None, int]:
126
+ if data is None:
127
+ return data
128
+ return cast(Union[None, int], data)
129
+
130
+ estimated_credits = _parse_estimated_credits(d.pop("estimated_credits"))
131
+
132
+ webhook_url = d.pop("webhook_url")
133
+
134
+ delete_bulk_response_200 = cls(
135
+ id=id,
136
+ status=status,
137
+ total=total,
138
+ completed=completed,
139
+ failed=failed,
140
+ created_at=created_at,
141
+ completed_at=completed_at,
142
+ total_credits_charged=total_credits_charged,
143
+ estimated_credits=estimated_credits,
144
+ webhook_url=webhook_url,
145
+ )
146
+
147
+ delete_bulk_response_200.additional_properties = d
148
+ return delete_bulk_response_200
149
+
150
+ @property
151
+ def additional_keys(self) -> list[str]:
152
+ return list(self.additional_properties.keys())
153
+
154
+ def __getitem__(self, key: str) -> Any:
155
+ return self.additional_properties[key]
156
+
157
+ def __setitem__(self, key: str, value: Any) -> None:
158
+ self.additional_properties[key] = value
159
+
160
+ def __delitem__(self, key: str) -> None:
161
+ del self.additional_properties[key]
162
+
163
+ def __contains__(self, key: str) -> bool:
164
+ return key in self.additional_properties
@@ -0,0 +1,11 @@
1
+ from enum import Enum
2
+
3
+
4
+ class DeleteBulkResponse200Status(str, Enum):
5
+ CANCELLED = "cancelled"
6
+ COMPLETED = "completed"
7
+ FAILED = "failed"
8
+ PROCESSING = "processing"
9
+
10
+ def __str__(self) -> str:
11
+ return str(self.value)
@@ -0,0 +1,83 @@
1
+ from collections.abc import Mapping
2
+ from typing import (
3
+ TYPE_CHECKING,
4
+ Any,
5
+ TypeVar,
6
+ )
7
+
8
+ from attrs import define as _attrs_define
9
+ from attrs import field as _attrs_field
10
+
11
+ from ..models.error_status import ErrorStatus
12
+
13
+ if TYPE_CHECKING:
14
+ from ..models.error_error import ErrorError
15
+
16
+
17
+ T = TypeVar("T", bound="Error")
18
+
19
+
20
+ @_attrs_define
21
+ class Error:
22
+ """Canonical 4xx/5xx error envelope used by every public-API route
23
+ (issue #699). `status` is the top-level discriminator so clients can
24
+ match on the body alone, without re-checking HTTP status. `http_status`
25
+ mirrors the HTTP response status for replayed or logged bodies.
26
+
27
+ Attributes:
28
+ status (ErrorStatus): Top-level discriminator. Always `failed` for error responses.
29
+ error (ErrorError):
30
+ """
31
+
32
+ status: ErrorStatus
33
+ error: "ErrorError"
34
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
35
+
36
+ def to_dict(self) -> dict[str, Any]:
37
+ status = self.status.value
38
+
39
+ error = self.error.to_dict()
40
+
41
+ field_dict: dict[str, Any] = {}
42
+ field_dict.update(self.additional_properties)
43
+ field_dict.update(
44
+ {
45
+ "status": status,
46
+ "error": error,
47
+ }
48
+ )
49
+
50
+ return field_dict
51
+
52
+ @classmethod
53
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
54
+ from ..models.error_error import ErrorError
55
+
56
+ d = dict(src_dict)
57
+ status = ErrorStatus(d.pop("status"))
58
+
59
+ error = ErrorError.from_dict(d.pop("error"))
60
+
61
+ error = cls(
62
+ status=status,
63
+ error=error,
64
+ )
65
+
66
+ error.additional_properties = d
67
+ return error
68
+
69
+ @property
70
+ def additional_keys(self) -> list[str]:
71
+ return list(self.additional_properties.keys())
72
+
73
+ def __getitem__(self, key: str) -> Any:
74
+ return self.additional_properties[key]
75
+
76
+ def __setitem__(self, key: str, value: Any) -> None:
77
+ self.additional_properties[key] = value
78
+
79
+ def __delitem__(self, key: str) -> None:
80
+ del self.additional_properties[key]
81
+
82
+ def __contains__(self, key: str) -> bool:
83
+ return key in self.additional_properties
@@ -0,0 +1,100 @@
1
+ import datetime
2
+ from collections.abc import Mapping
3
+ from typing import (
4
+ Any,
5
+ TypeVar,
6
+ Union,
7
+ )
8
+
9
+ from attrs import define as _attrs_define
10
+ from attrs import field as _attrs_field
11
+ from dateutil.parser import isoparse
12
+
13
+ from ..types import UNSET, Unset
14
+
15
+ T = TypeVar("T", bound="ErrorError")
16
+
17
+
18
+ @_attrs_define
19
+ class ErrorError:
20
+ """
21
+ Attributes:
22
+ code (str): Machine-readable error code.
23
+ message (str): Human-readable error message.
24
+ http_status (int): HTTP status code (mirrors the response status for replayed bodies).
25
+ failed_at (datetime.datetime): ISO-8601 UTC timestamp when the error was emitted.
26
+ details (Union[Unset, Any]): Optional structured details (e.g. which fields failed validation).
27
+ """
28
+
29
+ code: str
30
+ message: str
31
+ http_status: int
32
+ failed_at: datetime.datetime
33
+ details: Union[Unset, Any] = UNSET
34
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
35
+
36
+ def to_dict(self) -> dict[str, Any]:
37
+ code = self.code
38
+
39
+ message = self.message
40
+
41
+ http_status = self.http_status
42
+
43
+ failed_at = self.failed_at.isoformat()
44
+
45
+ details = self.details
46
+
47
+ field_dict: dict[str, Any] = {}
48
+ field_dict.update(self.additional_properties)
49
+ field_dict.update(
50
+ {
51
+ "code": code,
52
+ "message": message,
53
+ "http_status": http_status,
54
+ "failed_at": failed_at,
55
+ }
56
+ )
57
+ if details is not UNSET:
58
+ field_dict["details"] = details
59
+
60
+ return field_dict
61
+
62
+ @classmethod
63
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
64
+ d = dict(src_dict)
65
+ code = d.pop("code")
66
+
67
+ message = d.pop("message")
68
+
69
+ http_status = d.pop("http_status")
70
+
71
+ failed_at = isoparse(d.pop("failed_at"))
72
+
73
+ details = d.pop("details", UNSET)
74
+
75
+ error_error = cls(
76
+ code=code,
77
+ message=message,
78
+ http_status=http_status,
79
+ failed_at=failed_at,
80
+ details=details,
81
+ )
82
+
83
+ error_error.additional_properties = d
84
+ return error_error
85
+
86
+ @property
87
+ def additional_keys(self) -> list[str]:
88
+ return list(self.additional_properties.keys())
89
+
90
+ def __getitem__(self, key: str) -> Any:
91
+ return self.additional_properties[key]
92
+
93
+ def __setitem__(self, key: str, value: Any) -> None:
94
+ self.additional_properties[key] = value
95
+
96
+ def __delitem__(self, key: str) -> None:
97
+ del self.additional_properties[key]
98
+
99
+ def __contains__(self, key: str) -> bool:
100
+ return key in self.additional_properties
@@ -0,0 +1,8 @@
1
+ from enum import Enum
2
+
3
+
4
+ class ErrorStatus(str, Enum):
5
+ FAILED = "failed"
6
+
7
+ def __str__(self) -> str:
8
+ return str(self.value)