mirascope 2.0.0a6__py3-none-any.whl → 2.0.1__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 (226) hide show
  1. mirascope/api/_generated/__init__.py +186 -5
  2. mirascope/api/_generated/annotations/client.py +38 -6
  3. mirascope/api/_generated/annotations/raw_client.py +366 -47
  4. mirascope/api/_generated/annotations/types/annotations_create_response.py +19 -6
  5. mirascope/api/_generated/annotations/types/annotations_get_response.py +19 -6
  6. mirascope/api/_generated/annotations/types/annotations_list_response_annotations_item.py +22 -7
  7. mirascope/api/_generated/annotations/types/annotations_update_response.py +19 -6
  8. mirascope/api/_generated/api_keys/__init__.py +12 -2
  9. mirascope/api/_generated/api_keys/client.py +107 -6
  10. mirascope/api/_generated/api_keys/raw_client.py +486 -38
  11. mirascope/api/_generated/api_keys/types/__init__.py +7 -1
  12. mirascope/api/_generated/api_keys/types/api_keys_list_all_for_org_response_item.py +40 -0
  13. mirascope/api/_generated/client.py +36 -0
  14. mirascope/api/_generated/docs/raw_client.py +71 -9
  15. mirascope/api/_generated/environment.py +3 -3
  16. mirascope/api/_generated/environments/__init__.py +6 -0
  17. mirascope/api/_generated/environments/client.py +158 -9
  18. mirascope/api/_generated/environments/raw_client.py +620 -52
  19. mirascope/api/_generated/environments/types/__init__.py +10 -0
  20. mirascope/api/_generated/environments/types/environments_get_analytics_response.py +60 -0
  21. mirascope/api/_generated/environments/types/environments_get_analytics_response_top_functions_item.py +24 -0
  22. mirascope/api/_generated/{organizations/types/organizations_credits_response.py → environments/types/environments_get_analytics_response_top_models_item.py} +6 -3
  23. mirascope/api/_generated/errors/__init__.py +6 -0
  24. mirascope/api/_generated/errors/bad_request_error.py +5 -2
  25. mirascope/api/_generated/errors/conflict_error.py +5 -2
  26. mirascope/api/_generated/errors/payment_required_error.py +15 -0
  27. mirascope/api/_generated/errors/service_unavailable_error.py +14 -0
  28. mirascope/api/_generated/errors/too_many_requests_error.py +15 -0
  29. mirascope/api/_generated/functions/__init__.py +10 -0
  30. mirascope/api/_generated/functions/client.py +222 -8
  31. mirascope/api/_generated/functions/raw_client.py +975 -134
  32. mirascope/api/_generated/functions/types/__init__.py +28 -4
  33. mirascope/api/_generated/functions/types/functions_get_by_env_response.py +53 -0
  34. mirascope/api/_generated/functions/types/functions_get_by_env_response_dependencies_value.py +22 -0
  35. mirascope/api/_generated/functions/types/functions_list_by_env_response.py +25 -0
  36. mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item.py +56 -0
  37. mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item_dependencies_value.py +22 -0
  38. mirascope/api/_generated/health/raw_client.py +74 -10
  39. mirascope/api/_generated/organization_invitations/__init__.py +33 -0
  40. mirascope/api/_generated/organization_invitations/client.py +546 -0
  41. mirascope/api/_generated/organization_invitations/raw_client.py +1519 -0
  42. mirascope/api/_generated/organization_invitations/types/__init__.py +53 -0
  43. mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response.py +34 -0
  44. mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response_role.py +7 -0
  45. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_request_role.py +7 -0
  46. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response.py +48 -0
  47. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_role.py +7 -0
  48. mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_status.py +7 -0
  49. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response.py +48 -0
  50. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_role.py +7 -0
  51. mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_status.py +7 -0
  52. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item.py +48 -0
  53. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_role.py +7 -0
  54. mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_status.py +7 -0
  55. mirascope/api/_generated/organization_memberships/__init__.py +19 -0
  56. mirascope/api/_generated/organization_memberships/client.py +302 -0
  57. mirascope/api/_generated/organization_memberships/raw_client.py +736 -0
  58. mirascope/api/_generated/organization_memberships/types/__init__.py +27 -0
  59. mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item.py +33 -0
  60. mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item_role.py +7 -0
  61. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_request_role.py +7 -0
  62. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response.py +31 -0
  63. mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response_role.py +7 -0
  64. mirascope/api/_generated/organizations/__init__.py +26 -2
  65. mirascope/api/_generated/organizations/client.py +442 -20
  66. mirascope/api/_generated/organizations/raw_client.py +1763 -164
  67. mirascope/api/_generated/organizations/types/__init__.py +48 -2
  68. mirascope/api/_generated/organizations/types/organizations_create_payment_intent_response.py +24 -0
  69. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_request_target_plan.py +7 -0
  70. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response.py +47 -0
  71. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item.py +33 -0
  72. mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item_resource.py +7 -0
  73. mirascope/api/_generated/organizations/types/organizations_router_balance_response.py +24 -0
  74. mirascope/api/_generated/organizations/types/organizations_subscription_response.py +53 -0
  75. mirascope/api/_generated/organizations/types/organizations_subscription_response_current_plan.py +7 -0
  76. mirascope/api/_generated/organizations/types/organizations_subscription_response_payment_method.py +26 -0
  77. mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change.py +34 -0
  78. mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change_target_plan.py +7 -0
  79. mirascope/api/_generated/organizations/types/organizations_update_subscription_request_target_plan.py +7 -0
  80. mirascope/api/_generated/organizations/types/organizations_update_subscription_response.py +35 -0
  81. mirascope/api/_generated/project_memberships/__init__.py +25 -0
  82. mirascope/api/_generated/project_memberships/client.py +437 -0
  83. mirascope/api/_generated/project_memberships/raw_client.py +1039 -0
  84. mirascope/api/_generated/project_memberships/types/__init__.py +29 -0
  85. mirascope/api/_generated/project_memberships/types/project_memberships_create_request_role.py +7 -0
  86. mirascope/api/_generated/project_memberships/types/project_memberships_create_response.py +35 -0
  87. mirascope/api/_generated/project_memberships/types/project_memberships_create_response_role.py +7 -0
  88. mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item.py +33 -0
  89. mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item_role.py +7 -0
  90. mirascope/api/_generated/project_memberships/types/project_memberships_update_request_role.py +7 -0
  91. mirascope/api/_generated/project_memberships/types/project_memberships_update_response.py +35 -0
  92. mirascope/api/_generated/project_memberships/types/project_memberships_update_response_role.py +7 -0
  93. mirascope/api/_generated/projects/raw_client.py +415 -58
  94. mirascope/api/_generated/reference.md +2767 -397
  95. mirascope/api/_generated/tags/__init__.py +19 -0
  96. mirascope/api/_generated/tags/client.py +504 -0
  97. mirascope/api/_generated/tags/raw_client.py +1288 -0
  98. mirascope/api/_generated/tags/types/__init__.py +17 -0
  99. mirascope/api/_generated/tags/types/tags_create_response.py +41 -0
  100. mirascope/api/_generated/tags/types/tags_get_response.py +41 -0
  101. mirascope/api/_generated/tags/types/tags_list_response.py +23 -0
  102. mirascope/api/_generated/tags/types/tags_list_response_tags_item.py +41 -0
  103. mirascope/api/_generated/tags/types/tags_update_response.py +41 -0
  104. mirascope/api/_generated/token_cost/__init__.py +7 -0
  105. mirascope/api/_generated/token_cost/client.py +160 -0
  106. mirascope/api/_generated/token_cost/raw_client.py +264 -0
  107. mirascope/api/_generated/token_cost/types/__init__.py +8 -0
  108. mirascope/api/_generated/token_cost/types/token_cost_calculate_request_usage.py +54 -0
  109. mirascope/api/_generated/token_cost/types/token_cost_calculate_response.py +52 -0
  110. mirascope/api/_generated/traces/__init__.py +20 -0
  111. mirascope/api/_generated/traces/client.py +543 -0
  112. mirascope/api/_generated/traces/raw_client.py +1366 -96
  113. mirascope/api/_generated/traces/types/__init__.py +28 -0
  114. mirascope/api/_generated/traces/types/traces_get_analytics_summary_response.py +6 -0
  115. mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response.py +33 -0
  116. mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response_spans_item.py +88 -0
  117. mirascope/api/_generated/traces/types/traces_get_trace_detail_response_spans_item.py +0 -2
  118. mirascope/api/_generated/traces/types/traces_list_by_function_hash_response.py +25 -0
  119. mirascope/api/_generated/traces/types/traces_list_by_function_hash_response_traces_item.py +44 -0
  120. mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item.py +26 -0
  121. mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item_operator.py +7 -0
  122. mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_by.py +7 -0
  123. mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_order.py +7 -0
  124. mirascope/api/_generated/traces/types/traces_search_by_env_response.py +26 -0
  125. mirascope/api/_generated/traces/types/traces_search_by_env_response_spans_item.py +50 -0
  126. mirascope/api/_generated/traces/types/traces_search_response_spans_item.py +10 -1
  127. mirascope/api/_generated/types/__init__.py +32 -2
  128. mirascope/api/_generated/types/bad_request_error_body.py +50 -0
  129. mirascope/api/_generated/types/date.py +3 -0
  130. mirascope/api/_generated/types/immutable_resource_error.py +22 -0
  131. mirascope/api/_generated/types/internal_server_error_body.py +3 -3
  132. mirascope/api/_generated/types/plan_limit_exceeded_error.py +32 -0
  133. mirascope/api/_generated/types/plan_limit_exceeded_error_tag.py +7 -0
  134. mirascope/api/_generated/types/pricing_unavailable_error.py +23 -0
  135. mirascope/api/_generated/types/rate_limit_error.py +31 -0
  136. mirascope/api/_generated/types/rate_limit_error_tag.py +5 -0
  137. mirascope/api/_generated/types/service_unavailable_error_body.py +24 -0
  138. mirascope/api/_generated/types/service_unavailable_error_tag.py +7 -0
  139. mirascope/api/_generated/types/subscription_past_due_error.py +31 -0
  140. mirascope/api/_generated/types/subscription_past_due_error_tag.py +7 -0
  141. mirascope/api/settings.py +19 -1
  142. mirascope/llm/__init__.py +53 -10
  143. mirascope/llm/calls/__init__.py +2 -1
  144. mirascope/llm/calls/calls.py +3 -1
  145. mirascope/llm/calls/decorator.py +21 -7
  146. mirascope/llm/content/tool_output.py +22 -5
  147. mirascope/llm/exceptions.py +284 -71
  148. mirascope/llm/formatting/__init__.py +17 -0
  149. mirascope/llm/formatting/format.py +112 -35
  150. mirascope/llm/formatting/output_parser.py +178 -0
  151. mirascope/llm/formatting/partial.py +80 -7
  152. mirascope/llm/formatting/primitives.py +192 -0
  153. mirascope/llm/formatting/types.py +20 -8
  154. mirascope/llm/messages/__init__.py +3 -0
  155. mirascope/llm/messages/_utils.py +34 -0
  156. mirascope/llm/models/__init__.py +5 -0
  157. mirascope/llm/models/models.py +137 -69
  158. mirascope/llm/{providers/base → models}/params.py +7 -57
  159. mirascope/llm/models/thinking_config.py +61 -0
  160. mirascope/llm/prompts/_utils.py +0 -32
  161. mirascope/llm/prompts/decorator.py +16 -5
  162. mirascope/llm/prompts/prompts.py +131 -68
  163. mirascope/llm/providers/__init__.py +1 -4
  164. mirascope/llm/providers/anthropic/_utils/__init__.py +2 -0
  165. mirascope/llm/providers/anthropic/_utils/beta_decode.py +18 -9
  166. mirascope/llm/providers/anthropic/_utils/beta_encode.py +62 -13
  167. mirascope/llm/providers/anthropic/_utils/decode.py +18 -9
  168. mirascope/llm/providers/anthropic/_utils/encode.py +26 -7
  169. mirascope/llm/providers/anthropic/_utils/errors.py +2 -2
  170. mirascope/llm/providers/anthropic/beta_provider.py +64 -18
  171. mirascope/llm/providers/anthropic/provider.py +91 -33
  172. mirascope/llm/providers/base/__init__.py +0 -4
  173. mirascope/llm/providers/base/_utils.py +55 -6
  174. mirascope/llm/providers/base/base_provider.py +116 -37
  175. mirascope/llm/providers/google/_utils/__init__.py +2 -0
  176. mirascope/llm/providers/google/_utils/decode.py +20 -7
  177. mirascope/llm/providers/google/_utils/encode.py +26 -7
  178. mirascope/llm/providers/google/_utils/errors.py +3 -2
  179. mirascope/llm/providers/google/provider.py +64 -18
  180. mirascope/llm/providers/mirascope/_utils.py +13 -17
  181. mirascope/llm/providers/mirascope/provider.py +49 -18
  182. mirascope/llm/providers/mlx/_utils.py +7 -2
  183. mirascope/llm/providers/mlx/encoding/base.py +5 -2
  184. mirascope/llm/providers/mlx/encoding/transformers.py +5 -2
  185. mirascope/llm/providers/mlx/mlx.py +23 -6
  186. mirascope/llm/providers/mlx/provider.py +42 -13
  187. mirascope/llm/providers/openai/_utils/errors.py +2 -2
  188. mirascope/llm/providers/openai/completions/_utils/encode.py +20 -16
  189. mirascope/llm/providers/openai/completions/base_provider.py +40 -11
  190. mirascope/llm/providers/openai/provider.py +40 -10
  191. mirascope/llm/providers/openai/responses/_utils/__init__.py +2 -0
  192. mirascope/llm/providers/openai/responses/_utils/decode.py +19 -6
  193. mirascope/llm/providers/openai/responses/_utils/encode.py +22 -10
  194. mirascope/llm/providers/openai/responses/provider.py +56 -18
  195. mirascope/llm/providers/provider_registry.py +93 -19
  196. mirascope/llm/responses/__init__.py +6 -1
  197. mirascope/llm/responses/_utils.py +102 -12
  198. mirascope/llm/responses/base_response.py +5 -2
  199. mirascope/llm/responses/base_stream_response.py +115 -25
  200. mirascope/llm/responses/response.py +2 -1
  201. mirascope/llm/responses/root_response.py +89 -17
  202. mirascope/llm/responses/stream_response.py +6 -9
  203. mirascope/llm/tools/decorator.py +9 -4
  204. mirascope/llm/tools/tool_schema.py +12 -6
  205. mirascope/llm/tools/toolkit.py +35 -27
  206. mirascope/llm/tools/tools.py +45 -20
  207. mirascope/ops/__init__.py +4 -0
  208. mirascope/ops/_internal/configuration.py +82 -31
  209. mirascope/ops/_internal/exporters/exporters.py +64 -11
  210. mirascope/ops/_internal/instrumentation/llm/common.py +530 -0
  211. mirascope/ops/_internal/instrumentation/llm/cost.py +190 -0
  212. mirascope/ops/_internal/instrumentation/llm/encode.py +1 -1
  213. mirascope/ops/_internal/instrumentation/llm/llm.py +116 -1242
  214. mirascope/ops/_internal/instrumentation/llm/model.py +1798 -0
  215. mirascope/ops/_internal/instrumentation/llm/response.py +521 -0
  216. mirascope/ops/_internal/instrumentation/llm/serialize.py +300 -0
  217. mirascope/ops/_internal/protocols.py +83 -1
  218. mirascope/ops/_internal/traced_calls.py +4 -0
  219. mirascope/ops/_internal/traced_functions.py +118 -8
  220. mirascope/ops/_internal/tracing.py +78 -1
  221. mirascope/ops/_internal/utils.py +52 -4
  222. {mirascope-2.0.0a6.dist-info → mirascope-2.0.1.dist-info}/METADATA +12 -11
  223. mirascope-2.0.1.dist-info/RECORD +423 -0
  224. {mirascope-2.0.0a6.dist-info → mirascope-2.0.1.dist-info}/licenses/LICENSE +1 -1
  225. mirascope-2.0.0a6.dist-info/RECORD +0 -316
  226. {mirascope-2.0.0a6.dist-info → mirascope-2.0.1.dist-info}/WHEEL +0 -0
@@ -0,0 +1,1288 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.jsonable_encoder import jsonable_encoder
10
+ from ..core.pydantic_utilities import parse_obj_as
11
+ from ..core.request_options import RequestOptions
12
+ from ..errors.bad_request_error import BadRequestError
13
+ from ..errors.conflict_error import ConflictError
14
+ from ..errors.forbidden_error import ForbiddenError
15
+ from ..errors.internal_server_error import InternalServerError
16
+ from ..errors.not_found_error import NotFoundError
17
+ from ..errors.service_unavailable_error import ServiceUnavailableError
18
+ from ..errors.too_many_requests_error import TooManyRequestsError
19
+ from ..types.not_found_error_body import NotFoundErrorBody
20
+ from ..types.permission_denied_error import PermissionDeniedError
21
+ from ..types.rate_limit_error import RateLimitError
22
+ from .types.tags_create_response import TagsCreateResponse
23
+ from .types.tags_get_response import TagsGetResponse
24
+ from .types.tags_list_response import TagsListResponse
25
+ from .types.tags_update_response import TagsUpdateResponse
26
+
27
+ # this is used as the default value for optional parameters
28
+ OMIT = typing.cast(typing.Any, ...)
29
+
30
+
31
+ class RawTagsClient:
32
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
33
+ self._client_wrapper = client_wrapper
34
+
35
+ def list(
36
+ self,
37
+ organization_id: str,
38
+ project_id: str,
39
+ *,
40
+ request_options: typing.Optional[RequestOptions] = None,
41
+ ) -> HttpResponse[TagsListResponse]:
42
+ """
43
+ Parameters
44
+ ----------
45
+ organization_id : str
46
+
47
+ project_id : str
48
+
49
+ request_options : typing.Optional[RequestOptions]
50
+ Request-specific configuration.
51
+
52
+ Returns
53
+ -------
54
+ HttpResponse[TagsListResponse]
55
+ Success
56
+ """
57
+ _response = self._client_wrapper.httpx_client.request(
58
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags",
59
+ method="GET",
60
+ request_options=request_options,
61
+ )
62
+ try:
63
+ if 200 <= _response.status_code < 300:
64
+ _data = typing.cast(
65
+ TagsListResponse,
66
+ parse_obj_as(
67
+ type_=TagsListResponse, # type: ignore
68
+ object_=_response.json(),
69
+ ),
70
+ )
71
+ return HttpResponse(response=_response, data=_data)
72
+ if _response.status_code == 400:
73
+ raise BadRequestError(
74
+ headers=dict(_response.headers),
75
+ body=typing.cast(
76
+ typing.Optional[typing.Any],
77
+ parse_obj_as(
78
+ type_=typing.Optional[typing.Any], # type: ignore
79
+ object_=_response.json(),
80
+ ),
81
+ ),
82
+ )
83
+ if _response.status_code == 403:
84
+ raise ForbiddenError(
85
+ headers=dict(_response.headers),
86
+ body=typing.cast(
87
+ PermissionDeniedError,
88
+ parse_obj_as(
89
+ type_=PermissionDeniedError, # type: ignore
90
+ object_=_response.json(),
91
+ ),
92
+ ),
93
+ )
94
+ if _response.status_code == 404:
95
+ raise NotFoundError(
96
+ headers=dict(_response.headers),
97
+ body=typing.cast(
98
+ NotFoundErrorBody,
99
+ parse_obj_as(
100
+ type_=NotFoundErrorBody, # type: ignore
101
+ object_=_response.json(),
102
+ ),
103
+ ),
104
+ )
105
+ if _response.status_code == 429:
106
+ raise TooManyRequestsError(
107
+ headers=dict(_response.headers),
108
+ body=typing.cast(
109
+ RateLimitError,
110
+ parse_obj_as(
111
+ type_=RateLimitError, # type: ignore
112
+ object_=_response.json(),
113
+ ),
114
+ ),
115
+ )
116
+ if _response.status_code == 500:
117
+ raise InternalServerError(
118
+ headers=dict(_response.headers),
119
+ body=typing.cast(
120
+ typing.Optional[typing.Any],
121
+ parse_obj_as(
122
+ type_=typing.Optional[typing.Any], # type: ignore
123
+ object_=_response.json(),
124
+ ),
125
+ ),
126
+ )
127
+ if _response.status_code == 503:
128
+ raise ServiceUnavailableError(
129
+ headers=dict(_response.headers),
130
+ body=typing.cast(
131
+ typing.Optional[typing.Any],
132
+ parse_obj_as(
133
+ type_=typing.Optional[typing.Any], # type: ignore
134
+ object_=_response.json(),
135
+ ),
136
+ ),
137
+ )
138
+ _response_json = _response.json()
139
+ except JSONDecodeError:
140
+ raise ApiError(
141
+ status_code=_response.status_code,
142
+ headers=dict(_response.headers),
143
+ body=_response.text,
144
+ )
145
+ raise ApiError(
146
+ status_code=_response.status_code,
147
+ headers=dict(_response.headers),
148
+ body=_response_json,
149
+ )
150
+
151
+ def create(
152
+ self,
153
+ organization_id: str,
154
+ project_id: str,
155
+ *,
156
+ name: str,
157
+ request_options: typing.Optional[RequestOptions] = None,
158
+ ) -> HttpResponse[TagsCreateResponse]:
159
+ """
160
+ Parameters
161
+ ----------
162
+ organization_id : str
163
+
164
+ project_id : str
165
+
166
+ name : str
167
+ a string at most 100 character(s) long
168
+
169
+ request_options : typing.Optional[RequestOptions]
170
+ Request-specific configuration.
171
+
172
+ Returns
173
+ -------
174
+ HttpResponse[TagsCreateResponse]
175
+ Success
176
+ """
177
+ _response = self._client_wrapper.httpx_client.request(
178
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags",
179
+ method="POST",
180
+ json={
181
+ "name": name,
182
+ },
183
+ headers={
184
+ "content-type": "application/json",
185
+ },
186
+ request_options=request_options,
187
+ omit=OMIT,
188
+ )
189
+ try:
190
+ if 200 <= _response.status_code < 300:
191
+ _data = typing.cast(
192
+ TagsCreateResponse,
193
+ parse_obj_as(
194
+ type_=TagsCreateResponse, # type: ignore
195
+ object_=_response.json(),
196
+ ),
197
+ )
198
+ return HttpResponse(response=_response, data=_data)
199
+ if _response.status_code == 400:
200
+ raise BadRequestError(
201
+ headers=dict(_response.headers),
202
+ body=typing.cast(
203
+ typing.Optional[typing.Any],
204
+ parse_obj_as(
205
+ type_=typing.Optional[typing.Any], # type: ignore
206
+ object_=_response.json(),
207
+ ),
208
+ ),
209
+ )
210
+ if _response.status_code == 403:
211
+ raise ForbiddenError(
212
+ headers=dict(_response.headers),
213
+ body=typing.cast(
214
+ PermissionDeniedError,
215
+ parse_obj_as(
216
+ type_=PermissionDeniedError, # type: ignore
217
+ object_=_response.json(),
218
+ ),
219
+ ),
220
+ )
221
+ if _response.status_code == 404:
222
+ raise NotFoundError(
223
+ headers=dict(_response.headers),
224
+ body=typing.cast(
225
+ NotFoundErrorBody,
226
+ parse_obj_as(
227
+ type_=NotFoundErrorBody, # type: ignore
228
+ object_=_response.json(),
229
+ ),
230
+ ),
231
+ )
232
+ if _response.status_code == 409:
233
+ raise ConflictError(
234
+ headers=dict(_response.headers),
235
+ body=typing.cast(
236
+ typing.Optional[typing.Any],
237
+ parse_obj_as(
238
+ type_=typing.Optional[typing.Any], # type: ignore
239
+ object_=_response.json(),
240
+ ),
241
+ ),
242
+ )
243
+ if _response.status_code == 429:
244
+ raise TooManyRequestsError(
245
+ headers=dict(_response.headers),
246
+ body=typing.cast(
247
+ RateLimitError,
248
+ parse_obj_as(
249
+ type_=RateLimitError, # type: ignore
250
+ object_=_response.json(),
251
+ ),
252
+ ),
253
+ )
254
+ if _response.status_code == 500:
255
+ raise InternalServerError(
256
+ headers=dict(_response.headers),
257
+ body=typing.cast(
258
+ typing.Optional[typing.Any],
259
+ parse_obj_as(
260
+ type_=typing.Optional[typing.Any], # type: ignore
261
+ object_=_response.json(),
262
+ ),
263
+ ),
264
+ )
265
+ if _response.status_code == 503:
266
+ raise ServiceUnavailableError(
267
+ headers=dict(_response.headers),
268
+ body=typing.cast(
269
+ typing.Optional[typing.Any],
270
+ parse_obj_as(
271
+ type_=typing.Optional[typing.Any], # type: ignore
272
+ object_=_response.json(),
273
+ ),
274
+ ),
275
+ )
276
+ _response_json = _response.json()
277
+ except JSONDecodeError:
278
+ raise ApiError(
279
+ status_code=_response.status_code,
280
+ headers=dict(_response.headers),
281
+ body=_response.text,
282
+ )
283
+ raise ApiError(
284
+ status_code=_response.status_code,
285
+ headers=dict(_response.headers),
286
+ body=_response_json,
287
+ )
288
+
289
+ def get(
290
+ self,
291
+ organization_id: str,
292
+ project_id: str,
293
+ tag_id: str,
294
+ *,
295
+ request_options: typing.Optional[RequestOptions] = None,
296
+ ) -> HttpResponse[TagsGetResponse]:
297
+ """
298
+ Parameters
299
+ ----------
300
+ organization_id : str
301
+
302
+ project_id : str
303
+
304
+ tag_id : str
305
+
306
+ request_options : typing.Optional[RequestOptions]
307
+ Request-specific configuration.
308
+
309
+ Returns
310
+ -------
311
+ HttpResponse[TagsGetResponse]
312
+ Success
313
+ """
314
+ _response = self._client_wrapper.httpx_client.request(
315
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags/{jsonable_encoder(tag_id)}",
316
+ method="GET",
317
+ request_options=request_options,
318
+ )
319
+ try:
320
+ if 200 <= _response.status_code < 300:
321
+ _data = typing.cast(
322
+ TagsGetResponse,
323
+ parse_obj_as(
324
+ type_=TagsGetResponse, # type: ignore
325
+ object_=_response.json(),
326
+ ),
327
+ )
328
+ return HttpResponse(response=_response, data=_data)
329
+ if _response.status_code == 400:
330
+ raise BadRequestError(
331
+ headers=dict(_response.headers),
332
+ body=typing.cast(
333
+ typing.Optional[typing.Any],
334
+ parse_obj_as(
335
+ type_=typing.Optional[typing.Any], # type: ignore
336
+ object_=_response.json(),
337
+ ),
338
+ ),
339
+ )
340
+ if _response.status_code == 403:
341
+ raise ForbiddenError(
342
+ headers=dict(_response.headers),
343
+ body=typing.cast(
344
+ PermissionDeniedError,
345
+ parse_obj_as(
346
+ type_=PermissionDeniedError, # type: ignore
347
+ object_=_response.json(),
348
+ ),
349
+ ),
350
+ )
351
+ if _response.status_code == 404:
352
+ raise NotFoundError(
353
+ headers=dict(_response.headers),
354
+ body=typing.cast(
355
+ NotFoundErrorBody,
356
+ parse_obj_as(
357
+ type_=NotFoundErrorBody, # type: ignore
358
+ object_=_response.json(),
359
+ ),
360
+ ),
361
+ )
362
+ if _response.status_code == 429:
363
+ raise TooManyRequestsError(
364
+ headers=dict(_response.headers),
365
+ body=typing.cast(
366
+ RateLimitError,
367
+ parse_obj_as(
368
+ type_=RateLimitError, # type: ignore
369
+ object_=_response.json(),
370
+ ),
371
+ ),
372
+ )
373
+ if _response.status_code == 500:
374
+ raise InternalServerError(
375
+ headers=dict(_response.headers),
376
+ body=typing.cast(
377
+ typing.Optional[typing.Any],
378
+ parse_obj_as(
379
+ type_=typing.Optional[typing.Any], # type: ignore
380
+ object_=_response.json(),
381
+ ),
382
+ ),
383
+ )
384
+ if _response.status_code == 503:
385
+ raise ServiceUnavailableError(
386
+ headers=dict(_response.headers),
387
+ body=typing.cast(
388
+ typing.Optional[typing.Any],
389
+ parse_obj_as(
390
+ type_=typing.Optional[typing.Any], # type: ignore
391
+ object_=_response.json(),
392
+ ),
393
+ ),
394
+ )
395
+ _response_json = _response.json()
396
+ except JSONDecodeError:
397
+ raise ApiError(
398
+ status_code=_response.status_code,
399
+ headers=dict(_response.headers),
400
+ body=_response.text,
401
+ )
402
+ raise ApiError(
403
+ status_code=_response.status_code,
404
+ headers=dict(_response.headers),
405
+ body=_response_json,
406
+ )
407
+
408
+ def update(
409
+ self,
410
+ organization_id: str,
411
+ project_id: str,
412
+ tag_id: str,
413
+ *,
414
+ name: typing.Optional[str] = OMIT,
415
+ request_options: typing.Optional[RequestOptions] = None,
416
+ ) -> HttpResponse[TagsUpdateResponse]:
417
+ """
418
+ Parameters
419
+ ----------
420
+ organization_id : str
421
+
422
+ project_id : str
423
+
424
+ tag_id : str
425
+
426
+ name : typing.Optional[str]
427
+ a string at most 100 character(s) long
428
+
429
+ request_options : typing.Optional[RequestOptions]
430
+ Request-specific configuration.
431
+
432
+ Returns
433
+ -------
434
+ HttpResponse[TagsUpdateResponse]
435
+ Success
436
+ """
437
+ _response = self._client_wrapper.httpx_client.request(
438
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags/{jsonable_encoder(tag_id)}",
439
+ method="PUT",
440
+ json={
441
+ "name": name,
442
+ },
443
+ headers={
444
+ "content-type": "application/json",
445
+ },
446
+ request_options=request_options,
447
+ omit=OMIT,
448
+ )
449
+ try:
450
+ if 200 <= _response.status_code < 300:
451
+ _data = typing.cast(
452
+ TagsUpdateResponse,
453
+ parse_obj_as(
454
+ type_=TagsUpdateResponse, # type: ignore
455
+ object_=_response.json(),
456
+ ),
457
+ )
458
+ return HttpResponse(response=_response, data=_data)
459
+ if _response.status_code == 400:
460
+ raise BadRequestError(
461
+ headers=dict(_response.headers),
462
+ body=typing.cast(
463
+ typing.Optional[typing.Any],
464
+ parse_obj_as(
465
+ type_=typing.Optional[typing.Any], # type: ignore
466
+ object_=_response.json(),
467
+ ),
468
+ ),
469
+ )
470
+ if _response.status_code == 403:
471
+ raise ForbiddenError(
472
+ headers=dict(_response.headers),
473
+ body=typing.cast(
474
+ PermissionDeniedError,
475
+ parse_obj_as(
476
+ type_=PermissionDeniedError, # type: ignore
477
+ object_=_response.json(),
478
+ ),
479
+ ),
480
+ )
481
+ if _response.status_code == 404:
482
+ raise NotFoundError(
483
+ headers=dict(_response.headers),
484
+ body=typing.cast(
485
+ NotFoundErrorBody,
486
+ parse_obj_as(
487
+ type_=NotFoundErrorBody, # type: ignore
488
+ object_=_response.json(),
489
+ ),
490
+ ),
491
+ )
492
+ if _response.status_code == 409:
493
+ raise ConflictError(
494
+ headers=dict(_response.headers),
495
+ body=typing.cast(
496
+ typing.Optional[typing.Any],
497
+ parse_obj_as(
498
+ type_=typing.Optional[typing.Any], # type: ignore
499
+ object_=_response.json(),
500
+ ),
501
+ ),
502
+ )
503
+ if _response.status_code == 429:
504
+ raise TooManyRequestsError(
505
+ headers=dict(_response.headers),
506
+ body=typing.cast(
507
+ RateLimitError,
508
+ parse_obj_as(
509
+ type_=RateLimitError, # type: ignore
510
+ object_=_response.json(),
511
+ ),
512
+ ),
513
+ )
514
+ if _response.status_code == 500:
515
+ raise InternalServerError(
516
+ headers=dict(_response.headers),
517
+ body=typing.cast(
518
+ typing.Optional[typing.Any],
519
+ parse_obj_as(
520
+ type_=typing.Optional[typing.Any], # type: ignore
521
+ object_=_response.json(),
522
+ ),
523
+ ),
524
+ )
525
+ if _response.status_code == 503:
526
+ raise ServiceUnavailableError(
527
+ headers=dict(_response.headers),
528
+ body=typing.cast(
529
+ typing.Optional[typing.Any],
530
+ parse_obj_as(
531
+ type_=typing.Optional[typing.Any], # type: ignore
532
+ object_=_response.json(),
533
+ ),
534
+ ),
535
+ )
536
+ _response_json = _response.json()
537
+ except JSONDecodeError:
538
+ raise ApiError(
539
+ status_code=_response.status_code,
540
+ headers=dict(_response.headers),
541
+ body=_response.text,
542
+ )
543
+ raise ApiError(
544
+ status_code=_response.status_code,
545
+ headers=dict(_response.headers),
546
+ body=_response_json,
547
+ )
548
+
549
+ def delete(
550
+ self,
551
+ organization_id: str,
552
+ project_id: str,
553
+ tag_id: str,
554
+ *,
555
+ request_options: typing.Optional[RequestOptions] = None,
556
+ ) -> HttpResponse[None]:
557
+ """
558
+ Parameters
559
+ ----------
560
+ organization_id : str
561
+
562
+ project_id : str
563
+
564
+ tag_id : str
565
+
566
+ request_options : typing.Optional[RequestOptions]
567
+ Request-specific configuration.
568
+
569
+ Returns
570
+ -------
571
+ HttpResponse[None]
572
+ """
573
+ _response = self._client_wrapper.httpx_client.request(
574
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags/{jsonable_encoder(tag_id)}",
575
+ method="DELETE",
576
+ request_options=request_options,
577
+ )
578
+ try:
579
+ if 200 <= _response.status_code < 300:
580
+ return HttpResponse(response=_response, data=None)
581
+ if _response.status_code == 400:
582
+ raise BadRequestError(
583
+ headers=dict(_response.headers),
584
+ body=typing.cast(
585
+ typing.Optional[typing.Any],
586
+ parse_obj_as(
587
+ type_=typing.Optional[typing.Any], # type: ignore
588
+ object_=_response.json(),
589
+ ),
590
+ ),
591
+ )
592
+ if _response.status_code == 403:
593
+ raise ForbiddenError(
594
+ headers=dict(_response.headers),
595
+ body=typing.cast(
596
+ PermissionDeniedError,
597
+ parse_obj_as(
598
+ type_=PermissionDeniedError, # type: ignore
599
+ object_=_response.json(),
600
+ ),
601
+ ),
602
+ )
603
+ if _response.status_code == 404:
604
+ raise NotFoundError(
605
+ headers=dict(_response.headers),
606
+ body=typing.cast(
607
+ NotFoundErrorBody,
608
+ parse_obj_as(
609
+ type_=NotFoundErrorBody, # type: ignore
610
+ object_=_response.json(),
611
+ ),
612
+ ),
613
+ )
614
+ if _response.status_code == 429:
615
+ raise TooManyRequestsError(
616
+ headers=dict(_response.headers),
617
+ body=typing.cast(
618
+ RateLimitError,
619
+ parse_obj_as(
620
+ type_=RateLimitError, # type: ignore
621
+ object_=_response.json(),
622
+ ),
623
+ ),
624
+ )
625
+ if _response.status_code == 500:
626
+ raise InternalServerError(
627
+ headers=dict(_response.headers),
628
+ body=typing.cast(
629
+ typing.Optional[typing.Any],
630
+ parse_obj_as(
631
+ type_=typing.Optional[typing.Any], # type: ignore
632
+ object_=_response.json(),
633
+ ),
634
+ ),
635
+ )
636
+ if _response.status_code == 503:
637
+ raise ServiceUnavailableError(
638
+ headers=dict(_response.headers),
639
+ body=typing.cast(
640
+ typing.Optional[typing.Any],
641
+ parse_obj_as(
642
+ type_=typing.Optional[typing.Any], # type: ignore
643
+ object_=_response.json(),
644
+ ),
645
+ ),
646
+ )
647
+ _response_json = _response.json()
648
+ except JSONDecodeError:
649
+ raise ApiError(
650
+ status_code=_response.status_code,
651
+ headers=dict(_response.headers),
652
+ body=_response.text,
653
+ )
654
+ raise ApiError(
655
+ status_code=_response.status_code,
656
+ headers=dict(_response.headers),
657
+ body=_response_json,
658
+ )
659
+
660
+
661
+ class AsyncRawTagsClient:
662
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
663
+ self._client_wrapper = client_wrapper
664
+
665
+ async def list(
666
+ self,
667
+ organization_id: str,
668
+ project_id: str,
669
+ *,
670
+ request_options: typing.Optional[RequestOptions] = None,
671
+ ) -> AsyncHttpResponse[TagsListResponse]:
672
+ """
673
+ Parameters
674
+ ----------
675
+ organization_id : str
676
+
677
+ project_id : str
678
+
679
+ request_options : typing.Optional[RequestOptions]
680
+ Request-specific configuration.
681
+
682
+ Returns
683
+ -------
684
+ AsyncHttpResponse[TagsListResponse]
685
+ Success
686
+ """
687
+ _response = await self._client_wrapper.httpx_client.request(
688
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags",
689
+ method="GET",
690
+ request_options=request_options,
691
+ )
692
+ try:
693
+ if 200 <= _response.status_code < 300:
694
+ _data = typing.cast(
695
+ TagsListResponse,
696
+ parse_obj_as(
697
+ type_=TagsListResponse, # type: ignore
698
+ object_=_response.json(),
699
+ ),
700
+ )
701
+ return AsyncHttpResponse(response=_response, data=_data)
702
+ if _response.status_code == 400:
703
+ raise BadRequestError(
704
+ headers=dict(_response.headers),
705
+ body=typing.cast(
706
+ typing.Optional[typing.Any],
707
+ parse_obj_as(
708
+ type_=typing.Optional[typing.Any], # type: ignore
709
+ object_=_response.json(),
710
+ ),
711
+ ),
712
+ )
713
+ if _response.status_code == 403:
714
+ raise ForbiddenError(
715
+ headers=dict(_response.headers),
716
+ body=typing.cast(
717
+ PermissionDeniedError,
718
+ parse_obj_as(
719
+ type_=PermissionDeniedError, # type: ignore
720
+ object_=_response.json(),
721
+ ),
722
+ ),
723
+ )
724
+ if _response.status_code == 404:
725
+ raise NotFoundError(
726
+ headers=dict(_response.headers),
727
+ body=typing.cast(
728
+ NotFoundErrorBody,
729
+ parse_obj_as(
730
+ type_=NotFoundErrorBody, # type: ignore
731
+ object_=_response.json(),
732
+ ),
733
+ ),
734
+ )
735
+ if _response.status_code == 429:
736
+ raise TooManyRequestsError(
737
+ headers=dict(_response.headers),
738
+ body=typing.cast(
739
+ RateLimitError,
740
+ parse_obj_as(
741
+ type_=RateLimitError, # type: ignore
742
+ object_=_response.json(),
743
+ ),
744
+ ),
745
+ )
746
+ if _response.status_code == 500:
747
+ raise InternalServerError(
748
+ headers=dict(_response.headers),
749
+ body=typing.cast(
750
+ typing.Optional[typing.Any],
751
+ parse_obj_as(
752
+ type_=typing.Optional[typing.Any], # type: ignore
753
+ object_=_response.json(),
754
+ ),
755
+ ),
756
+ )
757
+ if _response.status_code == 503:
758
+ raise ServiceUnavailableError(
759
+ headers=dict(_response.headers),
760
+ body=typing.cast(
761
+ typing.Optional[typing.Any],
762
+ parse_obj_as(
763
+ type_=typing.Optional[typing.Any], # type: ignore
764
+ object_=_response.json(),
765
+ ),
766
+ ),
767
+ )
768
+ _response_json = _response.json()
769
+ except JSONDecodeError:
770
+ raise ApiError(
771
+ status_code=_response.status_code,
772
+ headers=dict(_response.headers),
773
+ body=_response.text,
774
+ )
775
+ raise ApiError(
776
+ status_code=_response.status_code,
777
+ headers=dict(_response.headers),
778
+ body=_response_json,
779
+ )
780
+
781
+ async def create(
782
+ self,
783
+ organization_id: str,
784
+ project_id: str,
785
+ *,
786
+ name: str,
787
+ request_options: typing.Optional[RequestOptions] = None,
788
+ ) -> AsyncHttpResponse[TagsCreateResponse]:
789
+ """
790
+ Parameters
791
+ ----------
792
+ organization_id : str
793
+
794
+ project_id : str
795
+
796
+ name : str
797
+ a string at most 100 character(s) long
798
+
799
+ request_options : typing.Optional[RequestOptions]
800
+ Request-specific configuration.
801
+
802
+ Returns
803
+ -------
804
+ AsyncHttpResponse[TagsCreateResponse]
805
+ Success
806
+ """
807
+ _response = await self._client_wrapper.httpx_client.request(
808
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags",
809
+ method="POST",
810
+ json={
811
+ "name": name,
812
+ },
813
+ headers={
814
+ "content-type": "application/json",
815
+ },
816
+ request_options=request_options,
817
+ omit=OMIT,
818
+ )
819
+ try:
820
+ if 200 <= _response.status_code < 300:
821
+ _data = typing.cast(
822
+ TagsCreateResponse,
823
+ parse_obj_as(
824
+ type_=TagsCreateResponse, # type: ignore
825
+ object_=_response.json(),
826
+ ),
827
+ )
828
+ return AsyncHttpResponse(response=_response, data=_data)
829
+ if _response.status_code == 400:
830
+ raise BadRequestError(
831
+ headers=dict(_response.headers),
832
+ body=typing.cast(
833
+ typing.Optional[typing.Any],
834
+ parse_obj_as(
835
+ type_=typing.Optional[typing.Any], # type: ignore
836
+ object_=_response.json(),
837
+ ),
838
+ ),
839
+ )
840
+ if _response.status_code == 403:
841
+ raise ForbiddenError(
842
+ headers=dict(_response.headers),
843
+ body=typing.cast(
844
+ PermissionDeniedError,
845
+ parse_obj_as(
846
+ type_=PermissionDeniedError, # type: ignore
847
+ object_=_response.json(),
848
+ ),
849
+ ),
850
+ )
851
+ if _response.status_code == 404:
852
+ raise NotFoundError(
853
+ headers=dict(_response.headers),
854
+ body=typing.cast(
855
+ NotFoundErrorBody,
856
+ parse_obj_as(
857
+ type_=NotFoundErrorBody, # type: ignore
858
+ object_=_response.json(),
859
+ ),
860
+ ),
861
+ )
862
+ if _response.status_code == 409:
863
+ raise ConflictError(
864
+ headers=dict(_response.headers),
865
+ body=typing.cast(
866
+ typing.Optional[typing.Any],
867
+ parse_obj_as(
868
+ type_=typing.Optional[typing.Any], # type: ignore
869
+ object_=_response.json(),
870
+ ),
871
+ ),
872
+ )
873
+ if _response.status_code == 429:
874
+ raise TooManyRequestsError(
875
+ headers=dict(_response.headers),
876
+ body=typing.cast(
877
+ RateLimitError,
878
+ parse_obj_as(
879
+ type_=RateLimitError, # type: ignore
880
+ object_=_response.json(),
881
+ ),
882
+ ),
883
+ )
884
+ if _response.status_code == 500:
885
+ raise InternalServerError(
886
+ headers=dict(_response.headers),
887
+ body=typing.cast(
888
+ typing.Optional[typing.Any],
889
+ parse_obj_as(
890
+ type_=typing.Optional[typing.Any], # type: ignore
891
+ object_=_response.json(),
892
+ ),
893
+ ),
894
+ )
895
+ if _response.status_code == 503:
896
+ raise ServiceUnavailableError(
897
+ headers=dict(_response.headers),
898
+ body=typing.cast(
899
+ typing.Optional[typing.Any],
900
+ parse_obj_as(
901
+ type_=typing.Optional[typing.Any], # type: ignore
902
+ object_=_response.json(),
903
+ ),
904
+ ),
905
+ )
906
+ _response_json = _response.json()
907
+ except JSONDecodeError:
908
+ raise ApiError(
909
+ status_code=_response.status_code,
910
+ headers=dict(_response.headers),
911
+ body=_response.text,
912
+ )
913
+ raise ApiError(
914
+ status_code=_response.status_code,
915
+ headers=dict(_response.headers),
916
+ body=_response_json,
917
+ )
918
+
919
+ async def get(
920
+ self,
921
+ organization_id: str,
922
+ project_id: str,
923
+ tag_id: str,
924
+ *,
925
+ request_options: typing.Optional[RequestOptions] = None,
926
+ ) -> AsyncHttpResponse[TagsGetResponse]:
927
+ """
928
+ Parameters
929
+ ----------
930
+ organization_id : str
931
+
932
+ project_id : str
933
+
934
+ tag_id : str
935
+
936
+ request_options : typing.Optional[RequestOptions]
937
+ Request-specific configuration.
938
+
939
+ Returns
940
+ -------
941
+ AsyncHttpResponse[TagsGetResponse]
942
+ Success
943
+ """
944
+ _response = await self._client_wrapper.httpx_client.request(
945
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags/{jsonable_encoder(tag_id)}",
946
+ method="GET",
947
+ request_options=request_options,
948
+ )
949
+ try:
950
+ if 200 <= _response.status_code < 300:
951
+ _data = typing.cast(
952
+ TagsGetResponse,
953
+ parse_obj_as(
954
+ type_=TagsGetResponse, # type: ignore
955
+ object_=_response.json(),
956
+ ),
957
+ )
958
+ return AsyncHttpResponse(response=_response, data=_data)
959
+ if _response.status_code == 400:
960
+ raise BadRequestError(
961
+ headers=dict(_response.headers),
962
+ body=typing.cast(
963
+ typing.Optional[typing.Any],
964
+ parse_obj_as(
965
+ type_=typing.Optional[typing.Any], # type: ignore
966
+ object_=_response.json(),
967
+ ),
968
+ ),
969
+ )
970
+ if _response.status_code == 403:
971
+ raise ForbiddenError(
972
+ headers=dict(_response.headers),
973
+ body=typing.cast(
974
+ PermissionDeniedError,
975
+ parse_obj_as(
976
+ type_=PermissionDeniedError, # type: ignore
977
+ object_=_response.json(),
978
+ ),
979
+ ),
980
+ )
981
+ if _response.status_code == 404:
982
+ raise NotFoundError(
983
+ headers=dict(_response.headers),
984
+ body=typing.cast(
985
+ NotFoundErrorBody,
986
+ parse_obj_as(
987
+ type_=NotFoundErrorBody, # type: ignore
988
+ object_=_response.json(),
989
+ ),
990
+ ),
991
+ )
992
+ if _response.status_code == 429:
993
+ raise TooManyRequestsError(
994
+ headers=dict(_response.headers),
995
+ body=typing.cast(
996
+ RateLimitError,
997
+ parse_obj_as(
998
+ type_=RateLimitError, # type: ignore
999
+ object_=_response.json(),
1000
+ ),
1001
+ ),
1002
+ )
1003
+ if _response.status_code == 500:
1004
+ raise InternalServerError(
1005
+ headers=dict(_response.headers),
1006
+ body=typing.cast(
1007
+ typing.Optional[typing.Any],
1008
+ parse_obj_as(
1009
+ type_=typing.Optional[typing.Any], # type: ignore
1010
+ object_=_response.json(),
1011
+ ),
1012
+ ),
1013
+ )
1014
+ if _response.status_code == 503:
1015
+ raise ServiceUnavailableError(
1016
+ headers=dict(_response.headers),
1017
+ body=typing.cast(
1018
+ typing.Optional[typing.Any],
1019
+ parse_obj_as(
1020
+ type_=typing.Optional[typing.Any], # type: ignore
1021
+ object_=_response.json(),
1022
+ ),
1023
+ ),
1024
+ )
1025
+ _response_json = _response.json()
1026
+ except JSONDecodeError:
1027
+ raise ApiError(
1028
+ status_code=_response.status_code,
1029
+ headers=dict(_response.headers),
1030
+ body=_response.text,
1031
+ )
1032
+ raise ApiError(
1033
+ status_code=_response.status_code,
1034
+ headers=dict(_response.headers),
1035
+ body=_response_json,
1036
+ )
1037
+
1038
+ async def update(
1039
+ self,
1040
+ organization_id: str,
1041
+ project_id: str,
1042
+ tag_id: str,
1043
+ *,
1044
+ name: typing.Optional[str] = OMIT,
1045
+ request_options: typing.Optional[RequestOptions] = None,
1046
+ ) -> AsyncHttpResponse[TagsUpdateResponse]:
1047
+ """
1048
+ Parameters
1049
+ ----------
1050
+ organization_id : str
1051
+
1052
+ project_id : str
1053
+
1054
+ tag_id : str
1055
+
1056
+ name : typing.Optional[str]
1057
+ a string at most 100 character(s) long
1058
+
1059
+ request_options : typing.Optional[RequestOptions]
1060
+ Request-specific configuration.
1061
+
1062
+ Returns
1063
+ -------
1064
+ AsyncHttpResponse[TagsUpdateResponse]
1065
+ Success
1066
+ """
1067
+ _response = await self._client_wrapper.httpx_client.request(
1068
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags/{jsonable_encoder(tag_id)}",
1069
+ method="PUT",
1070
+ json={
1071
+ "name": name,
1072
+ },
1073
+ headers={
1074
+ "content-type": "application/json",
1075
+ },
1076
+ request_options=request_options,
1077
+ omit=OMIT,
1078
+ )
1079
+ try:
1080
+ if 200 <= _response.status_code < 300:
1081
+ _data = typing.cast(
1082
+ TagsUpdateResponse,
1083
+ parse_obj_as(
1084
+ type_=TagsUpdateResponse, # type: ignore
1085
+ object_=_response.json(),
1086
+ ),
1087
+ )
1088
+ return AsyncHttpResponse(response=_response, data=_data)
1089
+ if _response.status_code == 400:
1090
+ raise BadRequestError(
1091
+ headers=dict(_response.headers),
1092
+ body=typing.cast(
1093
+ typing.Optional[typing.Any],
1094
+ parse_obj_as(
1095
+ type_=typing.Optional[typing.Any], # type: ignore
1096
+ object_=_response.json(),
1097
+ ),
1098
+ ),
1099
+ )
1100
+ if _response.status_code == 403:
1101
+ raise ForbiddenError(
1102
+ headers=dict(_response.headers),
1103
+ body=typing.cast(
1104
+ PermissionDeniedError,
1105
+ parse_obj_as(
1106
+ type_=PermissionDeniedError, # type: ignore
1107
+ object_=_response.json(),
1108
+ ),
1109
+ ),
1110
+ )
1111
+ if _response.status_code == 404:
1112
+ raise NotFoundError(
1113
+ headers=dict(_response.headers),
1114
+ body=typing.cast(
1115
+ NotFoundErrorBody,
1116
+ parse_obj_as(
1117
+ type_=NotFoundErrorBody, # type: ignore
1118
+ object_=_response.json(),
1119
+ ),
1120
+ ),
1121
+ )
1122
+ if _response.status_code == 409:
1123
+ raise ConflictError(
1124
+ headers=dict(_response.headers),
1125
+ body=typing.cast(
1126
+ typing.Optional[typing.Any],
1127
+ parse_obj_as(
1128
+ type_=typing.Optional[typing.Any], # type: ignore
1129
+ object_=_response.json(),
1130
+ ),
1131
+ ),
1132
+ )
1133
+ if _response.status_code == 429:
1134
+ raise TooManyRequestsError(
1135
+ headers=dict(_response.headers),
1136
+ body=typing.cast(
1137
+ RateLimitError,
1138
+ parse_obj_as(
1139
+ type_=RateLimitError, # type: ignore
1140
+ object_=_response.json(),
1141
+ ),
1142
+ ),
1143
+ )
1144
+ if _response.status_code == 500:
1145
+ raise InternalServerError(
1146
+ headers=dict(_response.headers),
1147
+ body=typing.cast(
1148
+ typing.Optional[typing.Any],
1149
+ parse_obj_as(
1150
+ type_=typing.Optional[typing.Any], # type: ignore
1151
+ object_=_response.json(),
1152
+ ),
1153
+ ),
1154
+ )
1155
+ if _response.status_code == 503:
1156
+ raise ServiceUnavailableError(
1157
+ headers=dict(_response.headers),
1158
+ body=typing.cast(
1159
+ typing.Optional[typing.Any],
1160
+ parse_obj_as(
1161
+ type_=typing.Optional[typing.Any], # type: ignore
1162
+ object_=_response.json(),
1163
+ ),
1164
+ ),
1165
+ )
1166
+ _response_json = _response.json()
1167
+ except JSONDecodeError:
1168
+ raise ApiError(
1169
+ status_code=_response.status_code,
1170
+ headers=dict(_response.headers),
1171
+ body=_response.text,
1172
+ )
1173
+ raise ApiError(
1174
+ status_code=_response.status_code,
1175
+ headers=dict(_response.headers),
1176
+ body=_response_json,
1177
+ )
1178
+
1179
+ async def delete(
1180
+ self,
1181
+ organization_id: str,
1182
+ project_id: str,
1183
+ tag_id: str,
1184
+ *,
1185
+ request_options: typing.Optional[RequestOptions] = None,
1186
+ ) -> AsyncHttpResponse[None]:
1187
+ """
1188
+ Parameters
1189
+ ----------
1190
+ organization_id : str
1191
+
1192
+ project_id : str
1193
+
1194
+ tag_id : str
1195
+
1196
+ request_options : typing.Optional[RequestOptions]
1197
+ Request-specific configuration.
1198
+
1199
+ Returns
1200
+ -------
1201
+ AsyncHttpResponse[None]
1202
+ """
1203
+ _response = await self._client_wrapper.httpx_client.request(
1204
+ f"organizations/{jsonable_encoder(organization_id)}/projects/{jsonable_encoder(project_id)}/tags/{jsonable_encoder(tag_id)}",
1205
+ method="DELETE",
1206
+ request_options=request_options,
1207
+ )
1208
+ try:
1209
+ if 200 <= _response.status_code < 300:
1210
+ return AsyncHttpResponse(response=_response, data=None)
1211
+ if _response.status_code == 400:
1212
+ raise BadRequestError(
1213
+ headers=dict(_response.headers),
1214
+ body=typing.cast(
1215
+ typing.Optional[typing.Any],
1216
+ parse_obj_as(
1217
+ type_=typing.Optional[typing.Any], # type: ignore
1218
+ object_=_response.json(),
1219
+ ),
1220
+ ),
1221
+ )
1222
+ if _response.status_code == 403:
1223
+ raise ForbiddenError(
1224
+ headers=dict(_response.headers),
1225
+ body=typing.cast(
1226
+ PermissionDeniedError,
1227
+ parse_obj_as(
1228
+ type_=PermissionDeniedError, # type: ignore
1229
+ object_=_response.json(),
1230
+ ),
1231
+ ),
1232
+ )
1233
+ if _response.status_code == 404:
1234
+ raise NotFoundError(
1235
+ headers=dict(_response.headers),
1236
+ body=typing.cast(
1237
+ NotFoundErrorBody,
1238
+ parse_obj_as(
1239
+ type_=NotFoundErrorBody, # type: ignore
1240
+ object_=_response.json(),
1241
+ ),
1242
+ ),
1243
+ )
1244
+ if _response.status_code == 429:
1245
+ raise TooManyRequestsError(
1246
+ headers=dict(_response.headers),
1247
+ body=typing.cast(
1248
+ RateLimitError,
1249
+ parse_obj_as(
1250
+ type_=RateLimitError, # type: ignore
1251
+ object_=_response.json(),
1252
+ ),
1253
+ ),
1254
+ )
1255
+ if _response.status_code == 500:
1256
+ raise InternalServerError(
1257
+ headers=dict(_response.headers),
1258
+ body=typing.cast(
1259
+ typing.Optional[typing.Any],
1260
+ parse_obj_as(
1261
+ type_=typing.Optional[typing.Any], # type: ignore
1262
+ object_=_response.json(),
1263
+ ),
1264
+ ),
1265
+ )
1266
+ if _response.status_code == 503:
1267
+ raise ServiceUnavailableError(
1268
+ headers=dict(_response.headers),
1269
+ body=typing.cast(
1270
+ typing.Optional[typing.Any],
1271
+ parse_obj_as(
1272
+ type_=typing.Optional[typing.Any], # type: ignore
1273
+ object_=_response.json(),
1274
+ ),
1275
+ ),
1276
+ )
1277
+ _response_json = _response.json()
1278
+ except JSONDecodeError:
1279
+ raise ApiError(
1280
+ status_code=_response.status_code,
1281
+ headers=dict(_response.headers),
1282
+ body=_response.text,
1283
+ )
1284
+ raise ApiError(
1285
+ status_code=_response.status_code,
1286
+ headers=dict(_response.headers),
1287
+ body=_response_json,
1288
+ )