paid-python 0.6.0__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 +65 -95
- paid/client.py +17 -494
- paid/contacts/client.py +415 -133
- paid/contacts/raw_client.py +1046 -118
- paid/core/client_wrapper.py +9 -10
- paid/customers/client.py +270 -566
- paid/customers/raw_client.py +731 -537
- 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/invoices/raw_client.py +692 -0
- paid/orders/__init__.py +0 -3
- paid/orders/client.py +371 -128
- paid/orders/raw_client.py +829 -121
- 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 +62 -86
- 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 +57 -0
- 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 +7 -0
- 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.py → update_contact_request.py} +10 -11
- paid/types/update_customer_request.py +38 -0
- paid/types/{product_update.py → update_product_request.py} +2 -12
- {paid_python-0.6.0.dist-info → paid_python-1.0.0a1.dist-info}/METADATA +27 -11
- paid_python-1.0.0a1.dist-info/RECORD +110 -0
- opentelemetry/instrumentation/openai/__init__.py +0 -54
- opentelemetry/instrumentation/openai/shared/__init__.py +0 -399
- opentelemetry/instrumentation/openai/shared/audio_wrappers.py +0 -247
- opentelemetry/instrumentation/openai/shared/chat_wrappers.py +0 -1192
- opentelemetry/instrumentation/openai/shared/completion_wrappers.py +0 -292
- opentelemetry/instrumentation/openai/shared/config.py +0 -15
- opentelemetry/instrumentation/openai/shared/embeddings_wrappers.py +0 -311
- opentelemetry/instrumentation/openai/shared/event_emitter.py +0 -108
- opentelemetry/instrumentation/openai/shared/event_models.py +0 -41
- opentelemetry/instrumentation/openai/shared/image_gen_wrappers.py +0 -68
- opentelemetry/instrumentation/openai/shared/span_utils.py +0 -0
- opentelemetry/instrumentation/openai/utils.py +0 -213
- opentelemetry/instrumentation/openai/v0/__init__.py +0 -176
- opentelemetry/instrumentation/openai/v1/__init__.py +0 -394
- opentelemetry/instrumentation/openai/v1/assistant_wrappers.py +0 -329
- opentelemetry/instrumentation/openai/v1/event_handler_wrapper.py +0 -134
- opentelemetry/instrumentation/openai/v1/responses_wrappers.py +0 -1113
- opentelemetry/instrumentation/openai/version.py +0 -1
- paid/agents/client.py +0 -880
- paid/agents/raw_client.py +0 -785
- 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 -332
- paid/plans/raw_client.py +0 -464
- 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_price_point.py +0 -27
- paid/types/agent_price_point_tiers.py +0 -23
- paid/types/agent_update.py +0 -29
- paid/types/api_error.py +0 -29
- paid/types/billing_frequency.py +0 -5
- paid/types/charge_type.py +0 -5
- 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/plan.py +0 -81
- paid/types/plan_group.py +0 -60
- paid/types/plan_plan_products_item.py +0 -35
- paid/types/plan_plan_products_item_plan_product_attribute_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/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-0.6.0.dist-info/RECORD +0 -153
- /paid/{agents → invoices}/__init__.py +0 -0
- /paid/{orders/lines → signals}/__init__.py +0 -0
- {paid_python-0.6.0.dist-info → paid_python-1.0.0a1.dist-info}/LICENSE +0 -0
- {paid_python-0.6.0.dist-info → paid_python-1.0.0a1.dist-info}/WHEEL +0 -0
paid/orders/raw_client.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
+
import datetime as dt
|
|
3
4
|
import typing
|
|
4
5
|
from json.decoder import JSONDecodeError
|
|
5
6
|
|
|
@@ -9,9 +10,16 @@ from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
|
9
10
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
10
11
|
from ..core.pydantic_utilities import parse_obj_as
|
|
11
12
|
from ..core.request_options import RequestOptions
|
|
12
|
-
from ..
|
|
13
|
+
from ..errors.bad_request_error import BadRequestError
|
|
14
|
+
from ..errors.forbidden_error import ForbiddenError
|
|
15
|
+
from ..errors.internal_server_error import InternalServerError
|
|
16
|
+
from ..errors.not_found_error import NotFoundError
|
|
17
|
+
from ..types.empty_response import EmptyResponse
|
|
18
|
+
from ..types.error_response import ErrorResponse
|
|
13
19
|
from ..types.order import Order
|
|
14
|
-
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
|
|
15
23
|
|
|
16
24
|
# this is used as the default value for optional parameters
|
|
17
25
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -21,76 +29,132 @@ class RawOrdersClient:
|
|
|
21
29
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
22
30
|
self._client_wrapper = client_wrapper
|
|
23
31
|
|
|
24
|
-
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]:
|
|
25
39
|
"""
|
|
40
|
+
Get a list of orders for the organization
|
|
41
|
+
|
|
26
42
|
Parameters
|
|
27
43
|
----------
|
|
44
|
+
limit : typing.Optional[int]
|
|
45
|
+
|
|
46
|
+
offset : typing.Optional[int]
|
|
47
|
+
|
|
28
48
|
request_options : typing.Optional[RequestOptions]
|
|
29
49
|
Request-specific configuration.
|
|
30
50
|
|
|
31
51
|
Returns
|
|
32
52
|
-------
|
|
33
|
-
HttpResponse[
|
|
34
|
-
|
|
53
|
+
HttpResponse[OrderListResponse]
|
|
54
|
+
200
|
|
35
55
|
"""
|
|
36
56
|
_response = self._client_wrapper.httpx_client.request(
|
|
37
|
-
"orders",
|
|
57
|
+
"orders/",
|
|
38
58
|
method="GET",
|
|
59
|
+
params={
|
|
60
|
+
"limit": limit,
|
|
61
|
+
"offset": offset,
|
|
62
|
+
},
|
|
39
63
|
request_options=request_options,
|
|
40
64
|
)
|
|
41
65
|
try:
|
|
42
66
|
if 200 <= _response.status_code < 300:
|
|
43
67
|
_data = typing.cast(
|
|
44
|
-
|
|
68
|
+
OrderListResponse,
|
|
45
69
|
parse_obj_as(
|
|
46
|
-
type_=
|
|
70
|
+
type_=OrderListResponse, # type: ignore
|
|
47
71
|
object_=_response.json(),
|
|
48
72
|
),
|
|
49
73
|
)
|
|
50
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
|
+
)
|
|
51
108
|
_response_json = _response.json()
|
|
52
109
|
except JSONDecodeError:
|
|
53
110
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
54
111
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
55
112
|
|
|
56
|
-
def
|
|
113
|
+
def create_a_new_order(
|
|
57
114
|
self,
|
|
58
115
|
*,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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,
|
|
69
128
|
request_options: typing.Optional[RequestOptions] = None,
|
|
70
129
|
) -> HttpResponse[Order]:
|
|
71
130
|
"""
|
|
131
|
+
Creates a new order for the organization
|
|
132
|
+
|
|
72
133
|
Parameters
|
|
73
134
|
----------
|
|
74
|
-
|
|
135
|
+
customer_id : str
|
|
136
|
+
|
|
137
|
+
billing_customer_id : typing.Optional[str]
|
|
138
|
+
|
|
139
|
+
billing_contact_ids : typing.Optional[typing.Sequence[str]]
|
|
75
140
|
|
|
76
|
-
|
|
141
|
+
name : typing.Optional[str]
|
|
77
142
|
|
|
78
|
-
|
|
143
|
+
start_date : typing.Optional[dt.datetime]
|
|
79
144
|
|
|
80
|
-
|
|
145
|
+
end_date : typing.Optional[dt.datetime]
|
|
81
146
|
|
|
82
|
-
|
|
147
|
+
subscription_terms : typing.Optional[int]
|
|
83
148
|
|
|
84
|
-
|
|
149
|
+
creation_state : typing.Optional[OrderCreationState]
|
|
85
150
|
|
|
86
|
-
|
|
151
|
+
billing_anchor : typing.Optional[float]
|
|
87
152
|
|
|
88
|
-
|
|
153
|
+
payment_terms : typing.Optional[str]
|
|
89
154
|
|
|
90
|
-
|
|
91
|
-
Optional plan ID to associate with this order
|
|
155
|
+
external_id : typing.Optional[str]
|
|
92
156
|
|
|
93
|
-
|
|
157
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
94
158
|
|
|
95
159
|
request_options : typing.Optional[RequestOptions]
|
|
96
160
|
Request-specific configuration.
|
|
@@ -98,24 +162,24 @@ class RawOrdersClient:
|
|
|
98
162
|
Returns
|
|
99
163
|
-------
|
|
100
164
|
HttpResponse[Order]
|
|
101
|
-
|
|
165
|
+
201
|
|
102
166
|
"""
|
|
103
167
|
_response = self._client_wrapper.httpx_client.request(
|
|
104
|
-
"orders",
|
|
168
|
+
"orders/",
|
|
105
169
|
method="POST",
|
|
106
170
|
json={
|
|
107
171
|
"customerId": customer_id,
|
|
108
|
-
"
|
|
109
|
-
"
|
|
172
|
+
"billingCustomerId": billing_customer_id,
|
|
173
|
+
"billingContactIds": billing_contact_ids,
|
|
110
174
|
"name": name,
|
|
111
|
-
"description": description,
|
|
112
175
|
"startDate": start_date,
|
|
113
176
|
"endDate": end_date,
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
|
|
118
|
-
|
|
177
|
+
"subscriptionTerms": subscription_terms,
|
|
178
|
+
"creationState": creation_state,
|
|
179
|
+
"billingAnchor": billing_anchor,
|
|
180
|
+
"paymentTerms": payment_terms,
|
|
181
|
+
"externalId": external_id,
|
|
182
|
+
"metadata": metadata,
|
|
119
183
|
},
|
|
120
184
|
headers={
|
|
121
185
|
"content-type": "application/json",
|
|
@@ -133,16 +197,51 @@ class RawOrdersClient:
|
|
|
133
197
|
),
|
|
134
198
|
)
|
|
135
199
|
return HttpResponse(response=_response, data=_data)
|
|
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
|
+
),
|
|
209
|
+
),
|
|
210
|
+
)
|
|
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
|
+
),
|
|
231
|
+
),
|
|
232
|
+
)
|
|
136
233
|
_response_json = _response.json()
|
|
137
234
|
except JSONDecodeError:
|
|
138
235
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
139
236
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
140
237
|
|
|
141
|
-
def
|
|
238
|
+
def get_order(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Order]:
|
|
142
239
|
"""
|
|
240
|
+
Get an order by its ID
|
|
241
|
+
|
|
143
242
|
Parameters
|
|
144
243
|
----------
|
|
145
|
-
|
|
244
|
+
id : str
|
|
146
245
|
|
|
147
246
|
request_options : typing.Optional[RequestOptions]
|
|
148
247
|
Request-specific configuration.
|
|
@@ -150,10 +249,10 @@ class RawOrdersClient:
|
|
|
150
249
|
Returns
|
|
151
250
|
-------
|
|
152
251
|
HttpResponse[Order]
|
|
153
|
-
|
|
252
|
+
200
|
|
154
253
|
"""
|
|
155
254
|
_response = self._client_wrapper.httpx_client.request(
|
|
156
|
-
f"orders/{jsonable_encoder(
|
|
255
|
+
f"orders/{jsonable_encoder(id)}",
|
|
157
256
|
method="GET",
|
|
158
257
|
request_options=request_options,
|
|
159
258
|
)
|
|
@@ -167,68 +266,329 @@ class RawOrdersClient:
|
|
|
167
266
|
),
|
|
168
267
|
)
|
|
169
268
|
return HttpResponse(response=_response, data=_data)
|
|
269
|
+
if _response.status_code == 403:
|
|
270
|
+
raise ForbiddenError(
|
|
271
|
+
headers=dict(_response.headers),
|
|
272
|
+
body=typing.cast(
|
|
273
|
+
ErrorResponse,
|
|
274
|
+
parse_obj_as(
|
|
275
|
+
type_=ErrorResponse, # type: ignore
|
|
276
|
+
object_=_response.json(),
|
|
277
|
+
),
|
|
278
|
+
),
|
|
279
|
+
)
|
|
280
|
+
if _response.status_code == 404:
|
|
281
|
+
raise NotFoundError(
|
|
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
|
+
)
|
|
170
302
|
_response_json = _response.json()
|
|
171
303
|
except JSONDecodeError:
|
|
172
304
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
173
305
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
174
306
|
|
|
175
|
-
def
|
|
307
|
+
def update_order(
|
|
308
|
+
self,
|
|
309
|
+
id: str,
|
|
310
|
+
*,
|
|
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,
|
|
322
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
323
|
+
) -> HttpResponse[Order]:
|
|
176
324
|
"""
|
|
325
|
+
Update an order by its ID
|
|
326
|
+
|
|
177
327
|
Parameters
|
|
178
328
|
----------
|
|
179
|
-
|
|
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]
|
|
342
|
+
|
|
343
|
+
payment_terms : typing.Optional[str]
|
|
344
|
+
|
|
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]]
|
|
180
352
|
|
|
181
353
|
request_options : typing.Optional[RequestOptions]
|
|
182
354
|
Request-specific configuration.
|
|
183
355
|
|
|
184
356
|
Returns
|
|
185
357
|
-------
|
|
186
|
-
HttpResponse[
|
|
358
|
+
HttpResponse[Order]
|
|
359
|
+
200
|
|
187
360
|
"""
|
|
188
361
|
_response = self._client_wrapper.httpx_client.request(
|
|
189
|
-
f"orders/{jsonable_encoder(
|
|
362
|
+
f"orders/{jsonable_encoder(id)}",
|
|
363
|
+
method="PUT",
|
|
364
|
+
json={
|
|
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,
|
|
376
|
+
},
|
|
377
|
+
headers={
|
|
378
|
+
"content-type": "application/json",
|
|
379
|
+
},
|
|
380
|
+
request_options=request_options,
|
|
381
|
+
omit=OMIT,
|
|
382
|
+
)
|
|
383
|
+
try:
|
|
384
|
+
if 200 <= _response.status_code < 300:
|
|
385
|
+
_data = typing.cast(
|
|
386
|
+
Order,
|
|
387
|
+
parse_obj_as(
|
|
388
|
+
type_=Order, # type: ignore
|
|
389
|
+
object_=_response.json(),
|
|
390
|
+
),
|
|
391
|
+
)
|
|
392
|
+
return HttpResponse(response=_response, data=_data)
|
|
393
|
+
if _response.status_code == 400:
|
|
394
|
+
raise BadRequestError(
|
|
395
|
+
headers=dict(_response.headers),
|
|
396
|
+
body=typing.cast(
|
|
397
|
+
ErrorResponse,
|
|
398
|
+
parse_obj_as(
|
|
399
|
+
type_=ErrorResponse, # type: ignore
|
|
400
|
+
object_=_response.json(),
|
|
401
|
+
),
|
|
402
|
+
),
|
|
403
|
+
)
|
|
404
|
+
if _response.status_code == 403:
|
|
405
|
+
raise ForbiddenError(
|
|
406
|
+
headers=dict(_response.headers),
|
|
407
|
+
body=typing.cast(
|
|
408
|
+
ErrorResponse,
|
|
409
|
+
parse_obj_as(
|
|
410
|
+
type_=ErrorResponse, # type: ignore
|
|
411
|
+
object_=_response.json(),
|
|
412
|
+
),
|
|
413
|
+
),
|
|
414
|
+
)
|
|
415
|
+
if _response.status_code == 404:
|
|
416
|
+
raise NotFoundError(
|
|
417
|
+
headers=dict(_response.headers),
|
|
418
|
+
body=typing.cast(
|
|
419
|
+
ErrorResponse,
|
|
420
|
+
parse_obj_as(
|
|
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
|
|
433
|
+
object_=_response.json(),
|
|
434
|
+
),
|
|
435
|
+
),
|
|
436
|
+
)
|
|
437
|
+
_response_json = _response.json()
|
|
438
|
+
except JSONDecodeError:
|
|
439
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
440
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
441
|
+
|
|
442
|
+
def delete_order(
|
|
443
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
444
|
+
) -> HttpResponse[EmptyResponse]:
|
|
445
|
+
"""
|
|
446
|
+
Delete an order by its ID
|
|
447
|
+
|
|
448
|
+
Parameters
|
|
449
|
+
----------
|
|
450
|
+
id : str
|
|
451
|
+
|
|
452
|
+
request_options : typing.Optional[RequestOptions]
|
|
453
|
+
Request-specific configuration.
|
|
454
|
+
|
|
455
|
+
Returns
|
|
456
|
+
-------
|
|
457
|
+
HttpResponse[EmptyResponse]
|
|
458
|
+
200
|
|
459
|
+
"""
|
|
460
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
461
|
+
f"orders/{jsonable_encoder(id)}",
|
|
190
462
|
method="DELETE",
|
|
191
463
|
request_options=request_options,
|
|
192
464
|
)
|
|
193
465
|
try:
|
|
194
466
|
if 200 <= _response.status_code < 300:
|
|
195
|
-
|
|
467
|
+
_data = typing.cast(
|
|
468
|
+
EmptyResponse,
|
|
469
|
+
parse_obj_as(
|
|
470
|
+
type_=EmptyResponse, # type: ignore
|
|
471
|
+
object_=_response.json(),
|
|
472
|
+
),
|
|
473
|
+
)
|
|
474
|
+
return HttpResponse(response=_response, data=_data)
|
|
475
|
+
if _response.status_code == 403:
|
|
476
|
+
raise ForbiddenError(
|
|
477
|
+
headers=dict(_response.headers),
|
|
478
|
+
body=typing.cast(
|
|
479
|
+
ErrorResponse,
|
|
480
|
+
parse_obj_as(
|
|
481
|
+
type_=ErrorResponse, # type: ignore
|
|
482
|
+
object_=_response.json(),
|
|
483
|
+
),
|
|
484
|
+
),
|
|
485
|
+
)
|
|
486
|
+
if _response.status_code == 404:
|
|
487
|
+
raise NotFoundError(
|
|
488
|
+
headers=dict(_response.headers),
|
|
489
|
+
body=typing.cast(
|
|
490
|
+
ErrorResponse,
|
|
491
|
+
parse_obj_as(
|
|
492
|
+
type_=ErrorResponse, # type: ignore
|
|
493
|
+
object_=_response.json(),
|
|
494
|
+
),
|
|
495
|
+
),
|
|
496
|
+
)
|
|
497
|
+
if _response.status_code == 500:
|
|
498
|
+
raise InternalServerError(
|
|
499
|
+
headers=dict(_response.headers),
|
|
500
|
+
body=typing.cast(
|
|
501
|
+
ErrorResponse,
|
|
502
|
+
parse_obj_as(
|
|
503
|
+
type_=ErrorResponse, # type: ignore
|
|
504
|
+
object_=_response.json(),
|
|
505
|
+
),
|
|
506
|
+
),
|
|
507
|
+
)
|
|
196
508
|
_response_json = _response.json()
|
|
197
509
|
except JSONDecodeError:
|
|
198
510
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
199
511
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
200
512
|
|
|
201
|
-
def
|
|
202
|
-
self,
|
|
203
|
-
|
|
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]:
|
|
204
521
|
"""
|
|
522
|
+
Get the order lines for an order by its ID
|
|
523
|
+
|
|
205
524
|
Parameters
|
|
206
525
|
----------
|
|
207
|
-
|
|
526
|
+
id : str
|
|
527
|
+
|
|
528
|
+
limit : typing.Optional[int]
|
|
529
|
+
|
|
530
|
+
offset : typing.Optional[int]
|
|
208
531
|
|
|
209
532
|
request_options : typing.Optional[RequestOptions]
|
|
210
533
|
Request-specific configuration.
|
|
211
534
|
|
|
212
535
|
Returns
|
|
213
536
|
-------
|
|
214
|
-
HttpResponse[
|
|
215
|
-
|
|
537
|
+
HttpResponse[OrderLinesResponse]
|
|
538
|
+
200
|
|
216
539
|
"""
|
|
217
540
|
_response = self._client_wrapper.httpx_client.request(
|
|
218
|
-
f"orders/{jsonable_encoder(
|
|
219
|
-
method="
|
|
541
|
+
f"orders/{jsonable_encoder(id)}/lines",
|
|
542
|
+
method="GET",
|
|
543
|
+
params={
|
|
544
|
+
"limit": limit,
|
|
545
|
+
"offset": offset,
|
|
546
|
+
},
|
|
220
547
|
request_options=request_options,
|
|
221
548
|
)
|
|
222
549
|
try:
|
|
223
550
|
if 200 <= _response.status_code < 300:
|
|
224
551
|
_data = typing.cast(
|
|
225
|
-
|
|
552
|
+
OrderLinesResponse,
|
|
226
553
|
parse_obj_as(
|
|
227
|
-
type_=
|
|
554
|
+
type_=OrderLinesResponse, # type: ignore
|
|
228
555
|
object_=_response.json(),
|
|
229
556
|
),
|
|
230
557
|
)
|
|
231
558
|
return HttpResponse(response=_response, data=_data)
|
|
559
|
+
if _response.status_code == 403:
|
|
560
|
+
raise ForbiddenError(
|
|
561
|
+
headers=dict(_response.headers),
|
|
562
|
+
body=typing.cast(
|
|
563
|
+
ErrorResponse,
|
|
564
|
+
parse_obj_as(
|
|
565
|
+
type_=ErrorResponse, # type: ignore
|
|
566
|
+
object_=_response.json(),
|
|
567
|
+
),
|
|
568
|
+
),
|
|
569
|
+
)
|
|
570
|
+
if _response.status_code == 404:
|
|
571
|
+
raise NotFoundError(
|
|
572
|
+
headers=dict(_response.headers),
|
|
573
|
+
body=typing.cast(
|
|
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,
|
|
586
|
+
parse_obj_as(
|
|
587
|
+
type_=ErrorResponse, # type: ignore
|
|
588
|
+
object_=_response.json(),
|
|
589
|
+
),
|
|
590
|
+
),
|
|
591
|
+
)
|
|
232
592
|
_response_json = _response.json()
|
|
233
593
|
except JSONDecodeError:
|
|
234
594
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
@@ -239,78 +599,132 @@ class AsyncRawOrdersClient:
|
|
|
239
599
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
240
600
|
self._client_wrapper = client_wrapper
|
|
241
601
|
|
|
242
|
-
async def
|
|
243
|
-
self,
|
|
244
|
-
|
|
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]:
|
|
245
609
|
"""
|
|
610
|
+
Get a list of orders for the organization
|
|
611
|
+
|
|
246
612
|
Parameters
|
|
247
613
|
----------
|
|
614
|
+
limit : typing.Optional[int]
|
|
615
|
+
|
|
616
|
+
offset : typing.Optional[int]
|
|
617
|
+
|
|
248
618
|
request_options : typing.Optional[RequestOptions]
|
|
249
619
|
Request-specific configuration.
|
|
250
620
|
|
|
251
621
|
Returns
|
|
252
622
|
-------
|
|
253
|
-
AsyncHttpResponse[
|
|
254
|
-
|
|
623
|
+
AsyncHttpResponse[OrderListResponse]
|
|
624
|
+
200
|
|
255
625
|
"""
|
|
256
626
|
_response = await self._client_wrapper.httpx_client.request(
|
|
257
|
-
"orders",
|
|
627
|
+
"orders/",
|
|
258
628
|
method="GET",
|
|
629
|
+
params={
|
|
630
|
+
"limit": limit,
|
|
631
|
+
"offset": offset,
|
|
632
|
+
},
|
|
259
633
|
request_options=request_options,
|
|
260
634
|
)
|
|
261
635
|
try:
|
|
262
636
|
if 200 <= _response.status_code < 300:
|
|
263
637
|
_data = typing.cast(
|
|
264
|
-
|
|
638
|
+
OrderListResponse,
|
|
265
639
|
parse_obj_as(
|
|
266
|
-
type_=
|
|
640
|
+
type_=OrderListResponse, # type: ignore
|
|
267
641
|
object_=_response.json(),
|
|
268
642
|
),
|
|
269
643
|
)
|
|
270
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
|
+
)
|
|
271
678
|
_response_json = _response.json()
|
|
272
679
|
except JSONDecodeError:
|
|
273
680
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
274
681
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
275
682
|
|
|
276
|
-
async def
|
|
683
|
+
async def create_a_new_order(
|
|
277
684
|
self,
|
|
278
685
|
*,
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
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,
|
|
289
698
|
request_options: typing.Optional[RequestOptions] = None,
|
|
290
699
|
) -> AsyncHttpResponse[Order]:
|
|
291
700
|
"""
|
|
701
|
+
Creates a new order for the organization
|
|
702
|
+
|
|
292
703
|
Parameters
|
|
293
704
|
----------
|
|
294
|
-
|
|
705
|
+
customer_id : str
|
|
706
|
+
|
|
707
|
+
billing_customer_id : typing.Optional[str]
|
|
708
|
+
|
|
709
|
+
billing_contact_ids : typing.Optional[typing.Sequence[str]]
|
|
295
710
|
|
|
296
|
-
|
|
711
|
+
name : typing.Optional[str]
|
|
297
712
|
|
|
298
|
-
|
|
713
|
+
start_date : typing.Optional[dt.datetime]
|
|
299
714
|
|
|
300
|
-
|
|
715
|
+
end_date : typing.Optional[dt.datetime]
|
|
301
716
|
|
|
302
|
-
|
|
717
|
+
subscription_terms : typing.Optional[int]
|
|
303
718
|
|
|
304
|
-
|
|
719
|
+
creation_state : typing.Optional[OrderCreationState]
|
|
305
720
|
|
|
306
|
-
|
|
721
|
+
billing_anchor : typing.Optional[float]
|
|
307
722
|
|
|
308
|
-
|
|
723
|
+
payment_terms : typing.Optional[str]
|
|
309
724
|
|
|
310
|
-
|
|
311
|
-
Optional plan ID to associate with this order
|
|
725
|
+
external_id : typing.Optional[str]
|
|
312
726
|
|
|
313
|
-
|
|
727
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
314
728
|
|
|
315
729
|
request_options : typing.Optional[RequestOptions]
|
|
316
730
|
Request-specific configuration.
|
|
@@ -318,24 +732,24 @@ class AsyncRawOrdersClient:
|
|
|
318
732
|
Returns
|
|
319
733
|
-------
|
|
320
734
|
AsyncHttpResponse[Order]
|
|
321
|
-
|
|
735
|
+
201
|
|
322
736
|
"""
|
|
323
737
|
_response = await self._client_wrapper.httpx_client.request(
|
|
324
|
-
"orders",
|
|
738
|
+
"orders/",
|
|
325
739
|
method="POST",
|
|
326
740
|
json={
|
|
327
741
|
"customerId": customer_id,
|
|
328
|
-
"
|
|
329
|
-
"
|
|
742
|
+
"billingCustomerId": billing_customer_id,
|
|
743
|
+
"billingContactIds": billing_contact_ids,
|
|
330
744
|
"name": name,
|
|
331
|
-
"description": description,
|
|
332
745
|
"startDate": start_date,
|
|
333
746
|
"endDate": end_date,
|
|
334
|
-
"
|
|
335
|
-
"
|
|
336
|
-
"
|
|
337
|
-
|
|
338
|
-
|
|
747
|
+
"subscriptionTerms": subscription_terms,
|
|
748
|
+
"creationState": creation_state,
|
|
749
|
+
"billingAnchor": billing_anchor,
|
|
750
|
+
"paymentTerms": payment_terms,
|
|
751
|
+
"externalId": external_id,
|
|
752
|
+
"metadata": metadata,
|
|
339
753
|
},
|
|
340
754
|
headers={
|
|
341
755
|
"content-type": "application/json",
|
|
@@ -353,18 +767,53 @@ class AsyncRawOrdersClient:
|
|
|
353
767
|
),
|
|
354
768
|
)
|
|
355
769
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
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
|
+
),
|
|
779
|
+
),
|
|
780
|
+
)
|
|
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
|
+
),
|
|
801
|
+
),
|
|
802
|
+
)
|
|
356
803
|
_response_json = _response.json()
|
|
357
804
|
except JSONDecodeError:
|
|
358
805
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
359
806
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
360
807
|
|
|
361
|
-
async def
|
|
362
|
-
self,
|
|
808
|
+
async def get_order(
|
|
809
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
363
810
|
) -> AsyncHttpResponse[Order]:
|
|
364
811
|
"""
|
|
812
|
+
Get an order by its ID
|
|
813
|
+
|
|
365
814
|
Parameters
|
|
366
815
|
----------
|
|
367
|
-
|
|
816
|
+
id : str
|
|
368
817
|
|
|
369
818
|
request_options : typing.Optional[RequestOptions]
|
|
370
819
|
Request-specific configuration.
|
|
@@ -372,10 +821,10 @@ class AsyncRawOrdersClient:
|
|
|
372
821
|
Returns
|
|
373
822
|
-------
|
|
374
823
|
AsyncHttpResponse[Order]
|
|
375
|
-
|
|
824
|
+
200
|
|
376
825
|
"""
|
|
377
826
|
_response = await self._client_wrapper.httpx_client.request(
|
|
378
|
-
f"orders/{jsonable_encoder(
|
|
827
|
+
f"orders/{jsonable_encoder(id)}",
|
|
379
828
|
method="GET",
|
|
380
829
|
request_options=request_options,
|
|
381
830
|
)
|
|
@@ -389,70 +838,329 @@ class AsyncRawOrdersClient:
|
|
|
389
838
|
),
|
|
390
839
|
)
|
|
391
840
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
841
|
+
if _response.status_code == 403:
|
|
842
|
+
raise ForbiddenError(
|
|
843
|
+
headers=dict(_response.headers),
|
|
844
|
+
body=typing.cast(
|
|
845
|
+
ErrorResponse,
|
|
846
|
+
parse_obj_as(
|
|
847
|
+
type_=ErrorResponse, # type: ignore
|
|
848
|
+
object_=_response.json(),
|
|
849
|
+
),
|
|
850
|
+
),
|
|
851
|
+
)
|
|
852
|
+
if _response.status_code == 404:
|
|
853
|
+
raise NotFoundError(
|
|
854
|
+
headers=dict(_response.headers),
|
|
855
|
+
body=typing.cast(
|
|
856
|
+
ErrorResponse,
|
|
857
|
+
parse_obj_as(
|
|
858
|
+
type_=ErrorResponse, # type: ignore
|
|
859
|
+
object_=_response.json(),
|
|
860
|
+
),
|
|
861
|
+
),
|
|
862
|
+
)
|
|
863
|
+
if _response.status_code == 500:
|
|
864
|
+
raise InternalServerError(
|
|
865
|
+
headers=dict(_response.headers),
|
|
866
|
+
body=typing.cast(
|
|
867
|
+
ErrorResponse,
|
|
868
|
+
parse_obj_as(
|
|
869
|
+
type_=ErrorResponse, # type: ignore
|
|
870
|
+
object_=_response.json(),
|
|
871
|
+
),
|
|
872
|
+
),
|
|
873
|
+
)
|
|
392
874
|
_response_json = _response.json()
|
|
393
875
|
except JSONDecodeError:
|
|
394
876
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
395
877
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
396
878
|
|
|
397
|
-
async def
|
|
398
|
-
self,
|
|
399
|
-
|
|
879
|
+
async def update_order(
|
|
880
|
+
self,
|
|
881
|
+
id: str,
|
|
882
|
+
*,
|
|
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,
|
|
894
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
895
|
+
) -> AsyncHttpResponse[Order]:
|
|
400
896
|
"""
|
|
897
|
+
Update an order by its ID
|
|
898
|
+
|
|
401
899
|
Parameters
|
|
402
900
|
----------
|
|
403
|
-
|
|
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]
|
|
914
|
+
|
|
915
|
+
payment_terms : typing.Optional[str]
|
|
916
|
+
|
|
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]]
|
|
404
924
|
|
|
405
925
|
request_options : typing.Optional[RequestOptions]
|
|
406
926
|
Request-specific configuration.
|
|
407
927
|
|
|
408
928
|
Returns
|
|
409
929
|
-------
|
|
410
|
-
AsyncHttpResponse[
|
|
930
|
+
AsyncHttpResponse[Order]
|
|
931
|
+
200
|
|
411
932
|
"""
|
|
412
933
|
_response = await self._client_wrapper.httpx_client.request(
|
|
413
|
-
f"orders/{jsonable_encoder(
|
|
934
|
+
f"orders/{jsonable_encoder(id)}",
|
|
935
|
+
method="PUT",
|
|
936
|
+
json={
|
|
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,
|
|
948
|
+
},
|
|
949
|
+
headers={
|
|
950
|
+
"content-type": "application/json",
|
|
951
|
+
},
|
|
952
|
+
request_options=request_options,
|
|
953
|
+
omit=OMIT,
|
|
954
|
+
)
|
|
955
|
+
try:
|
|
956
|
+
if 200 <= _response.status_code < 300:
|
|
957
|
+
_data = typing.cast(
|
|
958
|
+
Order,
|
|
959
|
+
parse_obj_as(
|
|
960
|
+
type_=Order, # type: ignore
|
|
961
|
+
object_=_response.json(),
|
|
962
|
+
),
|
|
963
|
+
)
|
|
964
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
965
|
+
if _response.status_code == 400:
|
|
966
|
+
raise BadRequestError(
|
|
967
|
+
headers=dict(_response.headers),
|
|
968
|
+
body=typing.cast(
|
|
969
|
+
ErrorResponse,
|
|
970
|
+
parse_obj_as(
|
|
971
|
+
type_=ErrorResponse, # type: ignore
|
|
972
|
+
object_=_response.json(),
|
|
973
|
+
),
|
|
974
|
+
),
|
|
975
|
+
)
|
|
976
|
+
if _response.status_code == 403:
|
|
977
|
+
raise ForbiddenError(
|
|
978
|
+
headers=dict(_response.headers),
|
|
979
|
+
body=typing.cast(
|
|
980
|
+
ErrorResponse,
|
|
981
|
+
parse_obj_as(
|
|
982
|
+
type_=ErrorResponse, # type: ignore
|
|
983
|
+
object_=_response.json(),
|
|
984
|
+
),
|
|
985
|
+
),
|
|
986
|
+
)
|
|
987
|
+
if _response.status_code == 404:
|
|
988
|
+
raise NotFoundError(
|
|
989
|
+
headers=dict(_response.headers),
|
|
990
|
+
body=typing.cast(
|
|
991
|
+
ErrorResponse,
|
|
992
|
+
parse_obj_as(
|
|
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
|
|
1005
|
+
object_=_response.json(),
|
|
1006
|
+
),
|
|
1007
|
+
),
|
|
1008
|
+
)
|
|
1009
|
+
_response_json = _response.json()
|
|
1010
|
+
except JSONDecodeError:
|
|
1011
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1012
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1013
|
+
|
|
1014
|
+
async def delete_order(
|
|
1015
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1016
|
+
) -> AsyncHttpResponse[EmptyResponse]:
|
|
1017
|
+
"""
|
|
1018
|
+
Delete an order by its ID
|
|
1019
|
+
|
|
1020
|
+
Parameters
|
|
1021
|
+
----------
|
|
1022
|
+
id : str
|
|
1023
|
+
|
|
1024
|
+
request_options : typing.Optional[RequestOptions]
|
|
1025
|
+
Request-specific configuration.
|
|
1026
|
+
|
|
1027
|
+
Returns
|
|
1028
|
+
-------
|
|
1029
|
+
AsyncHttpResponse[EmptyResponse]
|
|
1030
|
+
200
|
|
1031
|
+
"""
|
|
1032
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1033
|
+
f"orders/{jsonable_encoder(id)}",
|
|
414
1034
|
method="DELETE",
|
|
415
1035
|
request_options=request_options,
|
|
416
1036
|
)
|
|
417
1037
|
try:
|
|
418
1038
|
if 200 <= _response.status_code < 300:
|
|
419
|
-
|
|
1039
|
+
_data = typing.cast(
|
|
1040
|
+
EmptyResponse,
|
|
1041
|
+
parse_obj_as(
|
|
1042
|
+
type_=EmptyResponse, # type: ignore
|
|
1043
|
+
object_=_response.json(),
|
|
1044
|
+
),
|
|
1045
|
+
)
|
|
1046
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1047
|
+
if _response.status_code == 403:
|
|
1048
|
+
raise ForbiddenError(
|
|
1049
|
+
headers=dict(_response.headers),
|
|
1050
|
+
body=typing.cast(
|
|
1051
|
+
ErrorResponse,
|
|
1052
|
+
parse_obj_as(
|
|
1053
|
+
type_=ErrorResponse, # type: ignore
|
|
1054
|
+
object_=_response.json(),
|
|
1055
|
+
),
|
|
1056
|
+
),
|
|
1057
|
+
)
|
|
1058
|
+
if _response.status_code == 404:
|
|
1059
|
+
raise NotFoundError(
|
|
1060
|
+
headers=dict(_response.headers),
|
|
1061
|
+
body=typing.cast(
|
|
1062
|
+
ErrorResponse,
|
|
1063
|
+
parse_obj_as(
|
|
1064
|
+
type_=ErrorResponse, # type: ignore
|
|
1065
|
+
object_=_response.json(),
|
|
1066
|
+
),
|
|
1067
|
+
),
|
|
1068
|
+
)
|
|
1069
|
+
if _response.status_code == 500:
|
|
1070
|
+
raise InternalServerError(
|
|
1071
|
+
headers=dict(_response.headers),
|
|
1072
|
+
body=typing.cast(
|
|
1073
|
+
ErrorResponse,
|
|
1074
|
+
parse_obj_as(
|
|
1075
|
+
type_=ErrorResponse, # type: ignore
|
|
1076
|
+
object_=_response.json(),
|
|
1077
|
+
),
|
|
1078
|
+
),
|
|
1079
|
+
)
|
|
420
1080
|
_response_json = _response.json()
|
|
421
1081
|
except JSONDecodeError:
|
|
422
1082
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
423
1083
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
424
1084
|
|
|
425
|
-
async def
|
|
426
|
-
self,
|
|
427
|
-
|
|
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]:
|
|
428
1093
|
"""
|
|
1094
|
+
Get the order lines for an order by its ID
|
|
1095
|
+
|
|
429
1096
|
Parameters
|
|
430
1097
|
----------
|
|
431
|
-
|
|
1098
|
+
id : str
|
|
1099
|
+
|
|
1100
|
+
limit : typing.Optional[int]
|
|
1101
|
+
|
|
1102
|
+
offset : typing.Optional[int]
|
|
432
1103
|
|
|
433
1104
|
request_options : typing.Optional[RequestOptions]
|
|
434
1105
|
Request-specific configuration.
|
|
435
1106
|
|
|
436
1107
|
Returns
|
|
437
1108
|
-------
|
|
438
|
-
AsyncHttpResponse[
|
|
439
|
-
|
|
1109
|
+
AsyncHttpResponse[OrderLinesResponse]
|
|
1110
|
+
200
|
|
440
1111
|
"""
|
|
441
1112
|
_response = await self._client_wrapper.httpx_client.request(
|
|
442
|
-
f"orders/{jsonable_encoder(
|
|
443
|
-
method="
|
|
1113
|
+
f"orders/{jsonable_encoder(id)}/lines",
|
|
1114
|
+
method="GET",
|
|
1115
|
+
params={
|
|
1116
|
+
"limit": limit,
|
|
1117
|
+
"offset": offset,
|
|
1118
|
+
},
|
|
444
1119
|
request_options=request_options,
|
|
445
1120
|
)
|
|
446
1121
|
try:
|
|
447
1122
|
if 200 <= _response.status_code < 300:
|
|
448
1123
|
_data = typing.cast(
|
|
449
|
-
|
|
1124
|
+
OrderLinesResponse,
|
|
450
1125
|
parse_obj_as(
|
|
451
|
-
type_=
|
|
1126
|
+
type_=OrderLinesResponse, # type: ignore
|
|
452
1127
|
object_=_response.json(),
|
|
453
1128
|
),
|
|
454
1129
|
)
|
|
455
1130
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
1131
|
+
if _response.status_code == 403:
|
|
1132
|
+
raise ForbiddenError(
|
|
1133
|
+
headers=dict(_response.headers),
|
|
1134
|
+
body=typing.cast(
|
|
1135
|
+
ErrorResponse,
|
|
1136
|
+
parse_obj_as(
|
|
1137
|
+
type_=ErrorResponse, # type: ignore
|
|
1138
|
+
object_=_response.json(),
|
|
1139
|
+
),
|
|
1140
|
+
),
|
|
1141
|
+
)
|
|
1142
|
+
if _response.status_code == 404:
|
|
1143
|
+
raise NotFoundError(
|
|
1144
|
+
headers=dict(_response.headers),
|
|
1145
|
+
body=typing.cast(
|
|
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,
|
|
1158
|
+
parse_obj_as(
|
|
1159
|
+
type_=ErrorResponse, # type: ignore
|
|
1160
|
+
object_=_response.json(),
|
|
1161
|
+
),
|
|
1162
|
+
),
|
|
1163
|
+
)
|
|
456
1164
|
_response_json = _response.json()
|
|
457
1165
|
except JSONDecodeError:
|
|
458
1166
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|