paid-python 1.0.0a0__py3-none-any.whl → 1.0.0a1__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.
- paid/__init__.py +61 -122
- paid/client.py +16 -22
- paid/contacts/client.py +415 -133
- paid/contacts/raw_client.py +1046 -118
- paid/core/client_wrapper.py +8 -10
- paid/customers/__init__.py +0 -3
- paid/customers/client.py +392 -1112
- paid/customers/raw_client.py +656 -1054
- paid/environment.py +1 -1
- paid/errors/bad_request_error.py +2 -2
- paid/errors/forbidden_error.py +2 -2
- paid/errors/internal_server_error.py +2 -2
- paid/errors/not_found_error.py +2 -2
- paid/invoices/client.py +369 -0
- paid/{plans → invoices}/raw_client.py +310 -201
- paid/orders/__init__.py +0 -3
- paid/orders/client.py +279 -471
- paid/orders/raw_client.py +551 -538
- paid/products/__init__.py +0 -3
- paid/products/client.py +129 -265
- paid/products/raw_client.py +563 -233
- paid/signals/client.py +130 -0
- paid/signals/raw_client.py +190 -0
- paid/tracing/autoinstrumentation.py +12 -6
- paid/tracing/context_manager.py +2 -6
- paid/tracing/distributed_tracing.py +3 -3
- paid/tracing/signal.py +3 -3
- paid/tracing/wrappers/openai_agents/openaiAgentsHook.py +1 -1
- paid/types/__init__.py +58 -110
- paid/types/attribution.py +8 -0
- paid/types/{agent_attribute.py → bulk_signals_response.py} +4 -5
- paid/types/contact.py +12 -20
- paid/types/{address.py → contact_billing_address.py} +6 -7
- paid/types/{traces_response.py → contact_list_response.py} +5 -9
- paid/types/customer.py +15 -22
- paid/types/customer_attribution.py +8 -0
- paid/types/customer_billing_address.py +26 -0
- paid/types/{usage_summary_order.py → customer_by_external_id.py} +3 -5
- paid/types/{usage_summary_order_line.py → customer_by_id.py} +3 -5
- paid/types/customer_creation_state.py +5 -0
- paid/types/customer_list_response.py +22 -0
- paid/types/empty_response.py +17 -0
- paid/types/{error.py → error_response.py} +4 -7
- paid/types/invoice.py +33 -51
- paid/types/invoice_line.py +42 -0
- paid/types/invoice_line_payment_status.py +7 -0
- paid/types/invoice_lines_response.py +22 -0
- paid/types/invoice_list_response.py +22 -0
- paid/types/invoice_payment_status.py +5 -0
- paid/types/invoice_source.py +5 -0
- paid/types/invoice_status.py +3 -1
- paid/types/invoice_tax_status.py +7 -0
- paid/types/order.py +30 -29
- paid/types/order_creation_state.py +5 -0
- paid/types/order_line.py +6 -24
- paid/types/order_lines_response.py +22 -0
- paid/types/order_list_response.py +22 -0
- paid/types/pagination.py +24 -0
- paid/types/product.py +4 -29
- paid/types/{tier.py → product_by_external_id.py} +5 -4
- paid/types/{cost_amount.py → product_by_id.py} +5 -12
- paid/types/product_list_response.py +22 -0
- paid/types/signal.py +8 -34
- paid/types/{agent_update.py → update_contact_request.py} +10 -9
- paid/types/update_customer_request.py +38 -0
- paid/types/{product_update.py → update_product_request.py} +2 -12
- {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a1.dist-info}/METADATA +22 -8
- paid_python-1.0.0a1.dist-info/RECORD +110 -0
- paid/agents/client.py +0 -880
- paid/agents/raw_client.py +0 -785
- paid/customers/types/__init__.py +0 -8
- paid/customers/types/customers_check_entitlement_request_view.py +0 -5
- paid/customers/types/customers_check_entitlement_response.py +0 -22
- paid/orders/lines/client.py +0 -144
- paid/orders/lines/raw_client.py +0 -129
- paid/plans/__init__.py +0 -4
- paid/plans/client.py +0 -403
- paid/products/types/__init__.py +0 -7
- paid/products/types/product_create_type.py +0 -5
- paid/traces/__init__.py +0 -4
- paid/traces/client.py +0 -218
- paid/traces/raw_client.py +0 -226
- paid/types/agent.py +0 -31
- paid/types/agent_price_point.py +0 -27
- paid/types/agent_price_point_tiers.py +0 -23
- paid/types/api_error.py +0 -29
- paid/types/billing_frequency.py +0 -5
- paid/types/cancel_renewal_response.py +0 -49
- paid/types/charge_type.py +0 -5
- paid/types/contact_create_for_customer.py +0 -37
- paid/types/cost_trace.py +0 -55
- paid/types/cost_traces_response.py +0 -26
- paid/types/creation_source.py +0 -5
- paid/types/creation_state.py +0 -5
- paid/types/customer_update.py +0 -40
- paid/types/entitlement_usage.py +0 -48
- paid/types/order_line_attribute.py +0 -27
- paid/types/order_line_attribute_create_one.py +0 -5
- paid/types/order_line_attribute_pricing.py +0 -33
- paid/types/order_line_create.py +0 -72
- paid/types/pagination_meta.py +0 -84
- paid/types/payment_method.py +0 -58
- paid/types/payment_method_card.py +0 -49
- paid/types/payment_method_type.py +0 -5
- paid/types/payment_method_us_bank_account.py +0 -36
- paid/types/payment_method_us_bank_account_account_type.py +0 -5
- paid/types/plan.py +0 -81
- paid/types/plan_group.py +0 -60
- paid/types/plan_plan_products_item.py +0 -41
- paid/types/plan_plan_products_item_plan_product_attribute_item.py +0 -34
- paid/types/plan_with_features.py +0 -69
- paid/types/plan_with_features_features_item.py +0 -34
- paid/types/price_point.py +0 -25
- paid/types/pricing.py +0 -31
- paid/types/pricing_model_type.py +0 -7
- paid/types/product_type.py +0 -5
- paid/types/product_update_type.py +0 -5
- paid/types/proration_attribute_update.py +0 -44
- paid/types/proration_detail.py +0 -49
- paid/types/proration_upgrade_response.py +0 -73
- paid/types/salutation.py +0 -5
- paid/types/signal_v_2.py +0 -56
- paid/types/tax_exempt_status.py +0 -5
- paid/types/trace.py +0 -69
- paid/types/usage_pagination_meta.py +0 -43
- paid/types/usage_summaries_response.py +0 -26
- paid/types/usage_summary.py +0 -121
- paid/usage/__init__.py +0 -7
- paid/usage/client.py +0 -321
- paid/usage/raw_client.py +0 -387
- paid/usage/types/__init__.py +0 -7
- paid/usage/types/usage_check_usage_response.py +0 -53
- paid_python-1.0.0a0.dist-info/RECORD +0 -152
- /paid/{agents → invoices}/__init__.py +0 -0
- /paid/{orders/lines → signals}/__init__.py +0 -0
- {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a1.dist-info}/LICENSE +0 -0
- {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a1.dist-info}/WHEEL +0 -0
paid/orders/raw_client.py
CHANGED
|
@@ -10,17 +10,16 @@ from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
|
10
10
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
11
11
|
from ..core.pydantic_utilities import parse_obj_as
|
|
12
12
|
from ..core.request_options import RequestOptions
|
|
13
|
-
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
14
13
|
from ..errors.bad_request_error import BadRequestError
|
|
15
14
|
from ..errors.forbidden_error import ForbiddenError
|
|
15
|
+
from ..errors.internal_server_error import InternalServerError
|
|
16
16
|
from ..errors.not_found_error import NotFoundError
|
|
17
|
-
from ..types.
|
|
18
|
-
from ..types.
|
|
19
|
-
from ..types.invoice import Invoice
|
|
17
|
+
from ..types.empty_response import EmptyResponse
|
|
18
|
+
from ..types.error_response import ErrorResponse
|
|
20
19
|
from ..types.order import Order
|
|
21
|
-
from ..types.
|
|
22
|
-
from ..types.
|
|
23
|
-
from ..types.
|
|
20
|
+
from ..types.order_creation_state import OrderCreationState
|
|
21
|
+
from ..types.order_lines_response import OrderLinesResponse
|
|
22
|
+
from ..types.order_list_response import OrderListResponse
|
|
24
23
|
|
|
25
24
|
# this is used as the default value for optional parameters
|
|
26
25
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -30,76 +29,132 @@ class RawOrdersClient:
|
|
|
30
29
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
31
30
|
self._client_wrapper = client_wrapper
|
|
32
31
|
|
|
33
|
-
def
|
|
32
|
+
def list_orders(
|
|
33
|
+
self,
|
|
34
|
+
*,
|
|
35
|
+
limit: typing.Optional[int] = None,
|
|
36
|
+
offset: typing.Optional[int] = None,
|
|
37
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
38
|
+
) -> HttpResponse[OrderListResponse]:
|
|
34
39
|
"""
|
|
40
|
+
Get a list of orders for the organization
|
|
41
|
+
|
|
35
42
|
Parameters
|
|
36
43
|
----------
|
|
44
|
+
limit : typing.Optional[int]
|
|
45
|
+
|
|
46
|
+
offset : typing.Optional[int]
|
|
47
|
+
|
|
37
48
|
request_options : typing.Optional[RequestOptions]
|
|
38
49
|
Request-specific configuration.
|
|
39
50
|
|
|
40
51
|
Returns
|
|
41
52
|
-------
|
|
42
|
-
HttpResponse[
|
|
43
|
-
|
|
53
|
+
HttpResponse[OrderListResponse]
|
|
54
|
+
200
|
|
44
55
|
"""
|
|
45
56
|
_response = self._client_wrapper.httpx_client.request(
|
|
46
|
-
"orders",
|
|
57
|
+
"orders/",
|
|
47
58
|
method="GET",
|
|
59
|
+
params={
|
|
60
|
+
"limit": limit,
|
|
61
|
+
"offset": offset,
|
|
62
|
+
},
|
|
48
63
|
request_options=request_options,
|
|
49
64
|
)
|
|
50
65
|
try:
|
|
51
66
|
if 200 <= _response.status_code < 300:
|
|
52
67
|
_data = typing.cast(
|
|
53
|
-
|
|
68
|
+
OrderListResponse,
|
|
54
69
|
parse_obj_as(
|
|
55
|
-
type_=
|
|
70
|
+
type_=OrderListResponse, # type: ignore
|
|
56
71
|
object_=_response.json(),
|
|
57
72
|
),
|
|
58
73
|
)
|
|
59
74
|
return HttpResponse(response=_response, data=_data)
|
|
75
|
+
if _response.status_code == 400:
|
|
76
|
+
raise BadRequestError(
|
|
77
|
+
headers=dict(_response.headers),
|
|
78
|
+
body=typing.cast(
|
|
79
|
+
ErrorResponse,
|
|
80
|
+
parse_obj_as(
|
|
81
|
+
type_=ErrorResponse, # type: ignore
|
|
82
|
+
object_=_response.json(),
|
|
83
|
+
),
|
|
84
|
+
),
|
|
85
|
+
)
|
|
86
|
+
if _response.status_code == 403:
|
|
87
|
+
raise ForbiddenError(
|
|
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
|
+
)
|
|
60
108
|
_response_json = _response.json()
|
|
61
109
|
except JSONDecodeError:
|
|
62
110
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
63
111
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
64
112
|
|
|
65
|
-
def
|
|
113
|
+
def create_a_new_order(
|
|
66
114
|
self,
|
|
67
115
|
*,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
116
|
+
customer_id: str,
|
|
117
|
+
billing_customer_id: typing.Optional[str] = OMIT,
|
|
118
|
+
billing_contact_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
119
|
+
name: typing.Optional[str] = OMIT,
|
|
120
|
+
start_date: typing.Optional[dt.datetime] = OMIT,
|
|
121
|
+
end_date: typing.Optional[dt.datetime] = OMIT,
|
|
122
|
+
subscription_terms: typing.Optional[int] = OMIT,
|
|
123
|
+
creation_state: typing.Optional[OrderCreationState] = OMIT,
|
|
124
|
+
billing_anchor: typing.Optional[float] = OMIT,
|
|
125
|
+
payment_terms: typing.Optional[str] = OMIT,
|
|
126
|
+
external_id: typing.Optional[str] = OMIT,
|
|
127
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
78
128
|
request_options: typing.Optional[RequestOptions] = None,
|
|
79
129
|
) -> HttpResponse[Order]:
|
|
80
130
|
"""
|
|
131
|
+
Creates a new order for the organization
|
|
132
|
+
|
|
81
133
|
Parameters
|
|
82
134
|
----------
|
|
83
|
-
|
|
135
|
+
customer_id : str
|
|
136
|
+
|
|
137
|
+
billing_customer_id : typing.Optional[str]
|
|
138
|
+
|
|
139
|
+
billing_contact_ids : typing.Optional[typing.Sequence[str]]
|
|
84
140
|
|
|
85
|
-
|
|
141
|
+
name : typing.Optional[str]
|
|
86
142
|
|
|
87
|
-
|
|
143
|
+
start_date : typing.Optional[dt.datetime]
|
|
88
144
|
|
|
89
|
-
|
|
145
|
+
end_date : typing.Optional[dt.datetime]
|
|
90
146
|
|
|
91
|
-
|
|
147
|
+
subscription_terms : typing.Optional[int]
|
|
92
148
|
|
|
93
|
-
|
|
149
|
+
creation_state : typing.Optional[OrderCreationState]
|
|
94
150
|
|
|
95
|
-
|
|
151
|
+
billing_anchor : typing.Optional[float]
|
|
96
152
|
|
|
97
|
-
|
|
153
|
+
payment_terms : typing.Optional[str]
|
|
98
154
|
|
|
99
|
-
|
|
100
|
-
Optional plan ID to associate with this order
|
|
155
|
+
external_id : typing.Optional[str]
|
|
101
156
|
|
|
102
|
-
|
|
157
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
103
158
|
|
|
104
159
|
request_options : typing.Optional[RequestOptions]
|
|
105
160
|
Request-specific configuration.
|
|
@@ -107,24 +162,24 @@ class RawOrdersClient:
|
|
|
107
162
|
Returns
|
|
108
163
|
-------
|
|
109
164
|
HttpResponse[Order]
|
|
110
|
-
|
|
165
|
+
201
|
|
111
166
|
"""
|
|
112
167
|
_response = self._client_wrapper.httpx_client.request(
|
|
113
|
-
"orders",
|
|
168
|
+
"orders/",
|
|
114
169
|
method="POST",
|
|
115
170
|
json={
|
|
116
171
|
"customerId": customer_id,
|
|
117
|
-
"
|
|
118
|
-
"
|
|
172
|
+
"billingCustomerId": billing_customer_id,
|
|
173
|
+
"billingContactIds": billing_contact_ids,
|
|
119
174
|
"name": name,
|
|
120
|
-
"description": description,
|
|
121
175
|
"startDate": start_date,
|
|
122
176
|
"endDate": end_date,
|
|
123
|
-
"
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
-
|
|
127
|
-
|
|
177
|
+
"subscriptionTerms": subscription_terms,
|
|
178
|
+
"creationState": creation_state,
|
|
179
|
+
"billingAnchor": billing_anchor,
|
|
180
|
+
"paymentTerms": payment_terms,
|
|
181
|
+
"externalId": external_id,
|
|
182
|
+
"metadata": metadata,
|
|
128
183
|
},
|
|
129
184
|
headers={
|
|
130
185
|
"content-type": "application/json",
|
|
@@ -142,128 +197,51 @@ class RawOrdersClient:
|
|
|
142
197
|
),
|
|
143
198
|
)
|
|
144
199
|
return HttpResponse(response=_response, data=_data)
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
order_id : str
|
|
155
|
-
|
|
156
|
-
request_options : typing.Optional[RequestOptions]
|
|
157
|
-
Request-specific configuration.
|
|
158
|
-
|
|
159
|
-
Returns
|
|
160
|
-
-------
|
|
161
|
-
HttpResponse[Order]
|
|
162
|
-
Success response
|
|
163
|
-
"""
|
|
164
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
165
|
-
f"orders/{jsonable_encoder(order_id)}",
|
|
166
|
-
method="GET",
|
|
167
|
-
request_options=request_options,
|
|
168
|
-
)
|
|
169
|
-
try:
|
|
170
|
-
if 200 <= _response.status_code < 300:
|
|
171
|
-
_data = typing.cast(
|
|
172
|
-
Order,
|
|
173
|
-
parse_obj_as(
|
|
174
|
-
type_=Order, # type: ignore
|
|
175
|
-
object_=_response.json(),
|
|
200
|
+
if _response.status_code == 400:
|
|
201
|
+
raise BadRequestError(
|
|
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
|
+
),
|
|
176
209
|
),
|
|
177
210
|
)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
f"orders/{jsonable_encoder(order_id)}",
|
|
199
|
-
method="DELETE",
|
|
200
|
-
request_options=request_options,
|
|
201
|
-
)
|
|
202
|
-
try:
|
|
203
|
-
if 200 <= _response.status_code < 300:
|
|
204
|
-
return HttpResponse(response=_response, data=None)
|
|
205
|
-
_response_json = _response.json()
|
|
206
|
-
except JSONDecodeError:
|
|
207
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
208
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
209
|
-
|
|
210
|
-
def activate(
|
|
211
|
-
self, order_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
212
|
-
) -> HttpResponse[Order]:
|
|
213
|
-
"""
|
|
214
|
-
Parameters
|
|
215
|
-
----------
|
|
216
|
-
order_id : str
|
|
217
|
-
|
|
218
|
-
request_options : typing.Optional[RequestOptions]
|
|
219
|
-
Request-specific configuration.
|
|
220
|
-
|
|
221
|
-
Returns
|
|
222
|
-
-------
|
|
223
|
-
HttpResponse[Order]
|
|
224
|
-
Success response
|
|
225
|
-
"""
|
|
226
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
227
|
-
f"orders/{jsonable_encoder(order_id)}/activate",
|
|
228
|
-
method="POST",
|
|
229
|
-
request_options=request_options,
|
|
230
|
-
)
|
|
231
|
-
try:
|
|
232
|
-
if 200 <= _response.status_code < 300:
|
|
233
|
-
_data = typing.cast(
|
|
234
|
-
Order,
|
|
235
|
-
parse_obj_as(
|
|
236
|
-
type_=Order, # type: ignore
|
|
237
|
-
object_=_response.json(),
|
|
211
|
+
if _response.status_code == 403:
|
|
212
|
+
raise ForbiddenError(
|
|
213
|
+
headers=dict(_response.headers),
|
|
214
|
+
body=typing.cast(
|
|
215
|
+
ErrorResponse,
|
|
216
|
+
parse_obj_as(
|
|
217
|
+
type_=ErrorResponse, # type: ignore
|
|
218
|
+
object_=_response.json(),
|
|
219
|
+
),
|
|
220
|
+
),
|
|
221
|
+
)
|
|
222
|
+
if _response.status_code == 500:
|
|
223
|
+
raise InternalServerError(
|
|
224
|
+
headers=dict(_response.headers),
|
|
225
|
+
body=typing.cast(
|
|
226
|
+
ErrorResponse,
|
|
227
|
+
parse_obj_as(
|
|
228
|
+
type_=ErrorResponse, # type: ignore
|
|
229
|
+
object_=_response.json(),
|
|
230
|
+
),
|
|
238
231
|
),
|
|
239
232
|
)
|
|
240
|
-
return HttpResponse(response=_response, data=_data)
|
|
241
233
|
_response_json = _response.json()
|
|
242
234
|
except JSONDecodeError:
|
|
243
235
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
244
236
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
245
237
|
|
|
246
|
-
def
|
|
247
|
-
self,
|
|
248
|
-
order_id: str,
|
|
249
|
-
*,
|
|
250
|
-
confirmation_token: str,
|
|
251
|
-
return_url: str,
|
|
252
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
253
|
-
) -> HttpResponse[Order]:
|
|
238
|
+
def get_order(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Order]:
|
|
254
239
|
"""
|
|
255
|
-
|
|
240
|
+
Get an order by its ID
|
|
256
241
|
|
|
257
242
|
Parameters
|
|
258
243
|
----------
|
|
259
|
-
|
|
260
|
-
The order ID (can be internal ID or display ID)
|
|
261
|
-
|
|
262
|
-
confirmation_token : str
|
|
263
|
-
Stripe confirmation token for the payment method
|
|
264
|
-
|
|
265
|
-
return_url : str
|
|
266
|
-
URL to redirect to after payment processing
|
|
244
|
+
id : str
|
|
267
245
|
|
|
268
246
|
request_options : typing.Optional[RequestOptions]
|
|
269
247
|
Request-specific configuration.
|
|
@@ -271,20 +249,12 @@ class RawOrdersClient:
|
|
|
271
249
|
Returns
|
|
272
250
|
-------
|
|
273
251
|
HttpResponse[Order]
|
|
274
|
-
|
|
252
|
+
200
|
|
275
253
|
"""
|
|
276
254
|
_response = self._client_wrapper.httpx_client.request(
|
|
277
|
-
f"orders/{jsonable_encoder(
|
|
278
|
-
method="
|
|
279
|
-
json={
|
|
280
|
-
"confirmationToken": confirmation_token,
|
|
281
|
-
"returnUrl": return_url,
|
|
282
|
-
},
|
|
283
|
-
headers={
|
|
284
|
-
"content-type": "application/json",
|
|
285
|
-
},
|
|
255
|
+
f"orders/{jsonable_encoder(id)}",
|
|
256
|
+
method="GET",
|
|
286
257
|
request_options=request_options,
|
|
287
|
-
omit=OMIT,
|
|
288
258
|
)
|
|
289
259
|
try:
|
|
290
260
|
if 200 <= _response.status_code < 300:
|
|
@@ -296,35 +266,35 @@ class RawOrdersClient:
|
|
|
296
266
|
),
|
|
297
267
|
)
|
|
298
268
|
return HttpResponse(response=_response, data=_data)
|
|
299
|
-
if _response.status_code ==
|
|
300
|
-
raise
|
|
269
|
+
if _response.status_code == 403:
|
|
270
|
+
raise ForbiddenError(
|
|
301
271
|
headers=dict(_response.headers),
|
|
302
272
|
body=typing.cast(
|
|
303
|
-
|
|
273
|
+
ErrorResponse,
|
|
304
274
|
parse_obj_as(
|
|
305
|
-
type_=
|
|
275
|
+
type_=ErrorResponse, # type: ignore
|
|
306
276
|
object_=_response.json(),
|
|
307
277
|
),
|
|
308
278
|
),
|
|
309
279
|
)
|
|
310
|
-
if _response.status_code ==
|
|
311
|
-
raise
|
|
280
|
+
if _response.status_code == 404:
|
|
281
|
+
raise NotFoundError(
|
|
312
282
|
headers=dict(_response.headers),
|
|
313
283
|
body=typing.cast(
|
|
314
|
-
|
|
284
|
+
ErrorResponse,
|
|
315
285
|
parse_obj_as(
|
|
316
|
-
type_=
|
|
286
|
+
type_=ErrorResponse, # type: ignore
|
|
317
287
|
object_=_response.json(),
|
|
318
288
|
),
|
|
319
289
|
),
|
|
320
290
|
)
|
|
321
|
-
if _response.status_code ==
|
|
322
|
-
raise
|
|
291
|
+
if _response.status_code == 500:
|
|
292
|
+
raise InternalServerError(
|
|
323
293
|
headers=dict(_response.headers),
|
|
324
294
|
body=typing.cast(
|
|
325
|
-
|
|
295
|
+
ErrorResponse,
|
|
326
296
|
parse_obj_as(
|
|
327
|
-
type_=
|
|
297
|
+
type_=ErrorResponse, # type: ignore
|
|
328
298
|
object_=_response.json(),
|
|
329
299
|
),
|
|
330
300
|
),
|
|
@@ -334,42 +304,75 @@ class RawOrdersClient:
|
|
|
334
304
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
335
305
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
336
306
|
|
|
337
|
-
def
|
|
307
|
+
def update_order(
|
|
338
308
|
self,
|
|
339
|
-
|
|
309
|
+
id: str,
|
|
340
310
|
*,
|
|
341
|
-
|
|
342
|
-
|
|
311
|
+
name: typing.Optional[str] = OMIT,
|
|
312
|
+
start_date: typing.Optional[dt.datetime] = OMIT,
|
|
313
|
+
end_date: typing.Optional[dt.datetime] = OMIT,
|
|
314
|
+
subscription_terms: typing.Optional[int] = OMIT,
|
|
315
|
+
creation_state: typing.Optional[OrderCreationState] = OMIT,
|
|
316
|
+
billing_anchor: typing.Optional[float] = OMIT,
|
|
317
|
+
payment_terms: typing.Optional[str] = OMIT,
|
|
318
|
+
external_id: typing.Optional[str] = OMIT,
|
|
319
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
320
|
+
billing_customer_id: typing.Optional[str] = OMIT,
|
|
321
|
+
billing_contact_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
343
322
|
request_options: typing.Optional[RequestOptions] = None,
|
|
344
|
-
) -> HttpResponse[
|
|
323
|
+
) -> HttpResponse[Order]:
|
|
345
324
|
"""
|
|
346
|
-
|
|
325
|
+
Update an order by its ID
|
|
347
326
|
|
|
348
327
|
Parameters
|
|
349
328
|
----------
|
|
350
|
-
|
|
351
|
-
|
|
329
|
+
id : str
|
|
330
|
+
|
|
331
|
+
name : typing.Optional[str]
|
|
332
|
+
|
|
333
|
+
start_date : typing.Optional[dt.datetime]
|
|
334
|
+
|
|
335
|
+
end_date : typing.Optional[dt.datetime]
|
|
336
|
+
|
|
337
|
+
subscription_terms : typing.Optional[int]
|
|
338
|
+
|
|
339
|
+
creation_state : typing.Optional[OrderCreationState]
|
|
340
|
+
|
|
341
|
+
billing_anchor : typing.Optional[float]
|
|
352
342
|
|
|
353
|
-
|
|
354
|
-
The current version of the order (for optimistic locking)
|
|
343
|
+
payment_terms : typing.Optional[str]
|
|
355
344
|
|
|
356
|
-
|
|
357
|
-
|
|
345
|
+
external_id : typing.Optional[str]
|
|
346
|
+
|
|
347
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
348
|
+
|
|
349
|
+
billing_customer_id : typing.Optional[str]
|
|
350
|
+
|
|
351
|
+
billing_contact_ids : typing.Optional[typing.Sequence[str]]
|
|
358
352
|
|
|
359
353
|
request_options : typing.Optional[RequestOptions]
|
|
360
354
|
Request-specific configuration.
|
|
361
355
|
|
|
362
356
|
Returns
|
|
363
357
|
-------
|
|
364
|
-
HttpResponse[
|
|
365
|
-
|
|
358
|
+
HttpResponse[Order]
|
|
359
|
+
200
|
|
366
360
|
"""
|
|
367
361
|
_response = self._client_wrapper.httpx_client.request(
|
|
368
|
-
f"orders/{jsonable_encoder(
|
|
369
|
-
method="
|
|
362
|
+
f"orders/{jsonable_encoder(id)}",
|
|
363
|
+
method="PUT",
|
|
370
364
|
json={
|
|
371
|
-
"
|
|
372
|
-
"
|
|
365
|
+
"name": name,
|
|
366
|
+
"startDate": start_date,
|
|
367
|
+
"endDate": end_date,
|
|
368
|
+
"subscriptionTerms": subscription_terms,
|
|
369
|
+
"creationState": creation_state,
|
|
370
|
+
"billingAnchor": billing_anchor,
|
|
371
|
+
"paymentTerms": payment_terms,
|
|
372
|
+
"externalId": external_id,
|
|
373
|
+
"metadata": metadata,
|
|
374
|
+
"billingCustomerId": billing_customer_id,
|
|
375
|
+
"billingContactIds": billing_contact_ids,
|
|
373
376
|
},
|
|
374
377
|
headers={
|
|
375
378
|
"content-type": "application/json",
|
|
@@ -380,9 +383,9 @@ class RawOrdersClient:
|
|
|
380
383
|
try:
|
|
381
384
|
if 200 <= _response.status_code < 300:
|
|
382
385
|
_data = typing.cast(
|
|
383
|
-
|
|
386
|
+
Order,
|
|
384
387
|
parse_obj_as(
|
|
385
|
-
type_=
|
|
388
|
+
type_=Order, # type: ignore
|
|
386
389
|
object_=_response.json(),
|
|
387
390
|
),
|
|
388
391
|
)
|
|
@@ -391,9 +394,9 @@ class RawOrdersClient:
|
|
|
391
394
|
raise BadRequestError(
|
|
392
395
|
headers=dict(_response.headers),
|
|
393
396
|
body=typing.cast(
|
|
394
|
-
|
|
397
|
+
ErrorResponse,
|
|
395
398
|
parse_obj_as(
|
|
396
|
-
type_=
|
|
399
|
+
type_=ErrorResponse, # type: ignore
|
|
397
400
|
object_=_response.json(),
|
|
398
401
|
),
|
|
399
402
|
),
|
|
@@ -402,9 +405,9 @@ class RawOrdersClient:
|
|
|
402
405
|
raise ForbiddenError(
|
|
403
406
|
headers=dict(_response.headers),
|
|
404
407
|
body=typing.cast(
|
|
405
|
-
|
|
408
|
+
ErrorResponse,
|
|
406
409
|
parse_obj_as(
|
|
407
|
-
type_=
|
|
410
|
+
type_=ErrorResponse, # type: ignore
|
|
408
411
|
object_=_response.json(),
|
|
409
412
|
),
|
|
410
413
|
),
|
|
@@ -413,9 +416,20 @@ class RawOrdersClient:
|
|
|
413
416
|
raise NotFoundError(
|
|
414
417
|
headers=dict(_response.headers),
|
|
415
418
|
body=typing.cast(
|
|
416
|
-
|
|
419
|
+
ErrorResponse,
|
|
417
420
|
parse_obj_as(
|
|
418
|
-
type_=
|
|
421
|
+
type_=ErrorResponse, # type: ignore
|
|
422
|
+
object_=_response.json(),
|
|
423
|
+
),
|
|
424
|
+
),
|
|
425
|
+
)
|
|
426
|
+
if _response.status_code == 500:
|
|
427
|
+
raise InternalServerError(
|
|
428
|
+
headers=dict(_response.headers),
|
|
429
|
+
body=typing.cast(
|
|
430
|
+
ErrorResponse,
|
|
431
|
+
parse_obj_as(
|
|
432
|
+
type_=ErrorResponse, # type: ignore
|
|
419
433
|
object_=_response.json(),
|
|
420
434
|
),
|
|
421
435
|
),
|
|
@@ -425,97 +439,68 @@ class RawOrdersClient:
|
|
|
425
439
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
426
440
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
427
441
|
|
|
428
|
-
def
|
|
429
|
-
self,
|
|
430
|
-
|
|
431
|
-
*,
|
|
432
|
-
order_version: int,
|
|
433
|
-
effective_date: dt.datetime,
|
|
434
|
-
updated_order_line_attributes: typing.Sequence[ProrationAttributeUpdate],
|
|
435
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
436
|
-
) -> HttpResponse[ProrationUpgradeResponse]:
|
|
442
|
+
def delete_order(
|
|
443
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
444
|
+
) -> HttpResponse[EmptyResponse]:
|
|
437
445
|
"""
|
|
438
|
-
|
|
446
|
+
Delete an order by its ID
|
|
439
447
|
|
|
440
448
|
Parameters
|
|
441
449
|
----------
|
|
442
|
-
|
|
443
|
-
The order ID (can be internal ID or display ID)
|
|
444
|
-
|
|
445
|
-
order_version : int
|
|
446
|
-
The current version of the order (for optimistic locking)
|
|
447
|
-
|
|
448
|
-
effective_date : dt.datetime
|
|
449
|
-
The date when the plan change should take effect (ISO 8601 format)
|
|
450
|
-
|
|
451
|
-
updated_order_line_attributes : typing.Sequence[ProrationAttributeUpdate]
|
|
452
|
-
The list of order line attributes to update
|
|
450
|
+
id : str
|
|
453
451
|
|
|
454
452
|
request_options : typing.Optional[RequestOptions]
|
|
455
453
|
Request-specific configuration.
|
|
456
454
|
|
|
457
455
|
Returns
|
|
458
456
|
-------
|
|
459
|
-
HttpResponse[
|
|
460
|
-
|
|
457
|
+
HttpResponse[EmptyResponse]
|
|
458
|
+
200
|
|
461
459
|
"""
|
|
462
460
|
_response = self._client_wrapper.httpx_client.request(
|
|
463
|
-
f"orders/{jsonable_encoder(
|
|
464
|
-
method="
|
|
465
|
-
json={
|
|
466
|
-
"orderVersion": order_version,
|
|
467
|
-
"effectiveDate": effective_date,
|
|
468
|
-
"updatedOrderLineAttributes": convert_and_respect_annotation_metadata(
|
|
469
|
-
object_=updated_order_line_attributes,
|
|
470
|
-
annotation=typing.Sequence[ProrationAttributeUpdate],
|
|
471
|
-
direction="write",
|
|
472
|
-
),
|
|
473
|
-
},
|
|
474
|
-
headers={
|
|
475
|
-
"content-type": "application/json",
|
|
476
|
-
},
|
|
461
|
+
f"orders/{jsonable_encoder(id)}",
|
|
462
|
+
method="DELETE",
|
|
477
463
|
request_options=request_options,
|
|
478
|
-
omit=OMIT,
|
|
479
464
|
)
|
|
480
465
|
try:
|
|
481
466
|
if 200 <= _response.status_code < 300:
|
|
482
467
|
_data = typing.cast(
|
|
483
|
-
|
|
468
|
+
EmptyResponse,
|
|
484
469
|
parse_obj_as(
|
|
485
|
-
type_=
|
|
470
|
+
type_=EmptyResponse, # type: ignore
|
|
486
471
|
object_=_response.json(),
|
|
487
472
|
),
|
|
488
473
|
)
|
|
489
474
|
return HttpResponse(response=_response, data=_data)
|
|
490
|
-
if _response.status_code ==
|
|
491
|
-
raise
|
|
475
|
+
if _response.status_code == 403:
|
|
476
|
+
raise ForbiddenError(
|
|
492
477
|
headers=dict(_response.headers),
|
|
493
478
|
body=typing.cast(
|
|
494
|
-
|
|
479
|
+
ErrorResponse,
|
|
495
480
|
parse_obj_as(
|
|
496
|
-
type_=
|
|
481
|
+
type_=ErrorResponse, # type: ignore
|
|
497
482
|
object_=_response.json(),
|
|
498
483
|
),
|
|
499
484
|
),
|
|
500
485
|
)
|
|
501
|
-
if _response.status_code ==
|
|
502
|
-
raise
|
|
486
|
+
if _response.status_code == 404:
|
|
487
|
+
raise NotFoundError(
|
|
503
488
|
headers=dict(_response.headers),
|
|
504
489
|
body=typing.cast(
|
|
505
|
-
|
|
490
|
+
ErrorResponse,
|
|
506
491
|
parse_obj_as(
|
|
507
|
-
type_=
|
|
492
|
+
type_=ErrorResponse, # type: ignore
|
|
508
493
|
object_=_response.json(),
|
|
509
494
|
),
|
|
510
495
|
),
|
|
511
496
|
)
|
|
512
|
-
if _response.status_code ==
|
|
513
|
-
raise
|
|
497
|
+
if _response.status_code == 500:
|
|
498
|
+
raise InternalServerError(
|
|
514
499
|
headers=dict(_response.headers),
|
|
515
500
|
body=typing.cast(
|
|
516
|
-
|
|
501
|
+
ErrorResponse,
|
|
517
502
|
parse_obj_as(
|
|
518
|
-
type_=
|
|
503
|
+
type_=ErrorResponse, # type: ignore
|
|
519
504
|
object_=_response.json(),
|
|
520
505
|
),
|
|
521
506
|
),
|
|
@@ -525,36 +510,48 @@ class RawOrdersClient:
|
|
|
525
510
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
526
511
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
527
512
|
|
|
528
|
-
def
|
|
529
|
-
self,
|
|
530
|
-
|
|
513
|
+
def get_order_lines(
|
|
514
|
+
self,
|
|
515
|
+
id: str,
|
|
516
|
+
*,
|
|
517
|
+
limit: typing.Optional[int] = None,
|
|
518
|
+
offset: typing.Optional[int] = None,
|
|
519
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
520
|
+
) -> HttpResponse[OrderLinesResponse]:
|
|
531
521
|
"""
|
|
532
|
-
|
|
522
|
+
Get the order lines for an order by its ID
|
|
533
523
|
|
|
534
524
|
Parameters
|
|
535
525
|
----------
|
|
536
|
-
|
|
537
|
-
|
|
526
|
+
id : str
|
|
527
|
+
|
|
528
|
+
limit : typing.Optional[int]
|
|
529
|
+
|
|
530
|
+
offset : typing.Optional[int]
|
|
538
531
|
|
|
539
532
|
request_options : typing.Optional[RequestOptions]
|
|
540
533
|
Request-specific configuration.
|
|
541
534
|
|
|
542
535
|
Returns
|
|
543
536
|
-------
|
|
544
|
-
HttpResponse[
|
|
545
|
-
|
|
537
|
+
HttpResponse[OrderLinesResponse]
|
|
538
|
+
200
|
|
546
539
|
"""
|
|
547
540
|
_response = self._client_wrapper.httpx_client.request(
|
|
548
|
-
f"orders/{jsonable_encoder(
|
|
541
|
+
f"orders/{jsonable_encoder(id)}/lines",
|
|
549
542
|
method="GET",
|
|
543
|
+
params={
|
|
544
|
+
"limit": limit,
|
|
545
|
+
"offset": offset,
|
|
546
|
+
},
|
|
550
547
|
request_options=request_options,
|
|
551
548
|
)
|
|
552
549
|
try:
|
|
553
550
|
if 200 <= _response.status_code < 300:
|
|
554
551
|
_data = typing.cast(
|
|
555
|
-
|
|
552
|
+
OrderLinesResponse,
|
|
556
553
|
parse_obj_as(
|
|
557
|
-
type_=
|
|
554
|
+
type_=OrderLinesResponse, # type: ignore
|
|
558
555
|
object_=_response.json(),
|
|
559
556
|
),
|
|
560
557
|
)
|
|
@@ -563,9 +560,9 @@ class RawOrdersClient:
|
|
|
563
560
|
raise ForbiddenError(
|
|
564
561
|
headers=dict(_response.headers),
|
|
565
562
|
body=typing.cast(
|
|
566
|
-
|
|
563
|
+
ErrorResponse,
|
|
567
564
|
parse_obj_as(
|
|
568
|
-
type_=
|
|
565
|
+
type_=ErrorResponse, # type: ignore
|
|
569
566
|
object_=_response.json(),
|
|
570
567
|
),
|
|
571
568
|
),
|
|
@@ -574,9 +571,20 @@ class RawOrdersClient:
|
|
|
574
571
|
raise NotFoundError(
|
|
575
572
|
headers=dict(_response.headers),
|
|
576
573
|
body=typing.cast(
|
|
577
|
-
|
|
574
|
+
ErrorResponse,
|
|
575
|
+
parse_obj_as(
|
|
576
|
+
type_=ErrorResponse, # type: ignore
|
|
577
|
+
object_=_response.json(),
|
|
578
|
+
),
|
|
579
|
+
),
|
|
580
|
+
)
|
|
581
|
+
if _response.status_code == 500:
|
|
582
|
+
raise InternalServerError(
|
|
583
|
+
headers=dict(_response.headers),
|
|
584
|
+
body=typing.cast(
|
|
585
|
+
ErrorResponse,
|
|
578
586
|
parse_obj_as(
|
|
579
|
-
type_=
|
|
587
|
+
type_=ErrorResponse, # type: ignore
|
|
580
588
|
object_=_response.json(),
|
|
581
589
|
),
|
|
582
590
|
),
|
|
@@ -591,78 +599,132 @@ class AsyncRawOrdersClient:
|
|
|
591
599
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
592
600
|
self._client_wrapper = client_wrapper
|
|
593
601
|
|
|
594
|
-
async def
|
|
595
|
-
self,
|
|
596
|
-
|
|
602
|
+
async def list_orders(
|
|
603
|
+
self,
|
|
604
|
+
*,
|
|
605
|
+
limit: typing.Optional[int] = None,
|
|
606
|
+
offset: typing.Optional[int] = None,
|
|
607
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
608
|
+
) -> AsyncHttpResponse[OrderListResponse]:
|
|
597
609
|
"""
|
|
610
|
+
Get a list of orders for the organization
|
|
611
|
+
|
|
598
612
|
Parameters
|
|
599
613
|
----------
|
|
614
|
+
limit : typing.Optional[int]
|
|
615
|
+
|
|
616
|
+
offset : typing.Optional[int]
|
|
617
|
+
|
|
600
618
|
request_options : typing.Optional[RequestOptions]
|
|
601
619
|
Request-specific configuration.
|
|
602
620
|
|
|
603
621
|
Returns
|
|
604
622
|
-------
|
|
605
|
-
AsyncHttpResponse[
|
|
606
|
-
|
|
623
|
+
AsyncHttpResponse[OrderListResponse]
|
|
624
|
+
200
|
|
607
625
|
"""
|
|
608
626
|
_response = await self._client_wrapper.httpx_client.request(
|
|
609
|
-
"orders",
|
|
627
|
+
"orders/",
|
|
610
628
|
method="GET",
|
|
629
|
+
params={
|
|
630
|
+
"limit": limit,
|
|
631
|
+
"offset": offset,
|
|
632
|
+
},
|
|
611
633
|
request_options=request_options,
|
|
612
634
|
)
|
|
613
635
|
try:
|
|
614
636
|
if 200 <= _response.status_code < 300:
|
|
615
637
|
_data = typing.cast(
|
|
616
|
-
|
|
638
|
+
OrderListResponse,
|
|
617
639
|
parse_obj_as(
|
|
618
|
-
type_=
|
|
640
|
+
type_=OrderListResponse, # type: ignore
|
|
619
641
|
object_=_response.json(),
|
|
620
642
|
),
|
|
621
643
|
)
|
|
622
644
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
645
|
+
if _response.status_code == 400:
|
|
646
|
+
raise BadRequestError(
|
|
647
|
+
headers=dict(_response.headers),
|
|
648
|
+
body=typing.cast(
|
|
649
|
+
ErrorResponse,
|
|
650
|
+
parse_obj_as(
|
|
651
|
+
type_=ErrorResponse, # type: ignore
|
|
652
|
+
object_=_response.json(),
|
|
653
|
+
),
|
|
654
|
+
),
|
|
655
|
+
)
|
|
656
|
+
if _response.status_code == 403:
|
|
657
|
+
raise ForbiddenError(
|
|
658
|
+
headers=dict(_response.headers),
|
|
659
|
+
body=typing.cast(
|
|
660
|
+
ErrorResponse,
|
|
661
|
+
parse_obj_as(
|
|
662
|
+
type_=ErrorResponse, # type: ignore
|
|
663
|
+
object_=_response.json(),
|
|
664
|
+
),
|
|
665
|
+
),
|
|
666
|
+
)
|
|
667
|
+
if _response.status_code == 500:
|
|
668
|
+
raise InternalServerError(
|
|
669
|
+
headers=dict(_response.headers),
|
|
670
|
+
body=typing.cast(
|
|
671
|
+
ErrorResponse,
|
|
672
|
+
parse_obj_as(
|
|
673
|
+
type_=ErrorResponse, # type: ignore
|
|
674
|
+
object_=_response.json(),
|
|
675
|
+
),
|
|
676
|
+
),
|
|
677
|
+
)
|
|
623
678
|
_response_json = _response.json()
|
|
624
679
|
except JSONDecodeError:
|
|
625
680
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
626
681
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
627
682
|
|
|
628
|
-
async def
|
|
683
|
+
async def create_a_new_order(
|
|
629
684
|
self,
|
|
630
685
|
*,
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
686
|
+
customer_id: str,
|
|
687
|
+
billing_customer_id: typing.Optional[str] = OMIT,
|
|
688
|
+
billing_contact_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
689
|
+
name: typing.Optional[str] = OMIT,
|
|
690
|
+
start_date: typing.Optional[dt.datetime] = OMIT,
|
|
691
|
+
end_date: typing.Optional[dt.datetime] = OMIT,
|
|
692
|
+
subscription_terms: typing.Optional[int] = OMIT,
|
|
693
|
+
creation_state: typing.Optional[OrderCreationState] = OMIT,
|
|
694
|
+
billing_anchor: typing.Optional[float] = OMIT,
|
|
695
|
+
payment_terms: typing.Optional[str] = OMIT,
|
|
696
|
+
external_id: typing.Optional[str] = OMIT,
|
|
697
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
641
698
|
request_options: typing.Optional[RequestOptions] = None,
|
|
642
699
|
) -> AsyncHttpResponse[Order]:
|
|
643
700
|
"""
|
|
701
|
+
Creates a new order for the organization
|
|
702
|
+
|
|
644
703
|
Parameters
|
|
645
704
|
----------
|
|
646
|
-
|
|
705
|
+
customer_id : str
|
|
706
|
+
|
|
707
|
+
billing_customer_id : typing.Optional[str]
|
|
708
|
+
|
|
709
|
+
billing_contact_ids : typing.Optional[typing.Sequence[str]]
|
|
647
710
|
|
|
648
|
-
|
|
711
|
+
name : typing.Optional[str]
|
|
649
712
|
|
|
650
|
-
|
|
713
|
+
start_date : typing.Optional[dt.datetime]
|
|
651
714
|
|
|
652
|
-
|
|
715
|
+
end_date : typing.Optional[dt.datetime]
|
|
653
716
|
|
|
654
|
-
|
|
717
|
+
subscription_terms : typing.Optional[int]
|
|
655
718
|
|
|
656
|
-
|
|
719
|
+
creation_state : typing.Optional[OrderCreationState]
|
|
657
720
|
|
|
658
|
-
|
|
721
|
+
billing_anchor : typing.Optional[float]
|
|
659
722
|
|
|
660
|
-
|
|
723
|
+
payment_terms : typing.Optional[str]
|
|
661
724
|
|
|
662
|
-
|
|
663
|
-
Optional plan ID to associate with this order
|
|
725
|
+
external_id : typing.Optional[str]
|
|
664
726
|
|
|
665
|
-
|
|
727
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
666
728
|
|
|
667
729
|
request_options : typing.Optional[RequestOptions]
|
|
668
730
|
Request-specific configuration.
|
|
@@ -670,24 +732,24 @@ class AsyncRawOrdersClient:
|
|
|
670
732
|
Returns
|
|
671
733
|
-------
|
|
672
734
|
AsyncHttpResponse[Order]
|
|
673
|
-
|
|
735
|
+
201
|
|
674
736
|
"""
|
|
675
737
|
_response = await self._client_wrapper.httpx_client.request(
|
|
676
|
-
"orders",
|
|
738
|
+
"orders/",
|
|
677
739
|
method="POST",
|
|
678
740
|
json={
|
|
679
741
|
"customerId": customer_id,
|
|
680
|
-
"
|
|
681
|
-
"
|
|
742
|
+
"billingCustomerId": billing_customer_id,
|
|
743
|
+
"billingContactIds": billing_contact_ids,
|
|
682
744
|
"name": name,
|
|
683
|
-
"description": description,
|
|
684
745
|
"startDate": start_date,
|
|
685
746
|
"endDate": end_date,
|
|
686
|
-
"
|
|
687
|
-
"
|
|
688
|
-
"
|
|
689
|
-
|
|
690
|
-
|
|
747
|
+
"subscriptionTerms": subscription_terms,
|
|
748
|
+
"creationState": creation_state,
|
|
749
|
+
"billingAnchor": billing_anchor,
|
|
750
|
+
"paymentTerms": payment_terms,
|
|
751
|
+
"externalId": external_id,
|
|
752
|
+
"metadata": metadata,
|
|
691
753
|
},
|
|
692
754
|
headers={
|
|
693
755
|
"content-type": "application/json",
|
|
@@ -705,132 +767,53 @@ class AsyncRawOrdersClient:
|
|
|
705
767
|
),
|
|
706
768
|
)
|
|
707
769
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
Parameters
|
|
718
|
-
----------
|
|
719
|
-
order_id : str
|
|
720
|
-
|
|
721
|
-
request_options : typing.Optional[RequestOptions]
|
|
722
|
-
Request-specific configuration.
|
|
723
|
-
|
|
724
|
-
Returns
|
|
725
|
-
-------
|
|
726
|
-
AsyncHttpResponse[Order]
|
|
727
|
-
Success response
|
|
728
|
-
"""
|
|
729
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
730
|
-
f"orders/{jsonable_encoder(order_id)}",
|
|
731
|
-
method="GET",
|
|
732
|
-
request_options=request_options,
|
|
733
|
-
)
|
|
734
|
-
try:
|
|
735
|
-
if 200 <= _response.status_code < 300:
|
|
736
|
-
_data = typing.cast(
|
|
737
|
-
Order,
|
|
738
|
-
parse_obj_as(
|
|
739
|
-
type_=Order, # type: ignore
|
|
740
|
-
object_=_response.json(),
|
|
770
|
+
if _response.status_code == 400:
|
|
771
|
+
raise BadRequestError(
|
|
772
|
+
headers=dict(_response.headers),
|
|
773
|
+
body=typing.cast(
|
|
774
|
+
ErrorResponse,
|
|
775
|
+
parse_obj_as(
|
|
776
|
+
type_=ErrorResponse, # type: ignore
|
|
777
|
+
object_=_response.json(),
|
|
778
|
+
),
|
|
741
779
|
),
|
|
742
780
|
)
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
"""
|
|
764
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
765
|
-
f"orders/{jsonable_encoder(order_id)}",
|
|
766
|
-
method="DELETE",
|
|
767
|
-
request_options=request_options,
|
|
768
|
-
)
|
|
769
|
-
try:
|
|
770
|
-
if 200 <= _response.status_code < 300:
|
|
771
|
-
return AsyncHttpResponse(response=_response, data=None)
|
|
772
|
-
_response_json = _response.json()
|
|
773
|
-
except JSONDecodeError:
|
|
774
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
775
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
776
|
-
|
|
777
|
-
async def activate(
|
|
778
|
-
self, order_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
779
|
-
) -> AsyncHttpResponse[Order]:
|
|
780
|
-
"""
|
|
781
|
-
Parameters
|
|
782
|
-
----------
|
|
783
|
-
order_id : str
|
|
784
|
-
|
|
785
|
-
request_options : typing.Optional[RequestOptions]
|
|
786
|
-
Request-specific configuration.
|
|
787
|
-
|
|
788
|
-
Returns
|
|
789
|
-
-------
|
|
790
|
-
AsyncHttpResponse[Order]
|
|
791
|
-
Success response
|
|
792
|
-
"""
|
|
793
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
794
|
-
f"orders/{jsonable_encoder(order_id)}/activate",
|
|
795
|
-
method="POST",
|
|
796
|
-
request_options=request_options,
|
|
797
|
-
)
|
|
798
|
-
try:
|
|
799
|
-
if 200 <= _response.status_code < 300:
|
|
800
|
-
_data = typing.cast(
|
|
801
|
-
Order,
|
|
802
|
-
parse_obj_as(
|
|
803
|
-
type_=Order, # type: ignore
|
|
804
|
-
object_=_response.json(),
|
|
781
|
+
if _response.status_code == 403:
|
|
782
|
+
raise ForbiddenError(
|
|
783
|
+
headers=dict(_response.headers),
|
|
784
|
+
body=typing.cast(
|
|
785
|
+
ErrorResponse,
|
|
786
|
+
parse_obj_as(
|
|
787
|
+
type_=ErrorResponse, # type: ignore
|
|
788
|
+
object_=_response.json(),
|
|
789
|
+
),
|
|
790
|
+
),
|
|
791
|
+
)
|
|
792
|
+
if _response.status_code == 500:
|
|
793
|
+
raise InternalServerError(
|
|
794
|
+
headers=dict(_response.headers),
|
|
795
|
+
body=typing.cast(
|
|
796
|
+
ErrorResponse,
|
|
797
|
+
parse_obj_as(
|
|
798
|
+
type_=ErrorResponse, # type: ignore
|
|
799
|
+
object_=_response.json(),
|
|
800
|
+
),
|
|
805
801
|
),
|
|
806
802
|
)
|
|
807
|
-
return AsyncHttpResponse(response=_response, data=_data)
|
|
808
803
|
_response_json = _response.json()
|
|
809
804
|
except JSONDecodeError:
|
|
810
805
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
811
806
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
812
807
|
|
|
813
|
-
async def
|
|
814
|
-
self,
|
|
815
|
-
order_id: str,
|
|
816
|
-
*,
|
|
817
|
-
confirmation_token: str,
|
|
818
|
-
return_url: str,
|
|
819
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
808
|
+
async def get_order(
|
|
809
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
820
810
|
) -> AsyncHttpResponse[Order]:
|
|
821
811
|
"""
|
|
822
|
-
|
|
812
|
+
Get an order by its ID
|
|
823
813
|
|
|
824
814
|
Parameters
|
|
825
815
|
----------
|
|
826
|
-
|
|
827
|
-
The order ID (can be internal ID or display ID)
|
|
828
|
-
|
|
829
|
-
confirmation_token : str
|
|
830
|
-
Stripe confirmation token for the payment method
|
|
831
|
-
|
|
832
|
-
return_url : str
|
|
833
|
-
URL to redirect to after payment processing
|
|
816
|
+
id : str
|
|
834
817
|
|
|
835
818
|
request_options : typing.Optional[RequestOptions]
|
|
836
819
|
Request-specific configuration.
|
|
@@ -838,20 +821,12 @@ class AsyncRawOrdersClient:
|
|
|
838
821
|
Returns
|
|
839
822
|
-------
|
|
840
823
|
AsyncHttpResponse[Order]
|
|
841
|
-
|
|
824
|
+
200
|
|
842
825
|
"""
|
|
843
826
|
_response = await self._client_wrapper.httpx_client.request(
|
|
844
|
-
f"orders/{jsonable_encoder(
|
|
845
|
-
method="
|
|
846
|
-
json={
|
|
847
|
-
"confirmationToken": confirmation_token,
|
|
848
|
-
"returnUrl": return_url,
|
|
849
|
-
},
|
|
850
|
-
headers={
|
|
851
|
-
"content-type": "application/json",
|
|
852
|
-
},
|
|
827
|
+
f"orders/{jsonable_encoder(id)}",
|
|
828
|
+
method="GET",
|
|
853
829
|
request_options=request_options,
|
|
854
|
-
omit=OMIT,
|
|
855
830
|
)
|
|
856
831
|
try:
|
|
857
832
|
if 200 <= _response.status_code < 300:
|
|
@@ -863,35 +838,35 @@ class AsyncRawOrdersClient:
|
|
|
863
838
|
),
|
|
864
839
|
)
|
|
865
840
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
866
|
-
if _response.status_code ==
|
|
867
|
-
raise
|
|
841
|
+
if _response.status_code == 403:
|
|
842
|
+
raise ForbiddenError(
|
|
868
843
|
headers=dict(_response.headers),
|
|
869
844
|
body=typing.cast(
|
|
870
|
-
|
|
845
|
+
ErrorResponse,
|
|
871
846
|
parse_obj_as(
|
|
872
|
-
type_=
|
|
847
|
+
type_=ErrorResponse, # type: ignore
|
|
873
848
|
object_=_response.json(),
|
|
874
849
|
),
|
|
875
850
|
),
|
|
876
851
|
)
|
|
877
|
-
if _response.status_code ==
|
|
878
|
-
raise
|
|
852
|
+
if _response.status_code == 404:
|
|
853
|
+
raise NotFoundError(
|
|
879
854
|
headers=dict(_response.headers),
|
|
880
855
|
body=typing.cast(
|
|
881
|
-
|
|
856
|
+
ErrorResponse,
|
|
882
857
|
parse_obj_as(
|
|
883
|
-
type_=
|
|
858
|
+
type_=ErrorResponse, # type: ignore
|
|
884
859
|
object_=_response.json(),
|
|
885
860
|
),
|
|
886
861
|
),
|
|
887
862
|
)
|
|
888
|
-
if _response.status_code ==
|
|
889
|
-
raise
|
|
863
|
+
if _response.status_code == 500:
|
|
864
|
+
raise InternalServerError(
|
|
890
865
|
headers=dict(_response.headers),
|
|
891
866
|
body=typing.cast(
|
|
892
|
-
|
|
867
|
+
ErrorResponse,
|
|
893
868
|
parse_obj_as(
|
|
894
|
-
type_=
|
|
869
|
+
type_=ErrorResponse, # type: ignore
|
|
895
870
|
object_=_response.json(),
|
|
896
871
|
),
|
|
897
872
|
),
|
|
@@ -901,42 +876,75 @@ class AsyncRawOrdersClient:
|
|
|
901
876
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
902
877
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
903
878
|
|
|
904
|
-
async def
|
|
879
|
+
async def update_order(
|
|
905
880
|
self,
|
|
906
|
-
|
|
881
|
+
id: str,
|
|
907
882
|
*,
|
|
908
|
-
|
|
909
|
-
|
|
883
|
+
name: typing.Optional[str] = OMIT,
|
|
884
|
+
start_date: typing.Optional[dt.datetime] = OMIT,
|
|
885
|
+
end_date: typing.Optional[dt.datetime] = OMIT,
|
|
886
|
+
subscription_terms: typing.Optional[int] = OMIT,
|
|
887
|
+
creation_state: typing.Optional[OrderCreationState] = OMIT,
|
|
888
|
+
billing_anchor: typing.Optional[float] = OMIT,
|
|
889
|
+
payment_terms: typing.Optional[str] = OMIT,
|
|
890
|
+
external_id: typing.Optional[str] = OMIT,
|
|
891
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
892
|
+
billing_customer_id: typing.Optional[str] = OMIT,
|
|
893
|
+
billing_contact_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
910
894
|
request_options: typing.Optional[RequestOptions] = None,
|
|
911
|
-
) -> AsyncHttpResponse[
|
|
895
|
+
) -> AsyncHttpResponse[Order]:
|
|
912
896
|
"""
|
|
913
|
-
|
|
897
|
+
Update an order by its ID
|
|
914
898
|
|
|
915
899
|
Parameters
|
|
916
900
|
----------
|
|
917
|
-
|
|
918
|
-
|
|
901
|
+
id : str
|
|
902
|
+
|
|
903
|
+
name : typing.Optional[str]
|
|
904
|
+
|
|
905
|
+
start_date : typing.Optional[dt.datetime]
|
|
906
|
+
|
|
907
|
+
end_date : typing.Optional[dt.datetime]
|
|
908
|
+
|
|
909
|
+
subscription_terms : typing.Optional[int]
|
|
910
|
+
|
|
911
|
+
creation_state : typing.Optional[OrderCreationState]
|
|
912
|
+
|
|
913
|
+
billing_anchor : typing.Optional[float]
|
|
919
914
|
|
|
920
|
-
|
|
921
|
-
The current version of the order (for optimistic locking)
|
|
915
|
+
payment_terms : typing.Optional[str]
|
|
922
916
|
|
|
923
|
-
|
|
924
|
-
|
|
917
|
+
external_id : typing.Optional[str]
|
|
918
|
+
|
|
919
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
920
|
+
|
|
921
|
+
billing_customer_id : typing.Optional[str]
|
|
922
|
+
|
|
923
|
+
billing_contact_ids : typing.Optional[typing.Sequence[str]]
|
|
925
924
|
|
|
926
925
|
request_options : typing.Optional[RequestOptions]
|
|
927
926
|
Request-specific configuration.
|
|
928
927
|
|
|
929
928
|
Returns
|
|
930
929
|
-------
|
|
931
|
-
AsyncHttpResponse[
|
|
932
|
-
|
|
930
|
+
AsyncHttpResponse[Order]
|
|
931
|
+
200
|
|
933
932
|
"""
|
|
934
933
|
_response = await self._client_wrapper.httpx_client.request(
|
|
935
|
-
f"orders/{jsonable_encoder(
|
|
936
|
-
method="
|
|
934
|
+
f"orders/{jsonable_encoder(id)}",
|
|
935
|
+
method="PUT",
|
|
937
936
|
json={
|
|
938
|
-
"
|
|
939
|
-
"
|
|
937
|
+
"name": name,
|
|
938
|
+
"startDate": start_date,
|
|
939
|
+
"endDate": end_date,
|
|
940
|
+
"subscriptionTerms": subscription_terms,
|
|
941
|
+
"creationState": creation_state,
|
|
942
|
+
"billingAnchor": billing_anchor,
|
|
943
|
+
"paymentTerms": payment_terms,
|
|
944
|
+
"externalId": external_id,
|
|
945
|
+
"metadata": metadata,
|
|
946
|
+
"billingCustomerId": billing_customer_id,
|
|
947
|
+
"billingContactIds": billing_contact_ids,
|
|
940
948
|
},
|
|
941
949
|
headers={
|
|
942
950
|
"content-type": "application/json",
|
|
@@ -947,9 +955,9 @@ class AsyncRawOrdersClient:
|
|
|
947
955
|
try:
|
|
948
956
|
if 200 <= _response.status_code < 300:
|
|
949
957
|
_data = typing.cast(
|
|
950
|
-
|
|
958
|
+
Order,
|
|
951
959
|
parse_obj_as(
|
|
952
|
-
type_=
|
|
960
|
+
type_=Order, # type: ignore
|
|
953
961
|
object_=_response.json(),
|
|
954
962
|
),
|
|
955
963
|
)
|
|
@@ -958,9 +966,9 @@ class AsyncRawOrdersClient:
|
|
|
958
966
|
raise BadRequestError(
|
|
959
967
|
headers=dict(_response.headers),
|
|
960
968
|
body=typing.cast(
|
|
961
|
-
|
|
969
|
+
ErrorResponse,
|
|
962
970
|
parse_obj_as(
|
|
963
|
-
type_=
|
|
971
|
+
type_=ErrorResponse, # type: ignore
|
|
964
972
|
object_=_response.json(),
|
|
965
973
|
),
|
|
966
974
|
),
|
|
@@ -969,9 +977,9 @@ class AsyncRawOrdersClient:
|
|
|
969
977
|
raise ForbiddenError(
|
|
970
978
|
headers=dict(_response.headers),
|
|
971
979
|
body=typing.cast(
|
|
972
|
-
|
|
980
|
+
ErrorResponse,
|
|
973
981
|
parse_obj_as(
|
|
974
|
-
type_=
|
|
982
|
+
type_=ErrorResponse, # type: ignore
|
|
975
983
|
object_=_response.json(),
|
|
976
984
|
),
|
|
977
985
|
),
|
|
@@ -980,9 +988,20 @@ class AsyncRawOrdersClient:
|
|
|
980
988
|
raise NotFoundError(
|
|
981
989
|
headers=dict(_response.headers),
|
|
982
990
|
body=typing.cast(
|
|
983
|
-
|
|
991
|
+
ErrorResponse,
|
|
984
992
|
parse_obj_as(
|
|
985
|
-
type_=
|
|
993
|
+
type_=ErrorResponse, # type: ignore
|
|
994
|
+
object_=_response.json(),
|
|
995
|
+
),
|
|
996
|
+
),
|
|
997
|
+
)
|
|
998
|
+
if _response.status_code == 500:
|
|
999
|
+
raise InternalServerError(
|
|
1000
|
+
headers=dict(_response.headers),
|
|
1001
|
+
body=typing.cast(
|
|
1002
|
+
ErrorResponse,
|
|
1003
|
+
parse_obj_as(
|
|
1004
|
+
type_=ErrorResponse, # type: ignore
|
|
986
1005
|
object_=_response.json(),
|
|
987
1006
|
),
|
|
988
1007
|
),
|
|
@@ -992,97 +1011,68 @@ class AsyncRawOrdersClient:
|
|
|
992
1011
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
993
1012
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
994
1013
|
|
|
995
|
-
async def
|
|
996
|
-
self,
|
|
997
|
-
|
|
998
|
-
*,
|
|
999
|
-
order_version: int,
|
|
1000
|
-
effective_date: dt.datetime,
|
|
1001
|
-
updated_order_line_attributes: typing.Sequence[ProrationAttributeUpdate],
|
|
1002
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1003
|
-
) -> AsyncHttpResponse[ProrationUpgradeResponse]:
|
|
1014
|
+
async def delete_order(
|
|
1015
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1016
|
+
) -> AsyncHttpResponse[EmptyResponse]:
|
|
1004
1017
|
"""
|
|
1005
|
-
|
|
1018
|
+
Delete an order by its ID
|
|
1006
1019
|
|
|
1007
1020
|
Parameters
|
|
1008
1021
|
----------
|
|
1009
|
-
|
|
1010
|
-
The order ID (can be internal ID or display ID)
|
|
1011
|
-
|
|
1012
|
-
order_version : int
|
|
1013
|
-
The current version of the order (for optimistic locking)
|
|
1014
|
-
|
|
1015
|
-
effective_date : dt.datetime
|
|
1016
|
-
The date when the plan change should take effect (ISO 8601 format)
|
|
1017
|
-
|
|
1018
|
-
updated_order_line_attributes : typing.Sequence[ProrationAttributeUpdate]
|
|
1019
|
-
The list of order line attributes to update
|
|
1022
|
+
id : str
|
|
1020
1023
|
|
|
1021
1024
|
request_options : typing.Optional[RequestOptions]
|
|
1022
1025
|
Request-specific configuration.
|
|
1023
1026
|
|
|
1024
1027
|
Returns
|
|
1025
1028
|
-------
|
|
1026
|
-
AsyncHttpResponse[
|
|
1027
|
-
|
|
1029
|
+
AsyncHttpResponse[EmptyResponse]
|
|
1030
|
+
200
|
|
1028
1031
|
"""
|
|
1029
1032
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1030
|
-
f"orders/{jsonable_encoder(
|
|
1031
|
-
method="
|
|
1032
|
-
json={
|
|
1033
|
-
"orderVersion": order_version,
|
|
1034
|
-
"effectiveDate": effective_date,
|
|
1035
|
-
"updatedOrderLineAttributes": convert_and_respect_annotation_metadata(
|
|
1036
|
-
object_=updated_order_line_attributes,
|
|
1037
|
-
annotation=typing.Sequence[ProrationAttributeUpdate],
|
|
1038
|
-
direction="write",
|
|
1039
|
-
),
|
|
1040
|
-
},
|
|
1041
|
-
headers={
|
|
1042
|
-
"content-type": "application/json",
|
|
1043
|
-
},
|
|
1033
|
+
f"orders/{jsonable_encoder(id)}",
|
|
1034
|
+
method="DELETE",
|
|
1044
1035
|
request_options=request_options,
|
|
1045
|
-
omit=OMIT,
|
|
1046
1036
|
)
|
|
1047
1037
|
try:
|
|
1048
1038
|
if 200 <= _response.status_code < 300:
|
|
1049
1039
|
_data = typing.cast(
|
|
1050
|
-
|
|
1040
|
+
EmptyResponse,
|
|
1051
1041
|
parse_obj_as(
|
|
1052
|
-
type_=
|
|
1042
|
+
type_=EmptyResponse, # type: ignore
|
|
1053
1043
|
object_=_response.json(),
|
|
1054
1044
|
),
|
|
1055
1045
|
)
|
|
1056
1046
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
1057
|
-
if _response.status_code ==
|
|
1058
|
-
raise
|
|
1047
|
+
if _response.status_code == 403:
|
|
1048
|
+
raise ForbiddenError(
|
|
1059
1049
|
headers=dict(_response.headers),
|
|
1060
1050
|
body=typing.cast(
|
|
1061
|
-
|
|
1051
|
+
ErrorResponse,
|
|
1062
1052
|
parse_obj_as(
|
|
1063
|
-
type_=
|
|
1053
|
+
type_=ErrorResponse, # type: ignore
|
|
1064
1054
|
object_=_response.json(),
|
|
1065
1055
|
),
|
|
1066
1056
|
),
|
|
1067
1057
|
)
|
|
1068
|
-
if _response.status_code ==
|
|
1069
|
-
raise
|
|
1058
|
+
if _response.status_code == 404:
|
|
1059
|
+
raise NotFoundError(
|
|
1070
1060
|
headers=dict(_response.headers),
|
|
1071
1061
|
body=typing.cast(
|
|
1072
|
-
|
|
1062
|
+
ErrorResponse,
|
|
1073
1063
|
parse_obj_as(
|
|
1074
|
-
type_=
|
|
1064
|
+
type_=ErrorResponse, # type: ignore
|
|
1075
1065
|
object_=_response.json(),
|
|
1076
1066
|
),
|
|
1077
1067
|
),
|
|
1078
1068
|
)
|
|
1079
|
-
if _response.status_code ==
|
|
1080
|
-
raise
|
|
1069
|
+
if _response.status_code == 500:
|
|
1070
|
+
raise InternalServerError(
|
|
1081
1071
|
headers=dict(_response.headers),
|
|
1082
1072
|
body=typing.cast(
|
|
1083
|
-
|
|
1073
|
+
ErrorResponse,
|
|
1084
1074
|
parse_obj_as(
|
|
1085
|
-
type_=
|
|
1075
|
+
type_=ErrorResponse, # type: ignore
|
|
1086
1076
|
object_=_response.json(),
|
|
1087
1077
|
),
|
|
1088
1078
|
),
|
|
@@ -1092,36 +1082,48 @@ class AsyncRawOrdersClient:
|
|
|
1092
1082
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1093
1083
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1094
1084
|
|
|
1095
|
-
async def
|
|
1096
|
-
self,
|
|
1097
|
-
|
|
1085
|
+
async def get_order_lines(
|
|
1086
|
+
self,
|
|
1087
|
+
id: str,
|
|
1088
|
+
*,
|
|
1089
|
+
limit: typing.Optional[int] = None,
|
|
1090
|
+
offset: typing.Optional[int] = None,
|
|
1091
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1092
|
+
) -> AsyncHttpResponse[OrderLinesResponse]:
|
|
1098
1093
|
"""
|
|
1099
|
-
|
|
1094
|
+
Get the order lines for an order by its ID
|
|
1100
1095
|
|
|
1101
1096
|
Parameters
|
|
1102
1097
|
----------
|
|
1103
|
-
|
|
1104
|
-
|
|
1098
|
+
id : str
|
|
1099
|
+
|
|
1100
|
+
limit : typing.Optional[int]
|
|
1101
|
+
|
|
1102
|
+
offset : typing.Optional[int]
|
|
1105
1103
|
|
|
1106
1104
|
request_options : typing.Optional[RequestOptions]
|
|
1107
1105
|
Request-specific configuration.
|
|
1108
1106
|
|
|
1109
1107
|
Returns
|
|
1110
1108
|
-------
|
|
1111
|
-
AsyncHttpResponse[
|
|
1112
|
-
|
|
1109
|
+
AsyncHttpResponse[OrderLinesResponse]
|
|
1110
|
+
200
|
|
1113
1111
|
"""
|
|
1114
1112
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1115
|
-
f"orders/{jsonable_encoder(
|
|
1113
|
+
f"orders/{jsonable_encoder(id)}/lines",
|
|
1116
1114
|
method="GET",
|
|
1115
|
+
params={
|
|
1116
|
+
"limit": limit,
|
|
1117
|
+
"offset": offset,
|
|
1118
|
+
},
|
|
1117
1119
|
request_options=request_options,
|
|
1118
1120
|
)
|
|
1119
1121
|
try:
|
|
1120
1122
|
if 200 <= _response.status_code < 300:
|
|
1121
1123
|
_data = typing.cast(
|
|
1122
|
-
|
|
1124
|
+
OrderLinesResponse,
|
|
1123
1125
|
parse_obj_as(
|
|
1124
|
-
type_=
|
|
1126
|
+
type_=OrderLinesResponse, # type: ignore
|
|
1125
1127
|
object_=_response.json(),
|
|
1126
1128
|
),
|
|
1127
1129
|
)
|
|
@@ -1130,9 +1132,9 @@ class AsyncRawOrdersClient:
|
|
|
1130
1132
|
raise ForbiddenError(
|
|
1131
1133
|
headers=dict(_response.headers),
|
|
1132
1134
|
body=typing.cast(
|
|
1133
|
-
|
|
1135
|
+
ErrorResponse,
|
|
1134
1136
|
parse_obj_as(
|
|
1135
|
-
type_=
|
|
1137
|
+
type_=ErrorResponse, # type: ignore
|
|
1136
1138
|
object_=_response.json(),
|
|
1137
1139
|
),
|
|
1138
1140
|
),
|
|
@@ -1141,9 +1143,20 @@ class AsyncRawOrdersClient:
|
|
|
1141
1143
|
raise NotFoundError(
|
|
1142
1144
|
headers=dict(_response.headers),
|
|
1143
1145
|
body=typing.cast(
|
|
1144
|
-
|
|
1146
|
+
ErrorResponse,
|
|
1147
|
+
parse_obj_as(
|
|
1148
|
+
type_=ErrorResponse, # type: ignore
|
|
1149
|
+
object_=_response.json(),
|
|
1150
|
+
),
|
|
1151
|
+
),
|
|
1152
|
+
)
|
|
1153
|
+
if _response.status_code == 500:
|
|
1154
|
+
raise InternalServerError(
|
|
1155
|
+
headers=dict(_response.headers),
|
|
1156
|
+
body=typing.cast(
|
|
1157
|
+
ErrorResponse,
|
|
1145
1158
|
parse_obj_as(
|
|
1146
|
-
type_=
|
|
1159
|
+
type_=ErrorResponse, # type: ignore
|
|
1147
1160
|
object_=_response.json(),
|
|
1148
1161
|
),
|
|
1149
1162
|
),
|