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/client.py
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
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
|
|
|
5
6
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
7
|
from ..core.request_options import RequestOptions
|
|
8
|
+
from ..types.empty_response import EmptyResponse
|
|
7
9
|
from ..types.order import Order
|
|
8
|
-
from ..types.
|
|
9
|
-
from .
|
|
10
|
+
from ..types.order_creation_state import OrderCreationState
|
|
11
|
+
from ..types.order_lines_response import OrderLinesResponse
|
|
12
|
+
from ..types.order_list_response import OrderListResponse
|
|
10
13
|
from .raw_client import AsyncRawOrdersClient, RawOrdersClient
|
|
11
14
|
|
|
12
15
|
# this is used as the default value for optional parameters
|
|
@@ -16,7 +19,6 @@ OMIT = typing.cast(typing.Any, ...)
|
|
|
16
19
|
class OrdersClient:
|
|
17
20
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
18
21
|
self._raw_client = RawOrdersClient(client_wrapper=client_wrapper)
|
|
19
|
-
self.lines = LinesClient(client_wrapper=client_wrapper)
|
|
20
22
|
|
|
21
23
|
@property
|
|
22
24
|
def with_raw_response(self) -> RawOrdersClient:
|
|
@@ -29,17 +31,29 @@ class OrdersClient:
|
|
|
29
31
|
"""
|
|
30
32
|
return self._raw_client
|
|
31
33
|
|
|
32
|
-
def
|
|
34
|
+
def list_orders(
|
|
35
|
+
self,
|
|
36
|
+
*,
|
|
37
|
+
limit: typing.Optional[int] = None,
|
|
38
|
+
offset: typing.Optional[int] = None,
|
|
39
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
40
|
+
) -> OrderListResponse:
|
|
33
41
|
"""
|
|
42
|
+
Get a list of orders for the organization
|
|
43
|
+
|
|
34
44
|
Parameters
|
|
35
45
|
----------
|
|
46
|
+
limit : typing.Optional[int]
|
|
47
|
+
|
|
48
|
+
offset : typing.Optional[int]
|
|
49
|
+
|
|
36
50
|
request_options : typing.Optional[RequestOptions]
|
|
37
51
|
Request-specific configuration.
|
|
38
52
|
|
|
39
53
|
Returns
|
|
40
54
|
-------
|
|
41
|
-
|
|
42
|
-
|
|
55
|
+
OrderListResponse
|
|
56
|
+
200
|
|
43
57
|
|
|
44
58
|
Examples
|
|
45
59
|
--------
|
|
@@ -48,49 +62,56 @@ class OrdersClient:
|
|
|
48
62
|
client = Paid(
|
|
49
63
|
token="YOUR_TOKEN",
|
|
50
64
|
)
|
|
51
|
-
client.orders.
|
|
65
|
+
client.orders.list_orders()
|
|
52
66
|
"""
|
|
53
|
-
_response = self._raw_client.
|
|
67
|
+
_response = self._raw_client.list_orders(limit=limit, offset=offset, request_options=request_options)
|
|
54
68
|
return _response.data
|
|
55
69
|
|
|
56
|
-
def
|
|
70
|
+
def create_a_new_order(
|
|
57
71
|
self,
|
|
58
72
|
*,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
customer_id: str,
|
|
74
|
+
billing_customer_id: typing.Optional[str] = OMIT,
|
|
75
|
+
billing_contact_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
76
|
+
name: typing.Optional[str] = OMIT,
|
|
77
|
+
start_date: typing.Optional[dt.datetime] = OMIT,
|
|
78
|
+
end_date: typing.Optional[dt.datetime] = OMIT,
|
|
79
|
+
subscription_terms: typing.Optional[int] = OMIT,
|
|
80
|
+
creation_state: typing.Optional[OrderCreationState] = OMIT,
|
|
81
|
+
billing_anchor: typing.Optional[float] = OMIT,
|
|
82
|
+
payment_terms: typing.Optional[str] = OMIT,
|
|
83
|
+
external_id: typing.Optional[str] = OMIT,
|
|
84
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
69
85
|
request_options: typing.Optional[RequestOptions] = None,
|
|
70
86
|
) -> Order:
|
|
71
87
|
"""
|
|
88
|
+
Creates a new order for the organization
|
|
89
|
+
|
|
72
90
|
Parameters
|
|
73
91
|
----------
|
|
74
|
-
|
|
92
|
+
customer_id : str
|
|
93
|
+
|
|
94
|
+
billing_customer_id : typing.Optional[str]
|
|
95
|
+
|
|
96
|
+
billing_contact_ids : typing.Optional[typing.Sequence[str]]
|
|
75
97
|
|
|
76
|
-
|
|
98
|
+
name : typing.Optional[str]
|
|
77
99
|
|
|
78
|
-
|
|
100
|
+
start_date : typing.Optional[dt.datetime]
|
|
79
101
|
|
|
80
|
-
|
|
102
|
+
end_date : typing.Optional[dt.datetime]
|
|
81
103
|
|
|
82
|
-
|
|
104
|
+
subscription_terms : typing.Optional[int]
|
|
83
105
|
|
|
84
|
-
|
|
106
|
+
creation_state : typing.Optional[OrderCreationState]
|
|
85
107
|
|
|
86
|
-
|
|
108
|
+
billing_anchor : typing.Optional[float]
|
|
87
109
|
|
|
88
|
-
|
|
110
|
+
payment_terms : typing.Optional[str]
|
|
89
111
|
|
|
90
|
-
|
|
91
|
-
Optional plan ID to associate with this order
|
|
112
|
+
external_id : typing.Optional[str]
|
|
92
113
|
|
|
93
|
-
|
|
114
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
94
115
|
|
|
95
116
|
request_options : typing.Optional[RequestOptions]
|
|
96
117
|
Request-specific configuration.
|
|
@@ -98,7 +119,7 @@ class OrdersClient:
|
|
|
98
119
|
Returns
|
|
99
120
|
-------
|
|
100
121
|
Order
|
|
101
|
-
|
|
122
|
+
201
|
|
102
123
|
|
|
103
124
|
Examples
|
|
104
125
|
--------
|
|
@@ -107,35 +128,102 @@ class OrdersClient:
|
|
|
107
128
|
client = Paid(
|
|
108
129
|
token="YOUR_TOKEN",
|
|
109
130
|
)
|
|
110
|
-
client.orders.
|
|
111
|
-
|
|
112
|
-
name="Acme Order",
|
|
113
|
-
description="Acme Order is an order for Acme, Inc.",
|
|
114
|
-
start_date="2025-01-01",
|
|
115
|
-
end_date="2026-01-01",
|
|
116
|
-
currency="USD",
|
|
131
|
+
client.orders.create_a_new_order(
|
|
132
|
+
customer_id="customerId",
|
|
117
133
|
)
|
|
118
134
|
"""
|
|
119
|
-
_response = self._raw_client.
|
|
135
|
+
_response = self._raw_client.create_a_new_order(
|
|
136
|
+
customer_id=customer_id,
|
|
137
|
+
billing_customer_id=billing_customer_id,
|
|
138
|
+
billing_contact_ids=billing_contact_ids,
|
|
120
139
|
name=name,
|
|
121
140
|
start_date=start_date,
|
|
122
|
-
currency=currency,
|
|
123
|
-
customer_id=customer_id,
|
|
124
|
-
customer_external_id=customer_external_id,
|
|
125
|
-
billing_contact_id=billing_contact_id,
|
|
126
|
-
description=description,
|
|
127
141
|
end_date=end_date,
|
|
128
|
-
|
|
129
|
-
|
|
142
|
+
subscription_terms=subscription_terms,
|
|
143
|
+
creation_state=creation_state,
|
|
144
|
+
billing_anchor=billing_anchor,
|
|
145
|
+
payment_terms=payment_terms,
|
|
146
|
+
external_id=external_id,
|
|
147
|
+
metadata=metadata,
|
|
130
148
|
request_options=request_options,
|
|
131
149
|
)
|
|
132
150
|
return _response.data
|
|
133
151
|
|
|
134
|
-
def
|
|
152
|
+
def get_order(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Order:
|
|
153
|
+
"""
|
|
154
|
+
Get an order by its ID
|
|
155
|
+
|
|
156
|
+
Parameters
|
|
157
|
+
----------
|
|
158
|
+
id : str
|
|
159
|
+
|
|
160
|
+
request_options : typing.Optional[RequestOptions]
|
|
161
|
+
Request-specific configuration.
|
|
162
|
+
|
|
163
|
+
Returns
|
|
164
|
+
-------
|
|
165
|
+
Order
|
|
166
|
+
200
|
|
167
|
+
|
|
168
|
+
Examples
|
|
169
|
+
--------
|
|
170
|
+
from paid import Paid
|
|
171
|
+
|
|
172
|
+
client = Paid(
|
|
173
|
+
token="YOUR_TOKEN",
|
|
174
|
+
)
|
|
175
|
+
client.orders.get_order(
|
|
176
|
+
id="id",
|
|
177
|
+
)
|
|
178
|
+
"""
|
|
179
|
+
_response = self._raw_client.get_order(id, request_options=request_options)
|
|
180
|
+
return _response.data
|
|
181
|
+
|
|
182
|
+
def update_order(
|
|
183
|
+
self,
|
|
184
|
+
id: str,
|
|
185
|
+
*,
|
|
186
|
+
name: typing.Optional[str] = OMIT,
|
|
187
|
+
start_date: typing.Optional[dt.datetime] = OMIT,
|
|
188
|
+
end_date: typing.Optional[dt.datetime] = OMIT,
|
|
189
|
+
subscription_terms: typing.Optional[int] = OMIT,
|
|
190
|
+
creation_state: typing.Optional[OrderCreationState] = OMIT,
|
|
191
|
+
billing_anchor: typing.Optional[float] = OMIT,
|
|
192
|
+
payment_terms: typing.Optional[str] = OMIT,
|
|
193
|
+
external_id: typing.Optional[str] = OMIT,
|
|
194
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
195
|
+
billing_customer_id: typing.Optional[str] = OMIT,
|
|
196
|
+
billing_contact_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
197
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
198
|
+
) -> Order:
|
|
135
199
|
"""
|
|
200
|
+
Update an order by its ID
|
|
201
|
+
|
|
136
202
|
Parameters
|
|
137
203
|
----------
|
|
138
|
-
|
|
204
|
+
id : str
|
|
205
|
+
|
|
206
|
+
name : typing.Optional[str]
|
|
207
|
+
|
|
208
|
+
start_date : typing.Optional[dt.datetime]
|
|
209
|
+
|
|
210
|
+
end_date : typing.Optional[dt.datetime]
|
|
211
|
+
|
|
212
|
+
subscription_terms : typing.Optional[int]
|
|
213
|
+
|
|
214
|
+
creation_state : typing.Optional[OrderCreationState]
|
|
215
|
+
|
|
216
|
+
billing_anchor : typing.Optional[float]
|
|
217
|
+
|
|
218
|
+
payment_terms : typing.Optional[str]
|
|
219
|
+
|
|
220
|
+
external_id : typing.Optional[str]
|
|
221
|
+
|
|
222
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
223
|
+
|
|
224
|
+
billing_customer_id : typing.Optional[str]
|
|
225
|
+
|
|
226
|
+
billing_contact_ids : typing.Optional[typing.Sequence[str]]
|
|
139
227
|
|
|
140
228
|
request_options : typing.Optional[RequestOptions]
|
|
141
229
|
Request-specific configuration.
|
|
@@ -143,7 +231,7 @@ class OrdersClient:
|
|
|
143
231
|
Returns
|
|
144
232
|
-------
|
|
145
233
|
Order
|
|
146
|
-
|
|
234
|
+
200
|
|
147
235
|
|
|
148
236
|
Examples
|
|
149
237
|
--------
|
|
@@ -152,25 +240,42 @@ class OrdersClient:
|
|
|
152
240
|
client = Paid(
|
|
153
241
|
token="YOUR_TOKEN",
|
|
154
242
|
)
|
|
155
|
-
client.orders.
|
|
156
|
-
|
|
243
|
+
client.orders.update_order(
|
|
244
|
+
id="id",
|
|
157
245
|
)
|
|
158
246
|
"""
|
|
159
|
-
_response = self._raw_client.
|
|
247
|
+
_response = self._raw_client.update_order(
|
|
248
|
+
id,
|
|
249
|
+
name=name,
|
|
250
|
+
start_date=start_date,
|
|
251
|
+
end_date=end_date,
|
|
252
|
+
subscription_terms=subscription_terms,
|
|
253
|
+
creation_state=creation_state,
|
|
254
|
+
billing_anchor=billing_anchor,
|
|
255
|
+
payment_terms=payment_terms,
|
|
256
|
+
external_id=external_id,
|
|
257
|
+
metadata=metadata,
|
|
258
|
+
billing_customer_id=billing_customer_id,
|
|
259
|
+
billing_contact_ids=billing_contact_ids,
|
|
260
|
+
request_options=request_options,
|
|
261
|
+
)
|
|
160
262
|
return _response.data
|
|
161
263
|
|
|
162
|
-
def
|
|
264
|
+
def delete_order(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> EmptyResponse:
|
|
163
265
|
"""
|
|
266
|
+
Delete an order by its ID
|
|
267
|
+
|
|
164
268
|
Parameters
|
|
165
269
|
----------
|
|
166
|
-
|
|
270
|
+
id : str
|
|
167
271
|
|
|
168
272
|
request_options : typing.Optional[RequestOptions]
|
|
169
273
|
Request-specific configuration.
|
|
170
274
|
|
|
171
275
|
Returns
|
|
172
276
|
-------
|
|
173
|
-
|
|
277
|
+
EmptyResponse
|
|
278
|
+
200
|
|
174
279
|
|
|
175
280
|
Examples
|
|
176
281
|
--------
|
|
@@ -179,26 +284,39 @@ class OrdersClient:
|
|
|
179
284
|
client = Paid(
|
|
180
285
|
token="YOUR_TOKEN",
|
|
181
286
|
)
|
|
182
|
-
client.orders.
|
|
183
|
-
|
|
287
|
+
client.orders.delete_order(
|
|
288
|
+
id="id",
|
|
184
289
|
)
|
|
185
290
|
"""
|
|
186
|
-
_response = self._raw_client.
|
|
291
|
+
_response = self._raw_client.delete_order(id, request_options=request_options)
|
|
187
292
|
return _response.data
|
|
188
293
|
|
|
189
|
-
def
|
|
294
|
+
def get_order_lines(
|
|
295
|
+
self,
|
|
296
|
+
id: str,
|
|
297
|
+
*,
|
|
298
|
+
limit: typing.Optional[int] = None,
|
|
299
|
+
offset: typing.Optional[int] = None,
|
|
300
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
301
|
+
) -> OrderLinesResponse:
|
|
190
302
|
"""
|
|
303
|
+
Get the order lines for an order by its ID
|
|
304
|
+
|
|
191
305
|
Parameters
|
|
192
306
|
----------
|
|
193
|
-
|
|
307
|
+
id : str
|
|
308
|
+
|
|
309
|
+
limit : typing.Optional[int]
|
|
310
|
+
|
|
311
|
+
offset : typing.Optional[int]
|
|
194
312
|
|
|
195
313
|
request_options : typing.Optional[RequestOptions]
|
|
196
314
|
Request-specific configuration.
|
|
197
315
|
|
|
198
316
|
Returns
|
|
199
317
|
-------
|
|
200
|
-
|
|
201
|
-
|
|
318
|
+
OrderLinesResponse
|
|
319
|
+
200
|
|
202
320
|
|
|
203
321
|
Examples
|
|
204
322
|
--------
|
|
@@ -207,18 +325,17 @@ class OrdersClient:
|
|
|
207
325
|
client = Paid(
|
|
208
326
|
token="YOUR_TOKEN",
|
|
209
327
|
)
|
|
210
|
-
client.orders.
|
|
211
|
-
|
|
328
|
+
client.orders.get_order_lines(
|
|
329
|
+
id="id",
|
|
212
330
|
)
|
|
213
331
|
"""
|
|
214
|
-
_response = self._raw_client.
|
|
332
|
+
_response = self._raw_client.get_order_lines(id, limit=limit, offset=offset, request_options=request_options)
|
|
215
333
|
return _response.data
|
|
216
334
|
|
|
217
335
|
|
|
218
336
|
class AsyncOrdersClient:
|
|
219
337
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
220
338
|
self._raw_client = AsyncRawOrdersClient(client_wrapper=client_wrapper)
|
|
221
|
-
self.lines = AsyncLinesClient(client_wrapper=client_wrapper)
|
|
222
339
|
|
|
223
340
|
@property
|
|
224
341
|
def with_raw_response(self) -> AsyncRawOrdersClient:
|
|
@@ -231,17 +348,29 @@ class AsyncOrdersClient:
|
|
|
231
348
|
"""
|
|
232
349
|
return self._raw_client
|
|
233
350
|
|
|
234
|
-
async def
|
|
351
|
+
async def list_orders(
|
|
352
|
+
self,
|
|
353
|
+
*,
|
|
354
|
+
limit: typing.Optional[int] = None,
|
|
355
|
+
offset: typing.Optional[int] = None,
|
|
356
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
357
|
+
) -> OrderListResponse:
|
|
235
358
|
"""
|
|
359
|
+
Get a list of orders for the organization
|
|
360
|
+
|
|
236
361
|
Parameters
|
|
237
362
|
----------
|
|
363
|
+
limit : typing.Optional[int]
|
|
364
|
+
|
|
365
|
+
offset : typing.Optional[int]
|
|
366
|
+
|
|
238
367
|
request_options : typing.Optional[RequestOptions]
|
|
239
368
|
Request-specific configuration.
|
|
240
369
|
|
|
241
370
|
Returns
|
|
242
371
|
-------
|
|
243
|
-
|
|
244
|
-
|
|
372
|
+
OrderListResponse
|
|
373
|
+
200
|
|
245
374
|
|
|
246
375
|
Examples
|
|
247
376
|
--------
|
|
@@ -255,52 +384,59 @@ class AsyncOrdersClient:
|
|
|
255
384
|
|
|
256
385
|
|
|
257
386
|
async def main() -> None:
|
|
258
|
-
await client.orders.
|
|
387
|
+
await client.orders.list_orders()
|
|
259
388
|
|
|
260
389
|
|
|
261
390
|
asyncio.run(main())
|
|
262
391
|
"""
|
|
263
|
-
_response = await self._raw_client.
|
|
392
|
+
_response = await self._raw_client.list_orders(limit=limit, offset=offset, request_options=request_options)
|
|
264
393
|
return _response.data
|
|
265
394
|
|
|
266
|
-
async def
|
|
395
|
+
async def create_a_new_order(
|
|
267
396
|
self,
|
|
268
397
|
*,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
398
|
+
customer_id: str,
|
|
399
|
+
billing_customer_id: typing.Optional[str] = OMIT,
|
|
400
|
+
billing_contact_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
401
|
+
name: typing.Optional[str] = OMIT,
|
|
402
|
+
start_date: typing.Optional[dt.datetime] = OMIT,
|
|
403
|
+
end_date: typing.Optional[dt.datetime] = OMIT,
|
|
404
|
+
subscription_terms: typing.Optional[int] = OMIT,
|
|
405
|
+
creation_state: typing.Optional[OrderCreationState] = OMIT,
|
|
406
|
+
billing_anchor: typing.Optional[float] = OMIT,
|
|
407
|
+
payment_terms: typing.Optional[str] = OMIT,
|
|
408
|
+
external_id: typing.Optional[str] = OMIT,
|
|
409
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
279
410
|
request_options: typing.Optional[RequestOptions] = None,
|
|
280
411
|
) -> Order:
|
|
281
412
|
"""
|
|
413
|
+
Creates a new order for the organization
|
|
414
|
+
|
|
282
415
|
Parameters
|
|
283
416
|
----------
|
|
284
|
-
|
|
417
|
+
customer_id : str
|
|
418
|
+
|
|
419
|
+
billing_customer_id : typing.Optional[str]
|
|
285
420
|
|
|
286
|
-
|
|
421
|
+
billing_contact_ids : typing.Optional[typing.Sequence[str]]
|
|
287
422
|
|
|
288
|
-
|
|
423
|
+
name : typing.Optional[str]
|
|
289
424
|
|
|
290
|
-
|
|
425
|
+
start_date : typing.Optional[dt.datetime]
|
|
291
426
|
|
|
292
|
-
|
|
427
|
+
end_date : typing.Optional[dt.datetime]
|
|
293
428
|
|
|
294
|
-
|
|
429
|
+
subscription_terms : typing.Optional[int]
|
|
295
430
|
|
|
296
|
-
|
|
431
|
+
creation_state : typing.Optional[OrderCreationState]
|
|
297
432
|
|
|
298
|
-
|
|
433
|
+
billing_anchor : typing.Optional[float]
|
|
299
434
|
|
|
300
|
-
|
|
301
|
-
Optional plan ID to associate with this order
|
|
435
|
+
payment_terms : typing.Optional[str]
|
|
302
436
|
|
|
303
|
-
|
|
437
|
+
external_id : typing.Optional[str]
|
|
438
|
+
|
|
439
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
304
440
|
|
|
305
441
|
request_options : typing.Optional[RequestOptions]
|
|
306
442
|
Request-specific configuration.
|
|
@@ -308,7 +444,7 @@ class AsyncOrdersClient:
|
|
|
308
444
|
Returns
|
|
309
445
|
-------
|
|
310
446
|
Order
|
|
311
|
-
|
|
447
|
+
201
|
|
312
448
|
|
|
313
449
|
Examples
|
|
314
450
|
--------
|
|
@@ -322,38 +458,37 @@ class AsyncOrdersClient:
|
|
|
322
458
|
|
|
323
459
|
|
|
324
460
|
async def main() -> None:
|
|
325
|
-
await client.orders.
|
|
326
|
-
|
|
327
|
-
name="Acme Order",
|
|
328
|
-
description="Acme Order is an order for Acme, Inc.",
|
|
329
|
-
start_date="2025-01-01",
|
|
330
|
-
end_date="2026-01-01",
|
|
331
|
-
currency="USD",
|
|
461
|
+
await client.orders.create_a_new_order(
|
|
462
|
+
customer_id="customerId",
|
|
332
463
|
)
|
|
333
464
|
|
|
334
465
|
|
|
335
466
|
asyncio.run(main())
|
|
336
467
|
"""
|
|
337
|
-
_response = await self._raw_client.
|
|
468
|
+
_response = await self._raw_client.create_a_new_order(
|
|
469
|
+
customer_id=customer_id,
|
|
470
|
+
billing_customer_id=billing_customer_id,
|
|
471
|
+
billing_contact_ids=billing_contact_ids,
|
|
338
472
|
name=name,
|
|
339
473
|
start_date=start_date,
|
|
340
|
-
currency=currency,
|
|
341
|
-
customer_id=customer_id,
|
|
342
|
-
customer_external_id=customer_external_id,
|
|
343
|
-
billing_contact_id=billing_contact_id,
|
|
344
|
-
description=description,
|
|
345
474
|
end_date=end_date,
|
|
346
|
-
|
|
347
|
-
|
|
475
|
+
subscription_terms=subscription_terms,
|
|
476
|
+
creation_state=creation_state,
|
|
477
|
+
billing_anchor=billing_anchor,
|
|
478
|
+
payment_terms=payment_terms,
|
|
479
|
+
external_id=external_id,
|
|
480
|
+
metadata=metadata,
|
|
348
481
|
request_options=request_options,
|
|
349
482
|
)
|
|
350
483
|
return _response.data
|
|
351
484
|
|
|
352
|
-
async def
|
|
485
|
+
async def get_order(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Order:
|
|
353
486
|
"""
|
|
487
|
+
Get an order by its ID
|
|
488
|
+
|
|
354
489
|
Parameters
|
|
355
490
|
----------
|
|
356
|
-
|
|
491
|
+
id : str
|
|
357
492
|
|
|
358
493
|
request_options : typing.Optional[RequestOptions]
|
|
359
494
|
Request-specific configuration.
|
|
@@ -361,7 +496,7 @@ class AsyncOrdersClient:
|
|
|
361
496
|
Returns
|
|
362
497
|
-------
|
|
363
498
|
Order
|
|
364
|
-
|
|
499
|
+
200
|
|
365
500
|
|
|
366
501
|
Examples
|
|
367
502
|
--------
|
|
@@ -375,28 +510,69 @@ class AsyncOrdersClient:
|
|
|
375
510
|
|
|
376
511
|
|
|
377
512
|
async def main() -> None:
|
|
378
|
-
await client.orders.
|
|
379
|
-
|
|
513
|
+
await client.orders.get_order(
|
|
514
|
+
id="id",
|
|
380
515
|
)
|
|
381
516
|
|
|
382
517
|
|
|
383
518
|
asyncio.run(main())
|
|
384
519
|
"""
|
|
385
|
-
_response = await self._raw_client.
|
|
520
|
+
_response = await self._raw_client.get_order(id, request_options=request_options)
|
|
386
521
|
return _response.data
|
|
387
522
|
|
|
388
|
-
async def
|
|
523
|
+
async def update_order(
|
|
524
|
+
self,
|
|
525
|
+
id: str,
|
|
526
|
+
*,
|
|
527
|
+
name: typing.Optional[str] = OMIT,
|
|
528
|
+
start_date: typing.Optional[dt.datetime] = OMIT,
|
|
529
|
+
end_date: typing.Optional[dt.datetime] = OMIT,
|
|
530
|
+
subscription_terms: typing.Optional[int] = OMIT,
|
|
531
|
+
creation_state: typing.Optional[OrderCreationState] = OMIT,
|
|
532
|
+
billing_anchor: typing.Optional[float] = OMIT,
|
|
533
|
+
payment_terms: typing.Optional[str] = OMIT,
|
|
534
|
+
external_id: typing.Optional[str] = OMIT,
|
|
535
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
536
|
+
billing_customer_id: typing.Optional[str] = OMIT,
|
|
537
|
+
billing_contact_ids: typing.Optional[typing.Sequence[str]] = OMIT,
|
|
538
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
539
|
+
) -> Order:
|
|
389
540
|
"""
|
|
541
|
+
Update an order by its ID
|
|
542
|
+
|
|
390
543
|
Parameters
|
|
391
544
|
----------
|
|
392
|
-
|
|
545
|
+
id : str
|
|
546
|
+
|
|
547
|
+
name : typing.Optional[str]
|
|
548
|
+
|
|
549
|
+
start_date : typing.Optional[dt.datetime]
|
|
550
|
+
|
|
551
|
+
end_date : typing.Optional[dt.datetime]
|
|
552
|
+
|
|
553
|
+
subscription_terms : typing.Optional[int]
|
|
554
|
+
|
|
555
|
+
creation_state : typing.Optional[OrderCreationState]
|
|
556
|
+
|
|
557
|
+
billing_anchor : typing.Optional[float]
|
|
558
|
+
|
|
559
|
+
payment_terms : typing.Optional[str]
|
|
560
|
+
|
|
561
|
+
external_id : typing.Optional[str]
|
|
562
|
+
|
|
563
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
564
|
+
|
|
565
|
+
billing_customer_id : typing.Optional[str]
|
|
566
|
+
|
|
567
|
+
billing_contact_ids : typing.Optional[typing.Sequence[str]]
|
|
393
568
|
|
|
394
569
|
request_options : typing.Optional[RequestOptions]
|
|
395
570
|
Request-specific configuration.
|
|
396
571
|
|
|
397
572
|
Returns
|
|
398
573
|
-------
|
|
399
|
-
|
|
574
|
+
Order
|
|
575
|
+
200
|
|
400
576
|
|
|
401
577
|
Examples
|
|
402
578
|
--------
|
|
@@ -410,29 +586,45 @@ class AsyncOrdersClient:
|
|
|
410
586
|
|
|
411
587
|
|
|
412
588
|
async def main() -> None:
|
|
413
|
-
await client.orders.
|
|
414
|
-
|
|
589
|
+
await client.orders.update_order(
|
|
590
|
+
id="id",
|
|
415
591
|
)
|
|
416
592
|
|
|
417
593
|
|
|
418
594
|
asyncio.run(main())
|
|
419
595
|
"""
|
|
420
|
-
_response = await self._raw_client.
|
|
596
|
+
_response = await self._raw_client.update_order(
|
|
597
|
+
id,
|
|
598
|
+
name=name,
|
|
599
|
+
start_date=start_date,
|
|
600
|
+
end_date=end_date,
|
|
601
|
+
subscription_terms=subscription_terms,
|
|
602
|
+
creation_state=creation_state,
|
|
603
|
+
billing_anchor=billing_anchor,
|
|
604
|
+
payment_terms=payment_terms,
|
|
605
|
+
external_id=external_id,
|
|
606
|
+
metadata=metadata,
|
|
607
|
+
billing_customer_id=billing_customer_id,
|
|
608
|
+
billing_contact_ids=billing_contact_ids,
|
|
609
|
+
request_options=request_options,
|
|
610
|
+
)
|
|
421
611
|
return _response.data
|
|
422
612
|
|
|
423
|
-
async def
|
|
613
|
+
async def delete_order(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> EmptyResponse:
|
|
424
614
|
"""
|
|
615
|
+
Delete an order by its ID
|
|
616
|
+
|
|
425
617
|
Parameters
|
|
426
618
|
----------
|
|
427
|
-
|
|
619
|
+
id : str
|
|
428
620
|
|
|
429
621
|
request_options : typing.Optional[RequestOptions]
|
|
430
622
|
Request-specific configuration.
|
|
431
623
|
|
|
432
624
|
Returns
|
|
433
625
|
-------
|
|
434
|
-
|
|
435
|
-
|
|
626
|
+
EmptyResponse
|
|
627
|
+
200
|
|
436
628
|
|
|
437
629
|
Examples
|
|
438
630
|
--------
|
|
@@ -446,12 +638,63 @@ class AsyncOrdersClient:
|
|
|
446
638
|
|
|
447
639
|
|
|
448
640
|
async def main() -> None:
|
|
449
|
-
await client.orders.
|
|
450
|
-
|
|
641
|
+
await client.orders.delete_order(
|
|
642
|
+
id="id",
|
|
451
643
|
)
|
|
452
644
|
|
|
453
645
|
|
|
454
646
|
asyncio.run(main())
|
|
455
647
|
"""
|
|
456
|
-
_response = await self._raw_client.
|
|
648
|
+
_response = await self._raw_client.delete_order(id, request_options=request_options)
|
|
649
|
+
return _response.data
|
|
650
|
+
|
|
651
|
+
async def get_order_lines(
|
|
652
|
+
self,
|
|
653
|
+
id: str,
|
|
654
|
+
*,
|
|
655
|
+
limit: typing.Optional[int] = None,
|
|
656
|
+
offset: typing.Optional[int] = None,
|
|
657
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
658
|
+
) -> OrderLinesResponse:
|
|
659
|
+
"""
|
|
660
|
+
Get the order lines for an order by its ID
|
|
661
|
+
|
|
662
|
+
Parameters
|
|
663
|
+
----------
|
|
664
|
+
id : str
|
|
665
|
+
|
|
666
|
+
limit : typing.Optional[int]
|
|
667
|
+
|
|
668
|
+
offset : typing.Optional[int]
|
|
669
|
+
|
|
670
|
+
request_options : typing.Optional[RequestOptions]
|
|
671
|
+
Request-specific configuration.
|
|
672
|
+
|
|
673
|
+
Returns
|
|
674
|
+
-------
|
|
675
|
+
OrderLinesResponse
|
|
676
|
+
200
|
|
677
|
+
|
|
678
|
+
Examples
|
|
679
|
+
--------
|
|
680
|
+
import asyncio
|
|
681
|
+
|
|
682
|
+
from paid import AsyncPaid
|
|
683
|
+
|
|
684
|
+
client = AsyncPaid(
|
|
685
|
+
token="YOUR_TOKEN",
|
|
686
|
+
)
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
async def main() -> None:
|
|
690
|
+
await client.orders.get_order_lines(
|
|
691
|
+
id="id",
|
|
692
|
+
)
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
asyncio.run(main())
|
|
696
|
+
"""
|
|
697
|
+
_response = await self._raw_client.get_order_lines(
|
|
698
|
+
id, limit=limit, offset=offset, request_options=request_options
|
|
699
|
+
)
|
|
457
700
|
return _response.data
|