paid-python 0.4.1a0__py3-none-any.whl → 0.5.0__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 +42 -4
- paid/agents/client.py +32 -0
- paid/agents/raw_client.py +32 -0
- paid/client.py +25 -2
- paid/core/client_wrapper.py +2 -3
- paid/customers/client.py +168 -36
- paid/customers/raw_client.py +217 -36
- paid/errors/__init__.py +2 -1
- paid/errors/internal_server_error.py +11 -0
- paid/orders/lines/client.py +0 -4
- paid/plans/__init__.py +4 -0
- paid/plans/client.py +261 -0
- paid/plans/raw_client.py +345 -0
- paid/products/__init__.py +7 -0
- paid/products/client.py +788 -0
- paid/products/raw_client.py +807 -0
- paid/products/types/__init__.py +7 -0
- paid/products/types/product_create_type.py +5 -0
- paid/traces/__init__.py +4 -0
- paid/traces/client.py +218 -0
- paid/traces/raw_client.py +226 -0
- paid/tracing/context_manager.py +9 -4
- paid/types/__init__.py +32 -2
- paid/types/cost_trace.py +6 -1
- paid/types/customer.py +4 -3
- paid/types/customer_update.py +4 -2
- paid/types/order_line_attribute_create_one.py +5 -0
- paid/types/order_line_create.py +26 -5
- paid/types/pagination_meta.py +26 -0
- paid/types/plan.py +81 -0
- paid/types/plan_plan_products_item.py +35 -0
- paid/types/plan_plan_products_item_plan_product_attribute_item.py +34 -0
- paid/types/product.py +56 -0
- paid/types/product_type.py +5 -0
- paid/types/product_update.py +36 -0
- paid/types/product_update_type.py +5 -0
- paid/types/signal.py +17 -5
- paid/types/signal_v_2.py +56 -0
- paid/types/trace.py +69 -0
- paid/types/traces_response.py +26 -0
- paid/types/{order_line_attribute_create.py → usage_pagination_meta.py} +16 -8
- paid/types/usage_summaries_response.py +26 -0
- paid/types/usage_summary.py +121 -0
- paid/types/usage_summary_order.py +26 -0
- paid/types/usage_summary_order_line.py +26 -0
- paid/usage/__init__.py +3 -0
- paid/usage/client.py +206 -0
- paid/usage/raw_client.py +283 -0
- paid/usage/types/__init__.py +7 -0
- paid/usage/types/usage_check_usage_response.py +53 -0
- {paid_python-0.4.1a0.dist-info → paid_python-0.5.0.dist-info}/METADATA +20 -20
- {paid_python-0.4.1a0.dist-info → paid_python-0.5.0.dist-info}/RECORD +54 -25
- {paid_python-0.4.1a0.dist-info → paid_python-0.5.0.dist-info}/LICENSE +0 -0
- {paid_python-0.4.1a0.dist-info → paid_python-0.5.0.dist-info}/WHEEL +0 -0
paid/products/client.py
ADDED
|
@@ -0,0 +1,788 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
|
+
from ..core.request_options import RequestOptions
|
|
7
|
+
from ..types.agent_attribute import AgentAttribute
|
|
8
|
+
from ..types.product import Product
|
|
9
|
+
from ..types.product_update_type import ProductUpdateType
|
|
10
|
+
from .raw_client import AsyncRawProductsClient, RawProductsClient
|
|
11
|
+
from .types.product_create_type import ProductCreateType
|
|
12
|
+
|
|
13
|
+
# this is used as the default value for optional parameters
|
|
14
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ProductsClient:
|
|
18
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
19
|
+
self._raw_client = RawProductsClient(client_wrapper=client_wrapper)
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def with_raw_response(self) -> RawProductsClient:
|
|
23
|
+
"""
|
|
24
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
25
|
+
|
|
26
|
+
Returns
|
|
27
|
+
-------
|
|
28
|
+
RawProductsClient
|
|
29
|
+
"""
|
|
30
|
+
return self._raw_client
|
|
31
|
+
|
|
32
|
+
def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Product]:
|
|
33
|
+
"""
|
|
34
|
+
Parameters
|
|
35
|
+
----------
|
|
36
|
+
request_options : typing.Optional[RequestOptions]
|
|
37
|
+
Request-specific configuration.
|
|
38
|
+
|
|
39
|
+
Returns
|
|
40
|
+
-------
|
|
41
|
+
typing.List[Product]
|
|
42
|
+
Success response
|
|
43
|
+
|
|
44
|
+
Examples
|
|
45
|
+
--------
|
|
46
|
+
from paid import Paid
|
|
47
|
+
|
|
48
|
+
client = Paid(
|
|
49
|
+
token="YOUR_TOKEN",
|
|
50
|
+
)
|
|
51
|
+
client.products.list()
|
|
52
|
+
"""
|
|
53
|
+
_response = self._raw_client.list(request_options=request_options)
|
|
54
|
+
return _response.data
|
|
55
|
+
|
|
56
|
+
def create(
|
|
57
|
+
self,
|
|
58
|
+
*,
|
|
59
|
+
name: str,
|
|
60
|
+
description: typing.Optional[str] = OMIT,
|
|
61
|
+
external_id: typing.Optional[str] = OMIT,
|
|
62
|
+
type: typing.Optional[ProductCreateType] = OMIT,
|
|
63
|
+
active: typing.Optional[bool] = OMIT,
|
|
64
|
+
product_code: typing.Optional[str] = OMIT,
|
|
65
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
66
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
67
|
+
) -> Product:
|
|
68
|
+
"""
|
|
69
|
+
Parameters
|
|
70
|
+
----------
|
|
71
|
+
name : str
|
|
72
|
+
|
|
73
|
+
description : typing.Optional[str]
|
|
74
|
+
|
|
75
|
+
external_id : typing.Optional[str]
|
|
76
|
+
|
|
77
|
+
type : typing.Optional[ProductCreateType]
|
|
78
|
+
|
|
79
|
+
active : typing.Optional[bool]
|
|
80
|
+
|
|
81
|
+
product_code : typing.Optional[str]
|
|
82
|
+
|
|
83
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
84
|
+
|
|
85
|
+
request_options : typing.Optional[RequestOptions]
|
|
86
|
+
Request-specific configuration.
|
|
87
|
+
|
|
88
|
+
Returns
|
|
89
|
+
-------
|
|
90
|
+
Product
|
|
91
|
+
Success response
|
|
92
|
+
|
|
93
|
+
Examples
|
|
94
|
+
--------
|
|
95
|
+
from paid import Paid
|
|
96
|
+
|
|
97
|
+
client = Paid(
|
|
98
|
+
token="YOUR_TOKEN",
|
|
99
|
+
)
|
|
100
|
+
client.products.create(
|
|
101
|
+
name="Acme Product",
|
|
102
|
+
description="Acme Product does amazing things.",
|
|
103
|
+
external_id="acme-product",
|
|
104
|
+
type="product",
|
|
105
|
+
)
|
|
106
|
+
"""
|
|
107
|
+
_response = self._raw_client.create(
|
|
108
|
+
name=name,
|
|
109
|
+
description=description,
|
|
110
|
+
external_id=external_id,
|
|
111
|
+
type=type,
|
|
112
|
+
active=active,
|
|
113
|
+
product_code=product_code,
|
|
114
|
+
metadata=metadata,
|
|
115
|
+
request_options=request_options,
|
|
116
|
+
)
|
|
117
|
+
return _response.data
|
|
118
|
+
|
|
119
|
+
def get(self, product_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Product:
|
|
120
|
+
"""
|
|
121
|
+
Parameters
|
|
122
|
+
----------
|
|
123
|
+
product_id : str
|
|
124
|
+
|
|
125
|
+
request_options : typing.Optional[RequestOptions]
|
|
126
|
+
Request-specific configuration.
|
|
127
|
+
|
|
128
|
+
Returns
|
|
129
|
+
-------
|
|
130
|
+
Product
|
|
131
|
+
Success response
|
|
132
|
+
|
|
133
|
+
Examples
|
|
134
|
+
--------
|
|
135
|
+
from paid import Paid
|
|
136
|
+
|
|
137
|
+
client = Paid(
|
|
138
|
+
token="YOUR_TOKEN",
|
|
139
|
+
)
|
|
140
|
+
client.products.get(
|
|
141
|
+
product_id="productId",
|
|
142
|
+
)
|
|
143
|
+
"""
|
|
144
|
+
_response = self._raw_client.get(product_id, request_options=request_options)
|
|
145
|
+
return _response.data
|
|
146
|
+
|
|
147
|
+
def update(
|
|
148
|
+
self,
|
|
149
|
+
product_id: str,
|
|
150
|
+
*,
|
|
151
|
+
name: typing.Optional[str] = OMIT,
|
|
152
|
+
description: typing.Optional[str] = OMIT,
|
|
153
|
+
external_id: typing.Optional[str] = OMIT,
|
|
154
|
+
type: typing.Optional[ProductUpdateType] = OMIT,
|
|
155
|
+
active: typing.Optional[bool] = OMIT,
|
|
156
|
+
product_code: typing.Optional[str] = OMIT,
|
|
157
|
+
product_attribute: typing.Optional[typing.Sequence[AgentAttribute]] = OMIT,
|
|
158
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
159
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
160
|
+
) -> Product:
|
|
161
|
+
"""
|
|
162
|
+
Parameters
|
|
163
|
+
----------
|
|
164
|
+
product_id : str
|
|
165
|
+
|
|
166
|
+
name : typing.Optional[str]
|
|
167
|
+
|
|
168
|
+
description : typing.Optional[str]
|
|
169
|
+
|
|
170
|
+
external_id : typing.Optional[str]
|
|
171
|
+
|
|
172
|
+
type : typing.Optional[ProductUpdateType]
|
|
173
|
+
|
|
174
|
+
active : typing.Optional[bool]
|
|
175
|
+
|
|
176
|
+
product_code : typing.Optional[str]
|
|
177
|
+
|
|
178
|
+
product_attribute : typing.Optional[typing.Sequence[AgentAttribute]]
|
|
179
|
+
Pricing attributes for this product
|
|
180
|
+
|
|
181
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
182
|
+
|
|
183
|
+
request_options : typing.Optional[RequestOptions]
|
|
184
|
+
Request-specific configuration.
|
|
185
|
+
|
|
186
|
+
Returns
|
|
187
|
+
-------
|
|
188
|
+
Product
|
|
189
|
+
Success response
|
|
190
|
+
|
|
191
|
+
Examples
|
|
192
|
+
--------
|
|
193
|
+
from paid import Paid
|
|
194
|
+
|
|
195
|
+
client = Paid(
|
|
196
|
+
token="YOUR_TOKEN",
|
|
197
|
+
)
|
|
198
|
+
client.products.update(
|
|
199
|
+
product_id="productId",
|
|
200
|
+
)
|
|
201
|
+
"""
|
|
202
|
+
_response = self._raw_client.update(
|
|
203
|
+
product_id,
|
|
204
|
+
name=name,
|
|
205
|
+
description=description,
|
|
206
|
+
external_id=external_id,
|
|
207
|
+
type=type,
|
|
208
|
+
active=active,
|
|
209
|
+
product_code=product_code,
|
|
210
|
+
product_attribute=product_attribute,
|
|
211
|
+
metadata=metadata,
|
|
212
|
+
request_options=request_options,
|
|
213
|
+
)
|
|
214
|
+
return _response.data
|
|
215
|
+
|
|
216
|
+
def delete(self, product_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
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(
|
|
244
|
+
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
245
|
+
) -> Product:
|
|
246
|
+
"""
|
|
247
|
+
Parameters
|
|
248
|
+
----------
|
|
249
|
+
external_id : str
|
|
250
|
+
|
|
251
|
+
request_options : typing.Optional[RequestOptions]
|
|
252
|
+
Request-specific configuration.
|
|
253
|
+
|
|
254
|
+
Returns
|
|
255
|
+
-------
|
|
256
|
+
Product
|
|
257
|
+
Success response
|
|
258
|
+
|
|
259
|
+
Examples
|
|
260
|
+
--------
|
|
261
|
+
from paid import Paid
|
|
262
|
+
|
|
263
|
+
client = Paid(
|
|
264
|
+
token="YOUR_TOKEN",
|
|
265
|
+
)
|
|
266
|
+
client.products.get_by_external_id(
|
|
267
|
+
external_id="externalId",
|
|
268
|
+
)
|
|
269
|
+
"""
|
|
270
|
+
_response = self._raw_client.get_by_external_id(external_id, request_options=request_options)
|
|
271
|
+
return _response.data
|
|
272
|
+
|
|
273
|
+
def update_by_external_id(
|
|
274
|
+
self,
|
|
275
|
+
external_id_: str,
|
|
276
|
+
*,
|
|
277
|
+
name: typing.Optional[str] = OMIT,
|
|
278
|
+
description: typing.Optional[str] = OMIT,
|
|
279
|
+
external_id: typing.Optional[str] = OMIT,
|
|
280
|
+
type: typing.Optional[ProductUpdateType] = OMIT,
|
|
281
|
+
active: typing.Optional[bool] = OMIT,
|
|
282
|
+
product_code: typing.Optional[str] = OMIT,
|
|
283
|
+
product_attribute: typing.Optional[typing.Sequence[AgentAttribute]] = OMIT,
|
|
284
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
285
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
286
|
+
) -> Product:
|
|
287
|
+
"""
|
|
288
|
+
Parameters
|
|
289
|
+
----------
|
|
290
|
+
external_id_ : str
|
|
291
|
+
|
|
292
|
+
name : typing.Optional[str]
|
|
293
|
+
|
|
294
|
+
description : typing.Optional[str]
|
|
295
|
+
|
|
296
|
+
external_id : typing.Optional[str]
|
|
297
|
+
|
|
298
|
+
type : typing.Optional[ProductUpdateType]
|
|
299
|
+
|
|
300
|
+
active : typing.Optional[bool]
|
|
301
|
+
|
|
302
|
+
product_code : typing.Optional[str]
|
|
303
|
+
|
|
304
|
+
product_attribute : typing.Optional[typing.Sequence[AgentAttribute]]
|
|
305
|
+
Pricing attributes for this product
|
|
306
|
+
|
|
307
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
308
|
+
|
|
309
|
+
request_options : typing.Optional[RequestOptions]
|
|
310
|
+
Request-specific configuration.
|
|
311
|
+
|
|
312
|
+
Returns
|
|
313
|
+
-------
|
|
314
|
+
Product
|
|
315
|
+
Success response
|
|
316
|
+
|
|
317
|
+
Examples
|
|
318
|
+
--------
|
|
319
|
+
from paid import Paid
|
|
320
|
+
|
|
321
|
+
client = Paid(
|
|
322
|
+
token="YOUR_TOKEN",
|
|
323
|
+
)
|
|
324
|
+
client.products.update_by_external_id(
|
|
325
|
+
external_id_="externalId",
|
|
326
|
+
)
|
|
327
|
+
"""
|
|
328
|
+
_response = self._raw_client.update_by_external_id(
|
|
329
|
+
external_id_,
|
|
330
|
+
name=name,
|
|
331
|
+
description=description,
|
|
332
|
+
external_id=external_id,
|
|
333
|
+
type=type,
|
|
334
|
+
active=active,
|
|
335
|
+
product_code=product_code,
|
|
336
|
+
product_attribute=product_attribute,
|
|
337
|
+
metadata=metadata,
|
|
338
|
+
request_options=request_options,
|
|
339
|
+
)
|
|
340
|
+
return _response.data
|
|
341
|
+
|
|
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
|
+
|
|
372
|
+
class AsyncProductsClient:
|
|
373
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
374
|
+
self._raw_client = AsyncRawProductsClient(client_wrapper=client_wrapper)
|
|
375
|
+
|
|
376
|
+
@property
|
|
377
|
+
def with_raw_response(self) -> AsyncRawProductsClient:
|
|
378
|
+
"""
|
|
379
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
380
|
+
|
|
381
|
+
Returns
|
|
382
|
+
-------
|
|
383
|
+
AsyncRawProductsClient
|
|
384
|
+
"""
|
|
385
|
+
return self._raw_client
|
|
386
|
+
|
|
387
|
+
async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Product]:
|
|
388
|
+
"""
|
|
389
|
+
Parameters
|
|
390
|
+
----------
|
|
391
|
+
request_options : typing.Optional[RequestOptions]
|
|
392
|
+
Request-specific configuration.
|
|
393
|
+
|
|
394
|
+
Returns
|
|
395
|
+
-------
|
|
396
|
+
typing.List[Product]
|
|
397
|
+
Success response
|
|
398
|
+
|
|
399
|
+
Examples
|
|
400
|
+
--------
|
|
401
|
+
import asyncio
|
|
402
|
+
|
|
403
|
+
from paid import AsyncPaid
|
|
404
|
+
|
|
405
|
+
client = AsyncPaid(
|
|
406
|
+
token="YOUR_TOKEN",
|
|
407
|
+
)
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
async def main() -> None:
|
|
411
|
+
await client.products.list()
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
asyncio.run(main())
|
|
415
|
+
"""
|
|
416
|
+
_response = await self._raw_client.list(request_options=request_options)
|
|
417
|
+
return _response.data
|
|
418
|
+
|
|
419
|
+
async def create(
|
|
420
|
+
self,
|
|
421
|
+
*,
|
|
422
|
+
name: str,
|
|
423
|
+
description: typing.Optional[str] = OMIT,
|
|
424
|
+
external_id: typing.Optional[str] = OMIT,
|
|
425
|
+
type: typing.Optional[ProductCreateType] = OMIT,
|
|
426
|
+
active: typing.Optional[bool] = OMIT,
|
|
427
|
+
product_code: typing.Optional[str] = OMIT,
|
|
428
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
429
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
430
|
+
) -> Product:
|
|
431
|
+
"""
|
|
432
|
+
Parameters
|
|
433
|
+
----------
|
|
434
|
+
name : str
|
|
435
|
+
|
|
436
|
+
description : typing.Optional[str]
|
|
437
|
+
|
|
438
|
+
external_id : typing.Optional[str]
|
|
439
|
+
|
|
440
|
+
type : typing.Optional[ProductCreateType]
|
|
441
|
+
|
|
442
|
+
active : typing.Optional[bool]
|
|
443
|
+
|
|
444
|
+
product_code : typing.Optional[str]
|
|
445
|
+
|
|
446
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
447
|
+
|
|
448
|
+
request_options : typing.Optional[RequestOptions]
|
|
449
|
+
Request-specific configuration.
|
|
450
|
+
|
|
451
|
+
Returns
|
|
452
|
+
-------
|
|
453
|
+
Product
|
|
454
|
+
Success response
|
|
455
|
+
|
|
456
|
+
Examples
|
|
457
|
+
--------
|
|
458
|
+
import asyncio
|
|
459
|
+
|
|
460
|
+
from paid import AsyncPaid
|
|
461
|
+
|
|
462
|
+
client = AsyncPaid(
|
|
463
|
+
token="YOUR_TOKEN",
|
|
464
|
+
)
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
async def main() -> None:
|
|
468
|
+
await client.products.create(
|
|
469
|
+
name="Acme Product",
|
|
470
|
+
description="Acme Product does amazing things.",
|
|
471
|
+
external_id="acme-product",
|
|
472
|
+
type="product",
|
|
473
|
+
)
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
asyncio.run(main())
|
|
477
|
+
"""
|
|
478
|
+
_response = await self._raw_client.create(
|
|
479
|
+
name=name,
|
|
480
|
+
description=description,
|
|
481
|
+
external_id=external_id,
|
|
482
|
+
type=type,
|
|
483
|
+
active=active,
|
|
484
|
+
product_code=product_code,
|
|
485
|
+
metadata=metadata,
|
|
486
|
+
request_options=request_options,
|
|
487
|
+
)
|
|
488
|
+
return _response.data
|
|
489
|
+
|
|
490
|
+
async def get(self, product_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Product:
|
|
491
|
+
"""
|
|
492
|
+
Parameters
|
|
493
|
+
----------
|
|
494
|
+
product_id : str
|
|
495
|
+
|
|
496
|
+
request_options : typing.Optional[RequestOptions]
|
|
497
|
+
Request-specific configuration.
|
|
498
|
+
|
|
499
|
+
Returns
|
|
500
|
+
-------
|
|
501
|
+
Product
|
|
502
|
+
Success response
|
|
503
|
+
|
|
504
|
+
Examples
|
|
505
|
+
--------
|
|
506
|
+
import asyncio
|
|
507
|
+
|
|
508
|
+
from paid import AsyncPaid
|
|
509
|
+
|
|
510
|
+
client = AsyncPaid(
|
|
511
|
+
token="YOUR_TOKEN",
|
|
512
|
+
)
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
async def main() -> None:
|
|
516
|
+
await client.products.get(
|
|
517
|
+
product_id="productId",
|
|
518
|
+
)
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
asyncio.run(main())
|
|
522
|
+
"""
|
|
523
|
+
_response = await self._raw_client.get(product_id, request_options=request_options)
|
|
524
|
+
return _response.data
|
|
525
|
+
|
|
526
|
+
async def update(
|
|
527
|
+
self,
|
|
528
|
+
product_id: str,
|
|
529
|
+
*,
|
|
530
|
+
name: typing.Optional[str] = OMIT,
|
|
531
|
+
description: typing.Optional[str] = OMIT,
|
|
532
|
+
external_id: typing.Optional[str] = OMIT,
|
|
533
|
+
type: typing.Optional[ProductUpdateType] = OMIT,
|
|
534
|
+
active: typing.Optional[bool] = OMIT,
|
|
535
|
+
product_code: typing.Optional[str] = OMIT,
|
|
536
|
+
product_attribute: typing.Optional[typing.Sequence[AgentAttribute]] = OMIT,
|
|
537
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
538
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
539
|
+
) -> Product:
|
|
540
|
+
"""
|
|
541
|
+
Parameters
|
|
542
|
+
----------
|
|
543
|
+
product_id : str
|
|
544
|
+
|
|
545
|
+
name : typing.Optional[str]
|
|
546
|
+
|
|
547
|
+
description : typing.Optional[str]
|
|
548
|
+
|
|
549
|
+
external_id : typing.Optional[str]
|
|
550
|
+
|
|
551
|
+
type : typing.Optional[ProductUpdateType]
|
|
552
|
+
|
|
553
|
+
active : typing.Optional[bool]
|
|
554
|
+
|
|
555
|
+
product_code : typing.Optional[str]
|
|
556
|
+
|
|
557
|
+
product_attribute : typing.Optional[typing.Sequence[AgentAttribute]]
|
|
558
|
+
Pricing attributes for this product
|
|
559
|
+
|
|
560
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
561
|
+
|
|
562
|
+
request_options : typing.Optional[RequestOptions]
|
|
563
|
+
Request-specific configuration.
|
|
564
|
+
|
|
565
|
+
Returns
|
|
566
|
+
-------
|
|
567
|
+
Product
|
|
568
|
+
Success response
|
|
569
|
+
|
|
570
|
+
Examples
|
|
571
|
+
--------
|
|
572
|
+
import asyncio
|
|
573
|
+
|
|
574
|
+
from paid import AsyncPaid
|
|
575
|
+
|
|
576
|
+
client = AsyncPaid(
|
|
577
|
+
token="YOUR_TOKEN",
|
|
578
|
+
)
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
async def main() -> None:
|
|
582
|
+
await client.products.update(
|
|
583
|
+
product_id="productId",
|
|
584
|
+
)
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
asyncio.run(main())
|
|
588
|
+
"""
|
|
589
|
+
_response = await self._raw_client.update(
|
|
590
|
+
product_id,
|
|
591
|
+
name=name,
|
|
592
|
+
description=description,
|
|
593
|
+
external_id=external_id,
|
|
594
|
+
type=type,
|
|
595
|
+
active=active,
|
|
596
|
+
product_code=product_code,
|
|
597
|
+
product_attribute=product_attribute,
|
|
598
|
+
metadata=metadata,
|
|
599
|
+
request_options=request_options,
|
|
600
|
+
)
|
|
601
|
+
return _response.data
|
|
602
|
+
|
|
603
|
+
async def delete(self, product_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
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(
|
|
639
|
+
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
640
|
+
) -> Product:
|
|
641
|
+
"""
|
|
642
|
+
Parameters
|
|
643
|
+
----------
|
|
644
|
+
external_id : str
|
|
645
|
+
|
|
646
|
+
request_options : typing.Optional[RequestOptions]
|
|
647
|
+
Request-specific configuration.
|
|
648
|
+
|
|
649
|
+
Returns
|
|
650
|
+
-------
|
|
651
|
+
Product
|
|
652
|
+
Success response
|
|
653
|
+
|
|
654
|
+
Examples
|
|
655
|
+
--------
|
|
656
|
+
import asyncio
|
|
657
|
+
|
|
658
|
+
from paid import AsyncPaid
|
|
659
|
+
|
|
660
|
+
client = AsyncPaid(
|
|
661
|
+
token="YOUR_TOKEN",
|
|
662
|
+
)
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
async def main() -> None:
|
|
666
|
+
await client.products.get_by_external_id(
|
|
667
|
+
external_id="externalId",
|
|
668
|
+
)
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
asyncio.run(main())
|
|
672
|
+
"""
|
|
673
|
+
_response = await self._raw_client.get_by_external_id(external_id, request_options=request_options)
|
|
674
|
+
return _response.data
|
|
675
|
+
|
|
676
|
+
async def update_by_external_id(
|
|
677
|
+
self,
|
|
678
|
+
external_id_: str,
|
|
679
|
+
*,
|
|
680
|
+
name: typing.Optional[str] = OMIT,
|
|
681
|
+
description: typing.Optional[str] = OMIT,
|
|
682
|
+
external_id: typing.Optional[str] = OMIT,
|
|
683
|
+
type: typing.Optional[ProductUpdateType] = OMIT,
|
|
684
|
+
active: typing.Optional[bool] = OMIT,
|
|
685
|
+
product_code: typing.Optional[str] = OMIT,
|
|
686
|
+
product_attribute: typing.Optional[typing.Sequence[AgentAttribute]] = OMIT,
|
|
687
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
688
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
689
|
+
) -> Product:
|
|
690
|
+
"""
|
|
691
|
+
Parameters
|
|
692
|
+
----------
|
|
693
|
+
external_id_ : str
|
|
694
|
+
|
|
695
|
+
name : typing.Optional[str]
|
|
696
|
+
|
|
697
|
+
description : typing.Optional[str]
|
|
698
|
+
|
|
699
|
+
external_id : typing.Optional[str]
|
|
700
|
+
|
|
701
|
+
type : typing.Optional[ProductUpdateType]
|
|
702
|
+
|
|
703
|
+
active : typing.Optional[bool]
|
|
704
|
+
|
|
705
|
+
product_code : typing.Optional[str]
|
|
706
|
+
|
|
707
|
+
product_attribute : typing.Optional[typing.Sequence[AgentAttribute]]
|
|
708
|
+
Pricing attributes for this product
|
|
709
|
+
|
|
710
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
711
|
+
|
|
712
|
+
request_options : typing.Optional[RequestOptions]
|
|
713
|
+
Request-specific configuration.
|
|
714
|
+
|
|
715
|
+
Returns
|
|
716
|
+
-------
|
|
717
|
+
Product
|
|
718
|
+
Success response
|
|
719
|
+
|
|
720
|
+
Examples
|
|
721
|
+
--------
|
|
722
|
+
import asyncio
|
|
723
|
+
|
|
724
|
+
from paid import AsyncPaid
|
|
725
|
+
|
|
726
|
+
client = AsyncPaid(
|
|
727
|
+
token="YOUR_TOKEN",
|
|
728
|
+
)
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
async def main() -> None:
|
|
732
|
+
await client.products.update_by_external_id(
|
|
733
|
+
external_id_="externalId",
|
|
734
|
+
)
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
asyncio.run(main())
|
|
738
|
+
"""
|
|
739
|
+
_response = await self._raw_client.update_by_external_id(
|
|
740
|
+
external_id_,
|
|
741
|
+
name=name,
|
|
742
|
+
description=description,
|
|
743
|
+
external_id=external_id,
|
|
744
|
+
type=type,
|
|
745
|
+
active=active,
|
|
746
|
+
product_code=product_code,
|
|
747
|
+
product_attribute=product_attribute,
|
|
748
|
+
metadata=metadata,
|
|
749
|
+
request_options=request_options,
|
|
750
|
+
)
|
|
751
|
+
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
|