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.
- mirascope/api/_generated/__init__.py +186 -5
- mirascope/api/_generated/annotations/client.py +38 -6
- mirascope/api/_generated/annotations/raw_client.py +366 -47
- mirascope/api/_generated/annotations/types/annotations_create_response.py +19 -6
- mirascope/api/_generated/annotations/types/annotations_get_response.py +19 -6
- mirascope/api/_generated/annotations/types/annotations_list_response_annotations_item.py +22 -7
- mirascope/api/_generated/annotations/types/annotations_update_response.py +19 -6
- mirascope/api/_generated/api_keys/__init__.py +12 -2
- mirascope/api/_generated/api_keys/client.py +107 -6
- mirascope/api/_generated/api_keys/raw_client.py +486 -38
- mirascope/api/_generated/api_keys/types/__init__.py +7 -1
- mirascope/api/_generated/api_keys/types/api_keys_list_all_for_org_response_item.py +40 -0
- mirascope/api/_generated/client.py +36 -0
- mirascope/api/_generated/docs/raw_client.py +71 -9
- mirascope/api/_generated/environment.py +3 -3
- mirascope/api/_generated/environments/__init__.py +6 -0
- mirascope/api/_generated/environments/client.py +158 -9
- mirascope/api/_generated/environments/raw_client.py +620 -52
- mirascope/api/_generated/environments/types/__init__.py +10 -0
- mirascope/api/_generated/environments/types/environments_get_analytics_response.py +60 -0
- mirascope/api/_generated/environments/types/environments_get_analytics_response_top_functions_item.py +24 -0
- mirascope/api/_generated/{organizations/types/organizations_credits_response.py → environments/types/environments_get_analytics_response_top_models_item.py} +6 -3
- mirascope/api/_generated/errors/__init__.py +6 -0
- mirascope/api/_generated/errors/bad_request_error.py +5 -2
- mirascope/api/_generated/errors/conflict_error.py +5 -2
- mirascope/api/_generated/errors/payment_required_error.py +15 -0
- mirascope/api/_generated/errors/service_unavailable_error.py +14 -0
- mirascope/api/_generated/errors/too_many_requests_error.py +15 -0
- mirascope/api/_generated/functions/__init__.py +10 -0
- mirascope/api/_generated/functions/client.py +222 -8
- mirascope/api/_generated/functions/raw_client.py +975 -134
- mirascope/api/_generated/functions/types/__init__.py +28 -4
- mirascope/api/_generated/functions/types/functions_get_by_env_response.py +53 -0
- mirascope/api/_generated/functions/types/functions_get_by_env_response_dependencies_value.py +22 -0
- mirascope/api/_generated/functions/types/functions_list_by_env_response.py +25 -0
- mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item.py +56 -0
- mirascope/api/_generated/functions/types/functions_list_by_env_response_functions_item_dependencies_value.py +22 -0
- mirascope/api/_generated/health/raw_client.py +74 -10
- mirascope/api/_generated/organization_invitations/__init__.py +33 -0
- mirascope/api/_generated/organization_invitations/client.py +546 -0
- mirascope/api/_generated/organization_invitations/raw_client.py +1519 -0
- mirascope/api/_generated/organization_invitations/types/__init__.py +53 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response.py +34 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_accept_response_role.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_create_request_role.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response.py +48 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_role.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_create_response_status.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response.py +48 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_role.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_get_response_status.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item.py +48 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_role.py +7 -0
- mirascope/api/_generated/organization_invitations/types/organization_invitations_list_response_item_status.py +7 -0
- mirascope/api/_generated/organization_memberships/__init__.py +19 -0
- mirascope/api/_generated/organization_memberships/client.py +302 -0
- mirascope/api/_generated/organization_memberships/raw_client.py +736 -0
- mirascope/api/_generated/organization_memberships/types/__init__.py +27 -0
- mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item.py +33 -0
- mirascope/api/_generated/organization_memberships/types/organization_memberships_list_response_item_role.py +7 -0
- mirascope/api/_generated/organization_memberships/types/organization_memberships_update_request_role.py +7 -0
- mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response.py +31 -0
- mirascope/api/_generated/organization_memberships/types/organization_memberships_update_response_role.py +7 -0
- mirascope/api/_generated/organizations/__init__.py +26 -2
- mirascope/api/_generated/organizations/client.py +442 -20
- mirascope/api/_generated/organizations/raw_client.py +1763 -164
- mirascope/api/_generated/organizations/types/__init__.py +48 -2
- mirascope/api/_generated/organizations/types/organizations_create_payment_intent_response.py +24 -0
- mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_request_target_plan.py +7 -0
- mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response.py +47 -0
- mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item.py +33 -0
- mirascope/api/_generated/organizations/types/organizations_preview_subscription_change_response_validation_errors_item_resource.py +7 -0
- mirascope/api/_generated/organizations/types/organizations_router_balance_response.py +24 -0
- mirascope/api/_generated/organizations/types/organizations_subscription_response.py +53 -0
- mirascope/api/_generated/organizations/types/organizations_subscription_response_current_plan.py +7 -0
- mirascope/api/_generated/organizations/types/organizations_subscription_response_payment_method.py +26 -0
- mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change.py +34 -0
- mirascope/api/_generated/organizations/types/organizations_subscription_response_scheduled_change_target_plan.py +7 -0
- mirascope/api/_generated/organizations/types/organizations_update_subscription_request_target_plan.py +7 -0
- mirascope/api/_generated/organizations/types/organizations_update_subscription_response.py +35 -0
- mirascope/api/_generated/project_memberships/__init__.py +25 -0
- mirascope/api/_generated/project_memberships/client.py +437 -0
- mirascope/api/_generated/project_memberships/raw_client.py +1039 -0
- mirascope/api/_generated/project_memberships/types/__init__.py +29 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_create_request_role.py +7 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_create_response.py +35 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_create_response_role.py +7 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item.py +33 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_list_response_item_role.py +7 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_update_request_role.py +7 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_update_response.py +35 -0
- mirascope/api/_generated/project_memberships/types/project_memberships_update_response_role.py +7 -0
- mirascope/api/_generated/projects/raw_client.py +415 -58
- mirascope/api/_generated/reference.md +2767 -397
- mirascope/api/_generated/tags/__init__.py +19 -0
- mirascope/api/_generated/tags/client.py +504 -0
- mirascope/api/_generated/tags/raw_client.py +1288 -0
- mirascope/api/_generated/tags/types/__init__.py +17 -0
- mirascope/api/_generated/tags/types/tags_create_response.py +41 -0
- mirascope/api/_generated/tags/types/tags_get_response.py +41 -0
- mirascope/api/_generated/tags/types/tags_list_response.py +23 -0
- mirascope/api/_generated/tags/types/tags_list_response_tags_item.py +41 -0
- mirascope/api/_generated/tags/types/tags_update_response.py +41 -0
- mirascope/api/_generated/token_cost/__init__.py +7 -0
- mirascope/api/_generated/token_cost/client.py +160 -0
- mirascope/api/_generated/token_cost/raw_client.py +264 -0
- mirascope/api/_generated/token_cost/types/__init__.py +8 -0
- mirascope/api/_generated/token_cost/types/token_cost_calculate_request_usage.py +54 -0
- mirascope/api/_generated/token_cost/types/token_cost_calculate_response.py +52 -0
- mirascope/api/_generated/traces/__init__.py +20 -0
- mirascope/api/_generated/traces/client.py +543 -0
- mirascope/api/_generated/traces/raw_client.py +1366 -96
- mirascope/api/_generated/traces/types/__init__.py +28 -0
- mirascope/api/_generated/traces/types/traces_get_analytics_summary_response.py +6 -0
- mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response.py +33 -0
- mirascope/api/_generated/traces/types/traces_get_trace_detail_by_env_response_spans_item.py +88 -0
- mirascope/api/_generated/traces/types/traces_get_trace_detail_response_spans_item.py +0 -2
- mirascope/api/_generated/traces/types/traces_list_by_function_hash_response.py +25 -0
- mirascope/api/_generated/traces/types/traces_list_by_function_hash_response_traces_item.py +44 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item.py +26 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_request_attribute_filters_item_operator.py +7 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_by.py +7 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_request_sort_order.py +7 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_response.py +26 -0
- mirascope/api/_generated/traces/types/traces_search_by_env_response_spans_item.py +50 -0
- mirascope/api/_generated/traces/types/traces_search_response_spans_item.py +10 -1
- mirascope/api/_generated/types/__init__.py +32 -2
- mirascope/api/_generated/types/bad_request_error_body.py +50 -0
- mirascope/api/_generated/types/date.py +3 -0
- mirascope/api/_generated/types/immutable_resource_error.py +22 -0
- mirascope/api/_generated/types/internal_server_error_body.py +3 -3
- mirascope/api/_generated/types/plan_limit_exceeded_error.py +32 -0
- mirascope/api/_generated/types/plan_limit_exceeded_error_tag.py +7 -0
- mirascope/api/_generated/types/pricing_unavailable_error.py +23 -0
- mirascope/api/_generated/types/rate_limit_error.py +31 -0
- mirascope/api/_generated/types/rate_limit_error_tag.py +5 -0
- mirascope/api/_generated/types/service_unavailable_error_body.py +24 -0
- mirascope/api/_generated/types/service_unavailable_error_tag.py +7 -0
- mirascope/api/_generated/types/subscription_past_due_error.py +31 -0
- mirascope/api/_generated/types/subscription_past_due_error_tag.py +7 -0
- mirascope/api/settings.py +19 -1
- mirascope/llm/__init__.py +53 -10
- mirascope/llm/calls/__init__.py +2 -1
- mirascope/llm/calls/calls.py +3 -1
- mirascope/llm/calls/decorator.py +21 -7
- mirascope/llm/content/tool_output.py +22 -5
- mirascope/llm/exceptions.py +284 -71
- mirascope/llm/formatting/__init__.py +17 -0
- mirascope/llm/formatting/format.py +112 -35
- mirascope/llm/formatting/output_parser.py +178 -0
- mirascope/llm/formatting/partial.py +80 -7
- mirascope/llm/formatting/primitives.py +192 -0
- mirascope/llm/formatting/types.py +20 -8
- mirascope/llm/messages/__init__.py +3 -0
- mirascope/llm/messages/_utils.py +34 -0
- mirascope/llm/models/__init__.py +5 -0
- mirascope/llm/models/models.py +137 -69
- mirascope/llm/{providers/base → models}/params.py +7 -57
- mirascope/llm/models/thinking_config.py +61 -0
- mirascope/llm/prompts/_utils.py +0 -32
- mirascope/llm/prompts/decorator.py +16 -5
- mirascope/llm/prompts/prompts.py +131 -68
- mirascope/llm/providers/__init__.py +1 -4
- mirascope/llm/providers/anthropic/_utils/__init__.py +2 -0
- mirascope/llm/providers/anthropic/_utils/beta_decode.py +18 -9
- mirascope/llm/providers/anthropic/_utils/beta_encode.py +62 -13
- mirascope/llm/providers/anthropic/_utils/decode.py +18 -9
- mirascope/llm/providers/anthropic/_utils/encode.py +26 -7
- mirascope/llm/providers/anthropic/_utils/errors.py +2 -2
- mirascope/llm/providers/anthropic/beta_provider.py +64 -18
- mirascope/llm/providers/anthropic/provider.py +91 -33
- mirascope/llm/providers/base/__init__.py +0 -4
- mirascope/llm/providers/base/_utils.py +55 -6
- mirascope/llm/providers/base/base_provider.py +116 -37
- mirascope/llm/providers/google/_utils/__init__.py +2 -0
- mirascope/llm/providers/google/_utils/decode.py +20 -7
- mirascope/llm/providers/google/_utils/encode.py +26 -7
- mirascope/llm/providers/google/_utils/errors.py +3 -2
- mirascope/llm/providers/google/provider.py +64 -18
- mirascope/llm/providers/mirascope/_utils.py +13 -17
- mirascope/llm/providers/mirascope/provider.py +49 -18
- mirascope/llm/providers/mlx/_utils.py +7 -2
- mirascope/llm/providers/mlx/encoding/base.py +5 -2
- mirascope/llm/providers/mlx/encoding/transformers.py +5 -2
- mirascope/llm/providers/mlx/mlx.py +23 -6
- mirascope/llm/providers/mlx/provider.py +42 -13
- mirascope/llm/providers/openai/_utils/errors.py +2 -2
- mirascope/llm/providers/openai/completions/_utils/encode.py +20 -16
- mirascope/llm/providers/openai/completions/base_provider.py +40 -11
- mirascope/llm/providers/openai/provider.py +40 -10
- mirascope/llm/providers/openai/responses/_utils/__init__.py +2 -0
- mirascope/llm/providers/openai/responses/_utils/decode.py +19 -6
- mirascope/llm/providers/openai/responses/_utils/encode.py +22 -10
- mirascope/llm/providers/openai/responses/provider.py +56 -18
- mirascope/llm/providers/provider_registry.py +93 -19
- mirascope/llm/responses/__init__.py +6 -1
- mirascope/llm/responses/_utils.py +102 -12
- mirascope/llm/responses/base_response.py +5 -2
- mirascope/llm/responses/base_stream_response.py +115 -25
- mirascope/llm/responses/response.py +2 -1
- mirascope/llm/responses/root_response.py +89 -17
- mirascope/llm/responses/stream_response.py +6 -9
- mirascope/llm/tools/decorator.py +9 -4
- mirascope/llm/tools/tool_schema.py +12 -6
- mirascope/llm/tools/toolkit.py +35 -27
- mirascope/llm/tools/tools.py +45 -20
- mirascope/ops/__init__.py +4 -0
- mirascope/ops/_internal/configuration.py +82 -31
- mirascope/ops/_internal/exporters/exporters.py +64 -11
- mirascope/ops/_internal/instrumentation/llm/common.py +530 -0
- mirascope/ops/_internal/instrumentation/llm/cost.py +190 -0
- mirascope/ops/_internal/instrumentation/llm/encode.py +1 -1
- mirascope/ops/_internal/instrumentation/llm/llm.py +116 -1242
- mirascope/ops/_internal/instrumentation/llm/model.py +1798 -0
- mirascope/ops/_internal/instrumentation/llm/response.py +521 -0
- mirascope/ops/_internal/instrumentation/llm/serialize.py +300 -0
- mirascope/ops/_internal/protocols.py +83 -1
- mirascope/ops/_internal/traced_calls.py +4 -0
- mirascope/ops/_internal/traced_functions.py +118 -8
- mirascope/ops/_internal/tracing.py +78 -1
- mirascope/ops/_internal/utils.py +52 -4
- {mirascope-2.0.0a6.dist-info → mirascope-2.0.1.dist-info}/METADATA +12 -11
- mirascope-2.0.1.dist-info/RECORD +423 -0
- {mirascope-2.0.0a6.dist-info → mirascope-2.0.1.dist-info}/licenses/LICENSE +1 -1
- mirascope-2.0.0a6.dist-info/RECORD +0 -316
- {mirascope-2.0.0a6.dist-info → mirascope-2.0.1.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,736 @@
|
|
|
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.forbidden_error import ForbiddenError
|
|
14
|
+
from ..errors.internal_server_error import InternalServerError
|
|
15
|
+
from ..errors.not_found_error import NotFoundError
|
|
16
|
+
from ..errors.service_unavailable_error import ServiceUnavailableError
|
|
17
|
+
from ..errors.too_many_requests_error import TooManyRequestsError
|
|
18
|
+
from ..types.not_found_error_body import NotFoundErrorBody
|
|
19
|
+
from ..types.permission_denied_error import PermissionDeniedError
|
|
20
|
+
from ..types.rate_limit_error import RateLimitError
|
|
21
|
+
from .types.organization_memberships_list_response_item import (
|
|
22
|
+
OrganizationMembershipsListResponseItem,
|
|
23
|
+
)
|
|
24
|
+
from .types.organization_memberships_update_request_role import (
|
|
25
|
+
OrganizationMembershipsUpdateRequestRole,
|
|
26
|
+
)
|
|
27
|
+
from .types.organization_memberships_update_response import (
|
|
28
|
+
OrganizationMembershipsUpdateResponse,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
# this is used as the default value for optional parameters
|
|
32
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class RawOrganizationMembershipsClient:
|
|
36
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
37
|
+
self._client_wrapper = client_wrapper
|
|
38
|
+
|
|
39
|
+
def list(
|
|
40
|
+
self,
|
|
41
|
+
organization_id: str,
|
|
42
|
+
*,
|
|
43
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
44
|
+
) -> HttpResponse[typing.List[OrganizationMembershipsListResponseItem]]:
|
|
45
|
+
"""
|
|
46
|
+
Parameters
|
|
47
|
+
----------
|
|
48
|
+
organization_id : str
|
|
49
|
+
|
|
50
|
+
request_options : typing.Optional[RequestOptions]
|
|
51
|
+
Request-specific configuration.
|
|
52
|
+
|
|
53
|
+
Returns
|
|
54
|
+
-------
|
|
55
|
+
HttpResponse[typing.List[OrganizationMembershipsListResponseItem]]
|
|
56
|
+
Success
|
|
57
|
+
"""
|
|
58
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
59
|
+
f"organizations/{jsonable_encoder(organization_id)}/members",
|
|
60
|
+
method="GET",
|
|
61
|
+
request_options=request_options,
|
|
62
|
+
)
|
|
63
|
+
try:
|
|
64
|
+
if 200 <= _response.status_code < 300:
|
|
65
|
+
_data = typing.cast(
|
|
66
|
+
typing.List[OrganizationMembershipsListResponseItem],
|
|
67
|
+
parse_obj_as(
|
|
68
|
+
type_=typing.List[OrganizationMembershipsListResponseItem], # type: ignore
|
|
69
|
+
object_=_response.json(),
|
|
70
|
+
),
|
|
71
|
+
)
|
|
72
|
+
return HttpResponse(response=_response, data=_data)
|
|
73
|
+
if _response.status_code == 400:
|
|
74
|
+
raise BadRequestError(
|
|
75
|
+
headers=dict(_response.headers),
|
|
76
|
+
body=typing.cast(
|
|
77
|
+
typing.Optional[typing.Any],
|
|
78
|
+
parse_obj_as(
|
|
79
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
80
|
+
object_=_response.json(),
|
|
81
|
+
),
|
|
82
|
+
),
|
|
83
|
+
)
|
|
84
|
+
if _response.status_code == 403:
|
|
85
|
+
raise ForbiddenError(
|
|
86
|
+
headers=dict(_response.headers),
|
|
87
|
+
body=typing.cast(
|
|
88
|
+
PermissionDeniedError,
|
|
89
|
+
parse_obj_as(
|
|
90
|
+
type_=PermissionDeniedError, # type: ignore
|
|
91
|
+
object_=_response.json(),
|
|
92
|
+
),
|
|
93
|
+
),
|
|
94
|
+
)
|
|
95
|
+
if _response.status_code == 404:
|
|
96
|
+
raise NotFoundError(
|
|
97
|
+
headers=dict(_response.headers),
|
|
98
|
+
body=typing.cast(
|
|
99
|
+
NotFoundErrorBody,
|
|
100
|
+
parse_obj_as(
|
|
101
|
+
type_=NotFoundErrorBody, # type: ignore
|
|
102
|
+
object_=_response.json(),
|
|
103
|
+
),
|
|
104
|
+
),
|
|
105
|
+
)
|
|
106
|
+
if _response.status_code == 429:
|
|
107
|
+
raise TooManyRequestsError(
|
|
108
|
+
headers=dict(_response.headers),
|
|
109
|
+
body=typing.cast(
|
|
110
|
+
RateLimitError,
|
|
111
|
+
parse_obj_as(
|
|
112
|
+
type_=RateLimitError, # type: ignore
|
|
113
|
+
object_=_response.json(),
|
|
114
|
+
),
|
|
115
|
+
),
|
|
116
|
+
)
|
|
117
|
+
if _response.status_code == 500:
|
|
118
|
+
raise InternalServerError(
|
|
119
|
+
headers=dict(_response.headers),
|
|
120
|
+
body=typing.cast(
|
|
121
|
+
typing.Optional[typing.Any],
|
|
122
|
+
parse_obj_as(
|
|
123
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
124
|
+
object_=_response.json(),
|
|
125
|
+
),
|
|
126
|
+
),
|
|
127
|
+
)
|
|
128
|
+
if _response.status_code == 503:
|
|
129
|
+
raise ServiceUnavailableError(
|
|
130
|
+
headers=dict(_response.headers),
|
|
131
|
+
body=typing.cast(
|
|
132
|
+
typing.Optional[typing.Any],
|
|
133
|
+
parse_obj_as(
|
|
134
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
135
|
+
object_=_response.json(),
|
|
136
|
+
),
|
|
137
|
+
),
|
|
138
|
+
)
|
|
139
|
+
_response_json = _response.json()
|
|
140
|
+
except JSONDecodeError:
|
|
141
|
+
raise ApiError(
|
|
142
|
+
status_code=_response.status_code,
|
|
143
|
+
headers=dict(_response.headers),
|
|
144
|
+
body=_response.text,
|
|
145
|
+
)
|
|
146
|
+
raise ApiError(
|
|
147
|
+
status_code=_response.status_code,
|
|
148
|
+
headers=dict(_response.headers),
|
|
149
|
+
body=_response_json,
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
def delete(
|
|
153
|
+
self,
|
|
154
|
+
organization_id: str,
|
|
155
|
+
member_id: str,
|
|
156
|
+
*,
|
|
157
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
158
|
+
) -> HttpResponse[None]:
|
|
159
|
+
"""
|
|
160
|
+
Parameters
|
|
161
|
+
----------
|
|
162
|
+
organization_id : str
|
|
163
|
+
|
|
164
|
+
member_id : str
|
|
165
|
+
|
|
166
|
+
request_options : typing.Optional[RequestOptions]
|
|
167
|
+
Request-specific configuration.
|
|
168
|
+
|
|
169
|
+
Returns
|
|
170
|
+
-------
|
|
171
|
+
HttpResponse[None]
|
|
172
|
+
"""
|
|
173
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
174
|
+
f"organizations/{jsonable_encoder(organization_id)}/members/{jsonable_encoder(member_id)}",
|
|
175
|
+
method="DELETE",
|
|
176
|
+
request_options=request_options,
|
|
177
|
+
)
|
|
178
|
+
try:
|
|
179
|
+
if 200 <= _response.status_code < 300:
|
|
180
|
+
return HttpResponse(response=_response, data=None)
|
|
181
|
+
if _response.status_code == 400:
|
|
182
|
+
raise BadRequestError(
|
|
183
|
+
headers=dict(_response.headers),
|
|
184
|
+
body=typing.cast(
|
|
185
|
+
typing.Optional[typing.Any],
|
|
186
|
+
parse_obj_as(
|
|
187
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
188
|
+
object_=_response.json(),
|
|
189
|
+
),
|
|
190
|
+
),
|
|
191
|
+
)
|
|
192
|
+
if _response.status_code == 403:
|
|
193
|
+
raise ForbiddenError(
|
|
194
|
+
headers=dict(_response.headers),
|
|
195
|
+
body=typing.cast(
|
|
196
|
+
PermissionDeniedError,
|
|
197
|
+
parse_obj_as(
|
|
198
|
+
type_=PermissionDeniedError, # type: ignore
|
|
199
|
+
object_=_response.json(),
|
|
200
|
+
),
|
|
201
|
+
),
|
|
202
|
+
)
|
|
203
|
+
if _response.status_code == 404:
|
|
204
|
+
raise NotFoundError(
|
|
205
|
+
headers=dict(_response.headers),
|
|
206
|
+
body=typing.cast(
|
|
207
|
+
NotFoundErrorBody,
|
|
208
|
+
parse_obj_as(
|
|
209
|
+
type_=NotFoundErrorBody, # type: ignore
|
|
210
|
+
object_=_response.json(),
|
|
211
|
+
),
|
|
212
|
+
),
|
|
213
|
+
)
|
|
214
|
+
if _response.status_code == 429:
|
|
215
|
+
raise TooManyRequestsError(
|
|
216
|
+
headers=dict(_response.headers),
|
|
217
|
+
body=typing.cast(
|
|
218
|
+
RateLimitError,
|
|
219
|
+
parse_obj_as(
|
|
220
|
+
type_=RateLimitError, # type: ignore
|
|
221
|
+
object_=_response.json(),
|
|
222
|
+
),
|
|
223
|
+
),
|
|
224
|
+
)
|
|
225
|
+
if _response.status_code == 500:
|
|
226
|
+
raise InternalServerError(
|
|
227
|
+
headers=dict(_response.headers),
|
|
228
|
+
body=typing.cast(
|
|
229
|
+
typing.Optional[typing.Any],
|
|
230
|
+
parse_obj_as(
|
|
231
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
232
|
+
object_=_response.json(),
|
|
233
|
+
),
|
|
234
|
+
),
|
|
235
|
+
)
|
|
236
|
+
if _response.status_code == 503:
|
|
237
|
+
raise ServiceUnavailableError(
|
|
238
|
+
headers=dict(_response.headers),
|
|
239
|
+
body=typing.cast(
|
|
240
|
+
typing.Optional[typing.Any],
|
|
241
|
+
parse_obj_as(
|
|
242
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
243
|
+
object_=_response.json(),
|
|
244
|
+
),
|
|
245
|
+
),
|
|
246
|
+
)
|
|
247
|
+
_response_json = _response.json()
|
|
248
|
+
except JSONDecodeError:
|
|
249
|
+
raise ApiError(
|
|
250
|
+
status_code=_response.status_code,
|
|
251
|
+
headers=dict(_response.headers),
|
|
252
|
+
body=_response.text,
|
|
253
|
+
)
|
|
254
|
+
raise ApiError(
|
|
255
|
+
status_code=_response.status_code,
|
|
256
|
+
headers=dict(_response.headers),
|
|
257
|
+
body=_response_json,
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
def update(
|
|
261
|
+
self,
|
|
262
|
+
organization_id: str,
|
|
263
|
+
member_id: str,
|
|
264
|
+
*,
|
|
265
|
+
role: OrganizationMembershipsUpdateRequestRole,
|
|
266
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
267
|
+
) -> HttpResponse[OrganizationMembershipsUpdateResponse]:
|
|
268
|
+
"""
|
|
269
|
+
Parameters
|
|
270
|
+
----------
|
|
271
|
+
organization_id : str
|
|
272
|
+
|
|
273
|
+
member_id : str
|
|
274
|
+
|
|
275
|
+
role : OrganizationMembershipsUpdateRequestRole
|
|
276
|
+
|
|
277
|
+
request_options : typing.Optional[RequestOptions]
|
|
278
|
+
Request-specific configuration.
|
|
279
|
+
|
|
280
|
+
Returns
|
|
281
|
+
-------
|
|
282
|
+
HttpResponse[OrganizationMembershipsUpdateResponse]
|
|
283
|
+
Success
|
|
284
|
+
"""
|
|
285
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
286
|
+
f"organizations/{jsonable_encoder(organization_id)}/members/{jsonable_encoder(member_id)}",
|
|
287
|
+
method="PATCH",
|
|
288
|
+
json={
|
|
289
|
+
"role": role,
|
|
290
|
+
},
|
|
291
|
+
headers={
|
|
292
|
+
"content-type": "application/json",
|
|
293
|
+
},
|
|
294
|
+
request_options=request_options,
|
|
295
|
+
omit=OMIT,
|
|
296
|
+
)
|
|
297
|
+
try:
|
|
298
|
+
if 200 <= _response.status_code < 300:
|
|
299
|
+
_data = typing.cast(
|
|
300
|
+
OrganizationMembershipsUpdateResponse,
|
|
301
|
+
parse_obj_as(
|
|
302
|
+
type_=OrganizationMembershipsUpdateResponse, # type: ignore
|
|
303
|
+
object_=_response.json(),
|
|
304
|
+
),
|
|
305
|
+
)
|
|
306
|
+
return HttpResponse(response=_response, data=_data)
|
|
307
|
+
if _response.status_code == 400:
|
|
308
|
+
raise BadRequestError(
|
|
309
|
+
headers=dict(_response.headers),
|
|
310
|
+
body=typing.cast(
|
|
311
|
+
typing.Optional[typing.Any],
|
|
312
|
+
parse_obj_as(
|
|
313
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
314
|
+
object_=_response.json(),
|
|
315
|
+
),
|
|
316
|
+
),
|
|
317
|
+
)
|
|
318
|
+
if _response.status_code == 403:
|
|
319
|
+
raise ForbiddenError(
|
|
320
|
+
headers=dict(_response.headers),
|
|
321
|
+
body=typing.cast(
|
|
322
|
+
PermissionDeniedError,
|
|
323
|
+
parse_obj_as(
|
|
324
|
+
type_=PermissionDeniedError, # type: ignore
|
|
325
|
+
object_=_response.json(),
|
|
326
|
+
),
|
|
327
|
+
),
|
|
328
|
+
)
|
|
329
|
+
if _response.status_code == 404:
|
|
330
|
+
raise NotFoundError(
|
|
331
|
+
headers=dict(_response.headers),
|
|
332
|
+
body=typing.cast(
|
|
333
|
+
NotFoundErrorBody,
|
|
334
|
+
parse_obj_as(
|
|
335
|
+
type_=NotFoundErrorBody, # type: ignore
|
|
336
|
+
object_=_response.json(),
|
|
337
|
+
),
|
|
338
|
+
),
|
|
339
|
+
)
|
|
340
|
+
if _response.status_code == 429:
|
|
341
|
+
raise TooManyRequestsError(
|
|
342
|
+
headers=dict(_response.headers),
|
|
343
|
+
body=typing.cast(
|
|
344
|
+
RateLimitError,
|
|
345
|
+
parse_obj_as(
|
|
346
|
+
type_=RateLimitError, # type: ignore
|
|
347
|
+
object_=_response.json(),
|
|
348
|
+
),
|
|
349
|
+
),
|
|
350
|
+
)
|
|
351
|
+
if _response.status_code == 500:
|
|
352
|
+
raise InternalServerError(
|
|
353
|
+
headers=dict(_response.headers),
|
|
354
|
+
body=typing.cast(
|
|
355
|
+
typing.Optional[typing.Any],
|
|
356
|
+
parse_obj_as(
|
|
357
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
358
|
+
object_=_response.json(),
|
|
359
|
+
),
|
|
360
|
+
),
|
|
361
|
+
)
|
|
362
|
+
if _response.status_code == 503:
|
|
363
|
+
raise ServiceUnavailableError(
|
|
364
|
+
headers=dict(_response.headers),
|
|
365
|
+
body=typing.cast(
|
|
366
|
+
typing.Optional[typing.Any],
|
|
367
|
+
parse_obj_as(
|
|
368
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
369
|
+
object_=_response.json(),
|
|
370
|
+
),
|
|
371
|
+
),
|
|
372
|
+
)
|
|
373
|
+
_response_json = _response.json()
|
|
374
|
+
except JSONDecodeError:
|
|
375
|
+
raise ApiError(
|
|
376
|
+
status_code=_response.status_code,
|
|
377
|
+
headers=dict(_response.headers),
|
|
378
|
+
body=_response.text,
|
|
379
|
+
)
|
|
380
|
+
raise ApiError(
|
|
381
|
+
status_code=_response.status_code,
|
|
382
|
+
headers=dict(_response.headers),
|
|
383
|
+
body=_response_json,
|
|
384
|
+
)
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
class AsyncRawOrganizationMembershipsClient:
|
|
388
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
389
|
+
self._client_wrapper = client_wrapper
|
|
390
|
+
|
|
391
|
+
async def list(
|
|
392
|
+
self,
|
|
393
|
+
organization_id: str,
|
|
394
|
+
*,
|
|
395
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
396
|
+
) -> AsyncHttpResponse[typing.List[OrganizationMembershipsListResponseItem]]:
|
|
397
|
+
"""
|
|
398
|
+
Parameters
|
|
399
|
+
----------
|
|
400
|
+
organization_id : str
|
|
401
|
+
|
|
402
|
+
request_options : typing.Optional[RequestOptions]
|
|
403
|
+
Request-specific configuration.
|
|
404
|
+
|
|
405
|
+
Returns
|
|
406
|
+
-------
|
|
407
|
+
AsyncHttpResponse[typing.List[OrganizationMembershipsListResponseItem]]
|
|
408
|
+
Success
|
|
409
|
+
"""
|
|
410
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
411
|
+
f"organizations/{jsonable_encoder(organization_id)}/members",
|
|
412
|
+
method="GET",
|
|
413
|
+
request_options=request_options,
|
|
414
|
+
)
|
|
415
|
+
try:
|
|
416
|
+
if 200 <= _response.status_code < 300:
|
|
417
|
+
_data = typing.cast(
|
|
418
|
+
typing.List[OrganizationMembershipsListResponseItem],
|
|
419
|
+
parse_obj_as(
|
|
420
|
+
type_=typing.List[OrganizationMembershipsListResponseItem], # type: ignore
|
|
421
|
+
object_=_response.json(),
|
|
422
|
+
),
|
|
423
|
+
)
|
|
424
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
425
|
+
if _response.status_code == 400:
|
|
426
|
+
raise BadRequestError(
|
|
427
|
+
headers=dict(_response.headers),
|
|
428
|
+
body=typing.cast(
|
|
429
|
+
typing.Optional[typing.Any],
|
|
430
|
+
parse_obj_as(
|
|
431
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
432
|
+
object_=_response.json(),
|
|
433
|
+
),
|
|
434
|
+
),
|
|
435
|
+
)
|
|
436
|
+
if _response.status_code == 403:
|
|
437
|
+
raise ForbiddenError(
|
|
438
|
+
headers=dict(_response.headers),
|
|
439
|
+
body=typing.cast(
|
|
440
|
+
PermissionDeniedError,
|
|
441
|
+
parse_obj_as(
|
|
442
|
+
type_=PermissionDeniedError, # type: ignore
|
|
443
|
+
object_=_response.json(),
|
|
444
|
+
),
|
|
445
|
+
),
|
|
446
|
+
)
|
|
447
|
+
if _response.status_code == 404:
|
|
448
|
+
raise NotFoundError(
|
|
449
|
+
headers=dict(_response.headers),
|
|
450
|
+
body=typing.cast(
|
|
451
|
+
NotFoundErrorBody,
|
|
452
|
+
parse_obj_as(
|
|
453
|
+
type_=NotFoundErrorBody, # type: ignore
|
|
454
|
+
object_=_response.json(),
|
|
455
|
+
),
|
|
456
|
+
),
|
|
457
|
+
)
|
|
458
|
+
if _response.status_code == 429:
|
|
459
|
+
raise TooManyRequestsError(
|
|
460
|
+
headers=dict(_response.headers),
|
|
461
|
+
body=typing.cast(
|
|
462
|
+
RateLimitError,
|
|
463
|
+
parse_obj_as(
|
|
464
|
+
type_=RateLimitError, # type: ignore
|
|
465
|
+
object_=_response.json(),
|
|
466
|
+
),
|
|
467
|
+
),
|
|
468
|
+
)
|
|
469
|
+
if _response.status_code == 500:
|
|
470
|
+
raise InternalServerError(
|
|
471
|
+
headers=dict(_response.headers),
|
|
472
|
+
body=typing.cast(
|
|
473
|
+
typing.Optional[typing.Any],
|
|
474
|
+
parse_obj_as(
|
|
475
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
476
|
+
object_=_response.json(),
|
|
477
|
+
),
|
|
478
|
+
),
|
|
479
|
+
)
|
|
480
|
+
if _response.status_code == 503:
|
|
481
|
+
raise ServiceUnavailableError(
|
|
482
|
+
headers=dict(_response.headers),
|
|
483
|
+
body=typing.cast(
|
|
484
|
+
typing.Optional[typing.Any],
|
|
485
|
+
parse_obj_as(
|
|
486
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
487
|
+
object_=_response.json(),
|
|
488
|
+
),
|
|
489
|
+
),
|
|
490
|
+
)
|
|
491
|
+
_response_json = _response.json()
|
|
492
|
+
except JSONDecodeError:
|
|
493
|
+
raise ApiError(
|
|
494
|
+
status_code=_response.status_code,
|
|
495
|
+
headers=dict(_response.headers),
|
|
496
|
+
body=_response.text,
|
|
497
|
+
)
|
|
498
|
+
raise ApiError(
|
|
499
|
+
status_code=_response.status_code,
|
|
500
|
+
headers=dict(_response.headers),
|
|
501
|
+
body=_response_json,
|
|
502
|
+
)
|
|
503
|
+
|
|
504
|
+
async def delete(
|
|
505
|
+
self,
|
|
506
|
+
organization_id: str,
|
|
507
|
+
member_id: str,
|
|
508
|
+
*,
|
|
509
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
510
|
+
) -> AsyncHttpResponse[None]:
|
|
511
|
+
"""
|
|
512
|
+
Parameters
|
|
513
|
+
----------
|
|
514
|
+
organization_id : str
|
|
515
|
+
|
|
516
|
+
member_id : str
|
|
517
|
+
|
|
518
|
+
request_options : typing.Optional[RequestOptions]
|
|
519
|
+
Request-specific configuration.
|
|
520
|
+
|
|
521
|
+
Returns
|
|
522
|
+
-------
|
|
523
|
+
AsyncHttpResponse[None]
|
|
524
|
+
"""
|
|
525
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
526
|
+
f"organizations/{jsonable_encoder(organization_id)}/members/{jsonable_encoder(member_id)}",
|
|
527
|
+
method="DELETE",
|
|
528
|
+
request_options=request_options,
|
|
529
|
+
)
|
|
530
|
+
try:
|
|
531
|
+
if 200 <= _response.status_code < 300:
|
|
532
|
+
return AsyncHttpResponse(response=_response, data=None)
|
|
533
|
+
if _response.status_code == 400:
|
|
534
|
+
raise BadRequestError(
|
|
535
|
+
headers=dict(_response.headers),
|
|
536
|
+
body=typing.cast(
|
|
537
|
+
typing.Optional[typing.Any],
|
|
538
|
+
parse_obj_as(
|
|
539
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
540
|
+
object_=_response.json(),
|
|
541
|
+
),
|
|
542
|
+
),
|
|
543
|
+
)
|
|
544
|
+
if _response.status_code == 403:
|
|
545
|
+
raise ForbiddenError(
|
|
546
|
+
headers=dict(_response.headers),
|
|
547
|
+
body=typing.cast(
|
|
548
|
+
PermissionDeniedError,
|
|
549
|
+
parse_obj_as(
|
|
550
|
+
type_=PermissionDeniedError, # type: ignore
|
|
551
|
+
object_=_response.json(),
|
|
552
|
+
),
|
|
553
|
+
),
|
|
554
|
+
)
|
|
555
|
+
if _response.status_code == 404:
|
|
556
|
+
raise NotFoundError(
|
|
557
|
+
headers=dict(_response.headers),
|
|
558
|
+
body=typing.cast(
|
|
559
|
+
NotFoundErrorBody,
|
|
560
|
+
parse_obj_as(
|
|
561
|
+
type_=NotFoundErrorBody, # type: ignore
|
|
562
|
+
object_=_response.json(),
|
|
563
|
+
),
|
|
564
|
+
),
|
|
565
|
+
)
|
|
566
|
+
if _response.status_code == 429:
|
|
567
|
+
raise TooManyRequestsError(
|
|
568
|
+
headers=dict(_response.headers),
|
|
569
|
+
body=typing.cast(
|
|
570
|
+
RateLimitError,
|
|
571
|
+
parse_obj_as(
|
|
572
|
+
type_=RateLimitError, # type: ignore
|
|
573
|
+
object_=_response.json(),
|
|
574
|
+
),
|
|
575
|
+
),
|
|
576
|
+
)
|
|
577
|
+
if _response.status_code == 500:
|
|
578
|
+
raise InternalServerError(
|
|
579
|
+
headers=dict(_response.headers),
|
|
580
|
+
body=typing.cast(
|
|
581
|
+
typing.Optional[typing.Any],
|
|
582
|
+
parse_obj_as(
|
|
583
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
584
|
+
object_=_response.json(),
|
|
585
|
+
),
|
|
586
|
+
),
|
|
587
|
+
)
|
|
588
|
+
if _response.status_code == 503:
|
|
589
|
+
raise ServiceUnavailableError(
|
|
590
|
+
headers=dict(_response.headers),
|
|
591
|
+
body=typing.cast(
|
|
592
|
+
typing.Optional[typing.Any],
|
|
593
|
+
parse_obj_as(
|
|
594
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
595
|
+
object_=_response.json(),
|
|
596
|
+
),
|
|
597
|
+
),
|
|
598
|
+
)
|
|
599
|
+
_response_json = _response.json()
|
|
600
|
+
except JSONDecodeError:
|
|
601
|
+
raise ApiError(
|
|
602
|
+
status_code=_response.status_code,
|
|
603
|
+
headers=dict(_response.headers),
|
|
604
|
+
body=_response.text,
|
|
605
|
+
)
|
|
606
|
+
raise ApiError(
|
|
607
|
+
status_code=_response.status_code,
|
|
608
|
+
headers=dict(_response.headers),
|
|
609
|
+
body=_response_json,
|
|
610
|
+
)
|
|
611
|
+
|
|
612
|
+
async def update(
|
|
613
|
+
self,
|
|
614
|
+
organization_id: str,
|
|
615
|
+
member_id: str,
|
|
616
|
+
*,
|
|
617
|
+
role: OrganizationMembershipsUpdateRequestRole,
|
|
618
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
619
|
+
) -> AsyncHttpResponse[OrganizationMembershipsUpdateResponse]:
|
|
620
|
+
"""
|
|
621
|
+
Parameters
|
|
622
|
+
----------
|
|
623
|
+
organization_id : str
|
|
624
|
+
|
|
625
|
+
member_id : str
|
|
626
|
+
|
|
627
|
+
role : OrganizationMembershipsUpdateRequestRole
|
|
628
|
+
|
|
629
|
+
request_options : typing.Optional[RequestOptions]
|
|
630
|
+
Request-specific configuration.
|
|
631
|
+
|
|
632
|
+
Returns
|
|
633
|
+
-------
|
|
634
|
+
AsyncHttpResponse[OrganizationMembershipsUpdateResponse]
|
|
635
|
+
Success
|
|
636
|
+
"""
|
|
637
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
638
|
+
f"organizations/{jsonable_encoder(organization_id)}/members/{jsonable_encoder(member_id)}",
|
|
639
|
+
method="PATCH",
|
|
640
|
+
json={
|
|
641
|
+
"role": role,
|
|
642
|
+
},
|
|
643
|
+
headers={
|
|
644
|
+
"content-type": "application/json",
|
|
645
|
+
},
|
|
646
|
+
request_options=request_options,
|
|
647
|
+
omit=OMIT,
|
|
648
|
+
)
|
|
649
|
+
try:
|
|
650
|
+
if 200 <= _response.status_code < 300:
|
|
651
|
+
_data = typing.cast(
|
|
652
|
+
OrganizationMembershipsUpdateResponse,
|
|
653
|
+
parse_obj_as(
|
|
654
|
+
type_=OrganizationMembershipsUpdateResponse, # type: ignore
|
|
655
|
+
object_=_response.json(),
|
|
656
|
+
),
|
|
657
|
+
)
|
|
658
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
659
|
+
if _response.status_code == 400:
|
|
660
|
+
raise BadRequestError(
|
|
661
|
+
headers=dict(_response.headers),
|
|
662
|
+
body=typing.cast(
|
|
663
|
+
typing.Optional[typing.Any],
|
|
664
|
+
parse_obj_as(
|
|
665
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
666
|
+
object_=_response.json(),
|
|
667
|
+
),
|
|
668
|
+
),
|
|
669
|
+
)
|
|
670
|
+
if _response.status_code == 403:
|
|
671
|
+
raise ForbiddenError(
|
|
672
|
+
headers=dict(_response.headers),
|
|
673
|
+
body=typing.cast(
|
|
674
|
+
PermissionDeniedError,
|
|
675
|
+
parse_obj_as(
|
|
676
|
+
type_=PermissionDeniedError, # type: ignore
|
|
677
|
+
object_=_response.json(),
|
|
678
|
+
),
|
|
679
|
+
),
|
|
680
|
+
)
|
|
681
|
+
if _response.status_code == 404:
|
|
682
|
+
raise NotFoundError(
|
|
683
|
+
headers=dict(_response.headers),
|
|
684
|
+
body=typing.cast(
|
|
685
|
+
NotFoundErrorBody,
|
|
686
|
+
parse_obj_as(
|
|
687
|
+
type_=NotFoundErrorBody, # type: ignore
|
|
688
|
+
object_=_response.json(),
|
|
689
|
+
),
|
|
690
|
+
),
|
|
691
|
+
)
|
|
692
|
+
if _response.status_code == 429:
|
|
693
|
+
raise TooManyRequestsError(
|
|
694
|
+
headers=dict(_response.headers),
|
|
695
|
+
body=typing.cast(
|
|
696
|
+
RateLimitError,
|
|
697
|
+
parse_obj_as(
|
|
698
|
+
type_=RateLimitError, # type: ignore
|
|
699
|
+
object_=_response.json(),
|
|
700
|
+
),
|
|
701
|
+
),
|
|
702
|
+
)
|
|
703
|
+
if _response.status_code == 500:
|
|
704
|
+
raise InternalServerError(
|
|
705
|
+
headers=dict(_response.headers),
|
|
706
|
+
body=typing.cast(
|
|
707
|
+
typing.Optional[typing.Any],
|
|
708
|
+
parse_obj_as(
|
|
709
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
710
|
+
object_=_response.json(),
|
|
711
|
+
),
|
|
712
|
+
),
|
|
713
|
+
)
|
|
714
|
+
if _response.status_code == 503:
|
|
715
|
+
raise ServiceUnavailableError(
|
|
716
|
+
headers=dict(_response.headers),
|
|
717
|
+
body=typing.cast(
|
|
718
|
+
typing.Optional[typing.Any],
|
|
719
|
+
parse_obj_as(
|
|
720
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
721
|
+
object_=_response.json(),
|
|
722
|
+
),
|
|
723
|
+
),
|
|
724
|
+
)
|
|
725
|
+
_response_json = _response.json()
|
|
726
|
+
except JSONDecodeError:
|
|
727
|
+
raise ApiError(
|
|
728
|
+
status_code=_response.status_code,
|
|
729
|
+
headers=dict(_response.headers),
|
|
730
|
+
body=_response.text,
|
|
731
|
+
)
|
|
732
|
+
raise ApiError(
|
|
733
|
+
status_code=_response.status_code,
|
|
734
|
+
headers=dict(_response.headers),
|
|
735
|
+
body=_response_json,
|
|
736
|
+
)
|