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/products/client.py
CHANGED
|
@@ -4,11 +4,9 @@ import typing
|
|
|
4
4
|
|
|
5
5
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
6
|
from ..core.request_options import RequestOptions
|
|
7
|
-
from ..types.agent_attribute import AgentAttribute
|
|
8
7
|
from ..types.product import Product
|
|
9
|
-
from ..types.
|
|
8
|
+
from ..types.product_list_response import ProductListResponse
|
|
10
9
|
from .raw_client import AsyncRawProductsClient, RawProductsClient
|
|
11
|
-
from .types.product_create_type import ProductCreateType
|
|
12
10
|
|
|
13
11
|
# this is used as the default value for optional parameters
|
|
14
12
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -29,17 +27,29 @@ class ProductsClient:
|
|
|
29
27
|
"""
|
|
30
28
|
return self._raw_client
|
|
31
29
|
|
|
32
|
-
def
|
|
30
|
+
def list_products(
|
|
31
|
+
self,
|
|
32
|
+
*,
|
|
33
|
+
limit: typing.Optional[int] = None,
|
|
34
|
+
offset: typing.Optional[int] = None,
|
|
35
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
36
|
+
) -> ProductListResponse:
|
|
33
37
|
"""
|
|
38
|
+
Get a list of products for the organization
|
|
39
|
+
|
|
34
40
|
Parameters
|
|
35
41
|
----------
|
|
42
|
+
limit : typing.Optional[int]
|
|
43
|
+
|
|
44
|
+
offset : typing.Optional[int]
|
|
45
|
+
|
|
36
46
|
request_options : typing.Optional[RequestOptions]
|
|
37
47
|
Request-specific configuration.
|
|
38
48
|
|
|
39
49
|
Returns
|
|
40
50
|
-------
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
ProductListResponse
|
|
52
|
+
200
|
|
43
53
|
|
|
44
54
|
Examples
|
|
45
55
|
--------
|
|
@@ -48,38 +58,37 @@ class ProductsClient:
|
|
|
48
58
|
client = Paid(
|
|
49
59
|
token="YOUR_TOKEN",
|
|
50
60
|
)
|
|
51
|
-
client.products.
|
|
61
|
+
client.products.list_products()
|
|
52
62
|
"""
|
|
53
|
-
_response = self._raw_client.
|
|
63
|
+
_response = self._raw_client.list_products(limit=limit, offset=offset, request_options=request_options)
|
|
54
64
|
return _response.data
|
|
55
65
|
|
|
56
|
-
def
|
|
66
|
+
def create_a_new_product(
|
|
57
67
|
self,
|
|
58
68
|
*,
|
|
59
69
|
name: str,
|
|
60
70
|
description: typing.Optional[str] = OMIT,
|
|
61
|
-
external_id: typing.Optional[str] = OMIT,
|
|
62
|
-
type: typing.Optional[ProductCreateType] = OMIT,
|
|
63
71
|
active: typing.Optional[bool] = OMIT,
|
|
64
72
|
product_code: typing.Optional[str] = OMIT,
|
|
73
|
+
external_id: typing.Optional[str] = OMIT,
|
|
65
74
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
66
75
|
request_options: typing.Optional[RequestOptions] = None,
|
|
67
76
|
) -> Product:
|
|
68
77
|
"""
|
|
78
|
+
Creates a new product for the organization
|
|
79
|
+
|
|
69
80
|
Parameters
|
|
70
81
|
----------
|
|
71
82
|
name : str
|
|
72
83
|
|
|
73
84
|
description : typing.Optional[str]
|
|
74
85
|
|
|
75
|
-
external_id : typing.Optional[str]
|
|
76
|
-
|
|
77
|
-
type : typing.Optional[ProductCreateType]
|
|
78
|
-
|
|
79
86
|
active : typing.Optional[bool]
|
|
80
87
|
|
|
81
88
|
product_code : typing.Optional[str]
|
|
82
89
|
|
|
90
|
+
external_id : typing.Optional[str]
|
|
91
|
+
|
|
83
92
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
84
93
|
|
|
85
94
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -88,7 +97,7 @@ class ProductsClient:
|
|
|
88
97
|
Returns
|
|
89
98
|
-------
|
|
90
99
|
Product
|
|
91
|
-
|
|
100
|
+
201
|
|
92
101
|
|
|
93
102
|
Examples
|
|
94
103
|
--------
|
|
@@ -97,30 +106,28 @@ class ProductsClient:
|
|
|
97
106
|
client = Paid(
|
|
98
107
|
token="YOUR_TOKEN",
|
|
99
108
|
)
|
|
100
|
-
client.products.
|
|
101
|
-
name="
|
|
102
|
-
description="Acme Product does amazing things.",
|
|
103
|
-
external_id="acme-product",
|
|
104
|
-
type="product",
|
|
109
|
+
client.products.create_a_new_product(
|
|
110
|
+
name="name",
|
|
105
111
|
)
|
|
106
112
|
"""
|
|
107
|
-
_response = self._raw_client.
|
|
113
|
+
_response = self._raw_client.create_a_new_product(
|
|
108
114
|
name=name,
|
|
109
115
|
description=description,
|
|
110
|
-
external_id=external_id,
|
|
111
|
-
type=type,
|
|
112
116
|
active=active,
|
|
113
117
|
product_code=product_code,
|
|
118
|
+
external_id=external_id,
|
|
114
119
|
metadata=metadata,
|
|
115
120
|
request_options=request_options,
|
|
116
121
|
)
|
|
117
122
|
return _response.data
|
|
118
123
|
|
|
119
|
-
def
|
|
124
|
+
def get_product(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Product:
|
|
120
125
|
"""
|
|
126
|
+
Get a product by its ID
|
|
127
|
+
|
|
121
128
|
Parameters
|
|
122
129
|
----------
|
|
123
|
-
|
|
130
|
+
id : str
|
|
124
131
|
|
|
125
132
|
request_options : typing.Optional[RequestOptions]
|
|
126
133
|
Request-specific configuration.
|
|
@@ -128,7 +135,7 @@ class ProductsClient:
|
|
|
128
135
|
Returns
|
|
129
136
|
-------
|
|
130
137
|
Product
|
|
131
|
-
|
|
138
|
+
200
|
|
132
139
|
|
|
133
140
|
Examples
|
|
134
141
|
--------
|
|
@@ -137,46 +144,41 @@ class ProductsClient:
|
|
|
137
144
|
client = Paid(
|
|
138
145
|
token="YOUR_TOKEN",
|
|
139
146
|
)
|
|
140
|
-
client.products.
|
|
141
|
-
|
|
147
|
+
client.products.get_product(
|
|
148
|
+
id="id",
|
|
142
149
|
)
|
|
143
150
|
"""
|
|
144
|
-
_response = self._raw_client.
|
|
151
|
+
_response = self._raw_client.get_product(id, request_options=request_options)
|
|
145
152
|
return _response.data
|
|
146
153
|
|
|
147
|
-
def
|
|
154
|
+
def update_product(
|
|
148
155
|
self,
|
|
149
|
-
|
|
156
|
+
id: str,
|
|
150
157
|
*,
|
|
151
158
|
name: typing.Optional[str] = OMIT,
|
|
152
159
|
description: typing.Optional[str] = OMIT,
|
|
153
|
-
external_id: typing.Optional[str] = OMIT,
|
|
154
|
-
type: typing.Optional[ProductUpdateType] = OMIT,
|
|
155
160
|
active: typing.Optional[bool] = OMIT,
|
|
156
161
|
product_code: typing.Optional[str] = OMIT,
|
|
157
|
-
|
|
162
|
+
external_id: typing.Optional[str] = OMIT,
|
|
158
163
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
159
164
|
request_options: typing.Optional[RequestOptions] = None,
|
|
160
165
|
) -> Product:
|
|
161
166
|
"""
|
|
167
|
+
Update a product by its ID
|
|
168
|
+
|
|
162
169
|
Parameters
|
|
163
170
|
----------
|
|
164
|
-
|
|
171
|
+
id : str
|
|
165
172
|
|
|
166
173
|
name : typing.Optional[str]
|
|
167
174
|
|
|
168
175
|
description : typing.Optional[str]
|
|
169
176
|
|
|
170
|
-
external_id : typing.Optional[str]
|
|
171
|
-
|
|
172
|
-
type : typing.Optional[ProductUpdateType]
|
|
173
|
-
|
|
174
177
|
active : typing.Optional[bool]
|
|
175
178
|
|
|
176
179
|
product_code : typing.Optional[str]
|
|
177
180
|
|
|
178
|
-
|
|
179
|
-
Pricing attributes for this product
|
|
181
|
+
external_id : typing.Optional[str]
|
|
180
182
|
|
|
181
183
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
182
184
|
|
|
@@ -186,7 +188,7 @@ class ProductsClient:
|
|
|
186
188
|
Returns
|
|
187
189
|
-------
|
|
188
190
|
Product
|
|
189
|
-
|
|
191
|
+
200
|
|
190
192
|
|
|
191
193
|
Examples
|
|
192
194
|
--------
|
|
@@ -195,55 +197,28 @@ class ProductsClient:
|
|
|
195
197
|
client = Paid(
|
|
196
198
|
token="YOUR_TOKEN",
|
|
197
199
|
)
|
|
198
|
-
client.products.
|
|
199
|
-
|
|
200
|
+
client.products.update_product(
|
|
201
|
+
id="id",
|
|
200
202
|
)
|
|
201
203
|
"""
|
|
202
|
-
_response = self._raw_client.
|
|
203
|
-
|
|
204
|
+
_response = self._raw_client.update_product(
|
|
205
|
+
id,
|
|
204
206
|
name=name,
|
|
205
207
|
description=description,
|
|
206
|
-
external_id=external_id,
|
|
207
|
-
type=type,
|
|
208
208
|
active=active,
|
|
209
209
|
product_code=product_code,
|
|
210
|
-
|
|
210
|
+
external_id=external_id,
|
|
211
211
|
metadata=metadata,
|
|
212
212
|
request_options=request_options,
|
|
213
213
|
)
|
|
214
214
|
return _response.data
|
|
215
215
|
|
|
216
|
-
def
|
|
217
|
-
"""
|
|
218
|
-
Parameters
|
|
219
|
-
----------
|
|
220
|
-
product_id : str
|
|
221
|
-
|
|
222
|
-
request_options : typing.Optional[RequestOptions]
|
|
223
|
-
Request-specific configuration.
|
|
224
|
-
|
|
225
|
-
Returns
|
|
226
|
-
-------
|
|
227
|
-
None
|
|
228
|
-
|
|
229
|
-
Examples
|
|
230
|
-
--------
|
|
231
|
-
from paid import Paid
|
|
232
|
-
|
|
233
|
-
client = Paid(
|
|
234
|
-
token="YOUR_TOKEN",
|
|
235
|
-
)
|
|
236
|
-
client.products.delete(
|
|
237
|
-
product_id="productId",
|
|
238
|
-
)
|
|
239
|
-
"""
|
|
240
|
-
_response = self._raw_client.delete(product_id, request_options=request_options)
|
|
241
|
-
return _response.data
|
|
242
|
-
|
|
243
|
-
def get_by_external_id(
|
|
216
|
+
def get_product_by_external_id(
|
|
244
217
|
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
245
218
|
) -> Product:
|
|
246
219
|
"""
|
|
220
|
+
Get a product by its externalId
|
|
221
|
+
|
|
247
222
|
Parameters
|
|
248
223
|
----------
|
|
249
224
|
external_id : str
|
|
@@ -254,7 +229,7 @@ class ProductsClient:
|
|
|
254
229
|
Returns
|
|
255
230
|
-------
|
|
256
231
|
Product
|
|
257
|
-
|
|
232
|
+
200
|
|
258
233
|
|
|
259
234
|
Examples
|
|
260
235
|
--------
|
|
@@ -263,28 +238,28 @@ class ProductsClient:
|
|
|
263
238
|
client = Paid(
|
|
264
239
|
token="YOUR_TOKEN",
|
|
265
240
|
)
|
|
266
|
-
client.products.
|
|
241
|
+
client.products.get_product_by_external_id(
|
|
267
242
|
external_id="externalId",
|
|
268
243
|
)
|
|
269
244
|
"""
|
|
270
|
-
_response = self._raw_client.
|
|
245
|
+
_response = self._raw_client.get_product_by_external_id(external_id, request_options=request_options)
|
|
271
246
|
return _response.data
|
|
272
247
|
|
|
273
|
-
def
|
|
248
|
+
def update_product_by_external_id(
|
|
274
249
|
self,
|
|
275
250
|
external_id_: str,
|
|
276
251
|
*,
|
|
277
252
|
name: typing.Optional[str] = OMIT,
|
|
278
253
|
description: typing.Optional[str] = OMIT,
|
|
279
|
-
external_id: typing.Optional[str] = OMIT,
|
|
280
|
-
type: typing.Optional[ProductUpdateType] = OMIT,
|
|
281
254
|
active: typing.Optional[bool] = OMIT,
|
|
282
255
|
product_code: typing.Optional[str] = OMIT,
|
|
283
|
-
|
|
256
|
+
external_id: typing.Optional[str] = OMIT,
|
|
284
257
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
285
258
|
request_options: typing.Optional[RequestOptions] = None,
|
|
286
259
|
) -> Product:
|
|
287
260
|
"""
|
|
261
|
+
Update a product by its externalId
|
|
262
|
+
|
|
288
263
|
Parameters
|
|
289
264
|
----------
|
|
290
265
|
external_id_ : str
|
|
@@ -293,16 +268,11 @@ class ProductsClient:
|
|
|
293
268
|
|
|
294
269
|
description : typing.Optional[str]
|
|
295
270
|
|
|
296
|
-
external_id : typing.Optional[str]
|
|
297
|
-
|
|
298
|
-
type : typing.Optional[ProductUpdateType]
|
|
299
|
-
|
|
300
271
|
active : typing.Optional[bool]
|
|
301
272
|
|
|
302
273
|
product_code : typing.Optional[str]
|
|
303
274
|
|
|
304
|
-
|
|
305
|
-
Pricing attributes for this product
|
|
275
|
+
external_id : typing.Optional[str]
|
|
306
276
|
|
|
307
277
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
308
278
|
|
|
@@ -312,7 +282,7 @@ class ProductsClient:
|
|
|
312
282
|
Returns
|
|
313
283
|
-------
|
|
314
284
|
Product
|
|
315
|
-
|
|
285
|
+
200
|
|
316
286
|
|
|
317
287
|
Examples
|
|
318
288
|
--------
|
|
@@ -321,53 +291,22 @@ class ProductsClient:
|
|
|
321
291
|
client = Paid(
|
|
322
292
|
token="YOUR_TOKEN",
|
|
323
293
|
)
|
|
324
|
-
client.products.
|
|
294
|
+
client.products.update_product_by_external_id(
|
|
325
295
|
external_id_="externalId",
|
|
326
296
|
)
|
|
327
297
|
"""
|
|
328
|
-
_response = self._raw_client.
|
|
298
|
+
_response = self._raw_client.update_product_by_external_id(
|
|
329
299
|
external_id_,
|
|
330
300
|
name=name,
|
|
331
301
|
description=description,
|
|
332
|
-
external_id=external_id,
|
|
333
|
-
type=type,
|
|
334
302
|
active=active,
|
|
335
303
|
product_code=product_code,
|
|
336
|
-
|
|
304
|
+
external_id=external_id,
|
|
337
305
|
metadata=metadata,
|
|
338
306
|
request_options=request_options,
|
|
339
307
|
)
|
|
340
308
|
return _response.data
|
|
341
309
|
|
|
342
|
-
def delete_by_external_id(
|
|
343
|
-
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
344
|
-
) -> None:
|
|
345
|
-
"""
|
|
346
|
-
Parameters
|
|
347
|
-
----------
|
|
348
|
-
external_id : str
|
|
349
|
-
|
|
350
|
-
request_options : typing.Optional[RequestOptions]
|
|
351
|
-
Request-specific configuration.
|
|
352
|
-
|
|
353
|
-
Returns
|
|
354
|
-
-------
|
|
355
|
-
None
|
|
356
|
-
|
|
357
|
-
Examples
|
|
358
|
-
--------
|
|
359
|
-
from paid import Paid
|
|
360
|
-
|
|
361
|
-
client = Paid(
|
|
362
|
-
token="YOUR_TOKEN",
|
|
363
|
-
)
|
|
364
|
-
client.products.delete_by_external_id(
|
|
365
|
-
external_id="externalId",
|
|
366
|
-
)
|
|
367
|
-
"""
|
|
368
|
-
_response = self._raw_client.delete_by_external_id(external_id, request_options=request_options)
|
|
369
|
-
return _response.data
|
|
370
|
-
|
|
371
310
|
|
|
372
311
|
class AsyncProductsClient:
|
|
373
312
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -384,17 +323,29 @@ class AsyncProductsClient:
|
|
|
384
323
|
"""
|
|
385
324
|
return self._raw_client
|
|
386
325
|
|
|
387
|
-
async def
|
|
326
|
+
async def list_products(
|
|
327
|
+
self,
|
|
328
|
+
*,
|
|
329
|
+
limit: typing.Optional[int] = None,
|
|
330
|
+
offset: typing.Optional[int] = None,
|
|
331
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
332
|
+
) -> ProductListResponse:
|
|
388
333
|
"""
|
|
334
|
+
Get a list of products for the organization
|
|
335
|
+
|
|
389
336
|
Parameters
|
|
390
337
|
----------
|
|
338
|
+
limit : typing.Optional[int]
|
|
339
|
+
|
|
340
|
+
offset : typing.Optional[int]
|
|
341
|
+
|
|
391
342
|
request_options : typing.Optional[RequestOptions]
|
|
392
343
|
Request-specific configuration.
|
|
393
344
|
|
|
394
345
|
Returns
|
|
395
346
|
-------
|
|
396
|
-
|
|
397
|
-
|
|
347
|
+
ProductListResponse
|
|
348
|
+
200
|
|
398
349
|
|
|
399
350
|
Examples
|
|
400
351
|
--------
|
|
@@ -408,41 +359,40 @@ class AsyncProductsClient:
|
|
|
408
359
|
|
|
409
360
|
|
|
410
361
|
async def main() -> None:
|
|
411
|
-
await client.products.
|
|
362
|
+
await client.products.list_products()
|
|
412
363
|
|
|
413
364
|
|
|
414
365
|
asyncio.run(main())
|
|
415
366
|
"""
|
|
416
|
-
_response = await self._raw_client.
|
|
367
|
+
_response = await self._raw_client.list_products(limit=limit, offset=offset, request_options=request_options)
|
|
417
368
|
return _response.data
|
|
418
369
|
|
|
419
|
-
async def
|
|
370
|
+
async def create_a_new_product(
|
|
420
371
|
self,
|
|
421
372
|
*,
|
|
422
373
|
name: str,
|
|
423
374
|
description: typing.Optional[str] = OMIT,
|
|
424
|
-
external_id: typing.Optional[str] = OMIT,
|
|
425
|
-
type: typing.Optional[ProductCreateType] = OMIT,
|
|
426
375
|
active: typing.Optional[bool] = OMIT,
|
|
427
376
|
product_code: typing.Optional[str] = OMIT,
|
|
377
|
+
external_id: typing.Optional[str] = OMIT,
|
|
428
378
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
429
379
|
request_options: typing.Optional[RequestOptions] = None,
|
|
430
380
|
) -> Product:
|
|
431
381
|
"""
|
|
382
|
+
Creates a new product for the organization
|
|
383
|
+
|
|
432
384
|
Parameters
|
|
433
385
|
----------
|
|
434
386
|
name : str
|
|
435
387
|
|
|
436
388
|
description : typing.Optional[str]
|
|
437
389
|
|
|
438
|
-
external_id : typing.Optional[str]
|
|
439
|
-
|
|
440
|
-
type : typing.Optional[ProductCreateType]
|
|
441
|
-
|
|
442
390
|
active : typing.Optional[bool]
|
|
443
391
|
|
|
444
392
|
product_code : typing.Optional[str]
|
|
445
393
|
|
|
394
|
+
external_id : typing.Optional[str]
|
|
395
|
+
|
|
446
396
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
447
397
|
|
|
448
398
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -451,7 +401,7 @@ class AsyncProductsClient:
|
|
|
451
401
|
Returns
|
|
452
402
|
-------
|
|
453
403
|
Product
|
|
454
|
-
|
|
404
|
+
201
|
|
455
405
|
|
|
456
406
|
Examples
|
|
457
407
|
--------
|
|
@@ -465,33 +415,31 @@ class AsyncProductsClient:
|
|
|
465
415
|
|
|
466
416
|
|
|
467
417
|
async def main() -> None:
|
|
468
|
-
await client.products.
|
|
469
|
-
name="
|
|
470
|
-
description="Acme Product does amazing things.",
|
|
471
|
-
external_id="acme-product",
|
|
472
|
-
type="product",
|
|
418
|
+
await client.products.create_a_new_product(
|
|
419
|
+
name="name",
|
|
473
420
|
)
|
|
474
421
|
|
|
475
422
|
|
|
476
423
|
asyncio.run(main())
|
|
477
424
|
"""
|
|
478
|
-
_response = await self._raw_client.
|
|
425
|
+
_response = await self._raw_client.create_a_new_product(
|
|
479
426
|
name=name,
|
|
480
427
|
description=description,
|
|
481
|
-
external_id=external_id,
|
|
482
|
-
type=type,
|
|
483
428
|
active=active,
|
|
484
429
|
product_code=product_code,
|
|
430
|
+
external_id=external_id,
|
|
485
431
|
metadata=metadata,
|
|
486
432
|
request_options=request_options,
|
|
487
433
|
)
|
|
488
434
|
return _response.data
|
|
489
435
|
|
|
490
|
-
async def
|
|
436
|
+
async def get_product(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Product:
|
|
491
437
|
"""
|
|
438
|
+
Get a product by its ID
|
|
439
|
+
|
|
492
440
|
Parameters
|
|
493
441
|
----------
|
|
494
|
-
|
|
442
|
+
id : str
|
|
495
443
|
|
|
496
444
|
request_options : typing.Optional[RequestOptions]
|
|
497
445
|
Request-specific configuration.
|
|
@@ -499,7 +447,7 @@ class AsyncProductsClient:
|
|
|
499
447
|
Returns
|
|
500
448
|
-------
|
|
501
449
|
Product
|
|
502
|
-
|
|
450
|
+
200
|
|
503
451
|
|
|
504
452
|
Examples
|
|
505
453
|
--------
|
|
@@ -513,49 +461,44 @@ class AsyncProductsClient:
|
|
|
513
461
|
|
|
514
462
|
|
|
515
463
|
async def main() -> None:
|
|
516
|
-
await client.products.
|
|
517
|
-
|
|
464
|
+
await client.products.get_product(
|
|
465
|
+
id="id",
|
|
518
466
|
)
|
|
519
467
|
|
|
520
468
|
|
|
521
469
|
asyncio.run(main())
|
|
522
470
|
"""
|
|
523
|
-
_response = await self._raw_client.
|
|
471
|
+
_response = await self._raw_client.get_product(id, request_options=request_options)
|
|
524
472
|
return _response.data
|
|
525
473
|
|
|
526
|
-
async def
|
|
474
|
+
async def update_product(
|
|
527
475
|
self,
|
|
528
|
-
|
|
476
|
+
id: str,
|
|
529
477
|
*,
|
|
530
478
|
name: typing.Optional[str] = OMIT,
|
|
531
479
|
description: typing.Optional[str] = OMIT,
|
|
532
|
-
external_id: typing.Optional[str] = OMIT,
|
|
533
|
-
type: typing.Optional[ProductUpdateType] = OMIT,
|
|
534
480
|
active: typing.Optional[bool] = OMIT,
|
|
535
481
|
product_code: typing.Optional[str] = OMIT,
|
|
536
|
-
|
|
482
|
+
external_id: typing.Optional[str] = OMIT,
|
|
537
483
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
538
484
|
request_options: typing.Optional[RequestOptions] = None,
|
|
539
485
|
) -> Product:
|
|
540
486
|
"""
|
|
487
|
+
Update a product by its ID
|
|
488
|
+
|
|
541
489
|
Parameters
|
|
542
490
|
----------
|
|
543
|
-
|
|
491
|
+
id : str
|
|
544
492
|
|
|
545
493
|
name : typing.Optional[str]
|
|
546
494
|
|
|
547
495
|
description : typing.Optional[str]
|
|
548
496
|
|
|
549
|
-
external_id : typing.Optional[str]
|
|
550
|
-
|
|
551
|
-
type : typing.Optional[ProductUpdateType]
|
|
552
|
-
|
|
553
497
|
active : typing.Optional[bool]
|
|
554
498
|
|
|
555
499
|
product_code : typing.Optional[str]
|
|
556
500
|
|
|
557
|
-
|
|
558
|
-
Pricing attributes for this product
|
|
501
|
+
external_id : typing.Optional[str]
|
|
559
502
|
|
|
560
503
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
561
504
|
|
|
@@ -565,7 +508,7 @@ class AsyncProductsClient:
|
|
|
565
508
|
Returns
|
|
566
509
|
-------
|
|
567
510
|
Product
|
|
568
|
-
|
|
511
|
+
200
|
|
569
512
|
|
|
570
513
|
Examples
|
|
571
514
|
--------
|
|
@@ -579,66 +522,31 @@ class AsyncProductsClient:
|
|
|
579
522
|
|
|
580
523
|
|
|
581
524
|
async def main() -> None:
|
|
582
|
-
await client.products.
|
|
583
|
-
|
|
525
|
+
await client.products.update_product(
|
|
526
|
+
id="id",
|
|
584
527
|
)
|
|
585
528
|
|
|
586
529
|
|
|
587
530
|
asyncio.run(main())
|
|
588
531
|
"""
|
|
589
|
-
_response = await self._raw_client.
|
|
590
|
-
|
|
532
|
+
_response = await self._raw_client.update_product(
|
|
533
|
+
id,
|
|
591
534
|
name=name,
|
|
592
535
|
description=description,
|
|
593
|
-
external_id=external_id,
|
|
594
|
-
type=type,
|
|
595
536
|
active=active,
|
|
596
537
|
product_code=product_code,
|
|
597
|
-
|
|
538
|
+
external_id=external_id,
|
|
598
539
|
metadata=metadata,
|
|
599
540
|
request_options=request_options,
|
|
600
541
|
)
|
|
601
542
|
return _response.data
|
|
602
543
|
|
|
603
|
-
async def
|
|
604
|
-
"""
|
|
605
|
-
Parameters
|
|
606
|
-
----------
|
|
607
|
-
product_id : str
|
|
608
|
-
|
|
609
|
-
request_options : typing.Optional[RequestOptions]
|
|
610
|
-
Request-specific configuration.
|
|
611
|
-
|
|
612
|
-
Returns
|
|
613
|
-
-------
|
|
614
|
-
None
|
|
615
|
-
|
|
616
|
-
Examples
|
|
617
|
-
--------
|
|
618
|
-
import asyncio
|
|
619
|
-
|
|
620
|
-
from paid import AsyncPaid
|
|
621
|
-
|
|
622
|
-
client = AsyncPaid(
|
|
623
|
-
token="YOUR_TOKEN",
|
|
624
|
-
)
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
async def main() -> None:
|
|
628
|
-
await client.products.delete(
|
|
629
|
-
product_id="productId",
|
|
630
|
-
)
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
asyncio.run(main())
|
|
634
|
-
"""
|
|
635
|
-
_response = await self._raw_client.delete(product_id, request_options=request_options)
|
|
636
|
-
return _response.data
|
|
637
|
-
|
|
638
|
-
async def get_by_external_id(
|
|
544
|
+
async def get_product_by_external_id(
|
|
639
545
|
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
640
546
|
) -> Product:
|
|
641
547
|
"""
|
|
548
|
+
Get a product by its externalId
|
|
549
|
+
|
|
642
550
|
Parameters
|
|
643
551
|
----------
|
|
644
552
|
external_id : str
|
|
@@ -649,7 +557,7 @@ class AsyncProductsClient:
|
|
|
649
557
|
Returns
|
|
650
558
|
-------
|
|
651
559
|
Product
|
|
652
|
-
|
|
560
|
+
200
|
|
653
561
|
|
|
654
562
|
Examples
|
|
655
563
|
--------
|
|
@@ -663,31 +571,31 @@ class AsyncProductsClient:
|
|
|
663
571
|
|
|
664
572
|
|
|
665
573
|
async def main() -> None:
|
|
666
|
-
await client.products.
|
|
574
|
+
await client.products.get_product_by_external_id(
|
|
667
575
|
external_id="externalId",
|
|
668
576
|
)
|
|
669
577
|
|
|
670
578
|
|
|
671
579
|
asyncio.run(main())
|
|
672
580
|
"""
|
|
673
|
-
_response = await self._raw_client.
|
|
581
|
+
_response = await self._raw_client.get_product_by_external_id(external_id, request_options=request_options)
|
|
674
582
|
return _response.data
|
|
675
583
|
|
|
676
|
-
async def
|
|
584
|
+
async def update_product_by_external_id(
|
|
677
585
|
self,
|
|
678
586
|
external_id_: str,
|
|
679
587
|
*,
|
|
680
588
|
name: typing.Optional[str] = OMIT,
|
|
681
589
|
description: typing.Optional[str] = OMIT,
|
|
682
|
-
external_id: typing.Optional[str] = OMIT,
|
|
683
|
-
type: typing.Optional[ProductUpdateType] = OMIT,
|
|
684
590
|
active: typing.Optional[bool] = OMIT,
|
|
685
591
|
product_code: typing.Optional[str] = OMIT,
|
|
686
|
-
|
|
592
|
+
external_id: typing.Optional[str] = OMIT,
|
|
687
593
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
688
594
|
request_options: typing.Optional[RequestOptions] = None,
|
|
689
595
|
) -> Product:
|
|
690
596
|
"""
|
|
597
|
+
Update a product by its externalId
|
|
598
|
+
|
|
691
599
|
Parameters
|
|
692
600
|
----------
|
|
693
601
|
external_id_ : str
|
|
@@ -696,16 +604,11 @@ class AsyncProductsClient:
|
|
|
696
604
|
|
|
697
605
|
description : typing.Optional[str]
|
|
698
606
|
|
|
699
|
-
external_id : typing.Optional[str]
|
|
700
|
-
|
|
701
|
-
type : typing.Optional[ProductUpdateType]
|
|
702
|
-
|
|
703
607
|
active : typing.Optional[bool]
|
|
704
608
|
|
|
705
609
|
product_code : typing.Optional[str]
|
|
706
610
|
|
|
707
|
-
|
|
708
|
-
Pricing attributes for this product
|
|
611
|
+
external_id : typing.Optional[str]
|
|
709
612
|
|
|
710
613
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
711
614
|
|
|
@@ -715,7 +618,7 @@ class AsyncProductsClient:
|
|
|
715
618
|
Returns
|
|
716
619
|
-------
|
|
717
620
|
Product
|
|
718
|
-
|
|
621
|
+
200
|
|
719
622
|
|
|
720
623
|
Examples
|
|
721
624
|
--------
|
|
@@ -729,60 +632,21 @@ class AsyncProductsClient:
|
|
|
729
632
|
|
|
730
633
|
|
|
731
634
|
async def main() -> None:
|
|
732
|
-
await client.products.
|
|
635
|
+
await client.products.update_product_by_external_id(
|
|
733
636
|
external_id_="externalId",
|
|
734
637
|
)
|
|
735
638
|
|
|
736
639
|
|
|
737
640
|
asyncio.run(main())
|
|
738
641
|
"""
|
|
739
|
-
_response = await self._raw_client.
|
|
642
|
+
_response = await self._raw_client.update_product_by_external_id(
|
|
740
643
|
external_id_,
|
|
741
644
|
name=name,
|
|
742
645
|
description=description,
|
|
743
|
-
external_id=external_id,
|
|
744
|
-
type=type,
|
|
745
646
|
active=active,
|
|
746
647
|
product_code=product_code,
|
|
747
|
-
|
|
648
|
+
external_id=external_id,
|
|
748
649
|
metadata=metadata,
|
|
749
650
|
request_options=request_options,
|
|
750
651
|
)
|
|
751
652
|
return _response.data
|
|
752
|
-
|
|
753
|
-
async def delete_by_external_id(
|
|
754
|
-
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
755
|
-
) -> None:
|
|
756
|
-
"""
|
|
757
|
-
Parameters
|
|
758
|
-
----------
|
|
759
|
-
external_id : str
|
|
760
|
-
|
|
761
|
-
request_options : typing.Optional[RequestOptions]
|
|
762
|
-
Request-specific configuration.
|
|
763
|
-
|
|
764
|
-
Returns
|
|
765
|
-
-------
|
|
766
|
-
None
|
|
767
|
-
|
|
768
|
-
Examples
|
|
769
|
-
--------
|
|
770
|
-
import asyncio
|
|
771
|
-
|
|
772
|
-
from paid import AsyncPaid
|
|
773
|
-
|
|
774
|
-
client = AsyncPaid(
|
|
775
|
-
token="YOUR_TOKEN",
|
|
776
|
-
)
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
async def main() -> None:
|
|
780
|
-
await client.products.delete_by_external_id(
|
|
781
|
-
external_id="externalId",
|
|
782
|
-
)
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
asyncio.run(main())
|
|
786
|
-
"""
|
|
787
|
-
_response = await self._raw_client.delete_by_external_id(external_id, request_options=request_options)
|
|
788
|
-
return _response.data
|