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.
Files changed (54) hide show
  1. paid/__init__.py +42 -4
  2. paid/agents/client.py +32 -0
  3. paid/agents/raw_client.py +32 -0
  4. paid/client.py +25 -2
  5. paid/core/client_wrapper.py +2 -3
  6. paid/customers/client.py +168 -36
  7. paid/customers/raw_client.py +217 -36
  8. paid/errors/__init__.py +2 -1
  9. paid/errors/internal_server_error.py +11 -0
  10. paid/orders/lines/client.py +0 -4
  11. paid/plans/__init__.py +4 -0
  12. paid/plans/client.py +261 -0
  13. paid/plans/raw_client.py +345 -0
  14. paid/products/__init__.py +7 -0
  15. paid/products/client.py +788 -0
  16. paid/products/raw_client.py +807 -0
  17. paid/products/types/__init__.py +7 -0
  18. paid/products/types/product_create_type.py +5 -0
  19. paid/traces/__init__.py +4 -0
  20. paid/traces/client.py +218 -0
  21. paid/traces/raw_client.py +226 -0
  22. paid/tracing/context_manager.py +9 -4
  23. paid/types/__init__.py +32 -2
  24. paid/types/cost_trace.py +6 -1
  25. paid/types/customer.py +4 -3
  26. paid/types/customer_update.py +4 -2
  27. paid/types/order_line_attribute_create_one.py +5 -0
  28. paid/types/order_line_create.py +26 -5
  29. paid/types/pagination_meta.py +26 -0
  30. paid/types/plan.py +81 -0
  31. paid/types/plan_plan_products_item.py +35 -0
  32. paid/types/plan_plan_products_item_plan_product_attribute_item.py +34 -0
  33. paid/types/product.py +56 -0
  34. paid/types/product_type.py +5 -0
  35. paid/types/product_update.py +36 -0
  36. paid/types/product_update_type.py +5 -0
  37. paid/types/signal.py +17 -5
  38. paid/types/signal_v_2.py +56 -0
  39. paid/types/trace.py +69 -0
  40. paid/types/traces_response.py +26 -0
  41. paid/types/{order_line_attribute_create.py → usage_pagination_meta.py} +16 -8
  42. paid/types/usage_summaries_response.py +26 -0
  43. paid/types/usage_summary.py +121 -0
  44. paid/types/usage_summary_order.py +26 -0
  45. paid/types/usage_summary_order_line.py +26 -0
  46. paid/usage/__init__.py +3 -0
  47. paid/usage/client.py +206 -0
  48. paid/usage/raw_client.py +283 -0
  49. paid/usage/types/__init__.py +7 -0
  50. paid/usage/types/usage_check_usage_response.py +53 -0
  51. {paid_python-0.4.1a0.dist-info → paid_python-0.5.0.dist-info}/METADATA +20 -20
  52. {paid_python-0.4.1a0.dist-info → paid_python-0.5.0.dist-info}/RECORD +54 -25
  53. {paid_python-0.4.1a0.dist-info → paid_python-0.5.0.dist-info}/LICENSE +0 -0
  54. {paid_python-0.4.1a0.dist-info → paid_python-0.5.0.dist-info}/WHEEL +0 -0
paid/__init__.py CHANGED
@@ -25,22 +25,39 @@ from .types import (
25
25
  Order,
26
26
  OrderLine,
27
27
  OrderLineAttribute,
28
- OrderLineAttributeCreate,
28
+ OrderLineAttributeCreateOne,
29
29
  OrderLineAttributePricing,
30
30
  OrderLineCreate,
31
31
  PaginationMeta,
32
+ Plan,
33
+ PlanPlanProductsItem,
34
+ PlanPlanProductsItemPlanProductAttributeItem,
32
35
  PricePoint,
33
36
  Pricing,
34
37
  PricingModelType,
38
+ Product,
39
+ ProductType,
40
+ ProductUpdate,
41
+ ProductUpdateType,
35
42
  Salutation,
36
43
  Signal,
44
+ SignalV2,
37
45
  TaxExemptStatus,
38
46
  Tier,
47
+ Trace,
48
+ TracesResponse,
49
+ UsagePaginationMeta,
50
+ UsageSummariesResponse,
51
+ UsageSummary,
52
+ UsageSummaryOrder,
53
+ UsageSummaryOrderLine,
39
54
  )
40
- from .errors import BadRequestError, ForbiddenError, NotFoundError
41
- from . import agents, contacts, customers, orders, usage
55
+ from .errors import BadRequestError, ForbiddenError, InternalServerError, NotFoundError
56
+ from . import agents, contacts, customers, orders, plans, products, traces, usage
42
57
  from .client import AsyncPaid, Paid
43
58
  from .environment import PaidEnvironment
59
+ from .products import ProductCreateType
60
+ from .usage import UsageCheckUsageResponse
44
61
  from .version import __version__
45
62
 
46
63
  __all__ = [
@@ -66,27 +83,48 @@ __all__ = [
66
83
  "EntitlementUsage",
67
84
  "Error",
68
85
  "ForbiddenError",
86
+ "InternalServerError",
69
87
  "NotFoundError",
70
88
  "Order",
71
89
  "OrderLine",
72
90
  "OrderLineAttribute",
73
- "OrderLineAttributeCreate",
91
+ "OrderLineAttributeCreateOne",
74
92
  "OrderLineAttributePricing",
75
93
  "OrderLineCreate",
76
94
  "PaginationMeta",
77
95
  "Paid",
78
96
  "PaidEnvironment",
97
+ "Plan",
98
+ "PlanPlanProductsItem",
99
+ "PlanPlanProductsItemPlanProductAttributeItem",
79
100
  "PricePoint",
80
101
  "Pricing",
81
102
  "PricingModelType",
103
+ "Product",
104
+ "ProductCreateType",
105
+ "ProductType",
106
+ "ProductUpdate",
107
+ "ProductUpdateType",
82
108
  "Salutation",
83
109
  "Signal",
110
+ "SignalV2",
84
111
  "TaxExemptStatus",
85
112
  "Tier",
113
+ "Trace",
114
+ "TracesResponse",
115
+ "UsageCheckUsageResponse",
116
+ "UsagePaginationMeta",
117
+ "UsageSummariesResponse",
118
+ "UsageSummary",
119
+ "UsageSummaryOrder",
120
+ "UsageSummaryOrderLine",
86
121
  "__version__",
87
122
  "agents",
88
123
  "contacts",
89
124
  "customers",
90
125
  "orders",
126
+ "plans",
127
+ "products",
128
+ "traces",
91
129
  "usage",
92
130
  ]
paid/agents/client.py CHANGED
@@ -29,6 +29,8 @@ class AgentsClient:
29
29
 
30
30
  def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Agent]:
31
31
  """
32
+ DEPRECATED: Use /products instead. Agents are now products with type='agent'.
33
+
32
34
  Parameters
33
35
  ----------
34
36
  request_options : typing.Optional[RequestOptions]
@@ -62,6 +64,8 @@ class AgentsClient:
62
64
  request_options: typing.Optional[RequestOptions] = None,
63
65
  ) -> Agent:
64
66
  """
67
+ DEPRECATED: Use POST /products instead.
68
+
65
69
  Parameters
66
70
  ----------
67
71
  name : str
@@ -107,6 +111,8 @@ class AgentsClient:
107
111
 
108
112
  def get(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Agent:
109
113
  """
114
+ DEPRECATED: Use GET /products/{productId} instead.
115
+
110
116
  Parameters
111
117
  ----------
112
118
  agent_id : str
@@ -146,6 +152,8 @@ class AgentsClient:
146
152
  request_options: typing.Optional[RequestOptions] = None,
147
153
  ) -> Agent:
148
154
  """
155
+ DEPRECATED: Use PUT /products/{productId} instead.
156
+
149
157
  Parameters
150
158
  ----------
151
159
  agent_id : str
@@ -235,6 +243,8 @@ class AgentsClient:
235
243
 
236
244
  def delete(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
237
245
  """
246
+ DEPRECATED: Use DELETE /products/{productId} instead.
247
+
238
248
  Parameters
239
249
  ----------
240
250
  agent_id : str
@@ -262,6 +272,8 @@ class AgentsClient:
262
272
 
263
273
  def get_by_external_id(self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Agent:
264
274
  """
275
+ DEPRECATED: Use GET /products/external/{externalId} instead.
276
+
265
277
  Parameters
266
278
  ----------
267
279
  external_id : str
@@ -301,6 +313,8 @@ class AgentsClient:
301
313
  request_options: typing.Optional[RequestOptions] = None,
302
314
  ) -> Agent:
303
315
  """
316
+ DEPRECATED: Use PUT /products/external/{externalId} instead.
317
+
304
318
  Parameters
305
319
  ----------
306
320
  external_id_ : str
@@ -371,6 +385,8 @@ class AgentsClient:
371
385
  self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
372
386
  ) -> None:
373
387
  """
388
+ DEPRECATED: Use DELETE /products/external/{externalId} instead.
389
+
374
390
  Parameters
375
391
  ----------
376
392
  external_id : str
@@ -414,6 +430,8 @@ class AsyncAgentsClient:
414
430
 
415
431
  async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Agent]:
416
432
  """
433
+ DEPRECATED: Use /products instead. Agents are now products with type='agent'.
434
+
417
435
  Parameters
418
436
  ----------
419
437
  request_options : typing.Optional[RequestOptions]
@@ -455,6 +473,8 @@ class AsyncAgentsClient:
455
473
  request_options: typing.Optional[RequestOptions] = None,
456
474
  ) -> Agent:
457
475
  """
476
+ DEPRECATED: Use POST /products instead.
477
+
458
478
  Parameters
459
479
  ----------
460
480
  name : str
@@ -508,6 +528,8 @@ class AsyncAgentsClient:
508
528
 
509
529
  async def get(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Agent:
510
530
  """
531
+ DEPRECATED: Use GET /products/{productId} instead.
532
+
511
533
  Parameters
512
534
  ----------
513
535
  agent_id : str
@@ -555,6 +577,8 @@ class AsyncAgentsClient:
555
577
  request_options: typing.Optional[RequestOptions] = None,
556
578
  ) -> Agent:
557
579
  """
580
+ DEPRECATED: Use PUT /products/{productId} instead.
581
+
558
582
  Parameters
559
583
  ----------
560
584
  agent_id : str
@@ -652,6 +676,8 @@ class AsyncAgentsClient:
652
676
 
653
677
  async def delete(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
654
678
  """
679
+ DEPRECATED: Use DELETE /products/{productId} instead.
680
+
655
681
  Parameters
656
682
  ----------
657
683
  agent_id : str
@@ -689,6 +715,8 @@ class AsyncAgentsClient:
689
715
  self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
690
716
  ) -> Agent:
691
717
  """
718
+ DEPRECATED: Use GET /products/external/{externalId} instead.
719
+
692
720
  Parameters
693
721
  ----------
694
722
  external_id : str
@@ -736,6 +764,8 @@ class AsyncAgentsClient:
736
764
  request_options: typing.Optional[RequestOptions] = None,
737
765
  ) -> Agent:
738
766
  """
767
+ DEPRECATED: Use PUT /products/external/{externalId} instead.
768
+
739
769
  Parameters
740
770
  ----------
741
771
  external_id_ : str
@@ -814,6 +844,8 @@ class AsyncAgentsClient:
814
844
  self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
815
845
  ) -> None:
816
846
  """
847
+ DEPRECATED: Use DELETE /products/external/{externalId} instead.
848
+
817
849
  Parameters
818
850
  ----------
819
851
  external_id : str
paid/agents/raw_client.py CHANGED
@@ -23,6 +23,8 @@ class RawAgentsClient:
23
23
 
24
24
  def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[typing.List[Agent]]:
25
25
  """
26
+ DEPRECATED: Use /products instead. Agents are now products with type='agent'.
27
+
26
28
  Parameters
27
29
  ----------
28
30
  request_options : typing.Optional[RequestOptions]
@@ -64,6 +66,8 @@ class RawAgentsClient:
64
66
  request_options: typing.Optional[RequestOptions] = None,
65
67
  ) -> HttpResponse[Agent]:
66
68
  """
69
+ DEPRECATED: Use POST /products instead.
70
+
67
71
  Parameters
68
72
  ----------
69
73
  name : str
@@ -117,6 +121,8 @@ class RawAgentsClient:
117
121
 
118
122
  def get(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Agent]:
119
123
  """
124
+ DEPRECATED: Use GET /products/{productId} instead.
125
+
120
126
  Parameters
121
127
  ----------
122
128
  agent_id : str
@@ -162,6 +168,8 @@ class RawAgentsClient:
162
168
  request_options: typing.Optional[RequestOptions] = None,
163
169
  ) -> HttpResponse[Agent]:
164
170
  """
171
+ DEPRECATED: Use PUT /products/{productId} instead.
172
+
165
173
  Parameters
166
174
  ----------
167
175
  agent_id : str
@@ -222,6 +230,8 @@ class RawAgentsClient:
222
230
 
223
231
  def delete(self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
224
232
  """
233
+ DEPRECATED: Use DELETE /products/{productId} instead.
234
+
225
235
  Parameters
226
236
  ----------
227
237
  agent_id : str
@@ -250,6 +260,8 @@ class RawAgentsClient:
250
260
  self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
251
261
  ) -> HttpResponse[Agent]:
252
262
  """
263
+ DEPRECATED: Use GET /products/external/{externalId} instead.
264
+
253
265
  Parameters
254
266
  ----------
255
267
  external_id : str
@@ -295,6 +307,8 @@ class RawAgentsClient:
295
307
  request_options: typing.Optional[RequestOptions] = None,
296
308
  ) -> HttpResponse[Agent]:
297
309
  """
310
+ DEPRECATED: Use PUT /products/external/{externalId} instead.
311
+
298
312
  Parameters
299
313
  ----------
300
314
  external_id_ : str
@@ -357,6 +371,8 @@ class RawAgentsClient:
357
371
  self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
358
372
  ) -> HttpResponse[None]:
359
373
  """
374
+ DEPRECATED: Use DELETE /products/external/{externalId} instead.
375
+
360
376
  Parameters
361
377
  ----------
362
378
  external_id : str
@@ -390,6 +406,8 @@ class AsyncRawAgentsClient:
390
406
  self, *, request_options: typing.Optional[RequestOptions] = None
391
407
  ) -> AsyncHttpResponse[typing.List[Agent]]:
392
408
  """
409
+ DEPRECATED: Use /products instead. Agents are now products with type='agent'.
410
+
393
411
  Parameters
394
412
  ----------
395
413
  request_options : typing.Optional[RequestOptions]
@@ -431,6 +449,8 @@ class AsyncRawAgentsClient:
431
449
  request_options: typing.Optional[RequestOptions] = None,
432
450
  ) -> AsyncHttpResponse[Agent]:
433
451
  """
452
+ DEPRECATED: Use POST /products instead.
453
+
434
454
  Parameters
435
455
  ----------
436
456
  name : str
@@ -486,6 +506,8 @@ class AsyncRawAgentsClient:
486
506
  self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
487
507
  ) -> AsyncHttpResponse[Agent]:
488
508
  """
509
+ DEPRECATED: Use GET /products/{productId} instead.
510
+
489
511
  Parameters
490
512
  ----------
491
513
  agent_id : str
@@ -531,6 +553,8 @@ class AsyncRawAgentsClient:
531
553
  request_options: typing.Optional[RequestOptions] = None,
532
554
  ) -> AsyncHttpResponse[Agent]:
533
555
  """
556
+ DEPRECATED: Use PUT /products/{productId} instead.
557
+
534
558
  Parameters
535
559
  ----------
536
560
  agent_id : str
@@ -593,6 +617,8 @@ class AsyncRawAgentsClient:
593
617
  self, agent_id: str, *, request_options: typing.Optional[RequestOptions] = None
594
618
  ) -> AsyncHttpResponse[None]:
595
619
  """
620
+ DEPRECATED: Use DELETE /products/{productId} instead.
621
+
596
622
  Parameters
597
623
  ----------
598
624
  agent_id : str
@@ -621,6 +647,8 @@ class AsyncRawAgentsClient:
621
647
  self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
622
648
  ) -> AsyncHttpResponse[Agent]:
623
649
  """
650
+ DEPRECATED: Use GET /products/external/{externalId} instead.
651
+
624
652
  Parameters
625
653
  ----------
626
654
  external_id : str
@@ -666,6 +694,8 @@ class AsyncRawAgentsClient:
666
694
  request_options: typing.Optional[RequestOptions] = None,
667
695
  ) -> AsyncHttpResponse[Agent]:
668
696
  """
697
+ DEPRECATED: Use PUT /products/external/{externalId} instead.
698
+
669
699
  Parameters
670
700
  ----------
671
701
  external_id_ : str
@@ -728,6 +758,8 @@ class AsyncRawAgentsClient:
728
758
  self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
729
759
  ) -> AsyncHttpResponse[None]:
730
760
  """
761
+ DEPRECATED: Use DELETE /products/external/{externalId} instead.
762
+
731
763
  Parameters
732
764
  ----------
733
765
  external_id : str
paid/client.py CHANGED
@@ -14,6 +14,9 @@ from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
14
14
  from .customers.client import AsyncCustomersClient, CustomersClient
15
15
  from .environment import PaidEnvironment
16
16
  from .orders.client import AsyncOrdersClient, OrdersClient
17
+ from .plans.client import AsyncPlansClient, PlansClient
18
+ from .products.client import AsyncProductsClient, ProductsClient
19
+ from .traces.client import AsyncTracesClient, TracesClient
17
20
  from .tracing.distributed_tracing import (
18
21
  generate_tracing_token,
19
22
  set_tracing_token,
@@ -42,12 +45,20 @@ class Paid:
42
45
 
43
46
  environment : PaidEnvironment
44
47
  The environment to use for requests from the client. from .environment import PaidEnvironment
48
+
49
+
50
+
45
51
  Defaults to PaidEnvironment.PRODUCTION
46
- token : typing.Union[str, typing.Callable[[], str]]
52
+
53
+
54
+
55
+ token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
47
56
  timeout : typing.Optional[float]
48
57
  The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
58
+
49
59
  follow_redirects : typing.Optional[bool]
50
60
  Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
61
+
51
62
  httpx_client : typing.Optional[httpx.Client]
52
63
  The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
53
64
 
@@ -93,9 +104,12 @@ class Paid:
93
104
  )
94
105
  self.customers = CustomersClient(client_wrapper=self._client_wrapper)
95
106
  self.agents = AgentsClient(client_wrapper=self._client_wrapper)
107
+ self.products = ProductsClient(client_wrapper=self._client_wrapper)
96
108
  self.contacts = ContactsClient(client_wrapper=self._client_wrapper)
97
109
  self.orders = OrdersClient(client_wrapper=self._client_wrapper)
110
+ self.plans = PlansClient(client_wrapper=self._client_wrapper)
98
111
  self.usage = UsageClient(client_wrapper=self._client_wrapper)
112
+ self.traces = TracesClient(client_wrapper=self._client_wrapper)
99
113
 
100
114
  def initialize_tracing(self, collector_endpoint: str = DEFAULT_COLLECTOR_ENDPOINT) -> None:
101
115
  """
@@ -326,8 +340,14 @@ class AsyncPaid:
326
340
 
327
341
  environment : PaidEnvironment
328
342
  The environment to use for requests from the client. from .environment import PaidEnvironment
343
+
344
+
345
+
329
346
  Defaults to PaidEnvironment.PRODUCTION
330
- token : typing.Union[str, typing.Callable[[], str]]
347
+
348
+
349
+
350
+ token : typing.Optional[typing.Union[str, typing.Callable[[], str]]]
331
351
  timeout : typing.Optional[float]
332
352
  The timeout to be used, in seconds, for requests. By default the timeout is 60 seconds, unless a custom httpx client is used, in which case this default is not enforced.
333
353
 
@@ -379,9 +399,12 @@ class AsyncPaid:
379
399
  )
380
400
  self.customers = AsyncCustomersClient(client_wrapper=self._client_wrapper)
381
401
  self.agents = AsyncAgentsClient(client_wrapper=self._client_wrapper)
402
+ self.products = AsyncProductsClient(client_wrapper=self._client_wrapper)
382
403
  self.contacts = AsyncContactsClient(client_wrapper=self._client_wrapper)
383
404
  self.orders = AsyncOrdersClient(client_wrapper=self._client_wrapper)
405
+ self.plans = AsyncPlansClient(client_wrapper=self._client_wrapper)
384
406
  self.usage = AsyncUsageClient(client_wrapper=self._client_wrapper)
407
+ self.traces = AsyncTracesClient(client_wrapper=self._client_wrapper)
385
408
 
386
409
  def initialize_tracing(self, collector_endpoint: str = DEFAULT_COLLECTOR_ENDPOINT) -> None:
387
410
  """
@@ -20,10 +20,9 @@ class BaseClientWrapper:
20
20
 
21
21
  def get_headers(self) -> typing.Dict[str, str]:
22
22
  headers: typing.Dict[str, str] = {
23
- "User-Agent": "paid-python/0.0.4",
24
23
  "X-Fern-Language": "Python",
25
- "X-Fern-SDK-Name": "paid-python",
26
- "X-Fern-SDK-Version": "0.0.4",
24
+ "X-Fern-SDK-Name": "paid",
25
+ "X-Fern-SDK-Version": "0.5.0",
27
26
  }
28
27
  token = self._get_token()
29
28
  if token is not None: