kard-financial-sdk 0.0.82__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.
- kard/__init__.py +579 -0
- kard/auth/__init__.py +34 -0
- kard/auth/client.py +121 -0
- kard/auth/raw_client.py +108 -0
- kard/auth/types/__init__.py +34 -0
- kard/auth/types/token_response.py +25 -0
- kard/client.py +416 -0
- kard/commons/__init__.py +120 -0
- kard/commons/errors/__init__.py +44 -0
- kard/commons/errors/conflict_error.py +11 -0
- kard/commons/errors/does_not_exist_error.py +11 -0
- kard/commons/errors/internal_server_error.py +11 -0
- kard/commons/errors/invalid_request.py +11 -0
- kard/commons/errors/unauthorized_error.py +11 -0
- kard/commons/types/__init__.py +107 -0
- kard/commons/types/category_option.py +26 -0
- kard/commons/types/commission_type.py +5 -0
- kard/commons/types/commission_value.py +28 -0
- kard/commons/types/commission_value_type.py +5 -0
- kard/commons/types/empty_object.py +17 -0
- kard/commons/types/enrolled_rewards_type.py +5 -0
- kard/commons/types/error_object.py +43 -0
- kard/commons/types/error_response.py +20 -0
- kard/commons/types/error_source.py +32 -0
- kard/commons/types/job.py +24 -0
- kard/commons/types/job_response.py +27 -0
- kard/commons/types/job_status.py +5 -0
- kard/commons/types/links.py +27 -0
- kard/commons/types/mongo_id.py +3 -0
- kard/commons/types/notification_type.py +19 -0
- kard/commons/types/organization_id.py +3 -0
- kard/commons/types/purchase_channel.py +5 -0
- kard/commons/types/relationship_data.py +24 -0
- kard/commons/types/relationship_multiple.py +20 -0
- kard/commons/types/relationship_single.py +20 -0
- kard/commons/types/resource_type.py +3 -0
- kard/commons/types/state.py +68 -0
- kard/commons/types/subscription_id.py +3 -0
- kard/commons/types/user_id.py +3 -0
- kard/core/__init__.py +105 -0
- kard/core/api_error.py +23 -0
- kard/core/client_wrapper.py +97 -0
- kard/core/datetime_utils.py +28 -0
- kard/core/file.py +67 -0
- kard/core/force_multipart.py +18 -0
- kard/core/http_client.py +613 -0
- kard/core/http_response.py +55 -0
- kard/core/http_sse/__init__.py +42 -0
- kard/core/http_sse/_api.py +112 -0
- kard/core/http_sse/_decoders.py +61 -0
- kard/core/http_sse/_exceptions.py +7 -0
- kard/core/http_sse/_models.py +17 -0
- kard/core/jsonable_encoder.py +100 -0
- kard/core/oauth_token_provider.py +73 -0
- kard/core/pydantic_utilities.py +260 -0
- kard/core/query_encoder.py +58 -0
- kard/core/remove_none_from_dict.py +11 -0
- kard/core/request_options.py +35 -0
- kard/core/serialization.py +276 -0
- kard/environment.py +8 -0
- kard/files/__init__.py +58 -0
- kard/files/client.py +213 -0
- kard/files/errors/__init__.py +34 -0
- kard/files/errors/forbidden_error.py +11 -0
- kard/files/raw_client.py +278 -0
- kard/files/types/__init__.py +53 -0
- kard/files/types/file_metadata_attribute.py +39 -0
- kard/files/types/file_metadata_with_url.py +34 -0
- kard/files/types/file_type.py +13 -0
- kard/files/types/files_metadata_sort_options.py +5 -0
- kard/files/types/get_files_metadata_response.py +71 -0
- kard/files/types/pagination_meta.py +29 -0
- kard/notifications/__init__.py +279 -0
- kard/notifications/client.py +63 -0
- kard/notifications/raw_client.py +13 -0
- kard/notifications/subscriptions/__init__.py +97 -0
- kard/notifications/subscriptions/client.py +372 -0
- kard/notifications/subscriptions/raw_client.py +581 -0
- kard/notifications/subscriptions/types/__init__.py +94 -0
- kard/notifications/subscriptions/types/create_subscription_union.py +27 -0
- kard/notifications/subscriptions/types/create_subscriptions_response_object.py +43 -0
- kard/notifications/subscriptions/types/created_subscription.py +23 -0
- kard/notifications/subscriptions/types/subscription.py +25 -0
- kard/notifications/subscriptions/types/subscription_attributes.py +35 -0
- kard/notifications/subscriptions/types/subscription_request.py +20 -0
- kard/notifications/subscriptions/types/subscription_request_attributes.py +35 -0
- kard/notifications/subscriptions/types/subscription_request_body.py +42 -0
- kard/notifications/subscriptions/types/subscription_request_union.py +26 -0
- kard/notifications/subscriptions/types/subscription_union.py +27 -0
- kard/notifications/subscriptions/types/subscriptions_response_object.py +43 -0
- kard/notifications/subscriptions/types/update_subscription_request.py +20 -0
- kard/notifications/subscriptions/types/update_subscription_request_attributes.py +39 -0
- kard/notifications/subscriptions/types/update_subscription_request_body.py +40 -0
- kard/notifications/subscriptions/types/update_subscription_request_union.py +26 -0
- kard/notifications/subscriptions/types/update_subscriptions_response_object.py +41 -0
- kard/notifications/types/__init__.py +214 -0
- kard/notifications/types/audit_update_attributes.py +88 -0
- kard/notifications/types/audit_update_data.py +27 -0
- kard/notifications/types/audit_update_relationships.py +21 -0
- kard/notifications/types/broker_amount.py +28 -0
- kard/notifications/types/broker_amount_type.py +5 -0
- kard/notifications/types/broker_asset.py +33 -0
- kard/notifications/types/broker_asset_type.py +5 -0
- kard/notifications/types/broker_operation_hours.py +30 -0
- kard/notifications/types/broker_operation_period.py +28 -0
- kard/notifications/types/broker_purchase_channel.py +5 -0
- kard/notifications/types/broker_reward.py +28 -0
- kard/notifications/types/broker_reward_type.py +5 -0
- kard/notifications/types/clawback_data.py +27 -0
- kard/notifications/types/earned_reward_approved_data.py +27 -0
- kard/notifications/types/earned_reward_attributes.py +18 -0
- kard/notifications/types/earned_reward_relationships.py +21 -0
- kard/notifications/types/earned_reward_settled_attributes.py +23 -0
- kard/notifications/types/earned_reward_settled_data.py +27 -0
- kard/notifications/types/failed_transaction_attributes.py +41 -0
- kard/notifications/types/failed_transaction_data.py +27 -0
- kard/notifications/types/failed_transaction_relationships.py +22 -0
- kard/notifications/types/location_address.py +39 -0
- kard/notifications/types/location_coordinates.py +27 -0
- kard/notifications/types/location_status.py +5 -0
- kard/notifications/types/merchant_source.py +5 -0
- kard/notifications/types/notification_data_union.py +203 -0
- kard/notifications/types/notification_metadata.py +22 -0
- kard/notifications/types/notification_payload.py +65 -0
- kard/notifications/types/offer_status.py +5 -0
- kard/notifications/types/offer_type.py +5 -0
- kard/notifications/types/reward_notification_attributes.py +48 -0
- kard/notifications/types/time_period.py +27 -0
- kard/notifications/types/transaction_relationships.py +22 -0
- kard/notifications/types/user_offer_status.py +5 -0
- kard/notifications/types/valid_transaction_attributes.py +25 -0
- kard/notifications/types/valid_transaction_commission_earned.py +21 -0
- kard/notifications/types/valid_transaction_data.py +27 -0
- kard/notifications/types/webhook_locations_attributes.py +71 -0
- kard/notifications/types/webhook_locations_data.py +27 -0
- kard/notifications/types/webhook_locations_relationships.py +20 -0
- kard/notifications/types/webhook_merchant_attributes.py +67 -0
- kard/notifications/types/webhook_merchant_data.py +27 -0
- kard/notifications/types/webhook_merchant_relationships.py +20 -0
- kard/notifications/types/webhook_offer_attributes.py +143 -0
- kard/notifications/types/webhook_offer_data.py +27 -0
- kard/notifications/types/webhook_offer_relationships.py +20 -0
- kard/notifications/types/webhook_user_offer_attributes.py +41 -0
- kard/notifications/types/webhook_user_offer_data.py +27 -0
- kard/notifications/types/webhook_user_offer_relationships.py +21 -0
- kard/ping/__init__.py +39 -0
- kard/ping/client.py +100 -0
- kard/ping/errors/__init__.py +34 -0
- kard/ping/errors/network_blocked_error.py +11 -0
- kard/ping/raw_client.py +113 -0
- kard/ping/types/__init__.py +38 -0
- kard/ping/types/network_blocked_error_body.py +34 -0
- kard/ping/types/ping_response_object.py +46 -0
- kard/py.typed +0 -0
- kard/transactions/__init__.py +212 -0
- kard/transactions/client.py +639 -0
- kard/transactions/errors/__init__.py +40 -0
- kard/transactions/errors/create_audit_multi_status.py +11 -0
- kard/transactions/errors/create_incoming_transactions_multi_status.py +11 -0
- kard/transactions/errors/fraud_multi_status.py +11 -0
- kard/transactions/raw_client.py +925 -0
- kard/transactions/types/__init__.py +199 -0
- kard/transactions/types/audit_attributes.py +44 -0
- kard/transactions/types/audit_request_data.py +20 -0
- kard/transactions/types/audit_response_attributes.py +24 -0
- kard/transactions/types/audit_response_data.py +25 -0
- kard/transactions/types/audit_status.py +5 -0
- kard/transactions/types/card_network.py +5 -0
- kard/transactions/types/commission_earned_details.py +21 -0
- kard/transactions/types/create_audit_multi_status_response.py +21 -0
- kard/transactions/types/create_audit_request_body.py +43 -0
- kard/transactions/types/create_audit_request_data_union.py +26 -0
- kard/transactions/types/create_audit_response_body.py +41 -0
- kard/transactions/types/create_audit_response_data_union.py +27 -0
- kard/transactions/types/direction_type.py +5 -0
- kard/transactions/types/fraudulent_transaction_attributes.py +24 -0
- kard/transactions/types/fraudulent_transaction_data.py +30 -0
- kard/transactions/types/fraudulent_transaction_object.py +42 -0
- kard/transactions/types/fraudulent_transaction_request_body.py +45 -0
- kard/transactions/types/fraudulent_transaction_response.py +21 -0
- kard/transactions/types/get_earned_rewards_response.py +133 -0
- kard/transactions/types/matched_transactions_attributes.py +156 -0
- kard/transactions/types/matched_transactions_request.py +25 -0
- kard/transactions/types/merchant.py +82 -0
- kard/transactions/types/payment_status.py +5 -0
- kard/transactions/types/payment_type.py +5 -0
- kard/transactions/types/processor_mid.py +26 -0
- kard/transactions/types/receipt_medium_type.py +5 -0
- kard/transactions/types/rewarded_transaction.py +27 -0
- kard/transactions/types/rewarded_transaction_attributes.py +74 -0
- kard/transactions/types/rewarded_transaction_relationships.py +22 -0
- kard/transactions/types/rewarded_transaction_status.py +5 -0
- kard/transactions/types/rewarded_transaction_union.py +29 -0
- kard/transactions/types/states.py +68 -0
- kard/transactions/types/transaction_included_resource.py +47 -0
- kard/transactions/types/transaction_merchant_attributes.py +22 -0
- kard/transactions/types/transaction_merchant_resource.py +28 -0
- kard/transactions/types/transaction_offer_attributes.py +26 -0
- kard/transactions/types/transaction_offer_resource.py +28 -0
- kard/transactions/types/transaction_payment_type.py +5 -0
- kard/transactions/types/transaction_status.py +5 -0
- kard/transactions/types/transactions.py +46 -0
- kard/transactions/types/transactions_attributes.py +198 -0
- kard/transactions/types/transactions_multi_response.py +21 -0
- kard/transactions/types/transactions_request.py +25 -0
- kard/transactions/types/transactions_request_body.py +90 -0
- kard/transactions/types/transactions_response.py +38 -0
- kard/transactions/types/transactions_response_data.py +27 -0
- kard/transactions/types/visa_mid.py +23 -0
- kard/transactions/types/visa_mid_details.py +27 -0
- kard/users/__init__.py +293 -0
- kard/users/attributions/__init__.py +73 -0
- kard/users/attributions/client.py +229 -0
- kard/users/attributions/raw_client.py +215 -0
- kard/users/attributions/types/__init__.py +73 -0
- kard/users/attributions/types/create_attribution_request_object.py +75 -0
- kard/users/attributions/types/create_attribution_request_union.py +45 -0
- kard/users/attributions/types/create_attribution_response.py +38 -0
- kard/users/attributions/types/event_code.py +5 -0
- kard/users/attributions/types/notification_attribution_attributes.py +35 -0
- kard/users/attributions/types/notification_attribution_request.py +20 -0
- kard/users/attributions/types/notification_medium.py +5 -0
- kard/users/attributions/types/offer_attribution_attributes.py +35 -0
- kard/users/attributions/types/offer_attribution_request.py +20 -0
- kard/users/attributions/types/offer_medium.py +5 -0
- kard/users/client.py +512 -0
- kard/users/errors/__init__.py +34 -0
- kard/users/errors/multi_status.py +11 -0
- kard/users/raw_client.py +783 -0
- kard/users/rewards/__init__.py +133 -0
- kard/users/rewards/client.py +448 -0
- kard/users/rewards/raw_client.py +587 -0
- kard/users/rewards/types/__init__.py +130 -0
- kard/users/rewards/types/amount.py +21 -0
- kard/users/rewards/types/amount_type.py +5 -0
- kard/users/rewards/types/asset.py +28 -0
- kard/users/rewards/types/category_data.py +18 -0
- kard/users/rewards/types/category_fields.py +23 -0
- kard/users/rewards/types/category_identifier.py +24 -0
- kard/users/rewards/types/category_included.py +21 -0
- kard/users/rewards/types/category_relationship.py +20 -0
- kard/users/rewards/types/category_relationship_object.py +20 -0
- kard/users/rewards/types/commission.py +21 -0
- kard/users/rewards/types/coordinates.py +20 -0
- kard/users/rewards/types/eligibility_location_address.py +24 -0
- kard/users/rewards/types/eligibility_location_included.py +8 -0
- kard/users/rewards/types/eligibility_offer_included.py +7 -0
- kard/users/rewards/types/eligibility_offer_relationship.py +7 -0
- kard/users/rewards/types/location_attributes.py +28 -0
- kard/users/rewards/types/location_data.py +32 -0
- kard/users/rewards/types/location_relationships.py +18 -0
- kard/users/rewards/types/location_sort_options.py +5 -0
- kard/users/rewards/types/locations_response_object.py +215 -0
- kard/users/rewards/types/offer_common_fields.py +103 -0
- kard/users/rewards/types/offer_data_union.py +30 -0
- kard/users/rewards/types/offer_relationship.py +21 -0
- kard/users/rewards/types/offer_sort_options.py +7 -0
- kard/users/rewards/types/offers_response_object.py +130 -0
- kard/users/rewards/types/operation_hours.py +23 -0
- kard/users/rewards/types/operation_period.py +21 -0
- kard/users/rewards/types/operation_time.py +20 -0
- kard/users/rewards/types/standard_offer.py +21 -0
- kard/users/rewards/types/standard_offer_core.py +26 -0
- kard/users/rewards/types/standard_offer_fields.py +18 -0
- kard/users/types/__init__.py +66 -0
- kard/users/types/create_users_multi_status_response.py +21 -0
- kard/users/types/create_users_object.py +42 -0
- kard/users/types/delete_user_response_object.py +34 -0
- kard/users/types/update_user_object.py +40 -0
- kard/users/types/user_request_attributes.py +60 -0
- kard/users/types/user_request_data.py +22 -0
- kard/users/types/user_request_data_union.py +28 -0
- kard/users/types/user_response_no_data.py +22 -0
- kard/users/types/user_response_union_no_data.py +28 -0
- kard/users/uploads/__init__.py +112 -0
- kard/users/uploads/client.py +484 -0
- kard/users/uploads/errors/__init__.py +34 -0
- kard/users/uploads/errors/upload_part_multi_status.py +13 -0
- kard/users/uploads/raw_client.py +625 -0
- kard/users/uploads/types/__init__.py +119 -0
- kard/users/uploads/types/create_upload_part_data_union.py +27 -0
- kard/users/uploads/types/create_upload_part_multi_status_response.py +21 -0
- kard/users/uploads/types/create_upload_part_request_object.py +74 -0
- kard/users/uploads/types/create_upload_part_response_data.py +25 -0
- kard/users/uploads/types/create_upload_part_response_data_union.py +27 -0
- kard/users/uploads/types/create_upload_part_response_object.py +39 -0
- kard/users/uploads/types/create_upload_request_data_union.py +26 -0
- kard/users/uploads/types/create_upload_request_object.py +36 -0
- kard/users/uploads/types/create_upload_response_data.py +25 -0
- kard/users/uploads/types/create_upload_response_data_union.py +27 -0
- kard/users/uploads/types/create_upload_response_object.py +37 -0
- kard/users/uploads/types/historical_transaction_complete_no_data.py +25 -0
- kard/users/uploads/types/start_historical_upload_no_data.py +20 -0
- kard/users/uploads/types/update_upload_request_data_union.py +27 -0
- kard/users/uploads/types/update_upload_request_object.py +37 -0
- kard/users/uploads/types/update_upload_response_data.py +25 -0
- kard/users/uploads/types/update_upload_response_data_union.py +27 -0
- kard/users/uploads/types/update_upload_response_object.py +37 -0
- kard/version.py +3 -0
- kard_financial_sdk-0.0.82.dist-info/METADATA +238 -0
- kard_financial_sdk-0.0.82.dist-info/RECORD +302 -0
- kard_financial_sdk-0.0.82.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,625 @@
|
|
|
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 ...commons.errors.conflict_error import ConflictError
|
|
7
|
+
from ...commons.errors.internal_server_error import InternalServerError
|
|
8
|
+
from ...commons.errors.invalid_request import InvalidRequest
|
|
9
|
+
from ...commons.errors.unauthorized_error import UnauthorizedError
|
|
10
|
+
from ...commons.types.error_response import ErrorResponse
|
|
11
|
+
from ...commons.types.organization_id import OrganizationId
|
|
12
|
+
from ...core.api_error import ApiError
|
|
13
|
+
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
14
|
+
from ...core.http_response import AsyncHttpResponse, HttpResponse
|
|
15
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
|
16
|
+
from ...core.pydantic_utilities import parse_obj_as
|
|
17
|
+
from ...core.request_options import RequestOptions
|
|
18
|
+
from ...core.serialization import convert_and_respect_annotation_metadata
|
|
19
|
+
from .errors.upload_part_multi_status import UploadPartMultiStatus
|
|
20
|
+
from .types.create_upload_part_data_union import CreateUploadPartDataUnion
|
|
21
|
+
from .types.create_upload_part_multi_status_response import CreateUploadPartMultiStatusResponse
|
|
22
|
+
from .types.create_upload_part_response_object import CreateUploadPartResponseObject
|
|
23
|
+
from .types.create_upload_request_data_union import CreateUploadRequestDataUnion
|
|
24
|
+
from .types.create_upload_response_object import CreateUploadResponseObject
|
|
25
|
+
from .types.update_upload_request_data_union import UpdateUploadRequestDataUnion
|
|
26
|
+
from .types.update_upload_response_object import UpdateUploadResponseObject
|
|
27
|
+
|
|
28
|
+
# this is used as the default value for optional parameters
|
|
29
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class RawUploadsClient:
|
|
33
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
34
|
+
self._client_wrapper = client_wrapper
|
|
35
|
+
|
|
36
|
+
def create(
|
|
37
|
+
self,
|
|
38
|
+
organization_id: OrganizationId,
|
|
39
|
+
user_id: str,
|
|
40
|
+
*,
|
|
41
|
+
data: CreateUploadRequestDataUnion,
|
|
42
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
43
|
+
) -> HttpResponse[CreateUploadResponseObject]:
|
|
44
|
+
"""
|
|
45
|
+
Call this endpoint to create an upload session and retrieve an upload ID. Using the upload ID in the [Add Upload
|
|
46
|
+
Part](/api/uploads/create-upload-part) endpoint, historical transactions can be sent in batches for further processing.
|
|
47
|
+
<b>Required scopes:</b> `transaction:write`
|
|
48
|
+
|
|
49
|
+
Parameters
|
|
50
|
+
----------
|
|
51
|
+
organization_id : OrganizationId
|
|
52
|
+
|
|
53
|
+
user_id : str
|
|
54
|
+
The ID of the user as defined on the issuers system
|
|
55
|
+
|
|
56
|
+
data : CreateUploadRequestDataUnion
|
|
57
|
+
|
|
58
|
+
request_options : typing.Optional[RequestOptions]
|
|
59
|
+
Request-specific configuration.
|
|
60
|
+
|
|
61
|
+
Returns
|
|
62
|
+
-------
|
|
63
|
+
HttpResponse[CreateUploadResponseObject]
|
|
64
|
+
"""
|
|
65
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
66
|
+
f"v2/issuers/{jsonable_encoder(organization_id)}/users/{jsonable_encoder(user_id)}/uploads",
|
|
67
|
+
method="POST",
|
|
68
|
+
json={
|
|
69
|
+
"data": convert_and_respect_annotation_metadata(
|
|
70
|
+
object_=data, annotation=CreateUploadRequestDataUnion, direction="write"
|
|
71
|
+
),
|
|
72
|
+
},
|
|
73
|
+
request_options=request_options,
|
|
74
|
+
omit=OMIT,
|
|
75
|
+
)
|
|
76
|
+
try:
|
|
77
|
+
if 200 <= _response.status_code < 300:
|
|
78
|
+
_data = typing.cast(
|
|
79
|
+
CreateUploadResponseObject,
|
|
80
|
+
parse_obj_as(
|
|
81
|
+
type_=CreateUploadResponseObject, # type: ignore
|
|
82
|
+
object_=_response.json(),
|
|
83
|
+
),
|
|
84
|
+
)
|
|
85
|
+
return HttpResponse(response=_response, data=_data)
|
|
86
|
+
if _response.status_code == 401:
|
|
87
|
+
raise UnauthorizedError(
|
|
88
|
+
headers=dict(_response.headers),
|
|
89
|
+
body=typing.cast(
|
|
90
|
+
ErrorResponse,
|
|
91
|
+
parse_obj_as(
|
|
92
|
+
type_=ErrorResponse, # type: ignore
|
|
93
|
+
object_=_response.json(),
|
|
94
|
+
),
|
|
95
|
+
),
|
|
96
|
+
)
|
|
97
|
+
if _response.status_code == 500:
|
|
98
|
+
raise InternalServerError(
|
|
99
|
+
headers=dict(_response.headers),
|
|
100
|
+
body=typing.cast(
|
|
101
|
+
ErrorResponse,
|
|
102
|
+
parse_obj_as(
|
|
103
|
+
type_=ErrorResponse, # type: ignore
|
|
104
|
+
object_=_response.json(),
|
|
105
|
+
),
|
|
106
|
+
),
|
|
107
|
+
)
|
|
108
|
+
if _response.status_code == 400:
|
|
109
|
+
raise InvalidRequest(
|
|
110
|
+
headers=dict(_response.headers),
|
|
111
|
+
body=typing.cast(
|
|
112
|
+
ErrorResponse,
|
|
113
|
+
parse_obj_as(
|
|
114
|
+
type_=ErrorResponse, # type: ignore
|
|
115
|
+
object_=_response.json(),
|
|
116
|
+
),
|
|
117
|
+
),
|
|
118
|
+
)
|
|
119
|
+
_response_json = _response.json()
|
|
120
|
+
except JSONDecodeError:
|
|
121
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
122
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
123
|
+
|
|
124
|
+
def create_part(
|
|
125
|
+
self,
|
|
126
|
+
organization_id: OrganizationId,
|
|
127
|
+
user_id: str,
|
|
128
|
+
upload_id: str,
|
|
129
|
+
*,
|
|
130
|
+
data: typing.Sequence[CreateUploadPartDataUnion],
|
|
131
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
132
|
+
) -> HttpResponse[CreateUploadPartResponseObject]:
|
|
133
|
+
"""
|
|
134
|
+
Call this endpoint using the upload ID provided in the [Create Upload](/api/uploads/create-upload) endpoint to add parts to your upload. Currently, this endpoint supports adding historical transactions.
|
|
135
|
+
<b>Required scopes:</b> `transaction:write`
|
|
136
|
+
<b>Note:</b> `Maximum of 500 transactions can be uploaded per request`.
|
|
137
|
+
|
|
138
|
+
Parameters
|
|
139
|
+
----------
|
|
140
|
+
organization_id : OrganizationId
|
|
141
|
+
|
|
142
|
+
user_id : str
|
|
143
|
+
The ID of the user as defined on the issuers system
|
|
144
|
+
|
|
145
|
+
upload_id : str
|
|
146
|
+
The upload ID identifying the upload session to add parts
|
|
147
|
+
|
|
148
|
+
data : typing.Sequence[CreateUploadPartDataUnion]
|
|
149
|
+
|
|
150
|
+
request_options : typing.Optional[RequestOptions]
|
|
151
|
+
Request-specific configuration.
|
|
152
|
+
|
|
153
|
+
Returns
|
|
154
|
+
-------
|
|
155
|
+
HttpResponse[CreateUploadPartResponseObject]
|
|
156
|
+
"""
|
|
157
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
158
|
+
f"v2/issuers/{jsonable_encoder(organization_id)}/users/{jsonable_encoder(user_id)}/uploads/{jsonable_encoder(upload_id)}/parts",
|
|
159
|
+
method="PUT",
|
|
160
|
+
json={
|
|
161
|
+
"data": convert_and_respect_annotation_metadata(
|
|
162
|
+
object_=data, annotation=typing.Sequence[CreateUploadPartDataUnion], direction="write"
|
|
163
|
+
),
|
|
164
|
+
},
|
|
165
|
+
request_options=request_options,
|
|
166
|
+
omit=OMIT,
|
|
167
|
+
)
|
|
168
|
+
try:
|
|
169
|
+
if 200 <= _response.status_code < 300:
|
|
170
|
+
_data = typing.cast(
|
|
171
|
+
CreateUploadPartResponseObject,
|
|
172
|
+
parse_obj_as(
|
|
173
|
+
type_=CreateUploadPartResponseObject, # type: ignore
|
|
174
|
+
object_=_response.json(),
|
|
175
|
+
),
|
|
176
|
+
)
|
|
177
|
+
return HttpResponse(response=_response, data=_data)
|
|
178
|
+
if _response.status_code == 401:
|
|
179
|
+
raise UnauthorizedError(
|
|
180
|
+
headers=dict(_response.headers),
|
|
181
|
+
body=typing.cast(
|
|
182
|
+
ErrorResponse,
|
|
183
|
+
parse_obj_as(
|
|
184
|
+
type_=ErrorResponse, # type: ignore
|
|
185
|
+
object_=_response.json(),
|
|
186
|
+
),
|
|
187
|
+
),
|
|
188
|
+
)
|
|
189
|
+
if _response.status_code == 500:
|
|
190
|
+
raise InternalServerError(
|
|
191
|
+
headers=dict(_response.headers),
|
|
192
|
+
body=typing.cast(
|
|
193
|
+
ErrorResponse,
|
|
194
|
+
parse_obj_as(
|
|
195
|
+
type_=ErrorResponse, # type: ignore
|
|
196
|
+
object_=_response.json(),
|
|
197
|
+
),
|
|
198
|
+
),
|
|
199
|
+
)
|
|
200
|
+
if _response.status_code == 400:
|
|
201
|
+
raise InvalidRequest(
|
|
202
|
+
headers=dict(_response.headers),
|
|
203
|
+
body=typing.cast(
|
|
204
|
+
ErrorResponse,
|
|
205
|
+
parse_obj_as(
|
|
206
|
+
type_=ErrorResponse, # type: ignore
|
|
207
|
+
object_=_response.json(),
|
|
208
|
+
),
|
|
209
|
+
),
|
|
210
|
+
)
|
|
211
|
+
if _response.status_code == 207:
|
|
212
|
+
raise UploadPartMultiStatus(
|
|
213
|
+
headers=dict(_response.headers),
|
|
214
|
+
body=typing.cast(
|
|
215
|
+
CreateUploadPartMultiStatusResponse,
|
|
216
|
+
parse_obj_as(
|
|
217
|
+
type_=CreateUploadPartMultiStatusResponse, # type: ignore
|
|
218
|
+
object_=_response.json(),
|
|
219
|
+
),
|
|
220
|
+
),
|
|
221
|
+
)
|
|
222
|
+
_response_json = _response.json()
|
|
223
|
+
except JSONDecodeError:
|
|
224
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
225
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
226
|
+
|
|
227
|
+
def update(
|
|
228
|
+
self,
|
|
229
|
+
organization_id: OrganizationId,
|
|
230
|
+
user_id: str,
|
|
231
|
+
upload_id: str,
|
|
232
|
+
*,
|
|
233
|
+
data: UpdateUploadRequestDataUnion,
|
|
234
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
235
|
+
) -> HttpResponse[UpdateUploadResponseObject]:
|
|
236
|
+
"""
|
|
237
|
+
Call this endpoint to update your upload session. Currently, you can signal completing a historical transactions upload.
|
|
238
|
+
<b>Required scopes:</b> `transaction:write`
|
|
239
|
+
|
|
240
|
+
Parameters
|
|
241
|
+
----------
|
|
242
|
+
organization_id : OrganizationId
|
|
243
|
+
|
|
244
|
+
user_id : str
|
|
245
|
+
The ID of the user as defined on the issuers system
|
|
246
|
+
|
|
247
|
+
upload_id : str
|
|
248
|
+
The upload ID identifying the upload session to update
|
|
249
|
+
|
|
250
|
+
data : UpdateUploadRequestDataUnion
|
|
251
|
+
|
|
252
|
+
request_options : typing.Optional[RequestOptions]
|
|
253
|
+
Request-specific configuration.
|
|
254
|
+
|
|
255
|
+
Returns
|
|
256
|
+
-------
|
|
257
|
+
HttpResponse[UpdateUploadResponseObject]
|
|
258
|
+
"""
|
|
259
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
260
|
+
f"v2/issuers/{jsonable_encoder(organization_id)}/users/{jsonable_encoder(user_id)}/uploads/{jsonable_encoder(upload_id)}",
|
|
261
|
+
method="PUT",
|
|
262
|
+
json={
|
|
263
|
+
"data": convert_and_respect_annotation_metadata(
|
|
264
|
+
object_=data, annotation=UpdateUploadRequestDataUnion, direction="write"
|
|
265
|
+
),
|
|
266
|
+
},
|
|
267
|
+
request_options=request_options,
|
|
268
|
+
omit=OMIT,
|
|
269
|
+
)
|
|
270
|
+
try:
|
|
271
|
+
if 200 <= _response.status_code < 300:
|
|
272
|
+
_data = typing.cast(
|
|
273
|
+
UpdateUploadResponseObject,
|
|
274
|
+
parse_obj_as(
|
|
275
|
+
type_=UpdateUploadResponseObject, # type: ignore
|
|
276
|
+
object_=_response.json(),
|
|
277
|
+
),
|
|
278
|
+
)
|
|
279
|
+
return HttpResponse(response=_response, data=_data)
|
|
280
|
+
if _response.status_code == 401:
|
|
281
|
+
raise UnauthorizedError(
|
|
282
|
+
headers=dict(_response.headers),
|
|
283
|
+
body=typing.cast(
|
|
284
|
+
ErrorResponse,
|
|
285
|
+
parse_obj_as(
|
|
286
|
+
type_=ErrorResponse, # type: ignore
|
|
287
|
+
object_=_response.json(),
|
|
288
|
+
),
|
|
289
|
+
),
|
|
290
|
+
)
|
|
291
|
+
if _response.status_code == 500:
|
|
292
|
+
raise InternalServerError(
|
|
293
|
+
headers=dict(_response.headers),
|
|
294
|
+
body=typing.cast(
|
|
295
|
+
ErrorResponse,
|
|
296
|
+
parse_obj_as(
|
|
297
|
+
type_=ErrorResponse, # type: ignore
|
|
298
|
+
object_=_response.json(),
|
|
299
|
+
),
|
|
300
|
+
),
|
|
301
|
+
)
|
|
302
|
+
if _response.status_code == 400:
|
|
303
|
+
raise InvalidRequest(
|
|
304
|
+
headers=dict(_response.headers),
|
|
305
|
+
body=typing.cast(
|
|
306
|
+
ErrorResponse,
|
|
307
|
+
parse_obj_as(
|
|
308
|
+
type_=ErrorResponse, # type: ignore
|
|
309
|
+
object_=_response.json(),
|
|
310
|
+
),
|
|
311
|
+
),
|
|
312
|
+
)
|
|
313
|
+
if _response.status_code == 409:
|
|
314
|
+
raise ConflictError(
|
|
315
|
+
headers=dict(_response.headers),
|
|
316
|
+
body=typing.cast(
|
|
317
|
+
ErrorResponse,
|
|
318
|
+
parse_obj_as(
|
|
319
|
+
type_=ErrorResponse, # type: ignore
|
|
320
|
+
object_=_response.json(),
|
|
321
|
+
),
|
|
322
|
+
),
|
|
323
|
+
)
|
|
324
|
+
_response_json = _response.json()
|
|
325
|
+
except JSONDecodeError:
|
|
326
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
327
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
class AsyncRawUploadsClient:
|
|
331
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
332
|
+
self._client_wrapper = client_wrapper
|
|
333
|
+
|
|
334
|
+
async def create(
|
|
335
|
+
self,
|
|
336
|
+
organization_id: OrganizationId,
|
|
337
|
+
user_id: str,
|
|
338
|
+
*,
|
|
339
|
+
data: CreateUploadRequestDataUnion,
|
|
340
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
341
|
+
) -> AsyncHttpResponse[CreateUploadResponseObject]:
|
|
342
|
+
"""
|
|
343
|
+
Call this endpoint to create an upload session and retrieve an upload ID. Using the upload ID in the [Add Upload
|
|
344
|
+
Part](/api/uploads/create-upload-part) endpoint, historical transactions can be sent in batches for further processing.
|
|
345
|
+
<b>Required scopes:</b> `transaction:write`
|
|
346
|
+
|
|
347
|
+
Parameters
|
|
348
|
+
----------
|
|
349
|
+
organization_id : OrganizationId
|
|
350
|
+
|
|
351
|
+
user_id : str
|
|
352
|
+
The ID of the user as defined on the issuers system
|
|
353
|
+
|
|
354
|
+
data : CreateUploadRequestDataUnion
|
|
355
|
+
|
|
356
|
+
request_options : typing.Optional[RequestOptions]
|
|
357
|
+
Request-specific configuration.
|
|
358
|
+
|
|
359
|
+
Returns
|
|
360
|
+
-------
|
|
361
|
+
AsyncHttpResponse[CreateUploadResponseObject]
|
|
362
|
+
"""
|
|
363
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
364
|
+
f"v2/issuers/{jsonable_encoder(organization_id)}/users/{jsonable_encoder(user_id)}/uploads",
|
|
365
|
+
method="POST",
|
|
366
|
+
json={
|
|
367
|
+
"data": convert_and_respect_annotation_metadata(
|
|
368
|
+
object_=data, annotation=CreateUploadRequestDataUnion, direction="write"
|
|
369
|
+
),
|
|
370
|
+
},
|
|
371
|
+
request_options=request_options,
|
|
372
|
+
omit=OMIT,
|
|
373
|
+
)
|
|
374
|
+
try:
|
|
375
|
+
if 200 <= _response.status_code < 300:
|
|
376
|
+
_data = typing.cast(
|
|
377
|
+
CreateUploadResponseObject,
|
|
378
|
+
parse_obj_as(
|
|
379
|
+
type_=CreateUploadResponseObject, # type: ignore
|
|
380
|
+
object_=_response.json(),
|
|
381
|
+
),
|
|
382
|
+
)
|
|
383
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
384
|
+
if _response.status_code == 401:
|
|
385
|
+
raise UnauthorizedError(
|
|
386
|
+
headers=dict(_response.headers),
|
|
387
|
+
body=typing.cast(
|
|
388
|
+
ErrorResponse,
|
|
389
|
+
parse_obj_as(
|
|
390
|
+
type_=ErrorResponse, # type: ignore
|
|
391
|
+
object_=_response.json(),
|
|
392
|
+
),
|
|
393
|
+
),
|
|
394
|
+
)
|
|
395
|
+
if _response.status_code == 500:
|
|
396
|
+
raise InternalServerError(
|
|
397
|
+
headers=dict(_response.headers),
|
|
398
|
+
body=typing.cast(
|
|
399
|
+
ErrorResponse,
|
|
400
|
+
parse_obj_as(
|
|
401
|
+
type_=ErrorResponse, # type: ignore
|
|
402
|
+
object_=_response.json(),
|
|
403
|
+
),
|
|
404
|
+
),
|
|
405
|
+
)
|
|
406
|
+
if _response.status_code == 400:
|
|
407
|
+
raise InvalidRequest(
|
|
408
|
+
headers=dict(_response.headers),
|
|
409
|
+
body=typing.cast(
|
|
410
|
+
ErrorResponse,
|
|
411
|
+
parse_obj_as(
|
|
412
|
+
type_=ErrorResponse, # type: ignore
|
|
413
|
+
object_=_response.json(),
|
|
414
|
+
),
|
|
415
|
+
),
|
|
416
|
+
)
|
|
417
|
+
_response_json = _response.json()
|
|
418
|
+
except JSONDecodeError:
|
|
419
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
420
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
421
|
+
|
|
422
|
+
async def create_part(
|
|
423
|
+
self,
|
|
424
|
+
organization_id: OrganizationId,
|
|
425
|
+
user_id: str,
|
|
426
|
+
upload_id: str,
|
|
427
|
+
*,
|
|
428
|
+
data: typing.Sequence[CreateUploadPartDataUnion],
|
|
429
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
430
|
+
) -> AsyncHttpResponse[CreateUploadPartResponseObject]:
|
|
431
|
+
"""
|
|
432
|
+
Call this endpoint using the upload ID provided in the [Create Upload](/api/uploads/create-upload) endpoint to add parts to your upload. Currently, this endpoint supports adding historical transactions.
|
|
433
|
+
<b>Required scopes:</b> `transaction:write`
|
|
434
|
+
<b>Note:</b> `Maximum of 500 transactions can be uploaded per request`.
|
|
435
|
+
|
|
436
|
+
Parameters
|
|
437
|
+
----------
|
|
438
|
+
organization_id : OrganizationId
|
|
439
|
+
|
|
440
|
+
user_id : str
|
|
441
|
+
The ID of the user as defined on the issuers system
|
|
442
|
+
|
|
443
|
+
upload_id : str
|
|
444
|
+
The upload ID identifying the upload session to add parts
|
|
445
|
+
|
|
446
|
+
data : typing.Sequence[CreateUploadPartDataUnion]
|
|
447
|
+
|
|
448
|
+
request_options : typing.Optional[RequestOptions]
|
|
449
|
+
Request-specific configuration.
|
|
450
|
+
|
|
451
|
+
Returns
|
|
452
|
+
-------
|
|
453
|
+
AsyncHttpResponse[CreateUploadPartResponseObject]
|
|
454
|
+
"""
|
|
455
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
456
|
+
f"v2/issuers/{jsonable_encoder(organization_id)}/users/{jsonable_encoder(user_id)}/uploads/{jsonable_encoder(upload_id)}/parts",
|
|
457
|
+
method="PUT",
|
|
458
|
+
json={
|
|
459
|
+
"data": convert_and_respect_annotation_metadata(
|
|
460
|
+
object_=data, annotation=typing.Sequence[CreateUploadPartDataUnion], direction="write"
|
|
461
|
+
),
|
|
462
|
+
},
|
|
463
|
+
request_options=request_options,
|
|
464
|
+
omit=OMIT,
|
|
465
|
+
)
|
|
466
|
+
try:
|
|
467
|
+
if 200 <= _response.status_code < 300:
|
|
468
|
+
_data = typing.cast(
|
|
469
|
+
CreateUploadPartResponseObject,
|
|
470
|
+
parse_obj_as(
|
|
471
|
+
type_=CreateUploadPartResponseObject, # type: ignore
|
|
472
|
+
object_=_response.json(),
|
|
473
|
+
),
|
|
474
|
+
)
|
|
475
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
476
|
+
if _response.status_code == 401:
|
|
477
|
+
raise UnauthorizedError(
|
|
478
|
+
headers=dict(_response.headers),
|
|
479
|
+
body=typing.cast(
|
|
480
|
+
ErrorResponse,
|
|
481
|
+
parse_obj_as(
|
|
482
|
+
type_=ErrorResponse, # type: ignore
|
|
483
|
+
object_=_response.json(),
|
|
484
|
+
),
|
|
485
|
+
),
|
|
486
|
+
)
|
|
487
|
+
if _response.status_code == 500:
|
|
488
|
+
raise InternalServerError(
|
|
489
|
+
headers=dict(_response.headers),
|
|
490
|
+
body=typing.cast(
|
|
491
|
+
ErrorResponse,
|
|
492
|
+
parse_obj_as(
|
|
493
|
+
type_=ErrorResponse, # type: ignore
|
|
494
|
+
object_=_response.json(),
|
|
495
|
+
),
|
|
496
|
+
),
|
|
497
|
+
)
|
|
498
|
+
if _response.status_code == 400:
|
|
499
|
+
raise InvalidRequest(
|
|
500
|
+
headers=dict(_response.headers),
|
|
501
|
+
body=typing.cast(
|
|
502
|
+
ErrorResponse,
|
|
503
|
+
parse_obj_as(
|
|
504
|
+
type_=ErrorResponse, # type: ignore
|
|
505
|
+
object_=_response.json(),
|
|
506
|
+
),
|
|
507
|
+
),
|
|
508
|
+
)
|
|
509
|
+
if _response.status_code == 207:
|
|
510
|
+
raise UploadPartMultiStatus(
|
|
511
|
+
headers=dict(_response.headers),
|
|
512
|
+
body=typing.cast(
|
|
513
|
+
CreateUploadPartMultiStatusResponse,
|
|
514
|
+
parse_obj_as(
|
|
515
|
+
type_=CreateUploadPartMultiStatusResponse, # type: ignore
|
|
516
|
+
object_=_response.json(),
|
|
517
|
+
),
|
|
518
|
+
),
|
|
519
|
+
)
|
|
520
|
+
_response_json = _response.json()
|
|
521
|
+
except JSONDecodeError:
|
|
522
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
523
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
524
|
+
|
|
525
|
+
async def update(
|
|
526
|
+
self,
|
|
527
|
+
organization_id: OrganizationId,
|
|
528
|
+
user_id: str,
|
|
529
|
+
upload_id: str,
|
|
530
|
+
*,
|
|
531
|
+
data: UpdateUploadRequestDataUnion,
|
|
532
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
533
|
+
) -> AsyncHttpResponse[UpdateUploadResponseObject]:
|
|
534
|
+
"""
|
|
535
|
+
Call this endpoint to update your upload session. Currently, you can signal completing a historical transactions upload.
|
|
536
|
+
<b>Required scopes:</b> `transaction:write`
|
|
537
|
+
|
|
538
|
+
Parameters
|
|
539
|
+
----------
|
|
540
|
+
organization_id : OrganizationId
|
|
541
|
+
|
|
542
|
+
user_id : str
|
|
543
|
+
The ID of the user as defined on the issuers system
|
|
544
|
+
|
|
545
|
+
upload_id : str
|
|
546
|
+
The upload ID identifying the upload session to update
|
|
547
|
+
|
|
548
|
+
data : UpdateUploadRequestDataUnion
|
|
549
|
+
|
|
550
|
+
request_options : typing.Optional[RequestOptions]
|
|
551
|
+
Request-specific configuration.
|
|
552
|
+
|
|
553
|
+
Returns
|
|
554
|
+
-------
|
|
555
|
+
AsyncHttpResponse[UpdateUploadResponseObject]
|
|
556
|
+
"""
|
|
557
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
558
|
+
f"v2/issuers/{jsonable_encoder(organization_id)}/users/{jsonable_encoder(user_id)}/uploads/{jsonable_encoder(upload_id)}",
|
|
559
|
+
method="PUT",
|
|
560
|
+
json={
|
|
561
|
+
"data": convert_and_respect_annotation_metadata(
|
|
562
|
+
object_=data, annotation=UpdateUploadRequestDataUnion, direction="write"
|
|
563
|
+
),
|
|
564
|
+
},
|
|
565
|
+
request_options=request_options,
|
|
566
|
+
omit=OMIT,
|
|
567
|
+
)
|
|
568
|
+
try:
|
|
569
|
+
if 200 <= _response.status_code < 300:
|
|
570
|
+
_data = typing.cast(
|
|
571
|
+
UpdateUploadResponseObject,
|
|
572
|
+
parse_obj_as(
|
|
573
|
+
type_=UpdateUploadResponseObject, # type: ignore
|
|
574
|
+
object_=_response.json(),
|
|
575
|
+
),
|
|
576
|
+
)
|
|
577
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
578
|
+
if _response.status_code == 401:
|
|
579
|
+
raise UnauthorizedError(
|
|
580
|
+
headers=dict(_response.headers),
|
|
581
|
+
body=typing.cast(
|
|
582
|
+
ErrorResponse,
|
|
583
|
+
parse_obj_as(
|
|
584
|
+
type_=ErrorResponse, # type: ignore
|
|
585
|
+
object_=_response.json(),
|
|
586
|
+
),
|
|
587
|
+
),
|
|
588
|
+
)
|
|
589
|
+
if _response.status_code == 500:
|
|
590
|
+
raise InternalServerError(
|
|
591
|
+
headers=dict(_response.headers),
|
|
592
|
+
body=typing.cast(
|
|
593
|
+
ErrorResponse,
|
|
594
|
+
parse_obj_as(
|
|
595
|
+
type_=ErrorResponse, # type: ignore
|
|
596
|
+
object_=_response.json(),
|
|
597
|
+
),
|
|
598
|
+
),
|
|
599
|
+
)
|
|
600
|
+
if _response.status_code == 400:
|
|
601
|
+
raise InvalidRequest(
|
|
602
|
+
headers=dict(_response.headers),
|
|
603
|
+
body=typing.cast(
|
|
604
|
+
ErrorResponse,
|
|
605
|
+
parse_obj_as(
|
|
606
|
+
type_=ErrorResponse, # type: ignore
|
|
607
|
+
object_=_response.json(),
|
|
608
|
+
),
|
|
609
|
+
),
|
|
610
|
+
)
|
|
611
|
+
if _response.status_code == 409:
|
|
612
|
+
raise ConflictError(
|
|
613
|
+
headers=dict(_response.headers),
|
|
614
|
+
body=typing.cast(
|
|
615
|
+
ErrorResponse,
|
|
616
|
+
parse_obj_as(
|
|
617
|
+
type_=ErrorResponse, # type: ignore
|
|
618
|
+
object_=_response.json(),
|
|
619
|
+
),
|
|
620
|
+
),
|
|
621
|
+
)
|
|
622
|
+
_response_json = _response.json()
|
|
623
|
+
except JSONDecodeError:
|
|
624
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
625
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|