paid-python 0.6.0__py3-none-any.whl → 1.0.0a1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- paid/__init__.py +65 -95
- paid/client.py +17 -494
- paid/contacts/client.py +415 -133
- paid/contacts/raw_client.py +1046 -118
- paid/core/client_wrapper.py +9 -10
- paid/customers/client.py +270 -566
- paid/customers/raw_client.py +731 -537
- paid/environment.py +1 -1
- paid/errors/bad_request_error.py +2 -2
- paid/errors/forbidden_error.py +2 -2
- paid/errors/internal_server_error.py +2 -2
- paid/errors/not_found_error.py +2 -2
- paid/invoices/client.py +369 -0
- paid/invoices/raw_client.py +692 -0
- paid/orders/__init__.py +0 -3
- paid/orders/client.py +371 -128
- paid/orders/raw_client.py +829 -121
- paid/products/__init__.py +0 -3
- paid/products/client.py +129 -265
- paid/products/raw_client.py +563 -233
- paid/signals/client.py +130 -0
- paid/signals/raw_client.py +190 -0
- paid/tracing/autoinstrumentation.py +12 -6
- paid/tracing/context_manager.py +2 -6
- paid/tracing/distributed_tracing.py +3 -3
- paid/tracing/signal.py +3 -3
- paid/tracing/wrappers/openai_agents/openaiAgentsHook.py +1 -1
- paid/types/__init__.py +62 -86
- paid/types/attribution.py +8 -0
- paid/types/{agent_attribute.py → bulk_signals_response.py} +4 -5
- paid/types/contact.py +12 -20
- paid/types/{address.py → contact_billing_address.py} +6 -7
- paid/types/{traces_response.py → contact_list_response.py} +5 -9
- paid/types/customer.py +15 -22
- paid/types/customer_attribution.py +8 -0
- paid/types/customer_billing_address.py +26 -0
- paid/types/{usage_summary_order.py → customer_by_external_id.py} +3 -5
- paid/types/{usage_summary_order_line.py → customer_by_id.py} +3 -5
- paid/types/customer_creation_state.py +5 -0
- paid/types/customer_list_response.py +22 -0
- paid/types/empty_response.py +17 -0
- paid/types/{error.py → error_response.py} +4 -7
- paid/types/invoice.py +57 -0
- paid/types/invoice_line.py +42 -0
- paid/types/invoice_line_payment_status.py +7 -0
- paid/types/invoice_lines_response.py +22 -0
- paid/types/invoice_list_response.py +22 -0
- paid/types/invoice_payment_status.py +5 -0
- paid/types/invoice_source.py +5 -0
- paid/types/invoice_status.py +7 -0
- paid/types/invoice_tax_status.py +7 -0
- paid/types/order.py +30 -29
- paid/types/order_creation_state.py +5 -0
- paid/types/order_line.py +6 -24
- paid/types/order_lines_response.py +22 -0
- paid/types/order_list_response.py +22 -0
- paid/types/pagination.py +24 -0
- paid/types/product.py +4 -29
- paid/types/{tier.py → product_by_external_id.py} +5 -4
- paid/types/{cost_amount.py → product_by_id.py} +5 -12
- paid/types/product_list_response.py +22 -0
- paid/types/signal.py +8 -34
- paid/types/{agent.py → update_contact_request.py} +10 -11
- paid/types/update_customer_request.py +38 -0
- paid/types/{product_update.py → update_product_request.py} +2 -12
- {paid_python-0.6.0.dist-info → paid_python-1.0.0a1.dist-info}/METADATA +27 -11
- paid_python-1.0.0a1.dist-info/RECORD +110 -0
- opentelemetry/instrumentation/openai/__init__.py +0 -54
- opentelemetry/instrumentation/openai/shared/__init__.py +0 -399
- opentelemetry/instrumentation/openai/shared/audio_wrappers.py +0 -247
- opentelemetry/instrumentation/openai/shared/chat_wrappers.py +0 -1192
- opentelemetry/instrumentation/openai/shared/completion_wrappers.py +0 -292
- opentelemetry/instrumentation/openai/shared/config.py +0 -15
- opentelemetry/instrumentation/openai/shared/embeddings_wrappers.py +0 -311
- opentelemetry/instrumentation/openai/shared/event_emitter.py +0 -108
- opentelemetry/instrumentation/openai/shared/event_models.py +0 -41
- opentelemetry/instrumentation/openai/shared/image_gen_wrappers.py +0 -68
- opentelemetry/instrumentation/openai/shared/span_utils.py +0 -0
- opentelemetry/instrumentation/openai/utils.py +0 -213
- opentelemetry/instrumentation/openai/v0/__init__.py +0 -176
- opentelemetry/instrumentation/openai/v1/__init__.py +0 -394
- opentelemetry/instrumentation/openai/v1/assistant_wrappers.py +0 -329
- opentelemetry/instrumentation/openai/v1/event_handler_wrapper.py +0 -134
- opentelemetry/instrumentation/openai/v1/responses_wrappers.py +0 -1113
- opentelemetry/instrumentation/openai/version.py +0 -1
- paid/agents/client.py +0 -880
- paid/agents/raw_client.py +0 -785
- paid/orders/lines/client.py +0 -144
- paid/orders/lines/raw_client.py +0 -129
- paid/plans/__init__.py +0 -4
- paid/plans/client.py +0 -332
- paid/plans/raw_client.py +0 -464
- paid/products/types/__init__.py +0 -7
- paid/products/types/product_create_type.py +0 -5
- paid/traces/__init__.py +0 -4
- paid/traces/client.py +0 -218
- paid/traces/raw_client.py +0 -226
- paid/types/agent_price_point.py +0 -27
- paid/types/agent_price_point_tiers.py +0 -23
- paid/types/agent_update.py +0 -29
- paid/types/api_error.py +0 -29
- paid/types/billing_frequency.py +0 -5
- paid/types/charge_type.py +0 -5
- paid/types/cost_trace.py +0 -55
- paid/types/cost_traces_response.py +0 -26
- paid/types/creation_source.py +0 -5
- paid/types/creation_state.py +0 -5
- paid/types/customer_update.py +0 -40
- paid/types/entitlement_usage.py +0 -48
- paid/types/order_line_attribute.py +0 -27
- paid/types/order_line_attribute_create_one.py +0 -5
- paid/types/order_line_attribute_pricing.py +0 -33
- paid/types/order_line_create.py +0 -72
- paid/types/pagination_meta.py +0 -84
- paid/types/plan.py +0 -81
- paid/types/plan_group.py +0 -60
- paid/types/plan_plan_products_item.py +0 -35
- paid/types/plan_plan_products_item_plan_product_attribute_item.py +0 -34
- paid/types/price_point.py +0 -25
- paid/types/pricing.py +0 -31
- paid/types/pricing_model_type.py +0 -7
- paid/types/product_type.py +0 -5
- paid/types/product_update_type.py +0 -5
- paid/types/salutation.py +0 -5
- paid/types/signal_v_2.py +0 -56
- paid/types/tax_exempt_status.py +0 -5
- paid/types/trace.py +0 -69
- paid/types/usage_pagination_meta.py +0 -43
- paid/types/usage_summaries_response.py +0 -26
- paid/types/usage_summary.py +0 -121
- paid/usage/__init__.py +0 -7
- paid/usage/client.py +0 -321
- paid/usage/raw_client.py +0 -387
- paid/usage/types/__init__.py +0 -7
- paid/usage/types/usage_check_usage_response.py +0 -53
- paid_python-0.6.0.dist-info/RECORD +0 -153
- /paid/{agents → invoices}/__init__.py +0 -0
- /paid/{orders/lines → signals}/__init__.py +0 -0
- {paid_python-0.6.0.dist-info → paid_python-1.0.0a1.dist-info}/LICENSE +0 -0
- {paid_python-0.6.0.dist-info → paid_python-1.0.0a1.dist-info}/WHEEL +0 -0
paid/customers/client.py
CHANGED
|
@@ -5,13 +5,11 @@ 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.cost_traces_response import CostTracesResponse
|
|
10
|
-
from ..types.creation_source import CreationSource
|
|
11
8
|
from ..types.customer import Customer
|
|
12
|
-
from ..types.
|
|
13
|
-
from ..types.
|
|
14
|
-
from ..types.
|
|
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
|
|
15
13
|
from .raw_client import AsyncRawCustomersClient, RawCustomersClient
|
|
16
14
|
|
|
17
15
|
# this is used as the default value for optional parameters
|
|
@@ -33,17 +31,29 @@ class CustomersClient:
|
|
|
33
31
|
"""
|
|
34
32
|
return self._raw_client
|
|
35
33
|
|
|
36
|
-
def
|
|
34
|
+
def list_customers(
|
|
35
|
+
self,
|
|
36
|
+
*,
|
|
37
|
+
limit: typing.Optional[int] = None,
|
|
38
|
+
offset: typing.Optional[int] = None,
|
|
39
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
40
|
+
) -> CustomerListResponse:
|
|
37
41
|
"""
|
|
42
|
+
Get a list of customers for the organization
|
|
43
|
+
|
|
38
44
|
Parameters
|
|
39
45
|
----------
|
|
46
|
+
limit : typing.Optional[int]
|
|
47
|
+
|
|
48
|
+
offset : typing.Optional[int]
|
|
49
|
+
|
|
40
50
|
request_options : typing.Optional[RequestOptions]
|
|
41
51
|
Request-specific configuration.
|
|
42
52
|
|
|
43
53
|
Returns
|
|
44
54
|
-------
|
|
45
|
-
|
|
46
|
-
|
|
55
|
+
CustomerListResponse
|
|
56
|
+
200
|
|
47
57
|
|
|
48
58
|
Examples
|
|
49
59
|
--------
|
|
@@ -52,49 +62,50 @@ class CustomersClient:
|
|
|
52
62
|
client = Paid(
|
|
53
63
|
token="YOUR_TOKEN",
|
|
54
64
|
)
|
|
55
|
-
client.customers.
|
|
65
|
+
client.customers.list_customers()
|
|
56
66
|
"""
|
|
57
|
-
_response = self._raw_client.
|
|
67
|
+
_response = self._raw_client.list_customers(limit=limit, offset=offset, request_options=request_options)
|
|
58
68
|
return _response.data
|
|
59
69
|
|
|
60
|
-
def
|
|
70
|
+
def create_a_new_customer(
|
|
61
71
|
self,
|
|
62
72
|
*,
|
|
63
73
|
name: str,
|
|
64
|
-
|
|
74
|
+
legal_name: typing.Optional[str] = OMIT,
|
|
75
|
+
email: typing.Optional[str] = OMIT,
|
|
65
76
|
phone: typing.Optional[str] = OMIT,
|
|
66
|
-
employee_count: typing.Optional[float] = OMIT,
|
|
67
|
-
annual_revenue: typing.Optional[float] = OMIT,
|
|
68
|
-
tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
|
|
69
|
-
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
70
77
|
website: typing.Optional[str] = OMIT,
|
|
71
|
-
|
|
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,
|
|
72
82
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
73
83
|
request_options: typing.Optional[RequestOptions] = None,
|
|
74
84
|
) -> Customer:
|
|
75
85
|
"""
|
|
86
|
+
Creates a new customer for the organization
|
|
87
|
+
|
|
76
88
|
Parameters
|
|
77
89
|
----------
|
|
78
90
|
name : str
|
|
79
91
|
|
|
80
|
-
|
|
92
|
+
legal_name : typing.Optional[str]
|
|
81
93
|
|
|
82
|
-
|
|
94
|
+
email : typing.Optional[str]
|
|
83
95
|
|
|
84
|
-
|
|
96
|
+
phone : typing.Optional[str]
|
|
85
97
|
|
|
86
|
-
|
|
98
|
+
website : typing.Optional[str]
|
|
87
99
|
|
|
88
|
-
|
|
100
|
+
external_id : typing.Optional[str]
|
|
89
101
|
|
|
90
|
-
|
|
102
|
+
billing_address : typing.Optional[CustomerBillingAddress]
|
|
91
103
|
|
|
92
|
-
|
|
104
|
+
creation_state : typing.Optional[CustomerCreationState]
|
|
93
105
|
|
|
94
|
-
|
|
106
|
+
vat_number : typing.Optional[str]
|
|
95
107
|
|
|
96
108
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
97
|
-
Flexible JSON field for storing custom metadata about the customer
|
|
98
109
|
|
|
99
110
|
request_options : typing.Optional[RequestOptions]
|
|
100
111
|
Request-specific configuration.
|
|
@@ -102,7 +113,7 @@ class CustomersClient:
|
|
|
102
113
|
Returns
|
|
103
114
|
-------
|
|
104
115
|
Customer
|
|
105
|
-
|
|
116
|
+
201
|
|
106
117
|
|
|
107
118
|
Examples
|
|
108
119
|
--------
|
|
@@ -111,31 +122,32 @@ class CustomersClient:
|
|
|
111
122
|
client = Paid(
|
|
112
123
|
token="YOUR_TOKEN",
|
|
113
124
|
)
|
|
114
|
-
client.customers.
|
|
115
|
-
name="
|
|
116
|
-
external_id="acme-inc",
|
|
125
|
+
client.customers.create_a_new_customer(
|
|
126
|
+
name="name",
|
|
117
127
|
)
|
|
118
128
|
"""
|
|
119
|
-
_response = self._raw_client.
|
|
129
|
+
_response = self._raw_client.create_a_new_customer(
|
|
120
130
|
name=name,
|
|
121
|
-
|
|
131
|
+
legal_name=legal_name,
|
|
132
|
+
email=email,
|
|
122
133
|
phone=phone,
|
|
123
|
-
employee_count=employee_count,
|
|
124
|
-
annual_revenue=annual_revenue,
|
|
125
|
-
tax_exempt_status=tax_exempt_status,
|
|
126
|
-
creation_source=creation_source,
|
|
127
134
|
website=website,
|
|
135
|
+
external_id=external_id,
|
|
128
136
|
billing_address=billing_address,
|
|
137
|
+
creation_state=creation_state,
|
|
138
|
+
vat_number=vat_number,
|
|
129
139
|
metadata=metadata,
|
|
130
140
|
request_options=request_options,
|
|
131
141
|
)
|
|
132
142
|
return _response.data
|
|
133
143
|
|
|
134
|
-
def
|
|
144
|
+
def get_customer(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Customer:
|
|
135
145
|
"""
|
|
146
|
+
Get a customer by its ID
|
|
147
|
+
|
|
136
148
|
Parameters
|
|
137
149
|
----------
|
|
138
|
-
|
|
150
|
+
id : str
|
|
139
151
|
|
|
140
152
|
request_options : typing.Optional[RequestOptions]
|
|
141
153
|
Request-specific configuration.
|
|
@@ -143,7 +155,7 @@ class CustomersClient:
|
|
|
143
155
|
Returns
|
|
144
156
|
-------
|
|
145
157
|
Customer
|
|
146
|
-
|
|
158
|
+
200
|
|
147
159
|
|
|
148
160
|
Examples
|
|
149
161
|
--------
|
|
@@ -152,54 +164,58 @@ class CustomersClient:
|
|
|
152
164
|
client = Paid(
|
|
153
165
|
token="YOUR_TOKEN",
|
|
154
166
|
)
|
|
155
|
-
client.customers.
|
|
156
|
-
|
|
167
|
+
client.customers.get_customer(
|
|
168
|
+
id="id",
|
|
157
169
|
)
|
|
158
170
|
"""
|
|
159
|
-
_response = self._raw_client.
|
|
171
|
+
_response = self._raw_client.get_customer(id, request_options=request_options)
|
|
160
172
|
return _response.data
|
|
161
173
|
|
|
162
|
-
def
|
|
174
|
+
def update_customer(
|
|
163
175
|
self,
|
|
164
|
-
|
|
176
|
+
id: str,
|
|
165
177
|
*,
|
|
166
178
|
name: typing.Optional[str] = OMIT,
|
|
167
|
-
|
|
179
|
+
legal_name: typing.Optional[str] = OMIT,
|
|
180
|
+
email: typing.Optional[str] = OMIT,
|
|
168
181
|
phone: typing.Optional[str] = OMIT,
|
|
169
|
-
employee_count: typing.Optional[float] = OMIT,
|
|
170
|
-
annual_revenue: typing.Optional[float] = OMIT,
|
|
171
|
-
tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
|
|
172
|
-
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
173
182
|
website: typing.Optional[str] = OMIT,
|
|
174
|
-
|
|
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,
|
|
175
188
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
176
189
|
request_options: typing.Optional[RequestOptions] = None,
|
|
177
190
|
) -> Customer:
|
|
178
191
|
"""
|
|
192
|
+
Update a customer by its ID
|
|
193
|
+
|
|
179
194
|
Parameters
|
|
180
195
|
----------
|
|
181
|
-
|
|
196
|
+
id : str
|
|
182
197
|
|
|
183
198
|
name : typing.Optional[str]
|
|
184
199
|
|
|
185
|
-
|
|
200
|
+
legal_name : typing.Optional[str]
|
|
201
|
+
|
|
202
|
+
email : typing.Optional[str]
|
|
186
203
|
|
|
187
204
|
phone : typing.Optional[str]
|
|
188
205
|
|
|
189
|
-
|
|
206
|
+
website : typing.Optional[str]
|
|
190
207
|
|
|
191
|
-
|
|
208
|
+
external_id : typing.Optional[str]
|
|
192
209
|
|
|
193
|
-
|
|
210
|
+
billing_address : typing.Optional[CustomerBillingAddress]
|
|
194
211
|
|
|
195
|
-
|
|
212
|
+
creation_state : typing.Optional[CustomerCreationState]
|
|
196
213
|
|
|
197
|
-
|
|
214
|
+
churn_date : typing.Optional[dt.datetime]
|
|
198
215
|
|
|
199
|
-
|
|
216
|
+
vat_number : typing.Optional[str]
|
|
200
217
|
|
|
201
218
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
202
|
-
Flexible JSON field for storing custom metadata about the customer
|
|
203
219
|
|
|
204
220
|
request_options : typing.Optional[RequestOptions]
|
|
205
221
|
Request-specific configuration.
|
|
@@ -207,7 +223,7 @@ class CustomersClient:
|
|
|
207
223
|
Returns
|
|
208
224
|
-------
|
|
209
225
|
Customer
|
|
210
|
-
|
|
226
|
+
200
|
|
211
227
|
|
|
212
228
|
Examples
|
|
213
229
|
--------
|
|
@@ -216,73 +232,42 @@ class CustomersClient:
|
|
|
216
232
|
client = Paid(
|
|
217
233
|
token="YOUR_TOKEN",
|
|
218
234
|
)
|
|
219
|
-
client.customers.
|
|
220
|
-
|
|
221
|
-
name="Acme, Inc. (Updated)",
|
|
222
|
-
phone="123-456-7890",
|
|
223
|
-
employee_count=101.0,
|
|
224
|
-
annual_revenue=1000001.0,
|
|
235
|
+
client.customers.update_customer(
|
|
236
|
+
id="id",
|
|
225
237
|
)
|
|
226
238
|
"""
|
|
227
|
-
_response = self._raw_client.
|
|
228
|
-
|
|
239
|
+
_response = self._raw_client.update_customer(
|
|
240
|
+
id,
|
|
229
241
|
name=name,
|
|
230
|
-
|
|
242
|
+
legal_name=legal_name,
|
|
243
|
+
email=email,
|
|
231
244
|
phone=phone,
|
|
232
|
-
employee_count=employee_count,
|
|
233
|
-
annual_revenue=annual_revenue,
|
|
234
|
-
tax_exempt_status=tax_exempt_status,
|
|
235
|
-
creation_source=creation_source,
|
|
236
245
|
website=website,
|
|
246
|
+
external_id=external_id,
|
|
237
247
|
billing_address=billing_address,
|
|
248
|
+
creation_state=creation_state,
|
|
249
|
+
churn_date=churn_date,
|
|
250
|
+
vat_number=vat_number,
|
|
238
251
|
metadata=metadata,
|
|
239
252
|
request_options=request_options,
|
|
240
253
|
)
|
|
241
254
|
return _response.data
|
|
242
255
|
|
|
243
|
-
def
|
|
244
|
-
"""
|
|
245
|
-
Parameters
|
|
246
|
-
----------
|
|
247
|
-
customer_id : str
|
|
248
|
-
|
|
249
|
-
request_options : typing.Optional[RequestOptions]
|
|
250
|
-
Request-specific configuration.
|
|
251
|
-
|
|
252
|
-
Returns
|
|
253
|
-
-------
|
|
254
|
-
None
|
|
255
|
-
|
|
256
|
-
Examples
|
|
257
|
-
--------
|
|
258
|
-
from paid import Paid
|
|
259
|
-
|
|
260
|
-
client = Paid(
|
|
261
|
-
token="YOUR_TOKEN",
|
|
262
|
-
)
|
|
263
|
-
client.customers.delete(
|
|
264
|
-
customer_id="customerId",
|
|
265
|
-
)
|
|
256
|
+
def delete_customer(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> EmptyResponse:
|
|
266
257
|
"""
|
|
267
|
-
|
|
268
|
-
return _response.data
|
|
258
|
+
Delete a customer by its ID
|
|
269
259
|
|
|
270
|
-
def get_entitlements(
|
|
271
|
-
self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
272
|
-
) -> typing.List[EntitlementUsage]:
|
|
273
|
-
"""
|
|
274
260
|
Parameters
|
|
275
261
|
----------
|
|
276
|
-
|
|
277
|
-
The customer ID
|
|
262
|
+
id : str
|
|
278
263
|
|
|
279
264
|
request_options : typing.Optional[RequestOptions]
|
|
280
265
|
Request-specific configuration.
|
|
281
266
|
|
|
282
267
|
Returns
|
|
283
268
|
-------
|
|
284
|
-
|
|
285
|
-
|
|
269
|
+
EmptyResponse
|
|
270
|
+
200
|
|
286
271
|
|
|
287
272
|
Examples
|
|
288
273
|
--------
|
|
@@ -291,17 +276,19 @@ class CustomersClient:
|
|
|
291
276
|
client = Paid(
|
|
292
277
|
token="YOUR_TOKEN",
|
|
293
278
|
)
|
|
294
|
-
client.customers.
|
|
295
|
-
|
|
279
|
+
client.customers.delete_customer(
|
|
280
|
+
id="id",
|
|
296
281
|
)
|
|
297
282
|
"""
|
|
298
|
-
_response = self._raw_client.
|
|
283
|
+
_response = self._raw_client.delete_customer(id, request_options=request_options)
|
|
299
284
|
return _response.data
|
|
300
285
|
|
|
301
|
-
def
|
|
286
|
+
def get_customer_by_external_id(
|
|
302
287
|
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
303
288
|
) -> Customer:
|
|
304
289
|
"""
|
|
290
|
+
Get a customer by its externalId
|
|
291
|
+
|
|
305
292
|
Parameters
|
|
306
293
|
----------
|
|
307
294
|
external_id : str
|
|
@@ -312,7 +299,7 @@ class CustomersClient:
|
|
|
312
299
|
Returns
|
|
313
300
|
-------
|
|
314
301
|
Customer
|
|
315
|
-
|
|
302
|
+
200
|
|
316
303
|
|
|
317
304
|
Examples
|
|
318
305
|
--------
|
|
@@ -321,54 +308,58 @@ class CustomersClient:
|
|
|
321
308
|
client = Paid(
|
|
322
309
|
token="YOUR_TOKEN",
|
|
323
310
|
)
|
|
324
|
-
client.customers.
|
|
311
|
+
client.customers.get_customer_by_external_id(
|
|
325
312
|
external_id="externalId",
|
|
326
313
|
)
|
|
327
314
|
"""
|
|
328
|
-
_response = self._raw_client.
|
|
315
|
+
_response = self._raw_client.get_customer_by_external_id(external_id, request_options=request_options)
|
|
329
316
|
return _response.data
|
|
330
317
|
|
|
331
|
-
def
|
|
318
|
+
def update_customer_by_external_id(
|
|
332
319
|
self,
|
|
333
320
|
external_id_: str,
|
|
334
321
|
*,
|
|
335
322
|
name: typing.Optional[str] = OMIT,
|
|
336
|
-
|
|
323
|
+
legal_name: typing.Optional[str] = OMIT,
|
|
324
|
+
email: typing.Optional[str] = OMIT,
|
|
337
325
|
phone: typing.Optional[str] = OMIT,
|
|
338
|
-
employee_count: typing.Optional[float] = OMIT,
|
|
339
|
-
annual_revenue: typing.Optional[float] = OMIT,
|
|
340
|
-
tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
|
|
341
|
-
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
342
326
|
website: typing.Optional[str] = OMIT,
|
|
343
|
-
|
|
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,
|
|
344
332
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
345
333
|
request_options: typing.Optional[RequestOptions] = None,
|
|
346
334
|
) -> Customer:
|
|
347
335
|
"""
|
|
336
|
+
Update a customer by its externalId
|
|
337
|
+
|
|
348
338
|
Parameters
|
|
349
339
|
----------
|
|
350
340
|
external_id_ : str
|
|
351
341
|
|
|
352
342
|
name : typing.Optional[str]
|
|
353
343
|
|
|
354
|
-
|
|
344
|
+
legal_name : typing.Optional[str]
|
|
345
|
+
|
|
346
|
+
email : typing.Optional[str]
|
|
355
347
|
|
|
356
348
|
phone : typing.Optional[str]
|
|
357
349
|
|
|
358
|
-
|
|
350
|
+
website : typing.Optional[str]
|
|
359
351
|
|
|
360
|
-
|
|
352
|
+
external_id : typing.Optional[str]
|
|
361
353
|
|
|
362
|
-
|
|
354
|
+
billing_address : typing.Optional[CustomerBillingAddress]
|
|
363
355
|
|
|
364
|
-
|
|
356
|
+
creation_state : typing.Optional[CustomerCreationState]
|
|
365
357
|
|
|
366
|
-
|
|
358
|
+
churn_date : typing.Optional[dt.datetime]
|
|
367
359
|
|
|
368
|
-
|
|
360
|
+
vat_number : typing.Optional[str]
|
|
369
361
|
|
|
370
362
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
371
|
-
Flexible JSON field for storing custom metadata about the customer
|
|
372
363
|
|
|
373
364
|
request_options : typing.Optional[RequestOptions]
|
|
374
365
|
Request-specific configuration.
|
|
@@ -376,7 +367,7 @@ class CustomersClient:
|
|
|
376
367
|
Returns
|
|
377
368
|
-------
|
|
378
369
|
Customer
|
|
379
|
-
|
|
370
|
+
200
|
|
380
371
|
|
|
381
372
|
Examples
|
|
382
373
|
--------
|
|
@@ -385,187 +376,57 @@ class CustomersClient:
|
|
|
385
376
|
client = Paid(
|
|
386
377
|
token="YOUR_TOKEN",
|
|
387
378
|
)
|
|
388
|
-
client.customers.
|
|
379
|
+
client.customers.update_customer_by_external_id(
|
|
389
380
|
external_id_="externalId",
|
|
390
381
|
)
|
|
391
382
|
"""
|
|
392
|
-
_response = self._raw_client.
|
|
383
|
+
_response = self._raw_client.update_customer_by_external_id(
|
|
393
384
|
external_id_,
|
|
394
385
|
name=name,
|
|
395
|
-
|
|
386
|
+
legal_name=legal_name,
|
|
387
|
+
email=email,
|
|
396
388
|
phone=phone,
|
|
397
|
-
employee_count=employee_count,
|
|
398
|
-
annual_revenue=annual_revenue,
|
|
399
|
-
tax_exempt_status=tax_exempt_status,
|
|
400
|
-
creation_source=creation_source,
|
|
401
389
|
website=website,
|
|
390
|
+
external_id=external_id,
|
|
402
391
|
billing_address=billing_address,
|
|
392
|
+
creation_state=creation_state,
|
|
393
|
+
churn_date=churn_date,
|
|
394
|
+
vat_number=vat_number,
|
|
403
395
|
metadata=metadata,
|
|
404
396
|
request_options=request_options,
|
|
405
397
|
)
|
|
406
398
|
return _response.data
|
|
407
399
|
|
|
408
|
-
def
|
|
400
|
+
def delete_customer_by_external_id(
|
|
409
401
|
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
410
|
-
) ->
|
|
402
|
+
) -> EmptyResponse:
|
|
411
403
|
"""
|
|
412
|
-
|
|
413
|
-
----------
|
|
414
|
-
external_id : str
|
|
404
|
+
Delete a customer by its externalId
|
|
415
405
|
|
|
416
|
-
request_options : typing.Optional[RequestOptions]
|
|
417
|
-
Request-specific configuration.
|
|
418
|
-
|
|
419
|
-
Returns
|
|
420
|
-
-------
|
|
421
|
-
None
|
|
422
|
-
|
|
423
|
-
Examples
|
|
424
|
-
--------
|
|
425
|
-
from paid import Paid
|
|
426
|
-
|
|
427
|
-
client = Paid(
|
|
428
|
-
token="YOUR_TOKEN",
|
|
429
|
-
)
|
|
430
|
-
client.customers.delete_by_external_id(
|
|
431
|
-
external_id="externalId",
|
|
432
|
-
)
|
|
433
|
-
"""
|
|
434
|
-
_response = self._raw_client.delete_by_external_id(external_id, request_options=request_options)
|
|
435
|
-
return _response.data
|
|
436
|
-
|
|
437
|
-
def get_costs_by_external_id(
|
|
438
|
-
self,
|
|
439
|
-
external_id: str,
|
|
440
|
-
*,
|
|
441
|
-
limit: typing.Optional[int] = None,
|
|
442
|
-
offset: typing.Optional[int] = None,
|
|
443
|
-
start_time: typing.Optional[dt.datetime] = None,
|
|
444
|
-
end_time: typing.Optional[dt.datetime] = None,
|
|
445
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
446
|
-
) -> CostTracesResponse:
|
|
447
|
-
"""
|
|
448
406
|
Parameters
|
|
449
407
|
----------
|
|
450
408
|
external_id : str
|
|
451
|
-
The external ID of the customer
|
|
452
|
-
|
|
453
|
-
limit : typing.Optional[int]
|
|
454
|
-
Maximum number of traces to return (1-1000)
|
|
455
|
-
|
|
456
|
-
offset : typing.Optional[int]
|
|
457
|
-
Number of traces to skip for pagination
|
|
458
|
-
|
|
459
|
-
start_time : typing.Optional[dt.datetime]
|
|
460
|
-
Filter traces starting from this time (ISO 8601 format)
|
|
461
|
-
|
|
462
|
-
end_time : typing.Optional[dt.datetime]
|
|
463
|
-
Filter traces up to this time (ISO 8601 format)
|
|
464
409
|
|
|
465
410
|
request_options : typing.Optional[RequestOptions]
|
|
466
411
|
Request-specific configuration.
|
|
467
412
|
|
|
468
413
|
Returns
|
|
469
414
|
-------
|
|
470
|
-
|
|
471
|
-
|
|
415
|
+
EmptyResponse
|
|
416
|
+
200
|
|
472
417
|
|
|
473
418
|
Examples
|
|
474
419
|
--------
|
|
475
|
-
import datetime
|
|
476
|
-
|
|
477
420
|
from paid import Paid
|
|
478
421
|
|
|
479
422
|
client = Paid(
|
|
480
423
|
token="YOUR_TOKEN",
|
|
481
424
|
)
|
|
482
|
-
client.customers.
|
|
425
|
+
client.customers.delete_customer_by_external_id(
|
|
483
426
|
external_id="externalId",
|
|
484
|
-
limit=1,
|
|
485
|
-
offset=1,
|
|
486
|
-
start_time=datetime.datetime.fromisoformat(
|
|
487
|
-
"2024-01-15 09:30:00+00:00",
|
|
488
|
-
),
|
|
489
|
-
end_time=datetime.datetime.fromisoformat(
|
|
490
|
-
"2024-01-15 09:30:00+00:00",
|
|
491
|
-
),
|
|
492
427
|
)
|
|
493
428
|
"""
|
|
494
|
-
_response = self._raw_client.
|
|
495
|
-
external_id,
|
|
496
|
-
limit=limit,
|
|
497
|
-
offset=offset,
|
|
498
|
-
start_time=start_time,
|
|
499
|
-
end_time=end_time,
|
|
500
|
-
request_options=request_options,
|
|
501
|
-
)
|
|
502
|
-
return _response.data
|
|
503
|
-
|
|
504
|
-
def get_usage_by_external_id(
|
|
505
|
-
self,
|
|
506
|
-
external_id: str,
|
|
507
|
-
*,
|
|
508
|
-
limit: typing.Optional[int] = None,
|
|
509
|
-
offset: typing.Optional[int] = None,
|
|
510
|
-
start_time: typing.Optional[dt.datetime] = None,
|
|
511
|
-
end_time: typing.Optional[dt.datetime] = None,
|
|
512
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
513
|
-
) -> UsageSummariesResponse:
|
|
514
|
-
"""
|
|
515
|
-
Parameters
|
|
516
|
-
----------
|
|
517
|
-
external_id : str
|
|
518
|
-
The external ID of the customer
|
|
519
|
-
|
|
520
|
-
limit : typing.Optional[int]
|
|
521
|
-
Maximum number of usage summaries to return (1-1000)
|
|
522
|
-
|
|
523
|
-
offset : typing.Optional[int]
|
|
524
|
-
Number of usage summaries to skip for pagination
|
|
525
|
-
|
|
526
|
-
start_time : typing.Optional[dt.datetime]
|
|
527
|
-
Filter usage summaries starting from this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
528
|
-
|
|
529
|
-
end_time : typing.Optional[dt.datetime]
|
|
530
|
-
Filter usage summaries up to this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
531
|
-
|
|
532
|
-
request_options : typing.Optional[RequestOptions]
|
|
533
|
-
Request-specific configuration.
|
|
534
|
-
|
|
535
|
-
Returns
|
|
536
|
-
-------
|
|
537
|
-
UsageSummariesResponse
|
|
538
|
-
Success response
|
|
539
|
-
|
|
540
|
-
Examples
|
|
541
|
-
--------
|
|
542
|
-
import datetime
|
|
543
|
-
|
|
544
|
-
from paid import Paid
|
|
545
|
-
|
|
546
|
-
client = Paid(
|
|
547
|
-
token="YOUR_TOKEN",
|
|
548
|
-
)
|
|
549
|
-
client.customers.get_usage_by_external_id(
|
|
550
|
-
external_id="externalId",
|
|
551
|
-
limit=1,
|
|
552
|
-
offset=1,
|
|
553
|
-
start_time=datetime.datetime.fromisoformat(
|
|
554
|
-
"2024-01-15 09:30:00+00:00",
|
|
555
|
-
),
|
|
556
|
-
end_time=datetime.datetime.fromisoformat(
|
|
557
|
-
"2024-01-15 09:30:00+00:00",
|
|
558
|
-
),
|
|
559
|
-
)
|
|
560
|
-
"""
|
|
561
|
-
_response = self._raw_client.get_usage_by_external_id(
|
|
562
|
-
external_id,
|
|
563
|
-
limit=limit,
|
|
564
|
-
offset=offset,
|
|
565
|
-
start_time=start_time,
|
|
566
|
-
end_time=end_time,
|
|
567
|
-
request_options=request_options,
|
|
568
|
-
)
|
|
429
|
+
_response = self._raw_client.delete_customer_by_external_id(external_id, request_options=request_options)
|
|
569
430
|
return _response.data
|
|
570
431
|
|
|
571
432
|
|
|
@@ -584,17 +445,29 @@ class AsyncCustomersClient:
|
|
|
584
445
|
"""
|
|
585
446
|
return self._raw_client
|
|
586
447
|
|
|
587
|
-
async def
|
|
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:
|
|
588
455
|
"""
|
|
456
|
+
Get a list of customers for the organization
|
|
457
|
+
|
|
589
458
|
Parameters
|
|
590
459
|
----------
|
|
460
|
+
limit : typing.Optional[int]
|
|
461
|
+
|
|
462
|
+
offset : typing.Optional[int]
|
|
463
|
+
|
|
591
464
|
request_options : typing.Optional[RequestOptions]
|
|
592
465
|
Request-specific configuration.
|
|
593
466
|
|
|
594
467
|
Returns
|
|
595
468
|
-------
|
|
596
|
-
|
|
597
|
-
|
|
469
|
+
CustomerListResponse
|
|
470
|
+
200
|
|
598
471
|
|
|
599
472
|
Examples
|
|
600
473
|
--------
|
|
@@ -608,52 +481,53 @@ class AsyncCustomersClient:
|
|
|
608
481
|
|
|
609
482
|
|
|
610
483
|
async def main() -> None:
|
|
611
|
-
await client.customers.
|
|
484
|
+
await client.customers.list_customers()
|
|
612
485
|
|
|
613
486
|
|
|
614
487
|
asyncio.run(main())
|
|
615
488
|
"""
|
|
616
|
-
_response = await self._raw_client.
|
|
489
|
+
_response = await self._raw_client.list_customers(limit=limit, offset=offset, request_options=request_options)
|
|
617
490
|
return _response.data
|
|
618
491
|
|
|
619
|
-
async def
|
|
492
|
+
async def create_a_new_customer(
|
|
620
493
|
self,
|
|
621
494
|
*,
|
|
622
495
|
name: str,
|
|
623
|
-
|
|
496
|
+
legal_name: typing.Optional[str] = OMIT,
|
|
497
|
+
email: typing.Optional[str] = OMIT,
|
|
624
498
|
phone: typing.Optional[str] = OMIT,
|
|
625
|
-
employee_count: typing.Optional[float] = OMIT,
|
|
626
|
-
annual_revenue: typing.Optional[float] = OMIT,
|
|
627
|
-
tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
|
|
628
|
-
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
629
499
|
website: typing.Optional[str] = OMIT,
|
|
630
|
-
|
|
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,
|
|
631
504
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
632
505
|
request_options: typing.Optional[RequestOptions] = None,
|
|
633
506
|
) -> Customer:
|
|
634
507
|
"""
|
|
508
|
+
Creates a new customer for the organization
|
|
509
|
+
|
|
635
510
|
Parameters
|
|
636
511
|
----------
|
|
637
512
|
name : str
|
|
638
513
|
|
|
639
|
-
|
|
514
|
+
legal_name : typing.Optional[str]
|
|
640
515
|
|
|
641
|
-
|
|
516
|
+
email : typing.Optional[str]
|
|
642
517
|
|
|
643
|
-
|
|
518
|
+
phone : typing.Optional[str]
|
|
644
519
|
|
|
645
|
-
|
|
520
|
+
website : typing.Optional[str]
|
|
646
521
|
|
|
647
|
-
|
|
522
|
+
external_id : typing.Optional[str]
|
|
648
523
|
|
|
649
|
-
|
|
524
|
+
billing_address : typing.Optional[CustomerBillingAddress]
|
|
650
525
|
|
|
651
|
-
|
|
526
|
+
creation_state : typing.Optional[CustomerCreationState]
|
|
652
527
|
|
|
653
|
-
|
|
528
|
+
vat_number : typing.Optional[str]
|
|
654
529
|
|
|
655
530
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
656
|
-
Flexible JSON field for storing custom metadata about the customer
|
|
657
531
|
|
|
658
532
|
request_options : typing.Optional[RequestOptions]
|
|
659
533
|
Request-specific configuration.
|
|
@@ -661,7 +535,7 @@ class AsyncCustomersClient:
|
|
|
661
535
|
Returns
|
|
662
536
|
-------
|
|
663
537
|
Customer
|
|
664
|
-
|
|
538
|
+
201
|
|
665
539
|
|
|
666
540
|
Examples
|
|
667
541
|
--------
|
|
@@ -675,34 +549,35 @@ class AsyncCustomersClient:
|
|
|
675
549
|
|
|
676
550
|
|
|
677
551
|
async def main() -> None:
|
|
678
|
-
await client.customers.
|
|
679
|
-
name="
|
|
680
|
-
external_id="acme-inc",
|
|
552
|
+
await client.customers.create_a_new_customer(
|
|
553
|
+
name="name",
|
|
681
554
|
)
|
|
682
555
|
|
|
683
556
|
|
|
684
557
|
asyncio.run(main())
|
|
685
558
|
"""
|
|
686
|
-
_response = await self._raw_client.
|
|
559
|
+
_response = await self._raw_client.create_a_new_customer(
|
|
687
560
|
name=name,
|
|
688
|
-
|
|
561
|
+
legal_name=legal_name,
|
|
562
|
+
email=email,
|
|
689
563
|
phone=phone,
|
|
690
|
-
employee_count=employee_count,
|
|
691
|
-
annual_revenue=annual_revenue,
|
|
692
|
-
tax_exempt_status=tax_exempt_status,
|
|
693
|
-
creation_source=creation_source,
|
|
694
564
|
website=website,
|
|
565
|
+
external_id=external_id,
|
|
695
566
|
billing_address=billing_address,
|
|
567
|
+
creation_state=creation_state,
|
|
568
|
+
vat_number=vat_number,
|
|
696
569
|
metadata=metadata,
|
|
697
570
|
request_options=request_options,
|
|
698
571
|
)
|
|
699
572
|
return _response.data
|
|
700
573
|
|
|
701
|
-
async def
|
|
574
|
+
async def get_customer(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Customer:
|
|
702
575
|
"""
|
|
576
|
+
Get a customer by its ID
|
|
577
|
+
|
|
703
578
|
Parameters
|
|
704
579
|
----------
|
|
705
|
-
|
|
580
|
+
id : str
|
|
706
581
|
|
|
707
582
|
request_options : typing.Optional[RequestOptions]
|
|
708
583
|
Request-specific configuration.
|
|
@@ -710,7 +585,7 @@ class AsyncCustomersClient:
|
|
|
710
585
|
Returns
|
|
711
586
|
-------
|
|
712
587
|
Customer
|
|
713
|
-
|
|
588
|
+
200
|
|
714
589
|
|
|
715
590
|
Examples
|
|
716
591
|
--------
|
|
@@ -724,57 +599,61 @@ class AsyncCustomersClient:
|
|
|
724
599
|
|
|
725
600
|
|
|
726
601
|
async def main() -> None:
|
|
727
|
-
await client.customers.
|
|
728
|
-
|
|
602
|
+
await client.customers.get_customer(
|
|
603
|
+
id="id",
|
|
729
604
|
)
|
|
730
605
|
|
|
731
606
|
|
|
732
607
|
asyncio.run(main())
|
|
733
608
|
"""
|
|
734
|
-
_response = await self._raw_client.
|
|
609
|
+
_response = await self._raw_client.get_customer(id, request_options=request_options)
|
|
735
610
|
return _response.data
|
|
736
611
|
|
|
737
|
-
async def
|
|
612
|
+
async def update_customer(
|
|
738
613
|
self,
|
|
739
|
-
|
|
614
|
+
id: str,
|
|
740
615
|
*,
|
|
741
616
|
name: typing.Optional[str] = OMIT,
|
|
742
|
-
|
|
617
|
+
legal_name: typing.Optional[str] = OMIT,
|
|
618
|
+
email: typing.Optional[str] = OMIT,
|
|
743
619
|
phone: typing.Optional[str] = OMIT,
|
|
744
|
-
employee_count: typing.Optional[float] = OMIT,
|
|
745
|
-
annual_revenue: typing.Optional[float] = OMIT,
|
|
746
|
-
tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
|
|
747
|
-
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
748
620
|
website: typing.Optional[str] = OMIT,
|
|
749
|
-
|
|
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,
|
|
750
626
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
751
627
|
request_options: typing.Optional[RequestOptions] = None,
|
|
752
628
|
) -> Customer:
|
|
753
629
|
"""
|
|
630
|
+
Update a customer by its ID
|
|
631
|
+
|
|
754
632
|
Parameters
|
|
755
633
|
----------
|
|
756
|
-
|
|
634
|
+
id : str
|
|
757
635
|
|
|
758
636
|
name : typing.Optional[str]
|
|
759
637
|
|
|
760
|
-
|
|
638
|
+
legal_name : typing.Optional[str]
|
|
639
|
+
|
|
640
|
+
email : typing.Optional[str]
|
|
761
641
|
|
|
762
642
|
phone : typing.Optional[str]
|
|
763
643
|
|
|
764
|
-
|
|
644
|
+
website : typing.Optional[str]
|
|
765
645
|
|
|
766
|
-
|
|
646
|
+
external_id : typing.Optional[str]
|
|
767
647
|
|
|
768
|
-
|
|
648
|
+
billing_address : typing.Optional[CustomerBillingAddress]
|
|
769
649
|
|
|
770
|
-
|
|
650
|
+
creation_state : typing.Optional[CustomerCreationState]
|
|
771
651
|
|
|
772
|
-
|
|
652
|
+
churn_date : typing.Optional[dt.datetime]
|
|
773
653
|
|
|
774
|
-
|
|
654
|
+
vat_number : typing.Optional[str]
|
|
775
655
|
|
|
776
656
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
777
|
-
Flexible JSON field for storing custom metadata about the customer
|
|
778
657
|
|
|
779
658
|
request_options : typing.Optional[RequestOptions]
|
|
780
659
|
Request-specific configuration.
|
|
@@ -782,7 +661,7 @@ class AsyncCustomersClient:
|
|
|
782
661
|
Returns
|
|
783
662
|
-------
|
|
784
663
|
Customer
|
|
785
|
-
|
|
664
|
+
200
|
|
786
665
|
|
|
787
666
|
Examples
|
|
788
667
|
--------
|
|
@@ -796,84 +675,47 @@ class AsyncCustomersClient:
|
|
|
796
675
|
|
|
797
676
|
|
|
798
677
|
async def main() -> None:
|
|
799
|
-
await client.customers.
|
|
800
|
-
|
|
801
|
-
name="Acme, Inc. (Updated)",
|
|
802
|
-
phone="123-456-7890",
|
|
803
|
-
employee_count=101.0,
|
|
804
|
-
annual_revenue=1000001.0,
|
|
678
|
+
await client.customers.update_customer(
|
|
679
|
+
id="id",
|
|
805
680
|
)
|
|
806
681
|
|
|
807
682
|
|
|
808
683
|
asyncio.run(main())
|
|
809
684
|
"""
|
|
810
|
-
_response = await self._raw_client.
|
|
811
|
-
|
|
685
|
+
_response = await self._raw_client.update_customer(
|
|
686
|
+
id,
|
|
812
687
|
name=name,
|
|
813
|
-
|
|
688
|
+
legal_name=legal_name,
|
|
689
|
+
email=email,
|
|
814
690
|
phone=phone,
|
|
815
|
-
employee_count=employee_count,
|
|
816
|
-
annual_revenue=annual_revenue,
|
|
817
|
-
tax_exempt_status=tax_exempt_status,
|
|
818
|
-
creation_source=creation_source,
|
|
819
691
|
website=website,
|
|
692
|
+
external_id=external_id,
|
|
820
693
|
billing_address=billing_address,
|
|
694
|
+
creation_state=creation_state,
|
|
695
|
+
churn_date=churn_date,
|
|
696
|
+
vat_number=vat_number,
|
|
821
697
|
metadata=metadata,
|
|
822
698
|
request_options=request_options,
|
|
823
699
|
)
|
|
824
700
|
return _response.data
|
|
825
701
|
|
|
826
|
-
async def
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
----------
|
|
830
|
-
customer_id : str
|
|
831
|
-
|
|
832
|
-
request_options : typing.Optional[RequestOptions]
|
|
833
|
-
Request-specific configuration.
|
|
834
|
-
|
|
835
|
-
Returns
|
|
836
|
-
-------
|
|
837
|
-
None
|
|
838
|
-
|
|
839
|
-
Examples
|
|
840
|
-
--------
|
|
841
|
-
import asyncio
|
|
842
|
-
|
|
843
|
-
from paid import AsyncPaid
|
|
844
|
-
|
|
845
|
-
client = AsyncPaid(
|
|
846
|
-
token="YOUR_TOKEN",
|
|
847
|
-
)
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
async def main() -> None:
|
|
851
|
-
await client.customers.delete(
|
|
852
|
-
customer_id="customerId",
|
|
853
|
-
)
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
asyncio.run(main())
|
|
702
|
+
async def delete_customer(
|
|
703
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
704
|
+
) -> EmptyResponse:
|
|
857
705
|
"""
|
|
858
|
-
|
|
859
|
-
return _response.data
|
|
706
|
+
Delete a customer by its ID
|
|
860
707
|
|
|
861
|
-
async def get_entitlements(
|
|
862
|
-
self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
863
|
-
) -> typing.List[EntitlementUsage]:
|
|
864
|
-
"""
|
|
865
708
|
Parameters
|
|
866
709
|
----------
|
|
867
|
-
|
|
868
|
-
The customer ID
|
|
710
|
+
id : str
|
|
869
711
|
|
|
870
712
|
request_options : typing.Optional[RequestOptions]
|
|
871
713
|
Request-specific configuration.
|
|
872
714
|
|
|
873
715
|
Returns
|
|
874
716
|
-------
|
|
875
|
-
|
|
876
|
-
|
|
717
|
+
EmptyResponse
|
|
718
|
+
200
|
|
877
719
|
|
|
878
720
|
Examples
|
|
879
721
|
--------
|
|
@@ -887,20 +729,22 @@ class AsyncCustomersClient:
|
|
|
887
729
|
|
|
888
730
|
|
|
889
731
|
async def main() -> None:
|
|
890
|
-
await client.customers.
|
|
891
|
-
|
|
732
|
+
await client.customers.delete_customer(
|
|
733
|
+
id="id",
|
|
892
734
|
)
|
|
893
735
|
|
|
894
736
|
|
|
895
737
|
asyncio.run(main())
|
|
896
738
|
"""
|
|
897
|
-
_response = await self._raw_client.
|
|
739
|
+
_response = await self._raw_client.delete_customer(id, request_options=request_options)
|
|
898
740
|
return _response.data
|
|
899
741
|
|
|
900
|
-
async def
|
|
742
|
+
async def get_customer_by_external_id(
|
|
901
743
|
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
902
744
|
) -> Customer:
|
|
903
745
|
"""
|
|
746
|
+
Get a customer by its externalId
|
|
747
|
+
|
|
904
748
|
Parameters
|
|
905
749
|
----------
|
|
906
750
|
external_id : str
|
|
@@ -911,7 +755,7 @@ class AsyncCustomersClient:
|
|
|
911
755
|
Returns
|
|
912
756
|
-------
|
|
913
757
|
Customer
|
|
914
|
-
|
|
758
|
+
200
|
|
915
759
|
|
|
916
760
|
Examples
|
|
917
761
|
--------
|
|
@@ -925,57 +769,61 @@ class AsyncCustomersClient:
|
|
|
925
769
|
|
|
926
770
|
|
|
927
771
|
async def main() -> None:
|
|
928
|
-
await client.customers.
|
|
772
|
+
await client.customers.get_customer_by_external_id(
|
|
929
773
|
external_id="externalId",
|
|
930
774
|
)
|
|
931
775
|
|
|
932
776
|
|
|
933
777
|
asyncio.run(main())
|
|
934
778
|
"""
|
|
935
|
-
_response = await self._raw_client.
|
|
779
|
+
_response = await self._raw_client.get_customer_by_external_id(external_id, request_options=request_options)
|
|
936
780
|
return _response.data
|
|
937
781
|
|
|
938
|
-
async def
|
|
782
|
+
async def update_customer_by_external_id(
|
|
939
783
|
self,
|
|
940
784
|
external_id_: str,
|
|
941
785
|
*,
|
|
942
786
|
name: typing.Optional[str] = OMIT,
|
|
943
|
-
|
|
787
|
+
legal_name: typing.Optional[str] = OMIT,
|
|
788
|
+
email: typing.Optional[str] = OMIT,
|
|
944
789
|
phone: typing.Optional[str] = OMIT,
|
|
945
|
-
employee_count: typing.Optional[float] = OMIT,
|
|
946
|
-
annual_revenue: typing.Optional[float] = OMIT,
|
|
947
|
-
tax_exempt_status: typing.Optional[TaxExemptStatus] = OMIT,
|
|
948
|
-
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
949
790
|
website: typing.Optional[str] = OMIT,
|
|
950
|
-
|
|
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,
|
|
951
796
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
952
797
|
request_options: typing.Optional[RequestOptions] = None,
|
|
953
798
|
) -> Customer:
|
|
954
799
|
"""
|
|
800
|
+
Update a customer by its externalId
|
|
801
|
+
|
|
955
802
|
Parameters
|
|
956
803
|
----------
|
|
957
804
|
external_id_ : str
|
|
958
805
|
|
|
959
806
|
name : typing.Optional[str]
|
|
960
807
|
|
|
961
|
-
|
|
808
|
+
legal_name : typing.Optional[str]
|
|
809
|
+
|
|
810
|
+
email : typing.Optional[str]
|
|
962
811
|
|
|
963
812
|
phone : typing.Optional[str]
|
|
964
813
|
|
|
965
|
-
|
|
814
|
+
website : typing.Optional[str]
|
|
966
815
|
|
|
967
|
-
|
|
816
|
+
external_id : typing.Optional[str]
|
|
968
817
|
|
|
969
|
-
|
|
818
|
+
billing_address : typing.Optional[CustomerBillingAddress]
|
|
970
819
|
|
|
971
|
-
|
|
820
|
+
creation_state : typing.Optional[CustomerCreationState]
|
|
972
821
|
|
|
973
|
-
|
|
822
|
+
churn_date : typing.Optional[dt.datetime]
|
|
974
823
|
|
|
975
|
-
|
|
824
|
+
vat_number : typing.Optional[str]
|
|
976
825
|
|
|
977
826
|
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
978
|
-
Flexible JSON field for storing custom metadata about the customer
|
|
979
827
|
|
|
980
828
|
request_options : typing.Optional[RequestOptions]
|
|
981
829
|
Request-specific configuration.
|
|
@@ -983,7 +831,7 @@ class AsyncCustomersClient:
|
|
|
983
831
|
Returns
|
|
984
832
|
-------
|
|
985
833
|
Customer
|
|
986
|
-
|
|
834
|
+
200
|
|
987
835
|
|
|
988
836
|
Examples
|
|
989
837
|
--------
|
|
@@ -997,106 +845,51 @@ class AsyncCustomersClient:
|
|
|
997
845
|
|
|
998
846
|
|
|
999
847
|
async def main() -> None:
|
|
1000
|
-
await client.customers.
|
|
848
|
+
await client.customers.update_customer_by_external_id(
|
|
1001
849
|
external_id_="externalId",
|
|
1002
850
|
)
|
|
1003
851
|
|
|
1004
852
|
|
|
1005
853
|
asyncio.run(main())
|
|
1006
854
|
"""
|
|
1007
|
-
_response = await self._raw_client.
|
|
855
|
+
_response = await self._raw_client.update_customer_by_external_id(
|
|
1008
856
|
external_id_,
|
|
1009
857
|
name=name,
|
|
1010
|
-
|
|
858
|
+
legal_name=legal_name,
|
|
859
|
+
email=email,
|
|
1011
860
|
phone=phone,
|
|
1012
|
-
employee_count=employee_count,
|
|
1013
|
-
annual_revenue=annual_revenue,
|
|
1014
|
-
tax_exempt_status=tax_exempt_status,
|
|
1015
|
-
creation_source=creation_source,
|
|
1016
861
|
website=website,
|
|
862
|
+
external_id=external_id,
|
|
1017
863
|
billing_address=billing_address,
|
|
864
|
+
creation_state=creation_state,
|
|
865
|
+
churn_date=churn_date,
|
|
866
|
+
vat_number=vat_number,
|
|
1018
867
|
metadata=metadata,
|
|
1019
868
|
request_options=request_options,
|
|
1020
869
|
)
|
|
1021
870
|
return _response.data
|
|
1022
871
|
|
|
1023
|
-
async def
|
|
872
|
+
async def delete_customer_by_external_id(
|
|
1024
873
|
self, external_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1025
|
-
) ->
|
|
874
|
+
) -> EmptyResponse:
|
|
1026
875
|
"""
|
|
1027
|
-
|
|
1028
|
-
----------
|
|
1029
|
-
external_id : str
|
|
1030
|
-
|
|
1031
|
-
request_options : typing.Optional[RequestOptions]
|
|
1032
|
-
Request-specific configuration.
|
|
876
|
+
Delete a customer by its externalId
|
|
1033
877
|
|
|
1034
|
-
Returns
|
|
1035
|
-
-------
|
|
1036
|
-
None
|
|
1037
|
-
|
|
1038
|
-
Examples
|
|
1039
|
-
--------
|
|
1040
|
-
import asyncio
|
|
1041
|
-
|
|
1042
|
-
from paid import AsyncPaid
|
|
1043
|
-
|
|
1044
|
-
client = AsyncPaid(
|
|
1045
|
-
token="YOUR_TOKEN",
|
|
1046
|
-
)
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
async def main() -> None:
|
|
1050
|
-
await client.customers.delete_by_external_id(
|
|
1051
|
-
external_id="externalId",
|
|
1052
|
-
)
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
asyncio.run(main())
|
|
1056
|
-
"""
|
|
1057
|
-
_response = await self._raw_client.delete_by_external_id(external_id, request_options=request_options)
|
|
1058
|
-
return _response.data
|
|
1059
|
-
|
|
1060
|
-
async def get_costs_by_external_id(
|
|
1061
|
-
self,
|
|
1062
|
-
external_id: str,
|
|
1063
|
-
*,
|
|
1064
|
-
limit: typing.Optional[int] = None,
|
|
1065
|
-
offset: typing.Optional[int] = None,
|
|
1066
|
-
start_time: typing.Optional[dt.datetime] = None,
|
|
1067
|
-
end_time: typing.Optional[dt.datetime] = None,
|
|
1068
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1069
|
-
) -> CostTracesResponse:
|
|
1070
|
-
"""
|
|
1071
878
|
Parameters
|
|
1072
879
|
----------
|
|
1073
880
|
external_id : str
|
|
1074
|
-
The external ID of the customer
|
|
1075
|
-
|
|
1076
|
-
limit : typing.Optional[int]
|
|
1077
|
-
Maximum number of traces to return (1-1000)
|
|
1078
|
-
|
|
1079
|
-
offset : typing.Optional[int]
|
|
1080
|
-
Number of traces to skip for pagination
|
|
1081
|
-
|
|
1082
|
-
start_time : typing.Optional[dt.datetime]
|
|
1083
|
-
Filter traces starting from this time (ISO 8601 format)
|
|
1084
|
-
|
|
1085
|
-
end_time : typing.Optional[dt.datetime]
|
|
1086
|
-
Filter traces up to this time (ISO 8601 format)
|
|
1087
881
|
|
|
1088
882
|
request_options : typing.Optional[RequestOptions]
|
|
1089
883
|
Request-specific configuration.
|
|
1090
884
|
|
|
1091
885
|
Returns
|
|
1092
886
|
-------
|
|
1093
|
-
|
|
1094
|
-
|
|
887
|
+
EmptyResponse
|
|
888
|
+
200
|
|
1095
889
|
|
|
1096
890
|
Examples
|
|
1097
891
|
--------
|
|
1098
892
|
import asyncio
|
|
1099
|
-
import datetime
|
|
1100
893
|
|
|
1101
894
|
from paid import AsyncPaid
|
|
1102
895
|
|
|
@@ -1106,101 +899,12 @@ class AsyncCustomersClient:
|
|
|
1106
899
|
|
|
1107
900
|
|
|
1108
901
|
async def main() -> None:
|
|
1109
|
-
await client.customers.
|
|
902
|
+
await client.customers.delete_customer_by_external_id(
|
|
1110
903
|
external_id="externalId",
|
|
1111
|
-
limit=1,
|
|
1112
|
-
offset=1,
|
|
1113
|
-
start_time=datetime.datetime.fromisoformat(
|
|
1114
|
-
"2024-01-15 09:30:00+00:00",
|
|
1115
|
-
),
|
|
1116
|
-
end_time=datetime.datetime.fromisoformat(
|
|
1117
|
-
"2024-01-15 09:30:00+00:00",
|
|
1118
|
-
),
|
|
1119
904
|
)
|
|
1120
905
|
|
|
1121
906
|
|
|
1122
907
|
asyncio.run(main())
|
|
1123
908
|
"""
|
|
1124
|
-
_response = await self._raw_client.
|
|
1125
|
-
external_id,
|
|
1126
|
-
limit=limit,
|
|
1127
|
-
offset=offset,
|
|
1128
|
-
start_time=start_time,
|
|
1129
|
-
end_time=end_time,
|
|
1130
|
-
request_options=request_options,
|
|
1131
|
-
)
|
|
1132
|
-
return _response.data
|
|
1133
|
-
|
|
1134
|
-
async def get_usage_by_external_id(
|
|
1135
|
-
self,
|
|
1136
|
-
external_id: str,
|
|
1137
|
-
*,
|
|
1138
|
-
limit: typing.Optional[int] = None,
|
|
1139
|
-
offset: typing.Optional[int] = None,
|
|
1140
|
-
start_time: typing.Optional[dt.datetime] = None,
|
|
1141
|
-
end_time: typing.Optional[dt.datetime] = None,
|
|
1142
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1143
|
-
) -> UsageSummariesResponse:
|
|
1144
|
-
"""
|
|
1145
|
-
Parameters
|
|
1146
|
-
----------
|
|
1147
|
-
external_id : str
|
|
1148
|
-
The external ID of the customer
|
|
1149
|
-
|
|
1150
|
-
limit : typing.Optional[int]
|
|
1151
|
-
Maximum number of usage summaries to return (1-1000)
|
|
1152
|
-
|
|
1153
|
-
offset : typing.Optional[int]
|
|
1154
|
-
Number of usage summaries to skip for pagination
|
|
1155
|
-
|
|
1156
|
-
start_time : typing.Optional[dt.datetime]
|
|
1157
|
-
Filter usage summaries starting from this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
1158
|
-
|
|
1159
|
-
end_time : typing.Optional[dt.datetime]
|
|
1160
|
-
Filter usage summaries up to this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
1161
|
-
|
|
1162
|
-
request_options : typing.Optional[RequestOptions]
|
|
1163
|
-
Request-specific configuration.
|
|
1164
|
-
|
|
1165
|
-
Returns
|
|
1166
|
-
-------
|
|
1167
|
-
UsageSummariesResponse
|
|
1168
|
-
Success response
|
|
1169
|
-
|
|
1170
|
-
Examples
|
|
1171
|
-
--------
|
|
1172
|
-
import asyncio
|
|
1173
|
-
import datetime
|
|
1174
|
-
|
|
1175
|
-
from paid import AsyncPaid
|
|
1176
|
-
|
|
1177
|
-
client = AsyncPaid(
|
|
1178
|
-
token="YOUR_TOKEN",
|
|
1179
|
-
)
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
async def main() -> None:
|
|
1183
|
-
await client.customers.get_usage_by_external_id(
|
|
1184
|
-
external_id="externalId",
|
|
1185
|
-
limit=1,
|
|
1186
|
-
offset=1,
|
|
1187
|
-
start_time=datetime.datetime.fromisoformat(
|
|
1188
|
-
"2024-01-15 09:30:00+00:00",
|
|
1189
|
-
),
|
|
1190
|
-
end_time=datetime.datetime.fromisoformat(
|
|
1191
|
-
"2024-01-15 09:30:00+00:00",
|
|
1192
|
-
),
|
|
1193
|
-
)
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
asyncio.run(main())
|
|
1197
|
-
"""
|
|
1198
|
-
_response = await self._raw_client.get_usage_by_external_id(
|
|
1199
|
-
external_id,
|
|
1200
|
-
limit=limit,
|
|
1201
|
-
offset=offset,
|
|
1202
|
-
start_time=start_time,
|
|
1203
|
-
end_time=end_time,
|
|
1204
|
-
request_options=request_options,
|
|
1205
|
-
)
|
|
909
|
+
_response = await self._raw_client.delete_customer_by_external_id(external_id, request_options=request_options)
|
|
1206
910
|
return _response.data
|