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.
Files changed (137) hide show
  1. paid/__init__.py +61 -122
  2. paid/client.py +16 -22
  3. paid/contacts/client.py +415 -133
  4. paid/contacts/raw_client.py +1046 -118
  5. paid/core/client_wrapper.py +8 -10
  6. paid/customers/__init__.py +0 -3
  7. paid/customers/client.py +392 -1112
  8. paid/customers/raw_client.py +656 -1054
  9. paid/environment.py +1 -1
  10. paid/errors/bad_request_error.py +2 -2
  11. paid/errors/forbidden_error.py +2 -2
  12. paid/errors/internal_server_error.py +2 -2
  13. paid/errors/not_found_error.py +2 -2
  14. paid/invoices/client.py +369 -0
  15. paid/{plans → invoices}/raw_client.py +310 -201
  16. paid/orders/__init__.py +0 -3
  17. paid/orders/client.py +279 -471
  18. paid/orders/raw_client.py +551 -538
  19. paid/products/__init__.py +0 -3
  20. paid/products/client.py +129 -265
  21. paid/products/raw_client.py +563 -233
  22. paid/signals/client.py +130 -0
  23. paid/signals/raw_client.py +190 -0
  24. paid/tracing/autoinstrumentation.py +12 -6
  25. paid/tracing/context_manager.py +2 -6
  26. paid/tracing/distributed_tracing.py +3 -3
  27. paid/tracing/signal.py +3 -3
  28. paid/tracing/wrappers/openai_agents/openaiAgentsHook.py +1 -1
  29. paid/types/__init__.py +58 -110
  30. paid/types/attribution.py +8 -0
  31. paid/types/{agent_attribute.py → bulk_signals_response.py} +4 -5
  32. paid/types/contact.py +12 -20
  33. paid/types/{address.py → contact_billing_address.py} +6 -7
  34. paid/types/{traces_response.py → contact_list_response.py} +5 -9
  35. paid/types/customer.py +15 -22
  36. paid/types/customer_attribution.py +8 -0
  37. paid/types/customer_billing_address.py +26 -0
  38. paid/types/{usage_summary_order.py → customer_by_external_id.py} +3 -5
  39. paid/types/{usage_summary_order_line.py → customer_by_id.py} +3 -5
  40. paid/types/customer_creation_state.py +5 -0
  41. paid/types/customer_list_response.py +22 -0
  42. paid/types/empty_response.py +17 -0
  43. paid/types/{error.py → error_response.py} +4 -7
  44. paid/types/invoice.py +33 -51
  45. paid/types/invoice_line.py +42 -0
  46. paid/types/invoice_line_payment_status.py +7 -0
  47. paid/types/invoice_lines_response.py +22 -0
  48. paid/types/invoice_list_response.py +22 -0
  49. paid/types/invoice_payment_status.py +5 -0
  50. paid/types/invoice_source.py +5 -0
  51. paid/types/invoice_status.py +3 -1
  52. paid/types/invoice_tax_status.py +7 -0
  53. paid/types/order.py +30 -29
  54. paid/types/order_creation_state.py +5 -0
  55. paid/types/order_line.py +6 -24
  56. paid/types/order_lines_response.py +22 -0
  57. paid/types/order_list_response.py +22 -0
  58. paid/types/pagination.py +24 -0
  59. paid/types/product.py +4 -29
  60. paid/types/{tier.py → product_by_external_id.py} +5 -4
  61. paid/types/{cost_amount.py → product_by_id.py} +5 -12
  62. paid/types/product_list_response.py +22 -0
  63. paid/types/signal.py +8 -34
  64. paid/types/{agent_update.py → update_contact_request.py} +10 -9
  65. paid/types/update_customer_request.py +38 -0
  66. paid/types/{product_update.py → update_product_request.py} +2 -12
  67. {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a1.dist-info}/METADATA +22 -8
  68. paid_python-1.0.0a1.dist-info/RECORD +110 -0
  69. paid/agents/client.py +0 -880
  70. paid/agents/raw_client.py +0 -785
  71. paid/customers/types/__init__.py +0 -8
  72. paid/customers/types/customers_check_entitlement_request_view.py +0 -5
  73. paid/customers/types/customers_check_entitlement_response.py +0 -22
  74. paid/orders/lines/client.py +0 -144
  75. paid/orders/lines/raw_client.py +0 -129
  76. paid/plans/__init__.py +0 -4
  77. paid/plans/client.py +0 -403
  78. paid/products/types/__init__.py +0 -7
  79. paid/products/types/product_create_type.py +0 -5
  80. paid/traces/__init__.py +0 -4
  81. paid/traces/client.py +0 -218
  82. paid/traces/raw_client.py +0 -226
  83. paid/types/agent.py +0 -31
  84. paid/types/agent_price_point.py +0 -27
  85. paid/types/agent_price_point_tiers.py +0 -23
  86. paid/types/api_error.py +0 -29
  87. paid/types/billing_frequency.py +0 -5
  88. paid/types/cancel_renewal_response.py +0 -49
  89. paid/types/charge_type.py +0 -5
  90. paid/types/contact_create_for_customer.py +0 -37
  91. paid/types/cost_trace.py +0 -55
  92. paid/types/cost_traces_response.py +0 -26
  93. paid/types/creation_source.py +0 -5
  94. paid/types/creation_state.py +0 -5
  95. paid/types/customer_update.py +0 -40
  96. paid/types/entitlement_usage.py +0 -48
  97. paid/types/order_line_attribute.py +0 -27
  98. paid/types/order_line_attribute_create_one.py +0 -5
  99. paid/types/order_line_attribute_pricing.py +0 -33
  100. paid/types/order_line_create.py +0 -72
  101. paid/types/pagination_meta.py +0 -84
  102. paid/types/payment_method.py +0 -58
  103. paid/types/payment_method_card.py +0 -49
  104. paid/types/payment_method_type.py +0 -5
  105. paid/types/payment_method_us_bank_account.py +0 -36
  106. paid/types/payment_method_us_bank_account_account_type.py +0 -5
  107. paid/types/plan.py +0 -81
  108. paid/types/plan_group.py +0 -60
  109. paid/types/plan_plan_products_item.py +0 -41
  110. paid/types/plan_plan_products_item_plan_product_attribute_item.py +0 -34
  111. paid/types/plan_with_features.py +0 -69
  112. paid/types/plan_with_features_features_item.py +0 -34
  113. paid/types/price_point.py +0 -25
  114. paid/types/pricing.py +0 -31
  115. paid/types/pricing_model_type.py +0 -7
  116. paid/types/product_type.py +0 -5
  117. paid/types/product_update_type.py +0 -5
  118. paid/types/proration_attribute_update.py +0 -44
  119. paid/types/proration_detail.py +0 -49
  120. paid/types/proration_upgrade_response.py +0 -73
  121. paid/types/salutation.py +0 -5
  122. paid/types/signal_v_2.py +0 -56
  123. paid/types/tax_exempt_status.py +0 -5
  124. paid/types/trace.py +0 -69
  125. paid/types/usage_pagination_meta.py +0 -43
  126. paid/types/usage_summaries_response.py +0 -26
  127. paid/types/usage_summary.py +0 -121
  128. paid/usage/__init__.py +0 -7
  129. paid/usage/client.py +0 -321
  130. paid/usage/raw_client.py +0 -387
  131. paid/usage/types/__init__.py +0 -7
  132. paid/usage/types/usage_check_usage_response.py +0 -53
  133. paid_python-1.0.0a0.dist-info/RECORD +0 -152
  134. /paid/{agents → invoices}/__init__.py +0 -0
  135. /paid/{orders/lines → signals}/__init__.py +0 -0
  136. {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a1.dist-info}/LICENSE +0 -0
  137. {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a1.dist-info}/WHEEL +0 -0
paid/customers/client.py CHANGED
@@ -5,18 +5,12 @@ import typing
5
5
 
6
6
  from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
7
7
  from ..core.request_options import RequestOptions
8
- from ..types.address import Address
9
- from ..types.contact_create_for_customer import ContactCreateForCustomer
10
- from ..types.cost_traces_response import CostTracesResponse
11
- from ..types.creation_source import CreationSource
12
8
  from ..types.customer import Customer
13
- from ..types.entitlement_usage import EntitlementUsage
14
- from ..types.payment_method import PaymentMethod
15
- from ..types.tax_exempt_status import TaxExemptStatus
16
- from ..types.usage_summaries_response import UsageSummariesResponse
9
+ from ..types.customer_billing_address import CustomerBillingAddress
10
+ from ..types.customer_creation_state import CustomerCreationState
11
+ from ..types.customer_list_response import CustomerListResponse
12
+ from ..types.empty_response import EmptyResponse
17
13
  from .raw_client import AsyncRawCustomersClient, RawCustomersClient
18
- from .types.customers_check_entitlement_request_view import CustomersCheckEntitlementRequestView
19
- from .types.customers_check_entitlement_response import CustomersCheckEntitlementResponse
20
14
 
21
15
  # this is used as the default value for optional parameters
22
16
  OMIT = typing.cast(typing.Any, ...)
@@ -37,717 +31,29 @@ class CustomersClient:
37
31
  """
38
32
  return self._raw_client
39
33
 
40
- def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Customer]:
41
- """
42
- Parameters
43
- ----------
44
- request_options : typing.Optional[RequestOptions]
45
- Request-specific configuration.
46
-
47
- Returns
48
- -------
49
- typing.List[Customer]
50
- Success response
51
-
52
- Examples
53
- --------
54
- from paid import Paid
55
-
56
- client = Paid(
57
- token="YOUR_TOKEN",
58
- )
59
- client.customers.list()
60
- """
61
- _response = self._raw_client.list(request_options=request_options)
62
- return _response.data
63
-
64
- def create(
65
- self,
66
- *,
67
- name: str,
68
- external_id: typing.Optional[str] = OMIT,
69
- phone: typing.Optional[str] = OMIT,
70
- employee_count: typing.Optional[float] = OMIT,
71
- annual_revenue: typing.Optional[float] = OMIT,
72
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
73
- creation_source: typing.Optional[CreationSource] = OMIT,
74
- website: typing.Optional[str] = OMIT,
75
- billing_address: typing.Optional[Address] = OMIT,
76
- metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
77
- contacts: typing.Optional[typing.Sequence[ContactCreateForCustomer]] = OMIT,
78
- request_options: typing.Optional[RequestOptions] = None,
79
- ) -> Customer:
80
- """
81
- Parameters
82
- ----------
83
- name : str
84
-
85
- external_id : typing.Optional[str]
86
-
87
- phone : typing.Optional[str]
88
-
89
- employee_count : typing.Optional[float]
90
-
91
- annual_revenue : typing.Optional[float]
92
-
93
- tax_exempt_status : typing.Optional[TaxExemptStatus]
94
-
95
- creation_source : typing.Optional[CreationSource]
96
-
97
- website : typing.Optional[str]
98
-
99
- billing_address : typing.Optional[Address]
100
-
101
- metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
102
- Flexible JSON field for storing custom metadata about the customer
103
-
104
- contacts : typing.Optional[typing.Sequence[ContactCreateForCustomer]]
105
- Array of contacts to create for this customer
106
-
107
- request_options : typing.Optional[RequestOptions]
108
- Request-specific configuration.
109
-
110
- Returns
111
- -------
112
- Customer
113
- Success response - customer already exists with this externalId
114
-
115
- Examples
116
- --------
117
- from paid import ContactCreateForCustomer, Paid
118
-
119
- client = Paid(
120
- token="YOUR_TOKEN",
121
- )
122
- client.customers.create(
123
- name="Acme, Inc.",
124
- external_id="acme-inc",
125
- contacts=[
126
- ContactCreateForCustomer(
127
- salutation="Mr.",
128
- first_name="John",
129
- last_name="Doe",
130
- account_name="Acme, Inc.",
131
- email="john.doe@acme.com",
132
- phone="+1-555-0100",
133
- billing_street="123 Main Street",
134
- billing_city="San Francisco",
135
- billing_state_province="CA",
136
- billing_country="USA",
137
- billing_postal_code="94102",
138
- )
139
- ],
140
- )
141
- """
142
- _response = self._raw_client.create(
143
- name=name,
144
- external_id=external_id,
145
- phone=phone,
146
- employee_count=employee_count,
147
- annual_revenue=annual_revenue,
148
- tax_exempt_status=tax_exempt_status,
149
- creation_source=creation_source,
150
- website=website,
151
- billing_address=billing_address,
152
- metadata=metadata,
153
- contacts=contacts,
154
- request_options=request_options,
155
- )
156
- return _response.data
157
-
158
- def get(self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Customer:
159
- """
160
- Parameters
161
- ----------
162
- customer_id : str
163
-
164
- request_options : typing.Optional[RequestOptions]
165
- Request-specific configuration.
166
-
167
- Returns
168
- -------
169
- Customer
170
- Success response
171
-
172
- Examples
173
- --------
174
- from paid import Paid
175
-
176
- client = Paid(
177
- token="YOUR_TOKEN",
178
- )
179
- client.customers.get(
180
- customer_id="customerId",
181
- )
182
- """
183
- _response = self._raw_client.get(customer_id, request_options=request_options)
184
- return _response.data
185
-
186
- def update(
187
- self,
188
- customer_id: str,
189
- *,
190
- name: typing.Optional[str] = OMIT,
191
- external_id: typing.Optional[str] = OMIT,
192
- phone: typing.Optional[str] = OMIT,
193
- employee_count: typing.Optional[float] = OMIT,
194
- annual_revenue: typing.Optional[float] = OMIT,
195
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
196
- creation_source: typing.Optional[CreationSource] = OMIT,
197
- website: typing.Optional[str] = OMIT,
198
- billing_address: typing.Optional[Address] = OMIT,
199
- metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
200
- request_options: typing.Optional[RequestOptions] = None,
201
- ) -> Customer:
202
- """
203
- Parameters
204
- ----------
205
- customer_id : str
206
-
207
- name : typing.Optional[str]
208
-
209
- external_id : typing.Optional[str]
210
-
211
- phone : typing.Optional[str]
212
-
213
- employee_count : typing.Optional[float]
214
-
215
- annual_revenue : typing.Optional[float]
216
-
217
- tax_exempt_status : typing.Optional[TaxExemptStatus]
218
-
219
- creation_source : typing.Optional[CreationSource]
220
-
221
- website : typing.Optional[str]
222
-
223
- billing_address : typing.Optional[Address]
224
-
225
- metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
226
- Flexible JSON field for storing custom metadata about the customer
227
-
228
- request_options : typing.Optional[RequestOptions]
229
- Request-specific configuration.
230
-
231
- Returns
232
- -------
233
- Customer
234
- Customer updated successfully
235
-
236
- Examples
237
- --------
238
- from paid import Paid
239
-
240
- client = Paid(
241
- token="YOUR_TOKEN",
242
- )
243
- client.customers.update(
244
- customer_id="customerId",
245
- name="Acme, Inc. (Updated)",
246
- phone="123-456-7890",
247
- employee_count=101.0,
248
- annual_revenue=1000001.0,
249
- )
250
- """
251
- _response = self._raw_client.update(
252
- customer_id,
253
- name=name,
254
- external_id=external_id,
255
- phone=phone,
256
- employee_count=employee_count,
257
- annual_revenue=annual_revenue,
258
- tax_exempt_status=tax_exempt_status,
259
- creation_source=creation_source,
260
- website=website,
261
- billing_address=billing_address,
262
- metadata=metadata,
263
- request_options=request_options,
264
- )
265
- return _response.data
266
-
267
- def delete(self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
268
- """
269
- Parameters
270
- ----------
271
- customer_id : str
272
-
273
- request_options : typing.Optional[RequestOptions]
274
- Request-specific configuration.
275
-
276
- Returns
277
- -------
278
- None
279
-
280
- Examples
281
- --------
282
- from paid import Paid
283
-
284
- client = Paid(
285
- token="YOUR_TOKEN",
286
- )
287
- client.customers.delete(
288
- customer_id="customerId",
289
- )
290
- """
291
- _response = self._raw_client.delete(customer_id, request_options=request_options)
292
- return _response.data
293
-
294
- def check_entitlement(
295
- self,
296
- customer_id: str,
297
- *,
298
- event_name: str,
299
- view: typing.Optional[CustomersCheckEntitlementRequestView] = None,
300
- request_options: typing.Optional[RequestOptions] = None,
301
- ) -> CustomersCheckEntitlementResponse:
302
- """
303
- Parameters
304
- ----------
305
- customer_id : str
306
- The customer ID
307
-
308
- event_name : str
309
- The name of the usage event to check entitlement for
310
-
311
- view : typing.Optional[CustomersCheckEntitlementRequestView]
312
- Filter view - 'all' returns all entitlements regardless of status, 'active_only' returns only currently active entitlements with available credits
313
-
314
- request_options : typing.Optional[RequestOptions]
315
- Request-specific configuration.
316
-
317
- Returns
318
- -------
319
- CustomersCheckEntitlementResponse
320
- Success response
321
-
322
- Examples
323
- --------
324
- from paid import Paid
325
-
326
- client = Paid(
327
- token="YOUR_TOKEN",
328
- )
329
- client.customers.check_entitlement(
330
- customer_id="customerId",
331
- event_name="event_name",
332
- view="all",
333
- )
334
- """
335
- _response = self._raw_client.check_entitlement(
336
- customer_id, event_name=event_name, view=view, request_options=request_options
337
- )
338
- return _response.data
339
-
340
- def get_entitlements(
341
- self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
342
- ) -> typing.List[EntitlementUsage]:
343
- """
344
- Parameters
345
- ----------
346
- customer_id : str
347
- The customer ID
348
-
349
- request_options : typing.Optional[RequestOptions]
350
- Request-specific configuration.
351
-
352
- Returns
353
- -------
354
- typing.List[EntitlementUsage]
355
- Success response
356
-
357
- Examples
358
- --------
359
- from paid import Paid
360
-
361
- client = Paid(
362
- token="YOUR_TOKEN",
363
- )
364
- client.customers.get_entitlements(
365
- customer_id="customerId",
366
- )
367
- """
368
- _response = self._raw_client.get_entitlements(customer_id, request_options=request_options)
369
- return _response.data
370
-
371
- def get_by_external_id(
372
- self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
373
- ) -> Customer:
374
- """
375
- Parameters
376
- ----------
377
- external_id : str
378
-
379
- request_options : typing.Optional[RequestOptions]
380
- Request-specific configuration.
381
-
382
- Returns
383
- -------
384
- Customer
385
- Success response
386
-
387
- Examples
388
- --------
389
- from paid import Paid
390
-
391
- client = Paid(
392
- token="YOUR_TOKEN",
393
- )
394
- client.customers.get_by_external_id(
395
- external_id="externalId",
396
- )
397
- """
398
- _response = self._raw_client.get_by_external_id(external_id, request_options=request_options)
399
- return _response.data
400
-
401
- def update_by_external_id(
402
- self,
403
- external_id_: str,
404
- *,
405
- name: typing.Optional[str] = OMIT,
406
- external_id: typing.Optional[str] = OMIT,
407
- phone: typing.Optional[str] = OMIT,
408
- employee_count: typing.Optional[float] = OMIT,
409
- annual_revenue: typing.Optional[float] = OMIT,
410
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
411
- creation_source: typing.Optional[CreationSource] = OMIT,
412
- website: typing.Optional[str] = OMIT,
413
- billing_address: typing.Optional[Address] = OMIT,
414
- metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
415
- request_options: typing.Optional[RequestOptions] = None,
416
- ) -> Customer:
417
- """
418
- Parameters
419
- ----------
420
- external_id_ : str
421
-
422
- name : typing.Optional[str]
423
-
424
- external_id : typing.Optional[str]
425
-
426
- phone : typing.Optional[str]
427
-
428
- employee_count : typing.Optional[float]
429
-
430
- annual_revenue : typing.Optional[float]
431
-
432
- tax_exempt_status : typing.Optional[TaxExemptStatus]
433
-
434
- creation_source : typing.Optional[CreationSource]
435
-
436
- website : typing.Optional[str]
437
-
438
- billing_address : typing.Optional[Address]
439
-
440
- metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
441
- Flexible JSON field for storing custom metadata about the customer
442
-
443
- request_options : typing.Optional[RequestOptions]
444
- Request-specific configuration.
445
-
446
- Returns
447
- -------
448
- Customer
449
- Success response
450
-
451
- Examples
452
- --------
453
- from paid import Paid
454
-
455
- client = Paid(
456
- token="YOUR_TOKEN",
457
- )
458
- client.customers.update_by_external_id(
459
- external_id_="externalId",
460
- )
461
- """
462
- _response = self._raw_client.update_by_external_id(
463
- external_id_,
464
- name=name,
465
- external_id=external_id,
466
- phone=phone,
467
- employee_count=employee_count,
468
- annual_revenue=annual_revenue,
469
- tax_exempt_status=tax_exempt_status,
470
- creation_source=creation_source,
471
- website=website,
472
- billing_address=billing_address,
473
- metadata=metadata,
474
- request_options=request_options,
475
- )
476
- return _response.data
477
-
478
- def delete_by_external_id(
479
- self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
480
- ) -> None:
481
- """
482
- Parameters
483
- ----------
484
- external_id : str
485
-
486
- request_options : typing.Optional[RequestOptions]
487
- Request-specific configuration.
488
-
489
- Returns
490
- -------
491
- None
492
-
493
- Examples
494
- --------
495
- from paid import Paid
496
-
497
- client = Paid(
498
- token="YOUR_TOKEN",
499
- )
500
- client.customers.delete_by_external_id(
501
- external_id="externalId",
502
- )
503
- """
504
- _response = self._raw_client.delete_by_external_id(external_id, request_options=request_options)
505
- return _response.data
506
-
507
- def get_costs_by_external_id(
34
+ def list_customers(
508
35
  self,
509
- external_id: str,
510
36
  *,
511
37
  limit: typing.Optional[int] = None,
512
38
  offset: typing.Optional[int] = None,
513
- start_time: typing.Optional[dt.datetime] = None,
514
- end_time: typing.Optional[dt.datetime] = None,
515
39
  request_options: typing.Optional[RequestOptions] = None,
516
- ) -> CostTracesResponse:
517
- """
518
- Parameters
519
- ----------
520
- external_id : str
521
- The external ID of the customer
522
-
523
- limit : typing.Optional[int]
524
- Maximum number of traces to return (1-1000)
525
-
526
- offset : typing.Optional[int]
527
- Number of traces to skip for pagination
528
-
529
- start_time : typing.Optional[dt.datetime]
530
- Filter traces starting from this time (ISO 8601 format)
531
-
532
- end_time : typing.Optional[dt.datetime]
533
- Filter traces up to this time (ISO 8601 format)
534
-
535
- request_options : typing.Optional[RequestOptions]
536
- Request-specific configuration.
537
-
538
- Returns
539
- -------
540
- CostTracesResponse
541
- Success response
542
-
543
- Examples
544
- --------
545
- import datetime
546
-
547
- from paid import Paid
548
-
549
- client = Paid(
550
- token="YOUR_TOKEN",
551
- )
552
- client.customers.get_costs_by_external_id(
553
- external_id="externalId",
554
- limit=1,
555
- offset=1,
556
- start_time=datetime.datetime.fromisoformat(
557
- "2024-01-15 09:30:00+00:00",
558
- ),
559
- end_time=datetime.datetime.fromisoformat(
560
- "2024-01-15 09:30:00+00:00",
561
- ),
562
- )
40
+ ) -> CustomerListResponse:
563
41
  """
564
- _response = self._raw_client.get_costs_by_external_id(
565
- external_id,
566
- limit=limit,
567
- offset=offset,
568
- start_time=start_time,
569
- end_time=end_time,
570
- request_options=request_options,
571
- )
572
- return _response.data
42
+ Get a list of customers for the organization
573
43
 
574
- def get_usage_by_external_id(
575
- self,
576
- external_id: str,
577
- *,
578
- limit: typing.Optional[int] = None,
579
- offset: typing.Optional[int] = None,
580
- start_time: typing.Optional[dt.datetime] = None,
581
- end_time: typing.Optional[dt.datetime] = None,
582
- request_options: typing.Optional[RequestOptions] = None,
583
- ) -> UsageSummariesResponse:
584
- """
585
44
  Parameters
586
45
  ----------
587
- external_id : str
588
- The external ID of the customer
589
-
590
46
  limit : typing.Optional[int]
591
- Maximum number of usage summaries to return (1-1000)
592
47
 
593
48
  offset : typing.Optional[int]
594
- Number of usage summaries to skip for pagination
595
-
596
- start_time : typing.Optional[dt.datetime]
597
- Filter usage summaries starting from this time (ISO 8601 format). Returns summaries that overlap with the time range.
598
-
599
- end_time : typing.Optional[dt.datetime]
600
- Filter usage summaries up to this time (ISO 8601 format). Returns summaries that overlap with the time range.
601
-
602
- request_options : typing.Optional[RequestOptions]
603
- Request-specific configuration.
604
-
605
- Returns
606
- -------
607
- UsageSummariesResponse
608
- Success response
609
-
610
- Examples
611
- --------
612
- import datetime
613
-
614
- from paid import Paid
615
-
616
- client = Paid(
617
- token="YOUR_TOKEN",
618
- )
619
- client.customers.get_usage_by_external_id(
620
- external_id="externalId",
621
- limit=1,
622
- offset=1,
623
- start_time=datetime.datetime.fromisoformat(
624
- "2024-01-15 09:30:00+00:00",
625
- ),
626
- end_time=datetime.datetime.fromisoformat(
627
- "2024-01-15 09:30:00+00:00",
628
- ),
629
- )
630
- """
631
- _response = self._raw_client.get_usage_by_external_id(
632
- external_id,
633
- limit=limit,
634
- offset=offset,
635
- start_time=start_time,
636
- end_time=end_time,
637
- request_options=request_options,
638
- )
639
- return _response.data
640
-
641
- def list_payment_methods(
642
- self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
643
- ) -> typing.List[PaymentMethod]:
644
- """
645
- Retrieves all payment methods associated with a customer identified by their external ID.
646
-
647
- Parameters
648
- ----------
649
- external_id : str
650
- The external ID of the customer
651
-
652
- request_options : typing.Optional[RequestOptions]
653
- Request-specific configuration.
654
-
655
- Returns
656
- -------
657
- typing.List[PaymentMethod]
658
- Success response
659
-
660
- Examples
661
- --------
662
- from paid import Paid
663
-
664
- client = Paid(
665
- token="YOUR_TOKEN",
666
- )
667
- client.customers.list_payment_methods(
668
- external_id="externalId",
669
- )
670
- """
671
- _response = self._raw_client.list_payment_methods(external_id, request_options=request_options)
672
- return _response.data
673
-
674
- def create_payment_method(
675
- self,
676
- external_id: str,
677
- *,
678
- confirmation_token: str,
679
- return_url: str,
680
- metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
681
- request_options: typing.Optional[RequestOptions] = None,
682
- ) -> PaymentMethod:
683
- """
684
- Creates a new payment method for a customer using a Stripe confirmation token.
685
-
686
- Parameters
687
- ----------
688
- external_id : str
689
- The external ID of the customer
690
-
691
- confirmation_token : str
692
- Stripe confirmation token for the payment method
693
-
694
- return_url : str
695
- URL to redirect to after payment method setup
696
-
697
- metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
698
- Optional metadata to attach to the payment method
699
-
700
- request_options : typing.Optional[RequestOptions]
701
- Request-specific configuration.
702
-
703
- Returns
704
- -------
705
- PaymentMethod
706
- Payment method created successfully
707
-
708
- Examples
709
- --------
710
- from paid import Paid
711
-
712
- client = Paid(
713
- token="YOUR_TOKEN",
714
- )
715
- client.customers.create_payment_method(
716
- external_id="externalId",
717
- confirmation_token="ctoken_1234567890",
718
- return_url="https://example.com/payment-method-added",
719
- metadata={"source": "api"},
720
- )
721
- """
722
- _response = self._raw_client.create_payment_method(
723
- external_id,
724
- confirmation_token=confirmation_token,
725
- return_url=return_url,
726
- metadata=metadata,
727
- request_options=request_options,
728
- )
729
- return _response.data
730
-
731
- def delete_payment_method(
732
- self, external_id: str, payment_method_id: str, *, request_options: typing.Optional[RequestOptions] = None
733
- ) -> None:
734
- """
735
- Deletes a specific payment method from a customer's account.
736
-
737
- Parameters
738
- ----------
739
- external_id : str
740
- The external ID of the customer
741
-
742
- payment_method_id : str
743
- The ID of the payment method to delete
744
49
 
745
50
  request_options : typing.Optional[RequestOptions]
746
51
  Request-specific configuration.
747
52
 
748
53
  Returns
749
54
  -------
750
- None
55
+ CustomerListResponse
56
+ 200
751
57
 
752
58
  Examples
753
59
  --------
@@ -756,106 +62,50 @@ class CustomersClient:
756
62
  client = Paid(
757
63
  token="YOUR_TOKEN",
758
64
  )
759
- client.customers.delete_payment_method(
760
- external_id="externalId",
761
- payment_method_id="paymentMethodId",
762
- )
763
- """
764
- _response = self._raw_client.delete_payment_method(
765
- external_id, payment_method_id, request_options=request_options
766
- )
767
- return _response.data
768
-
769
-
770
- class AsyncCustomersClient:
771
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
772
- self._raw_client = AsyncRawCustomersClient(client_wrapper=client_wrapper)
773
-
774
- @property
775
- def with_raw_response(self) -> AsyncRawCustomersClient:
776
- """
777
- Retrieves a raw implementation of this client that returns raw responses.
778
-
779
- Returns
780
- -------
781
- AsyncRawCustomersClient
782
- """
783
- return self._raw_client
784
-
785
- async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> typing.List[Customer]:
786
- """
787
- Parameters
788
- ----------
789
- request_options : typing.Optional[RequestOptions]
790
- Request-specific configuration.
791
-
792
- Returns
793
- -------
794
- typing.List[Customer]
795
- Success response
796
-
797
- Examples
798
- --------
799
- import asyncio
800
-
801
- from paid import AsyncPaid
802
-
803
- client = AsyncPaid(
804
- token="YOUR_TOKEN",
805
- )
806
-
807
-
808
- async def main() -> None:
809
- await client.customers.list()
810
-
811
-
812
- asyncio.run(main())
65
+ client.customers.list_customers()
813
66
  """
814
- _response = await self._raw_client.list(request_options=request_options)
67
+ _response = self._raw_client.list_customers(limit=limit, offset=offset, request_options=request_options)
815
68
  return _response.data
816
69
 
817
- async def create(
70
+ def create_a_new_customer(
818
71
  self,
819
72
  *,
820
73
  name: str,
821
- external_id: typing.Optional[str] = OMIT,
74
+ legal_name: typing.Optional[str] = OMIT,
75
+ email: typing.Optional[str] = OMIT,
822
76
  phone: typing.Optional[str] = OMIT,
823
- employee_count: typing.Optional[float] = OMIT,
824
- annual_revenue: typing.Optional[float] = OMIT,
825
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
826
- creation_source: typing.Optional[CreationSource] = OMIT,
827
77
  website: typing.Optional[str] = OMIT,
828
- billing_address: typing.Optional[Address] = OMIT,
78
+ external_id: typing.Optional[str] = OMIT,
79
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
80
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
81
+ vat_number: typing.Optional[str] = OMIT,
829
82
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
830
- contacts: typing.Optional[typing.Sequence[ContactCreateForCustomer]] = OMIT,
831
83
  request_options: typing.Optional[RequestOptions] = None,
832
84
  ) -> Customer:
833
85
  """
86
+ Creates a new customer for the organization
87
+
834
88
  Parameters
835
89
  ----------
836
90
  name : str
837
91
 
838
- external_id : typing.Optional[str]
92
+ legal_name : typing.Optional[str]
839
93
 
840
- phone : typing.Optional[str]
94
+ email : typing.Optional[str]
841
95
 
842
- employee_count : typing.Optional[float]
96
+ phone : typing.Optional[str]
843
97
 
844
- annual_revenue : typing.Optional[float]
98
+ website : typing.Optional[str]
845
99
 
846
- tax_exempt_status : typing.Optional[TaxExemptStatus]
100
+ external_id : typing.Optional[str]
847
101
 
848
- creation_source : typing.Optional[CreationSource]
102
+ billing_address : typing.Optional[CustomerBillingAddress]
849
103
 
850
- website : typing.Optional[str]
104
+ creation_state : typing.Optional[CustomerCreationState]
851
105
 
852
- billing_address : typing.Optional[Address]
106
+ vat_number : typing.Optional[str]
853
107
 
854
108
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
855
- Flexible JSON field for storing custom metadata about the customer
856
-
857
- contacts : typing.Optional[typing.Sequence[ContactCreateForCustomer]]
858
- Array of contacts to create for this customer
859
109
 
860
110
  request_options : typing.Optional[RequestOptions]
861
111
  Request-specific configuration.
@@ -863,64 +113,41 @@ class AsyncCustomersClient:
863
113
  Returns
864
114
  -------
865
115
  Customer
866
- Success response - customer already exists with this externalId
116
+ 201
867
117
 
868
118
  Examples
869
119
  --------
870
- import asyncio
871
-
872
- from paid import AsyncPaid, ContactCreateForCustomer
120
+ from paid import Paid
873
121
 
874
- client = AsyncPaid(
122
+ client = Paid(
875
123
  token="YOUR_TOKEN",
876
124
  )
877
-
878
-
879
- async def main() -> None:
880
- await client.customers.create(
881
- name="Acme, Inc.",
882
- external_id="acme-inc",
883
- contacts=[
884
- ContactCreateForCustomer(
885
- salutation="Mr.",
886
- first_name="John",
887
- last_name="Doe",
888
- account_name="Acme, Inc.",
889
- email="john.doe@acme.com",
890
- phone="+1-555-0100",
891
- billing_street="123 Main Street",
892
- billing_city="San Francisco",
893
- billing_state_province="CA",
894
- billing_country="USA",
895
- billing_postal_code="94102",
896
- )
897
- ],
898
- )
899
-
900
-
901
- asyncio.run(main())
125
+ client.customers.create_a_new_customer(
126
+ name="name",
127
+ )
902
128
  """
903
- _response = await self._raw_client.create(
129
+ _response = self._raw_client.create_a_new_customer(
904
130
  name=name,
905
- external_id=external_id,
131
+ legal_name=legal_name,
132
+ email=email,
906
133
  phone=phone,
907
- employee_count=employee_count,
908
- annual_revenue=annual_revenue,
909
- tax_exempt_status=tax_exempt_status,
910
- creation_source=creation_source,
911
134
  website=website,
135
+ external_id=external_id,
912
136
  billing_address=billing_address,
137
+ creation_state=creation_state,
138
+ vat_number=vat_number,
913
139
  metadata=metadata,
914
- contacts=contacts,
915
140
  request_options=request_options,
916
141
  )
917
142
  return _response.data
918
143
 
919
- async def get(self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Customer:
144
+ def get_customer(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Customer:
920
145
  """
146
+ Get a customer by its ID
147
+
921
148
  Parameters
922
149
  ----------
923
- customer_id : str
150
+ id : str
924
151
 
925
152
  request_options : typing.Optional[RequestOptions]
926
153
  Request-specific configuration.
@@ -928,71 +155,67 @@ class AsyncCustomersClient:
928
155
  Returns
929
156
  -------
930
157
  Customer
931
- Success response
158
+ 200
932
159
 
933
160
  Examples
934
161
  --------
935
- import asyncio
936
-
937
- from paid import AsyncPaid
938
-
939
- client = AsyncPaid(
940
- token="YOUR_TOKEN",
941
- )
942
-
943
-
944
- async def main() -> None:
945
- await client.customers.get(
946
- customer_id="customerId",
947
- )
948
-
162
+ from paid import Paid
949
163
 
950
- asyncio.run(main())
164
+ client = Paid(
165
+ token="YOUR_TOKEN",
166
+ )
167
+ client.customers.get_customer(
168
+ id="id",
169
+ )
951
170
  """
952
- _response = await self._raw_client.get(customer_id, request_options=request_options)
171
+ _response = self._raw_client.get_customer(id, request_options=request_options)
953
172
  return _response.data
954
173
 
955
- async def update(
174
+ def update_customer(
956
175
  self,
957
- customer_id: str,
176
+ id: str,
958
177
  *,
959
178
  name: typing.Optional[str] = OMIT,
960
- external_id: typing.Optional[str] = OMIT,
179
+ legal_name: typing.Optional[str] = OMIT,
180
+ email: typing.Optional[str] = OMIT,
961
181
  phone: typing.Optional[str] = OMIT,
962
- employee_count: typing.Optional[float] = OMIT,
963
- annual_revenue: typing.Optional[float] = OMIT,
964
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
965
- creation_source: typing.Optional[CreationSource] = OMIT,
966
182
  website: typing.Optional[str] = OMIT,
967
- billing_address: typing.Optional[Address] = OMIT,
183
+ external_id: typing.Optional[str] = OMIT,
184
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
185
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
186
+ churn_date: typing.Optional[dt.datetime] = OMIT,
187
+ vat_number: typing.Optional[str] = OMIT,
968
188
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
969
189
  request_options: typing.Optional[RequestOptions] = None,
970
190
  ) -> Customer:
971
191
  """
192
+ Update a customer by its ID
193
+
972
194
  Parameters
973
195
  ----------
974
- customer_id : str
196
+ id : str
975
197
 
976
198
  name : typing.Optional[str]
977
199
 
978
- external_id : typing.Optional[str]
200
+ legal_name : typing.Optional[str]
201
+
202
+ email : typing.Optional[str]
979
203
 
980
204
  phone : typing.Optional[str]
981
205
 
982
- employee_count : typing.Optional[float]
206
+ website : typing.Optional[str]
983
207
 
984
- annual_revenue : typing.Optional[float]
208
+ external_id : typing.Optional[str]
985
209
 
986
- tax_exempt_status : typing.Optional[TaxExemptStatus]
210
+ billing_address : typing.Optional[CustomerBillingAddress]
987
211
 
988
- creation_source : typing.Optional[CreationSource]
212
+ creation_state : typing.Optional[CustomerCreationState]
989
213
 
990
- website : typing.Optional[str]
214
+ churn_date : typing.Optional[dt.datetime]
991
215
 
992
- billing_address : typing.Optional[Address]
216
+ vat_number : typing.Optional[str]
993
217
 
994
218
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
995
- Flexible JSON field for storing custom metadata about the customer
996
219
 
997
220
  request_options : typing.Optional[RequestOptions]
998
221
  Request-specific configuration.
@@ -1000,190 +223,251 @@ class AsyncCustomersClient:
1000
223
  Returns
1001
224
  -------
1002
225
  Customer
1003
- Customer updated successfully
226
+ 200
1004
227
 
1005
228
  Examples
1006
229
  --------
1007
- import asyncio
1008
-
1009
- from paid import AsyncPaid
230
+ from paid import Paid
1010
231
 
1011
- client = AsyncPaid(
232
+ client = Paid(
1012
233
  token="YOUR_TOKEN",
1013
234
  )
1014
-
1015
-
1016
- async def main() -> None:
1017
- await client.customers.update(
1018
- customer_id="customerId",
1019
- name="Acme, Inc. (Updated)",
1020
- phone="123-456-7890",
1021
- employee_count=101.0,
1022
- annual_revenue=1000001.0,
1023
- )
1024
-
1025
-
1026
- asyncio.run(main())
235
+ client.customers.update_customer(
236
+ id="id",
237
+ )
1027
238
  """
1028
- _response = await self._raw_client.update(
1029
- customer_id,
239
+ _response = self._raw_client.update_customer(
240
+ id,
1030
241
  name=name,
1031
- external_id=external_id,
242
+ legal_name=legal_name,
243
+ email=email,
1032
244
  phone=phone,
1033
- employee_count=employee_count,
1034
- annual_revenue=annual_revenue,
1035
- tax_exempt_status=tax_exempt_status,
1036
- creation_source=creation_source,
1037
245
  website=website,
246
+ external_id=external_id,
1038
247
  billing_address=billing_address,
248
+ creation_state=creation_state,
249
+ churn_date=churn_date,
250
+ vat_number=vat_number,
1039
251
  metadata=metadata,
1040
252
  request_options=request_options,
1041
253
  )
1042
254
  return _response.data
1043
255
 
1044
- async def delete(self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
256
+ def delete_customer(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> EmptyResponse:
1045
257
  """
258
+ Delete a customer by its ID
259
+
1046
260
  Parameters
1047
261
  ----------
1048
- customer_id : str
262
+ id : str
1049
263
 
1050
264
  request_options : typing.Optional[RequestOptions]
1051
265
  Request-specific configuration.
1052
266
 
1053
267
  Returns
1054
268
  -------
1055
- None
269
+ EmptyResponse
270
+ 200
1056
271
 
1057
272
  Examples
1058
273
  --------
1059
- import asyncio
1060
-
1061
- from paid import AsyncPaid
274
+ from paid import Paid
1062
275
 
1063
- client = AsyncPaid(
276
+ client = Paid(
1064
277
  token="YOUR_TOKEN",
1065
278
  )
279
+ client.customers.delete_customer(
280
+ id="id",
281
+ )
282
+ """
283
+ _response = self._raw_client.delete_customer(id, request_options=request_options)
284
+ return _response.data
1066
285
 
286
+ def get_customer_by_external_id(
287
+ self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
288
+ ) -> Customer:
289
+ """
290
+ Get a customer by its externalId
1067
291
 
1068
- async def main() -> None:
1069
- await client.customers.delete(
1070
- customer_id="customerId",
1071
- )
292
+ Parameters
293
+ ----------
294
+ external_id : str
1072
295
 
296
+ request_options : typing.Optional[RequestOptions]
297
+ Request-specific configuration.
1073
298
 
1074
- asyncio.run(main())
299
+ Returns
300
+ -------
301
+ Customer
302
+ 200
303
+
304
+ Examples
305
+ --------
306
+ from paid import Paid
307
+
308
+ client = Paid(
309
+ token="YOUR_TOKEN",
310
+ )
311
+ client.customers.get_customer_by_external_id(
312
+ external_id="externalId",
313
+ )
1075
314
  """
1076
- _response = await self._raw_client.delete(customer_id, request_options=request_options)
315
+ _response = self._raw_client.get_customer_by_external_id(external_id, request_options=request_options)
1077
316
  return _response.data
1078
317
 
1079
- async def check_entitlement(
318
+ def update_customer_by_external_id(
1080
319
  self,
1081
- customer_id: str,
320
+ external_id_: str,
1082
321
  *,
1083
- event_name: str,
1084
- view: typing.Optional[CustomersCheckEntitlementRequestView] = None,
322
+ name: typing.Optional[str] = OMIT,
323
+ legal_name: typing.Optional[str] = OMIT,
324
+ email: typing.Optional[str] = OMIT,
325
+ phone: typing.Optional[str] = OMIT,
326
+ website: typing.Optional[str] = OMIT,
327
+ external_id: typing.Optional[str] = OMIT,
328
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
329
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
330
+ churn_date: typing.Optional[dt.datetime] = OMIT,
331
+ vat_number: typing.Optional[str] = OMIT,
332
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
1085
333
  request_options: typing.Optional[RequestOptions] = None,
1086
- ) -> CustomersCheckEntitlementResponse:
334
+ ) -> Customer:
1087
335
  """
336
+ Update a customer by its externalId
337
+
1088
338
  Parameters
1089
339
  ----------
1090
- customer_id : str
1091
- The customer ID
340
+ external_id_ : str
341
+
342
+ name : typing.Optional[str]
343
+
344
+ legal_name : typing.Optional[str]
345
+
346
+ email : typing.Optional[str]
347
+
348
+ phone : typing.Optional[str]
349
+
350
+ website : typing.Optional[str]
351
+
352
+ external_id : typing.Optional[str]
1092
353
 
1093
- event_name : str
1094
- The name of the usage event to check entitlement for
354
+ billing_address : typing.Optional[CustomerBillingAddress]
1095
355
 
1096
- view : typing.Optional[CustomersCheckEntitlementRequestView]
1097
- Filter view - 'all' returns all entitlements regardless of status, 'active_only' returns only currently active entitlements with available credits
356
+ creation_state : typing.Optional[CustomerCreationState]
357
+
358
+ churn_date : typing.Optional[dt.datetime]
359
+
360
+ vat_number : typing.Optional[str]
361
+
362
+ metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
1098
363
 
1099
364
  request_options : typing.Optional[RequestOptions]
1100
365
  Request-specific configuration.
1101
366
 
1102
367
  Returns
1103
368
  -------
1104
- CustomersCheckEntitlementResponse
1105
- Success response
369
+ Customer
370
+ 200
1106
371
 
1107
372
  Examples
1108
373
  --------
1109
- import asyncio
1110
-
1111
- from paid import AsyncPaid
374
+ from paid import Paid
1112
375
 
1113
- client = AsyncPaid(
376
+ client = Paid(
1114
377
  token="YOUR_TOKEN",
1115
378
  )
1116
-
1117
-
1118
- async def main() -> None:
1119
- await client.customers.check_entitlement(
1120
- customer_id="customerId",
1121
- event_name="event_name",
1122
- view="all",
1123
- )
1124
-
1125
-
1126
- asyncio.run(main())
379
+ client.customers.update_customer_by_external_id(
380
+ external_id_="externalId",
381
+ )
1127
382
  """
1128
- _response = await self._raw_client.check_entitlement(
1129
- customer_id, event_name=event_name, view=view, request_options=request_options
383
+ _response = self._raw_client.update_customer_by_external_id(
384
+ external_id_,
385
+ name=name,
386
+ legal_name=legal_name,
387
+ email=email,
388
+ phone=phone,
389
+ website=website,
390
+ external_id=external_id,
391
+ billing_address=billing_address,
392
+ creation_state=creation_state,
393
+ churn_date=churn_date,
394
+ vat_number=vat_number,
395
+ metadata=metadata,
396
+ request_options=request_options,
1130
397
  )
1131
398
  return _response.data
1132
399
 
1133
- async def get_entitlements(
1134
- self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
1135
- ) -> typing.List[EntitlementUsage]:
400
+ def delete_customer_by_external_id(
401
+ self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
402
+ ) -> EmptyResponse:
1136
403
  """
404
+ Delete a customer by its externalId
405
+
1137
406
  Parameters
1138
407
  ----------
1139
- customer_id : str
1140
- The customer ID
408
+ external_id : str
1141
409
 
1142
410
  request_options : typing.Optional[RequestOptions]
1143
411
  Request-specific configuration.
1144
412
 
1145
413
  Returns
1146
414
  -------
1147
- typing.List[EntitlementUsage]
1148
- Success response
415
+ EmptyResponse
416
+ 200
1149
417
 
1150
418
  Examples
1151
419
  --------
1152
- import asyncio
1153
-
1154
- from paid import AsyncPaid
420
+ from paid import Paid
1155
421
 
1156
- client = AsyncPaid(
422
+ client = Paid(
1157
423
  token="YOUR_TOKEN",
1158
424
  )
425
+ client.customers.delete_customer_by_external_id(
426
+ external_id="externalId",
427
+ )
428
+ """
429
+ _response = self._raw_client.delete_customer_by_external_id(external_id, request_options=request_options)
430
+ return _response.data
1159
431
 
1160
432
 
1161
- async def main() -> None:
1162
- await client.customers.get_entitlements(
1163
- customer_id="customerId",
1164
- )
433
+ class AsyncCustomersClient:
434
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
435
+ self._raw_client = AsyncRawCustomersClient(client_wrapper=client_wrapper)
1165
436
 
437
+ @property
438
+ def with_raw_response(self) -> AsyncRawCustomersClient:
439
+ """
440
+ Retrieves a raw implementation of this client that returns raw responses.
1166
441
 
1167
- asyncio.run(main())
442
+ Returns
443
+ -------
444
+ AsyncRawCustomersClient
1168
445
  """
1169
- _response = await self._raw_client.get_entitlements(customer_id, request_options=request_options)
1170
- return _response.data
446
+ return self._raw_client
1171
447
 
1172
- async def get_by_external_id(
1173
- self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
1174
- ) -> Customer:
448
+ async def list_customers(
449
+ self,
450
+ *,
451
+ limit: typing.Optional[int] = None,
452
+ offset: typing.Optional[int] = None,
453
+ request_options: typing.Optional[RequestOptions] = None,
454
+ ) -> CustomerListResponse:
1175
455
  """
456
+ Get a list of customers for the organization
457
+
1176
458
  Parameters
1177
459
  ----------
1178
- external_id : str
460
+ limit : typing.Optional[int]
461
+
462
+ offset : typing.Optional[int]
1179
463
 
1180
464
  request_options : typing.Optional[RequestOptions]
1181
465
  Request-specific configuration.
1182
466
 
1183
467
  Returns
1184
468
  -------
1185
- Customer
1186
- Success response
469
+ CustomerListResponse
470
+ 200
1187
471
 
1188
472
  Examples
1189
473
  --------
@@ -1197,57 +481,53 @@ class AsyncCustomersClient:
1197
481
 
1198
482
 
1199
483
  async def main() -> None:
1200
- await client.customers.get_by_external_id(
1201
- external_id="externalId",
1202
- )
484
+ await client.customers.list_customers()
1203
485
 
1204
486
 
1205
487
  asyncio.run(main())
1206
488
  """
1207
- _response = await self._raw_client.get_by_external_id(external_id, request_options=request_options)
489
+ _response = await self._raw_client.list_customers(limit=limit, offset=offset, request_options=request_options)
1208
490
  return _response.data
1209
491
 
1210
- async def update_by_external_id(
492
+ async def create_a_new_customer(
1211
493
  self,
1212
- external_id_: str,
1213
494
  *,
1214
- name: typing.Optional[str] = OMIT,
1215
- external_id: typing.Optional[str] = OMIT,
495
+ name: str,
496
+ legal_name: typing.Optional[str] = OMIT,
497
+ email: typing.Optional[str] = OMIT,
1216
498
  phone: typing.Optional[str] = OMIT,
1217
- employee_count: typing.Optional[float] = OMIT,
1218
- annual_revenue: typing.Optional[float] = OMIT,
1219
- tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
1220
- creation_source: typing.Optional[CreationSource] = OMIT,
1221
499
  website: typing.Optional[str] = OMIT,
1222
- billing_address: typing.Optional[Address] = OMIT,
500
+ external_id: typing.Optional[str] = OMIT,
501
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
502
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
503
+ vat_number: typing.Optional[str] = OMIT,
1223
504
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
1224
505
  request_options: typing.Optional[RequestOptions] = None,
1225
506
  ) -> Customer:
1226
507
  """
508
+ Creates a new customer for the organization
509
+
1227
510
  Parameters
1228
511
  ----------
1229
- external_id_ : str
512
+ name : str
1230
513
 
1231
- name : typing.Optional[str]
514
+ legal_name : typing.Optional[str]
1232
515
 
1233
- external_id : typing.Optional[str]
516
+ email : typing.Optional[str]
1234
517
 
1235
518
  phone : typing.Optional[str]
1236
519
 
1237
- employee_count : typing.Optional[float]
1238
-
1239
- annual_revenue : typing.Optional[float]
520
+ website : typing.Optional[str]
1240
521
 
1241
- tax_exempt_status : typing.Optional[TaxExemptStatus]
522
+ external_id : typing.Optional[str]
1242
523
 
1243
- creation_source : typing.Optional[CreationSource]
524
+ billing_address : typing.Optional[CustomerBillingAddress]
1244
525
 
1245
- website : typing.Optional[str]
526
+ creation_state : typing.Optional[CustomerCreationState]
1246
527
 
1247
- billing_address : typing.Optional[Address]
528
+ vat_number : typing.Optional[str]
1248
529
 
1249
530
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
1250
- Flexible JSON field for storing custom metadata about the customer
1251
531
 
1252
532
  request_options : typing.Optional[RequestOptions]
1253
533
  Request-specific configuration.
@@ -1255,7 +535,7 @@ class AsyncCustomersClient:
1255
535
  Returns
1256
536
  -------
1257
537
  Customer
1258
- Success response
538
+ 201
1259
539
 
1260
540
  Examples
1261
541
  --------
@@ -1269,43 +549,43 @@ class AsyncCustomersClient:
1269
549
 
1270
550
 
1271
551
  async def main() -> None:
1272
- await client.customers.update_by_external_id(
1273
- external_id_="externalId",
552
+ await client.customers.create_a_new_customer(
553
+ name="name",
1274
554
  )
1275
555
 
1276
556
 
1277
557
  asyncio.run(main())
1278
558
  """
1279
- _response = await self._raw_client.update_by_external_id(
1280
- external_id_,
559
+ _response = await self._raw_client.create_a_new_customer(
1281
560
  name=name,
1282
- external_id=external_id,
561
+ legal_name=legal_name,
562
+ email=email,
1283
563
  phone=phone,
1284
- employee_count=employee_count,
1285
- annual_revenue=annual_revenue,
1286
- tax_exempt_status=tax_exempt_status,
1287
- creation_source=creation_source,
1288
564
  website=website,
565
+ external_id=external_id,
1289
566
  billing_address=billing_address,
567
+ creation_state=creation_state,
568
+ vat_number=vat_number,
1290
569
  metadata=metadata,
1291
570
  request_options=request_options,
1292
571
  )
1293
572
  return _response.data
1294
573
 
1295
- async def delete_by_external_id(
1296
- self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
1297
- ) -> None:
574
+ async def get_customer(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Customer:
1298
575
  """
576
+ Get a customer by its ID
577
+
1299
578
  Parameters
1300
579
  ----------
1301
- external_id : str
580
+ id : str
1302
581
 
1303
582
  request_options : typing.Optional[RequestOptions]
1304
583
  Request-specific configuration.
1305
584
 
1306
585
  Returns
1307
586
  -------
1308
- None
587
+ Customer
588
+ 200
1309
589
 
1310
590
  Examples
1311
591
  --------
@@ -1319,56 +599,73 @@ class AsyncCustomersClient:
1319
599
 
1320
600
 
1321
601
  async def main() -> None:
1322
- await client.customers.delete_by_external_id(
1323
- external_id="externalId",
602
+ await client.customers.get_customer(
603
+ id="id",
1324
604
  )
1325
605
 
1326
606
 
1327
607
  asyncio.run(main())
1328
608
  """
1329
- _response = await self._raw_client.delete_by_external_id(external_id, request_options=request_options)
609
+ _response = await self._raw_client.get_customer(id, request_options=request_options)
1330
610
  return _response.data
1331
611
 
1332
- async def get_costs_by_external_id(
612
+ async def update_customer(
1333
613
  self,
1334
- external_id: str,
614
+ id: str,
1335
615
  *,
1336
- limit: typing.Optional[int] = None,
1337
- offset: typing.Optional[int] = None,
1338
- start_time: typing.Optional[dt.datetime] = None,
1339
- end_time: typing.Optional[dt.datetime] = None,
616
+ name: typing.Optional[str] = OMIT,
617
+ legal_name: typing.Optional[str] = OMIT,
618
+ email: typing.Optional[str] = OMIT,
619
+ phone: typing.Optional[str] = OMIT,
620
+ website: typing.Optional[str] = OMIT,
621
+ external_id: typing.Optional[str] = OMIT,
622
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
623
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
624
+ churn_date: typing.Optional[dt.datetime] = OMIT,
625
+ vat_number: typing.Optional[str] = OMIT,
626
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
1340
627
  request_options: typing.Optional[RequestOptions] = None,
1341
- ) -> CostTracesResponse:
628
+ ) -> Customer:
1342
629
  """
630
+ Update a customer by its ID
631
+
1343
632
  Parameters
1344
633
  ----------
1345
- external_id : str
1346
- The external ID of the customer
634
+ id : str
1347
635
 
1348
- limit : typing.Optional[int]
1349
- Maximum number of traces to return (1-1000)
636
+ name : typing.Optional[str]
1350
637
 
1351
- offset : typing.Optional[int]
1352
- Number of traces to skip for pagination
638
+ legal_name : typing.Optional[str]
639
+
640
+ email : typing.Optional[str]
641
+
642
+ phone : typing.Optional[str]
643
+
644
+ website : typing.Optional[str]
1353
645
 
1354
- start_time : typing.Optional[dt.datetime]
1355
- Filter traces starting from this time (ISO 8601 format)
646
+ external_id : typing.Optional[str]
647
+
648
+ billing_address : typing.Optional[CustomerBillingAddress]
649
+
650
+ creation_state : typing.Optional[CustomerCreationState]
651
+
652
+ churn_date : typing.Optional[dt.datetime]
1356
653
 
1357
- end_time : typing.Optional[dt.datetime]
1358
- Filter traces up to this time (ISO 8601 format)
654
+ vat_number : typing.Optional[str]
655
+
656
+ metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
1359
657
 
1360
658
  request_options : typing.Optional[RequestOptions]
1361
659
  Request-specific configuration.
1362
660
 
1363
661
  Returns
1364
662
  -------
1365
- CostTracesResponse
1366
- Success response
663
+ Customer
664
+ 200
1367
665
 
1368
666
  Examples
1369
667
  --------
1370
668
  import asyncio
1371
- import datetime
1372
669
 
1373
670
  from paid import AsyncPaid
1374
671
 
@@ -1378,71 +675,51 @@ class AsyncCustomersClient:
1378
675
 
1379
676
 
1380
677
  async def main() -> None:
1381
- await client.customers.get_costs_by_external_id(
1382
- external_id="externalId",
1383
- limit=1,
1384
- offset=1,
1385
- start_time=datetime.datetime.fromisoformat(
1386
- "2024-01-15 09:30:00+00:00",
1387
- ),
1388
- end_time=datetime.datetime.fromisoformat(
1389
- "2024-01-15 09:30:00+00:00",
1390
- ),
678
+ await client.customers.update_customer(
679
+ id="id",
1391
680
  )
1392
681
 
1393
682
 
1394
683
  asyncio.run(main())
1395
684
  """
1396
- _response = await self._raw_client.get_costs_by_external_id(
1397
- external_id,
1398
- limit=limit,
1399
- offset=offset,
1400
- start_time=start_time,
1401
- end_time=end_time,
685
+ _response = await self._raw_client.update_customer(
686
+ id,
687
+ name=name,
688
+ legal_name=legal_name,
689
+ email=email,
690
+ phone=phone,
691
+ website=website,
692
+ external_id=external_id,
693
+ billing_address=billing_address,
694
+ creation_state=creation_state,
695
+ churn_date=churn_date,
696
+ vat_number=vat_number,
697
+ metadata=metadata,
1402
698
  request_options=request_options,
1403
699
  )
1404
700
  return _response.data
1405
701
 
1406
- async def get_usage_by_external_id(
1407
- self,
1408
- external_id: str,
1409
- *,
1410
- limit: typing.Optional[int] = None,
1411
- offset: typing.Optional[int] = None,
1412
- start_time: typing.Optional[dt.datetime] = None,
1413
- end_time: typing.Optional[dt.datetime] = None,
1414
- request_options: typing.Optional[RequestOptions] = None,
1415
- ) -> UsageSummariesResponse:
702
+ async def delete_customer(
703
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
704
+ ) -> EmptyResponse:
1416
705
  """
706
+ Delete a customer by its ID
707
+
1417
708
  Parameters
1418
709
  ----------
1419
- external_id : str
1420
- The external ID of the customer
1421
-
1422
- limit : typing.Optional[int]
1423
- Maximum number of usage summaries to return (1-1000)
1424
-
1425
- offset : typing.Optional[int]
1426
- Number of usage summaries to skip for pagination
1427
-
1428
- start_time : typing.Optional[dt.datetime]
1429
- Filter usage summaries starting from this time (ISO 8601 format). Returns summaries that overlap with the time range.
1430
-
1431
- end_time : typing.Optional[dt.datetime]
1432
- Filter usage summaries up to this time (ISO 8601 format). Returns summaries that overlap with the time range.
710
+ id : str
1433
711
 
1434
712
  request_options : typing.Optional[RequestOptions]
1435
713
  Request-specific configuration.
1436
714
 
1437
715
  Returns
1438
716
  -------
1439
- UsageSummariesResponse
1440
- Success response
717
+ EmptyResponse
718
+ 200
1441
719
 
1442
720
  Examples
1443
721
  --------
1444
722
  import asyncio
1445
- import datetime
1446
723
 
1447
724
  from paid import AsyncPaid
1448
725
 
@@ -1452,49 +729,33 @@ class AsyncCustomersClient:
1452
729
 
1453
730
 
1454
731
  async def main() -> None:
1455
- await client.customers.get_usage_by_external_id(
1456
- external_id="externalId",
1457
- limit=1,
1458
- offset=1,
1459
- start_time=datetime.datetime.fromisoformat(
1460
- "2024-01-15 09:30:00+00:00",
1461
- ),
1462
- end_time=datetime.datetime.fromisoformat(
1463
- "2024-01-15 09:30:00+00:00",
1464
- ),
732
+ await client.customers.delete_customer(
733
+ id="id",
1465
734
  )
1466
735
 
1467
736
 
1468
737
  asyncio.run(main())
1469
738
  """
1470
- _response = await self._raw_client.get_usage_by_external_id(
1471
- external_id,
1472
- limit=limit,
1473
- offset=offset,
1474
- start_time=start_time,
1475
- end_time=end_time,
1476
- request_options=request_options,
1477
- )
739
+ _response = await self._raw_client.delete_customer(id, request_options=request_options)
1478
740
  return _response.data
1479
741
 
1480
- async def list_payment_methods(
742
+ async def get_customer_by_external_id(
1481
743
  self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
1482
- ) -> typing.List[PaymentMethod]:
744
+ ) -> Customer:
1483
745
  """
1484
- Retrieves all payment methods associated with a customer identified by their external ID.
746
+ Get a customer by its externalId
1485
747
 
1486
748
  Parameters
1487
749
  ----------
1488
750
  external_id : str
1489
- The external ID of the customer
1490
751
 
1491
752
  request_options : typing.Optional[RequestOptions]
1492
753
  Request-specific configuration.
1493
754
 
1494
755
  Returns
1495
756
  -------
1496
- typing.List[PaymentMethod]
1497
- Success response
757
+ Customer
758
+ 200
1498
759
 
1499
760
  Examples
1500
761
  --------
@@ -1508,49 +769,69 @@ class AsyncCustomersClient:
1508
769
 
1509
770
 
1510
771
  async def main() -> None:
1511
- await client.customers.list_payment_methods(
772
+ await client.customers.get_customer_by_external_id(
1512
773
  external_id="externalId",
1513
774
  )
1514
775
 
1515
776
 
1516
777
  asyncio.run(main())
1517
778
  """
1518
- _response = await self._raw_client.list_payment_methods(external_id, request_options=request_options)
779
+ _response = await self._raw_client.get_customer_by_external_id(external_id, request_options=request_options)
1519
780
  return _response.data
1520
781
 
1521
- async def create_payment_method(
782
+ async def update_customer_by_external_id(
1522
783
  self,
1523
- external_id: str,
784
+ external_id_: str,
1524
785
  *,
1525
- confirmation_token: str,
1526
- return_url: str,
786
+ name: typing.Optional[str] = OMIT,
787
+ legal_name: typing.Optional[str] = OMIT,
788
+ email: typing.Optional[str] = OMIT,
789
+ phone: typing.Optional[str] = OMIT,
790
+ website: typing.Optional[str] = OMIT,
791
+ external_id: typing.Optional[str] = OMIT,
792
+ billing_address: typing.Optional[CustomerBillingAddress] = OMIT,
793
+ creation_state: typing.Optional[CustomerCreationState] = OMIT,
794
+ churn_date: typing.Optional[dt.datetime] = OMIT,
795
+ vat_number: typing.Optional[str] = OMIT,
1527
796
  metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
1528
797
  request_options: typing.Optional[RequestOptions] = None,
1529
- ) -> PaymentMethod:
798
+ ) -> Customer:
1530
799
  """
1531
- Creates a new payment method for a customer using a Stripe confirmation token.
800
+ Update a customer by its externalId
1532
801
 
1533
802
  Parameters
1534
803
  ----------
1535
- external_id : str
1536
- The external ID of the customer
804
+ external_id_ : str
805
+
806
+ name : typing.Optional[str]
807
+
808
+ legal_name : typing.Optional[str]
809
+
810
+ email : typing.Optional[str]
811
+
812
+ phone : typing.Optional[str]
813
+
814
+ website : typing.Optional[str]
1537
815
 
1538
- confirmation_token : str
1539
- Stripe confirmation token for the payment method
816
+ external_id : typing.Optional[str]
817
+
818
+ billing_address : typing.Optional[CustomerBillingAddress]
819
+
820
+ creation_state : typing.Optional[CustomerCreationState]
821
+
822
+ churn_date : typing.Optional[dt.datetime]
1540
823
 
1541
- return_url : str
1542
- URL to redirect to after payment method setup
824
+ vat_number : typing.Optional[str]
1543
825
 
1544
826
  metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
1545
- Optional metadata to attach to the payment method
1546
827
 
1547
828
  request_options : typing.Optional[RequestOptions]
1548
829
  Request-specific configuration.
1549
830
 
1550
831
  Returns
1551
832
  -------
1552
- PaymentMethod
1553
- Payment method created successfully
833
+ Customer
834
+ 200
1554
835
 
1555
836
  Examples
1556
837
  --------
@@ -1564,45 +845,47 @@ class AsyncCustomersClient:
1564
845
 
1565
846
 
1566
847
  async def main() -> None:
1567
- await client.customers.create_payment_method(
1568
- external_id="externalId",
1569
- confirmation_token="ctoken_1234567890",
1570
- return_url="https://example.com/payment-method-added",
1571
- metadata={"source": "api"},
848
+ await client.customers.update_customer_by_external_id(
849
+ external_id_="externalId",
1572
850
  )
1573
851
 
1574
852
 
1575
853
  asyncio.run(main())
1576
854
  """
1577
- _response = await self._raw_client.create_payment_method(
1578
- external_id,
1579
- confirmation_token=confirmation_token,
1580
- return_url=return_url,
855
+ _response = await self._raw_client.update_customer_by_external_id(
856
+ external_id_,
857
+ name=name,
858
+ legal_name=legal_name,
859
+ email=email,
860
+ phone=phone,
861
+ website=website,
862
+ external_id=external_id,
863
+ billing_address=billing_address,
864
+ creation_state=creation_state,
865
+ churn_date=churn_date,
866
+ vat_number=vat_number,
1581
867
  metadata=metadata,
1582
868
  request_options=request_options,
1583
869
  )
1584
870
  return _response.data
1585
871
 
1586
- async def delete_payment_method(
1587
- self, external_id: str, payment_method_id: str, *, request_options: typing.Optional[RequestOptions] = None
1588
- ) -> None:
872
+ async def delete_customer_by_external_id(
873
+ self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
874
+ ) -> EmptyResponse:
1589
875
  """
1590
- Deletes a specific payment method from a customer's account.
876
+ Delete a customer by its externalId
1591
877
 
1592
878
  Parameters
1593
879
  ----------
1594
880
  external_id : str
1595
- The external ID of the customer
1596
-
1597
- payment_method_id : str
1598
- The ID of the payment method to delete
1599
881
 
1600
882
  request_options : typing.Optional[RequestOptions]
1601
883
  Request-specific configuration.
1602
884
 
1603
885
  Returns
1604
886
  -------
1605
- None
887
+ EmptyResponse
888
+ 200
1606
889
 
1607
890
  Examples
1608
891
  --------
@@ -1616,15 +899,12 @@ class AsyncCustomersClient:
1616
899
 
1617
900
 
1618
901
  async def main() -> None:
1619
- await client.customers.delete_payment_method(
902
+ await client.customers.delete_customer_by_external_id(
1620
903
  external_id="externalId",
1621
- payment_method_id="paymentMethodId",
1622
904
  )
1623
905
 
1624
906
 
1625
907
  asyncio.run(main())
1626
908
  """
1627
- _response = await self._raw_client.delete_payment_method(
1628
- external_id, payment_method_id, request_options=request_options
1629
- )
909
+ _response = await self._raw_client.delete_customer_by_external_id(external_id, request_options=request_options)
1630
910
  return _response.data