paid-python 1.0.0a0__py3-none-any.whl → 1.0.0a2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- paid/__init__.py +61 -122
- paid/client.py +16 -22
- paid/contacts/client.py +417 -133
- paid/contacts/raw_client.py +1048 -118
- paid/core/client_wrapper.py +8 -10
- paid/customers/__init__.py +0 -3
- paid/customers/client.py +394 -1112
- paid/customers/raw_client.py +656 -1054
- paid/environment.py +1 -1
- paid/errors/bad_request_error.py +2 -2
- paid/errors/forbidden_error.py +2 -2
- paid/errors/internal_server_error.py +2 -2
- paid/errors/not_found_error.py +2 -2
- paid/invoices/client.py +369 -0
- paid/{plans → invoices}/raw_client.py +312 -201
- paid/orders/__init__.py +0 -3
- paid/orders/client.py +281 -471
- paid/orders/raw_client.py +552 -537
- paid/products/__init__.py +0 -3
- paid/products/client.py +129 -265
- paid/products/raw_client.py +565 -233
- paid/signals/client.py +130 -0
- paid/signals/raw_client.py +190 -0
- paid/tracing/autoinstrumentation.py +12 -6
- paid/tracing/context_manager.py +2 -6
- paid/tracing/distributed_tracing.py +3 -3
- paid/tracing/signal.py +3 -3
- paid/tracing/wrappers/openai_agents/openaiAgentsHook.py +1 -1
- paid/types/__init__.py +58 -110
- paid/types/attribution.py +8 -0
- paid/types/{agent_attribute.py → bulk_signals_response.py} +4 -5
- paid/types/contact.py +12 -20
- paid/types/{address.py → contact_billing_address.py} +6 -7
- paid/types/{traces_response.py → contact_list_response.py} +5 -9
- paid/types/customer.py +15 -22
- paid/types/customer_attribution.py +8 -0
- paid/types/customer_billing_address.py +26 -0
- paid/types/{usage_summary_order.py → customer_by_external_id.py} +3 -5
- paid/types/{usage_summary_order_line.py → customer_by_id.py} +3 -5
- paid/types/customer_creation_state.py +5 -0
- paid/types/customer_list_response.py +22 -0
- paid/types/empty_response.py +17 -0
- paid/types/{error.py → error_response.py} +4 -7
- paid/types/invoice.py +33 -51
- paid/types/invoice_line.py +42 -0
- paid/types/invoice_line_payment_status.py +7 -0
- paid/types/invoice_lines_response.py +22 -0
- paid/types/invoice_list_response.py +22 -0
- paid/types/invoice_payment_status.py +5 -0
- paid/types/invoice_source.py +5 -0
- paid/types/invoice_status.py +3 -1
- paid/types/invoice_tax_status.py +7 -0
- paid/types/order.py +30 -29
- paid/types/order_creation_state.py +5 -0
- paid/types/order_line.py +6 -24
- paid/types/order_lines_response.py +22 -0
- paid/types/order_list_response.py +22 -0
- paid/types/pagination.py +24 -0
- paid/types/product.py +4 -29
- paid/types/{tier.py → product_by_external_id.py} +5 -4
- paid/types/{cost_amount.py → product_by_id.py} +5 -12
- paid/types/product_list_response.py +22 -0
- paid/types/signal.py +8 -34
- paid/types/{agent_update.py → update_contact_request.py} +10 -9
- paid/types/update_customer_request.py +38 -0
- paid/types/{product_update.py → update_product_request.py} +2 -12
- {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a2.dist-info}/METADATA +23 -8
- paid_python-1.0.0a2.dist-info/RECORD +110 -0
- paid/agents/client.py +0 -880
- paid/agents/raw_client.py +0 -785
- paid/customers/types/__init__.py +0 -8
- paid/customers/types/customers_check_entitlement_request_view.py +0 -5
- paid/customers/types/customers_check_entitlement_response.py +0 -22
- paid/orders/lines/client.py +0 -144
- paid/orders/lines/raw_client.py +0 -129
- paid/plans/__init__.py +0 -4
- paid/plans/client.py +0 -403
- paid/products/types/__init__.py +0 -7
- paid/products/types/product_create_type.py +0 -5
- paid/traces/__init__.py +0 -4
- paid/traces/client.py +0 -218
- paid/traces/raw_client.py +0 -226
- paid/types/agent.py +0 -31
- paid/types/agent_price_point.py +0 -27
- paid/types/agent_price_point_tiers.py +0 -23
- paid/types/api_error.py +0 -29
- paid/types/billing_frequency.py +0 -5
- paid/types/cancel_renewal_response.py +0 -49
- paid/types/charge_type.py +0 -5
- paid/types/contact_create_for_customer.py +0 -37
- paid/types/cost_trace.py +0 -55
- paid/types/cost_traces_response.py +0 -26
- paid/types/creation_source.py +0 -5
- paid/types/creation_state.py +0 -5
- paid/types/customer_update.py +0 -40
- paid/types/entitlement_usage.py +0 -48
- paid/types/order_line_attribute.py +0 -27
- paid/types/order_line_attribute_create_one.py +0 -5
- paid/types/order_line_attribute_pricing.py +0 -33
- paid/types/order_line_create.py +0 -72
- paid/types/pagination_meta.py +0 -84
- paid/types/payment_method.py +0 -58
- paid/types/payment_method_card.py +0 -49
- paid/types/payment_method_type.py +0 -5
- paid/types/payment_method_us_bank_account.py +0 -36
- paid/types/payment_method_us_bank_account_account_type.py +0 -5
- paid/types/plan.py +0 -81
- paid/types/plan_group.py +0 -60
- paid/types/plan_plan_products_item.py +0 -41
- paid/types/plan_plan_products_item_plan_product_attribute_item.py +0 -34
- paid/types/plan_with_features.py +0 -69
- paid/types/plan_with_features_features_item.py +0 -34
- paid/types/price_point.py +0 -25
- paid/types/pricing.py +0 -31
- paid/types/pricing_model_type.py +0 -7
- paid/types/product_type.py +0 -5
- paid/types/product_update_type.py +0 -5
- paid/types/proration_attribute_update.py +0 -44
- paid/types/proration_detail.py +0 -49
- paid/types/proration_upgrade_response.py +0 -73
- paid/types/salutation.py +0 -5
- paid/types/signal_v_2.py +0 -56
- paid/types/tax_exempt_status.py +0 -5
- paid/types/trace.py +0 -69
- paid/types/usage_pagination_meta.py +0 -43
- paid/types/usage_summaries_response.py +0 -26
- paid/types/usage_summary.py +0 -121
- paid/usage/__init__.py +0 -7
- paid/usage/client.py +0 -321
- paid/usage/raw_client.py +0 -387
- paid/usage/types/__init__.py +0 -7
- paid/usage/types/usage_check_usage_response.py +0 -53
- paid_python-1.0.0a0.dist-info/RECORD +0 -152
- /paid/{agents → invoices}/__init__.py +0 -0
- /paid/{orders/lines → signals}/__init__.py +0 -0
- {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a2.dist-info}/LICENSE +0 -0
- {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a2.dist-info}/WHEEL +0 -0
|
@@ -1,78 +1,103 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
import datetime as dt
|
|
4
3
|
import typing
|
|
5
4
|
from json.decoder import JSONDecodeError
|
|
6
5
|
|
|
7
6
|
from ..core.api_error import ApiError
|
|
8
7
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
9
|
-
from ..core.datetime_utils import serialize_datetime
|
|
10
8
|
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
11
9
|
from ..core.jsonable_encoder import jsonable_encoder
|
|
12
10
|
from ..core.pydantic_utilities import parse_obj_as
|
|
13
11
|
from ..core.request_options import RequestOptions
|
|
14
12
|
from ..errors.bad_request_error import BadRequestError
|
|
15
13
|
from ..errors.forbidden_error import ForbiddenError
|
|
14
|
+
from ..errors.internal_server_error import InternalServerError
|
|
16
15
|
from ..errors.not_found_error import NotFoundError
|
|
17
|
-
from ..types.
|
|
18
|
-
from ..types.
|
|
19
|
-
from ..types.
|
|
20
|
-
from ..types.
|
|
21
|
-
from ..types.usage_summaries_response import UsageSummariesResponse
|
|
16
|
+
from ..types.error_response import ErrorResponse
|
|
17
|
+
from ..types.invoice import Invoice
|
|
18
|
+
from ..types.invoice_lines_response import InvoiceLinesResponse
|
|
19
|
+
from ..types.invoice_list_response import InvoiceListResponse
|
|
22
20
|
|
|
21
|
+
# this is used as the default value for optional parameters
|
|
22
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
|
|
25
|
+
class RawInvoicesClient:
|
|
25
26
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
26
27
|
self._client_wrapper = client_wrapper
|
|
27
28
|
|
|
28
|
-
def
|
|
29
|
+
def list_invoices(
|
|
30
|
+
self,
|
|
31
|
+
*,
|
|
32
|
+
limit: typing.Optional[int] = None,
|
|
33
|
+
offset: typing.Optional[int] = None,
|
|
34
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
35
|
+
) -> HttpResponse[InvoiceListResponse]:
|
|
29
36
|
"""
|
|
37
|
+
Get a list of invoices for the organization
|
|
38
|
+
|
|
30
39
|
Parameters
|
|
31
40
|
----------
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
limit : typing.Optional[int]
|
|
42
|
+
|
|
43
|
+
offset : typing.Optional[int]
|
|
34
44
|
|
|
35
45
|
request_options : typing.Optional[RequestOptions]
|
|
36
46
|
Request-specific configuration.
|
|
37
47
|
|
|
38
48
|
Returns
|
|
39
49
|
-------
|
|
40
|
-
HttpResponse[
|
|
41
|
-
|
|
50
|
+
HttpResponse[InvoiceListResponse]
|
|
51
|
+
200
|
|
42
52
|
"""
|
|
43
53
|
_response = self._client_wrapper.httpx_client.request(
|
|
44
|
-
|
|
54
|
+
"invoices/",
|
|
45
55
|
method="GET",
|
|
56
|
+
params={
|
|
57
|
+
"limit": limit,
|
|
58
|
+
"offset": offset,
|
|
59
|
+
},
|
|
46
60
|
request_options=request_options,
|
|
47
61
|
)
|
|
48
62
|
try:
|
|
49
63
|
if 200 <= _response.status_code < 300:
|
|
50
64
|
_data = typing.cast(
|
|
51
|
-
|
|
65
|
+
InvoiceListResponse,
|
|
52
66
|
parse_obj_as(
|
|
53
|
-
type_=
|
|
67
|
+
type_=InvoiceListResponse, # type: ignore
|
|
54
68
|
object_=_response.json(),
|
|
55
69
|
),
|
|
56
70
|
)
|
|
57
71
|
return HttpResponse(response=_response, data=_data)
|
|
72
|
+
if _response.status_code == 400:
|
|
73
|
+
raise BadRequestError(
|
|
74
|
+
headers=dict(_response.headers),
|
|
75
|
+
body=typing.cast(
|
|
76
|
+
ErrorResponse,
|
|
77
|
+
parse_obj_as(
|
|
78
|
+
type_=ErrorResponse, # type: ignore
|
|
79
|
+
object_=_response.json(),
|
|
80
|
+
),
|
|
81
|
+
),
|
|
82
|
+
)
|
|
58
83
|
if _response.status_code == 403:
|
|
59
84
|
raise ForbiddenError(
|
|
60
85
|
headers=dict(_response.headers),
|
|
61
86
|
body=typing.cast(
|
|
62
|
-
|
|
87
|
+
ErrorResponse,
|
|
63
88
|
parse_obj_as(
|
|
64
|
-
type_=
|
|
89
|
+
type_=ErrorResponse, # type: ignore
|
|
65
90
|
object_=_response.json(),
|
|
66
91
|
),
|
|
67
92
|
),
|
|
68
93
|
)
|
|
69
|
-
if _response.status_code ==
|
|
70
|
-
raise
|
|
94
|
+
if _response.status_code == 500:
|
|
95
|
+
raise InternalServerError(
|
|
71
96
|
headers=dict(_response.headers),
|
|
72
97
|
body=typing.cast(
|
|
73
|
-
|
|
98
|
+
ErrorResponse,
|
|
74
99
|
parse_obj_as(
|
|
75
|
-
type_=
|
|
100
|
+
type_=ErrorResponse, # type: ignore
|
|
76
101
|
object_=_response.json(),
|
|
77
102
|
),
|
|
78
103
|
),
|
|
@@ -82,97 +107,68 @@ class RawPlansClient:
|
|
|
82
107
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
83
108
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
84
109
|
|
|
85
|
-
def
|
|
86
|
-
self,
|
|
87
|
-
|
|
88
|
-
*,
|
|
89
|
-
external_id: str,
|
|
90
|
-
limit: typing.Optional[int] = None,
|
|
91
|
-
offset: typing.Optional[int] = None,
|
|
92
|
-
start_time: typing.Optional[dt.datetime] = None,
|
|
93
|
-
end_time: typing.Optional[dt.datetime] = None,
|
|
94
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
95
|
-
) -> HttpResponse[UsageSummariesResponse]:
|
|
110
|
+
def get_invoice_by_id(
|
|
111
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
112
|
+
) -> HttpResponse[Invoice]:
|
|
96
113
|
"""
|
|
114
|
+
Get an invoice by ID
|
|
115
|
+
|
|
97
116
|
Parameters
|
|
98
117
|
----------
|
|
99
|
-
|
|
100
|
-
The ID of the plan
|
|
101
|
-
|
|
102
|
-
external_id : str
|
|
103
|
-
The external ID of the customer
|
|
104
|
-
|
|
105
|
-
limit : typing.Optional[int]
|
|
106
|
-
Maximum number of usage summaries to return (1-1000)
|
|
107
|
-
|
|
108
|
-
offset : typing.Optional[int]
|
|
109
|
-
Number of usage summaries to skip for pagination
|
|
110
|
-
|
|
111
|
-
start_time : typing.Optional[dt.datetime]
|
|
112
|
-
Filter usage summaries starting from this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
113
|
-
|
|
114
|
-
end_time : typing.Optional[dt.datetime]
|
|
115
|
-
Filter usage summaries up to this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
118
|
+
id : str
|
|
116
119
|
|
|
117
120
|
request_options : typing.Optional[RequestOptions]
|
|
118
121
|
Request-specific configuration.
|
|
119
122
|
|
|
120
123
|
Returns
|
|
121
124
|
-------
|
|
122
|
-
HttpResponse[
|
|
123
|
-
|
|
125
|
+
HttpResponse[Invoice]
|
|
126
|
+
200
|
|
124
127
|
"""
|
|
125
128
|
_response = self._client_wrapper.httpx_client.request(
|
|
126
|
-
f"
|
|
129
|
+
f"invoices/{jsonable_encoder(id)}",
|
|
127
130
|
method="GET",
|
|
128
|
-
params={
|
|
129
|
-
"externalId": external_id,
|
|
130
|
-
"limit": limit,
|
|
131
|
-
"offset": offset,
|
|
132
|
-
"startTime": serialize_datetime(start_time) if start_time is not None else None,
|
|
133
|
-
"endTime": serialize_datetime(end_time) if end_time is not None else None,
|
|
134
|
-
},
|
|
135
131
|
request_options=request_options,
|
|
136
132
|
)
|
|
137
133
|
try:
|
|
138
134
|
if 200 <= _response.status_code < 300:
|
|
139
135
|
_data = typing.cast(
|
|
140
|
-
|
|
136
|
+
Invoice,
|
|
141
137
|
parse_obj_as(
|
|
142
|
-
type_=
|
|
138
|
+
type_=Invoice, # type: ignore
|
|
143
139
|
object_=_response.json(),
|
|
144
140
|
),
|
|
145
141
|
)
|
|
146
142
|
return HttpResponse(response=_response, data=_data)
|
|
147
|
-
if _response.status_code ==
|
|
148
|
-
raise
|
|
143
|
+
if _response.status_code == 403:
|
|
144
|
+
raise ForbiddenError(
|
|
149
145
|
headers=dict(_response.headers),
|
|
150
146
|
body=typing.cast(
|
|
151
|
-
|
|
147
|
+
ErrorResponse,
|
|
152
148
|
parse_obj_as(
|
|
153
|
-
type_=
|
|
149
|
+
type_=ErrorResponse, # type: ignore
|
|
154
150
|
object_=_response.json(),
|
|
155
151
|
),
|
|
156
152
|
),
|
|
157
153
|
)
|
|
158
|
-
if _response.status_code ==
|
|
159
|
-
raise
|
|
154
|
+
if _response.status_code == 404:
|
|
155
|
+
raise NotFoundError(
|
|
160
156
|
headers=dict(_response.headers),
|
|
161
157
|
body=typing.cast(
|
|
162
|
-
|
|
158
|
+
ErrorResponse,
|
|
163
159
|
parse_obj_as(
|
|
164
|
-
type_=
|
|
160
|
+
type_=ErrorResponse, # type: ignore
|
|
165
161
|
object_=_response.json(),
|
|
166
162
|
),
|
|
167
163
|
),
|
|
168
164
|
)
|
|
169
|
-
if _response.status_code ==
|
|
170
|
-
raise
|
|
165
|
+
if _response.status_code == 500:
|
|
166
|
+
raise InternalServerError(
|
|
171
167
|
headers=dict(_response.headers),
|
|
172
168
|
body=typing.cast(
|
|
173
|
-
|
|
169
|
+
ErrorResponse,
|
|
174
170
|
parse_obj_as(
|
|
175
|
-
type_=
|
|
171
|
+
type_=ErrorResponse, # type: ignore
|
|
176
172
|
object_=_response.json(),
|
|
177
173
|
),
|
|
178
174
|
),
|
|
@@ -182,45 +178,70 @@ class RawPlansClient:
|
|
|
182
178
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
183
179
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
184
180
|
|
|
185
|
-
def
|
|
186
|
-
self,
|
|
187
|
-
|
|
181
|
+
def update_invoice_by_id(
|
|
182
|
+
self,
|
|
183
|
+
id: str,
|
|
184
|
+
*,
|
|
185
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
186
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
187
|
+
) -> HttpResponse[Invoice]:
|
|
188
188
|
"""
|
|
189
|
+
Update an invoice by ID
|
|
190
|
+
|
|
189
191
|
Parameters
|
|
190
192
|
----------
|
|
191
|
-
|
|
192
|
-
|
|
193
|
+
id : str
|
|
194
|
+
|
|
195
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
193
196
|
|
|
194
197
|
request_options : typing.Optional[RequestOptions]
|
|
195
198
|
Request-specific configuration.
|
|
196
199
|
|
|
197
200
|
Returns
|
|
198
201
|
-------
|
|
199
|
-
HttpResponse[
|
|
200
|
-
|
|
202
|
+
HttpResponse[Invoice]
|
|
203
|
+
200
|
|
201
204
|
"""
|
|
202
205
|
_response = self._client_wrapper.httpx_client.request(
|
|
203
|
-
f"
|
|
204
|
-
method="
|
|
206
|
+
f"invoices/{jsonable_encoder(id)}",
|
|
207
|
+
method="PUT",
|
|
208
|
+
json={
|
|
209
|
+
"metadata": metadata,
|
|
210
|
+
},
|
|
211
|
+
headers={
|
|
212
|
+
"content-type": "application/json",
|
|
213
|
+
},
|
|
205
214
|
request_options=request_options,
|
|
215
|
+
omit=OMIT,
|
|
206
216
|
)
|
|
207
217
|
try:
|
|
208
218
|
if 200 <= _response.status_code < 300:
|
|
209
219
|
_data = typing.cast(
|
|
210
|
-
|
|
220
|
+
Invoice,
|
|
211
221
|
parse_obj_as(
|
|
212
|
-
type_=
|
|
222
|
+
type_=Invoice, # type: ignore
|
|
213
223
|
object_=_response.json(),
|
|
214
224
|
),
|
|
215
225
|
)
|
|
216
226
|
return HttpResponse(response=_response, data=_data)
|
|
227
|
+
if _response.status_code == 400:
|
|
228
|
+
raise BadRequestError(
|
|
229
|
+
headers=dict(_response.headers),
|
|
230
|
+
body=typing.cast(
|
|
231
|
+
ErrorResponse,
|
|
232
|
+
parse_obj_as(
|
|
233
|
+
type_=ErrorResponse, # type: ignore
|
|
234
|
+
object_=_response.json(),
|
|
235
|
+
),
|
|
236
|
+
),
|
|
237
|
+
)
|
|
217
238
|
if _response.status_code == 403:
|
|
218
239
|
raise ForbiddenError(
|
|
219
240
|
headers=dict(_response.headers),
|
|
220
241
|
body=typing.cast(
|
|
221
|
-
|
|
242
|
+
ErrorResponse,
|
|
222
243
|
parse_obj_as(
|
|
223
|
-
type_=
|
|
244
|
+
type_=ErrorResponse, # type: ignore
|
|
224
245
|
object_=_response.json(),
|
|
225
246
|
),
|
|
226
247
|
),
|
|
@@ -229,9 +250,20 @@ class RawPlansClient:
|
|
|
229
250
|
raise NotFoundError(
|
|
230
251
|
headers=dict(_response.headers),
|
|
231
252
|
body=typing.cast(
|
|
232
|
-
|
|
253
|
+
ErrorResponse,
|
|
254
|
+
parse_obj_as(
|
|
255
|
+
type_=ErrorResponse, # type: ignore
|
|
256
|
+
object_=_response.json(),
|
|
257
|
+
),
|
|
258
|
+
),
|
|
259
|
+
)
|
|
260
|
+
if _response.status_code == 500:
|
|
261
|
+
raise InternalServerError(
|
|
262
|
+
headers=dict(_response.headers),
|
|
263
|
+
body=typing.cast(
|
|
264
|
+
ErrorResponse,
|
|
233
265
|
parse_obj_as(
|
|
234
|
-
type_=
|
|
266
|
+
type_=ErrorResponse, # type: ignore
|
|
235
267
|
object_=_response.json(),
|
|
236
268
|
),
|
|
237
269
|
),
|
|
@@ -241,34 +273,48 @@ class RawPlansClient:
|
|
|
241
273
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
242
274
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
243
275
|
|
|
244
|
-
def
|
|
245
|
-
self,
|
|
246
|
-
|
|
276
|
+
def get_invoice_lines(
|
|
277
|
+
self,
|
|
278
|
+
id: str,
|
|
279
|
+
*,
|
|
280
|
+
limit: typing.Optional[int] = None,
|
|
281
|
+
offset: typing.Optional[int] = None,
|
|
282
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
283
|
+
) -> HttpResponse[InvoiceLinesResponse]:
|
|
247
284
|
"""
|
|
285
|
+
Get the invoice lines for an invoice by ID
|
|
286
|
+
|
|
248
287
|
Parameters
|
|
249
288
|
----------
|
|
250
|
-
|
|
251
|
-
|
|
289
|
+
id : str
|
|
290
|
+
|
|
291
|
+
limit : typing.Optional[int]
|
|
292
|
+
|
|
293
|
+
offset : typing.Optional[int]
|
|
252
294
|
|
|
253
295
|
request_options : typing.Optional[RequestOptions]
|
|
254
296
|
Request-specific configuration.
|
|
255
297
|
|
|
256
298
|
Returns
|
|
257
299
|
-------
|
|
258
|
-
HttpResponse[
|
|
259
|
-
|
|
300
|
+
HttpResponse[InvoiceLinesResponse]
|
|
301
|
+
200
|
|
260
302
|
"""
|
|
261
303
|
_response = self._client_wrapper.httpx_client.request(
|
|
262
|
-
f"
|
|
304
|
+
f"invoices/{jsonable_encoder(id)}/lines",
|
|
263
305
|
method="GET",
|
|
306
|
+
params={
|
|
307
|
+
"limit": limit,
|
|
308
|
+
"offset": offset,
|
|
309
|
+
},
|
|
264
310
|
request_options=request_options,
|
|
265
311
|
)
|
|
266
312
|
try:
|
|
267
313
|
if 200 <= _response.status_code < 300:
|
|
268
314
|
_data = typing.cast(
|
|
269
|
-
|
|
315
|
+
InvoiceLinesResponse,
|
|
270
316
|
parse_obj_as(
|
|
271
|
-
type_=
|
|
317
|
+
type_=InvoiceLinesResponse, # type: ignore
|
|
272
318
|
object_=_response.json(),
|
|
273
319
|
),
|
|
274
320
|
)
|
|
@@ -277,9 +323,9 @@ class RawPlansClient:
|
|
|
277
323
|
raise ForbiddenError(
|
|
278
324
|
headers=dict(_response.headers),
|
|
279
325
|
body=typing.cast(
|
|
280
|
-
|
|
326
|
+
ErrorResponse,
|
|
281
327
|
parse_obj_as(
|
|
282
|
-
type_=
|
|
328
|
+
type_=ErrorResponse, # type: ignore
|
|
283
329
|
object_=_response.json(),
|
|
284
330
|
),
|
|
285
331
|
),
|
|
@@ -288,9 +334,20 @@ class RawPlansClient:
|
|
|
288
334
|
raise NotFoundError(
|
|
289
335
|
headers=dict(_response.headers),
|
|
290
336
|
body=typing.cast(
|
|
291
|
-
|
|
337
|
+
ErrorResponse,
|
|
338
|
+
parse_obj_as(
|
|
339
|
+
type_=ErrorResponse, # type: ignore
|
|
340
|
+
object_=_response.json(),
|
|
341
|
+
),
|
|
342
|
+
),
|
|
343
|
+
)
|
|
344
|
+
if _response.status_code == 500:
|
|
345
|
+
raise InternalServerError(
|
|
346
|
+
headers=dict(_response.headers),
|
|
347
|
+
body=typing.cast(
|
|
348
|
+
ErrorResponse,
|
|
292
349
|
parse_obj_as(
|
|
293
|
-
type_=
|
|
350
|
+
type_=ErrorResponse, # type: ignore
|
|
294
351
|
object_=_response.json(),
|
|
295
352
|
),
|
|
296
353
|
),
|
|
@@ -301,60 +358,82 @@ class RawPlansClient:
|
|
|
301
358
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
302
359
|
|
|
303
360
|
|
|
304
|
-
class
|
|
361
|
+
class AsyncRawInvoicesClient:
|
|
305
362
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
306
363
|
self._client_wrapper = client_wrapper
|
|
307
364
|
|
|
308
|
-
async def
|
|
309
|
-
self,
|
|
310
|
-
|
|
365
|
+
async def list_invoices(
|
|
366
|
+
self,
|
|
367
|
+
*,
|
|
368
|
+
limit: typing.Optional[int] = None,
|
|
369
|
+
offset: typing.Optional[int] = None,
|
|
370
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
371
|
+
) -> AsyncHttpResponse[InvoiceListResponse]:
|
|
311
372
|
"""
|
|
373
|
+
Get a list of invoices for the organization
|
|
374
|
+
|
|
312
375
|
Parameters
|
|
313
376
|
----------
|
|
314
|
-
|
|
315
|
-
|
|
377
|
+
limit : typing.Optional[int]
|
|
378
|
+
|
|
379
|
+
offset : typing.Optional[int]
|
|
316
380
|
|
|
317
381
|
request_options : typing.Optional[RequestOptions]
|
|
318
382
|
Request-specific configuration.
|
|
319
383
|
|
|
320
384
|
Returns
|
|
321
385
|
-------
|
|
322
|
-
AsyncHttpResponse[
|
|
323
|
-
|
|
386
|
+
AsyncHttpResponse[InvoiceListResponse]
|
|
387
|
+
200
|
|
324
388
|
"""
|
|
325
389
|
_response = await self._client_wrapper.httpx_client.request(
|
|
326
|
-
|
|
390
|
+
"invoices/",
|
|
327
391
|
method="GET",
|
|
392
|
+
params={
|
|
393
|
+
"limit": limit,
|
|
394
|
+
"offset": offset,
|
|
395
|
+
},
|
|
328
396
|
request_options=request_options,
|
|
329
397
|
)
|
|
330
398
|
try:
|
|
331
399
|
if 200 <= _response.status_code < 300:
|
|
332
400
|
_data = typing.cast(
|
|
333
|
-
|
|
401
|
+
InvoiceListResponse,
|
|
334
402
|
parse_obj_as(
|
|
335
|
-
type_=
|
|
403
|
+
type_=InvoiceListResponse, # type: ignore
|
|
336
404
|
object_=_response.json(),
|
|
337
405
|
),
|
|
338
406
|
)
|
|
339
407
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
408
|
+
if _response.status_code == 400:
|
|
409
|
+
raise BadRequestError(
|
|
410
|
+
headers=dict(_response.headers),
|
|
411
|
+
body=typing.cast(
|
|
412
|
+
ErrorResponse,
|
|
413
|
+
parse_obj_as(
|
|
414
|
+
type_=ErrorResponse, # type: ignore
|
|
415
|
+
object_=_response.json(),
|
|
416
|
+
),
|
|
417
|
+
),
|
|
418
|
+
)
|
|
340
419
|
if _response.status_code == 403:
|
|
341
420
|
raise ForbiddenError(
|
|
342
421
|
headers=dict(_response.headers),
|
|
343
422
|
body=typing.cast(
|
|
344
|
-
|
|
423
|
+
ErrorResponse,
|
|
345
424
|
parse_obj_as(
|
|
346
|
-
type_=
|
|
425
|
+
type_=ErrorResponse, # type: ignore
|
|
347
426
|
object_=_response.json(),
|
|
348
427
|
),
|
|
349
428
|
),
|
|
350
429
|
)
|
|
351
|
-
if _response.status_code ==
|
|
352
|
-
raise
|
|
430
|
+
if _response.status_code == 500:
|
|
431
|
+
raise InternalServerError(
|
|
353
432
|
headers=dict(_response.headers),
|
|
354
433
|
body=typing.cast(
|
|
355
|
-
|
|
434
|
+
ErrorResponse,
|
|
356
435
|
parse_obj_as(
|
|
357
|
-
type_=
|
|
436
|
+
type_=ErrorResponse, # type: ignore
|
|
358
437
|
object_=_response.json(),
|
|
359
438
|
),
|
|
360
439
|
),
|
|
@@ -364,97 +443,68 @@ class AsyncRawPlansClient:
|
|
|
364
443
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
365
444
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
366
445
|
|
|
367
|
-
async def
|
|
368
|
-
self,
|
|
369
|
-
|
|
370
|
-
*,
|
|
371
|
-
external_id: str,
|
|
372
|
-
limit: typing.Optional[int] = None,
|
|
373
|
-
offset: typing.Optional[int] = None,
|
|
374
|
-
start_time: typing.Optional[dt.datetime] = None,
|
|
375
|
-
end_time: typing.Optional[dt.datetime] = None,
|
|
376
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
377
|
-
) -> AsyncHttpResponse[UsageSummariesResponse]:
|
|
446
|
+
async def get_invoice_by_id(
|
|
447
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
448
|
+
) -> AsyncHttpResponse[Invoice]:
|
|
378
449
|
"""
|
|
450
|
+
Get an invoice by ID
|
|
451
|
+
|
|
379
452
|
Parameters
|
|
380
453
|
----------
|
|
381
|
-
|
|
382
|
-
The ID of the plan
|
|
383
|
-
|
|
384
|
-
external_id : str
|
|
385
|
-
The external ID of the customer
|
|
386
|
-
|
|
387
|
-
limit : typing.Optional[int]
|
|
388
|
-
Maximum number of usage summaries to return (1-1000)
|
|
389
|
-
|
|
390
|
-
offset : typing.Optional[int]
|
|
391
|
-
Number of usage summaries to skip for pagination
|
|
392
|
-
|
|
393
|
-
start_time : typing.Optional[dt.datetime]
|
|
394
|
-
Filter usage summaries starting from this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
395
|
-
|
|
396
|
-
end_time : typing.Optional[dt.datetime]
|
|
397
|
-
Filter usage summaries up to this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
454
|
+
id : str
|
|
398
455
|
|
|
399
456
|
request_options : typing.Optional[RequestOptions]
|
|
400
457
|
Request-specific configuration.
|
|
401
458
|
|
|
402
459
|
Returns
|
|
403
460
|
-------
|
|
404
|
-
AsyncHttpResponse[
|
|
405
|
-
|
|
461
|
+
AsyncHttpResponse[Invoice]
|
|
462
|
+
200
|
|
406
463
|
"""
|
|
407
464
|
_response = await self._client_wrapper.httpx_client.request(
|
|
408
|
-
f"
|
|
465
|
+
f"invoices/{jsonable_encoder(id)}",
|
|
409
466
|
method="GET",
|
|
410
|
-
params={
|
|
411
|
-
"externalId": external_id,
|
|
412
|
-
"limit": limit,
|
|
413
|
-
"offset": offset,
|
|
414
|
-
"startTime": serialize_datetime(start_time) if start_time is not None else None,
|
|
415
|
-
"endTime": serialize_datetime(end_time) if end_time is not None else None,
|
|
416
|
-
},
|
|
417
467
|
request_options=request_options,
|
|
418
468
|
)
|
|
419
469
|
try:
|
|
420
470
|
if 200 <= _response.status_code < 300:
|
|
421
471
|
_data = typing.cast(
|
|
422
|
-
|
|
472
|
+
Invoice,
|
|
423
473
|
parse_obj_as(
|
|
424
|
-
type_=
|
|
474
|
+
type_=Invoice, # type: ignore
|
|
425
475
|
object_=_response.json(),
|
|
426
476
|
),
|
|
427
477
|
)
|
|
428
478
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
429
|
-
if _response.status_code ==
|
|
430
|
-
raise
|
|
479
|
+
if _response.status_code == 403:
|
|
480
|
+
raise ForbiddenError(
|
|
431
481
|
headers=dict(_response.headers),
|
|
432
482
|
body=typing.cast(
|
|
433
|
-
|
|
483
|
+
ErrorResponse,
|
|
434
484
|
parse_obj_as(
|
|
435
|
-
type_=
|
|
485
|
+
type_=ErrorResponse, # type: ignore
|
|
436
486
|
object_=_response.json(),
|
|
437
487
|
),
|
|
438
488
|
),
|
|
439
489
|
)
|
|
440
|
-
if _response.status_code ==
|
|
441
|
-
raise
|
|
490
|
+
if _response.status_code == 404:
|
|
491
|
+
raise NotFoundError(
|
|
442
492
|
headers=dict(_response.headers),
|
|
443
493
|
body=typing.cast(
|
|
444
|
-
|
|
494
|
+
ErrorResponse,
|
|
445
495
|
parse_obj_as(
|
|
446
|
-
type_=
|
|
496
|
+
type_=ErrorResponse, # type: ignore
|
|
447
497
|
object_=_response.json(),
|
|
448
498
|
),
|
|
449
499
|
),
|
|
450
500
|
)
|
|
451
|
-
if _response.status_code ==
|
|
452
|
-
raise
|
|
501
|
+
if _response.status_code == 500:
|
|
502
|
+
raise InternalServerError(
|
|
453
503
|
headers=dict(_response.headers),
|
|
454
504
|
body=typing.cast(
|
|
455
|
-
|
|
505
|
+
ErrorResponse,
|
|
456
506
|
parse_obj_as(
|
|
457
|
-
type_=
|
|
507
|
+
type_=ErrorResponse, # type: ignore
|
|
458
508
|
object_=_response.json(),
|
|
459
509
|
),
|
|
460
510
|
),
|
|
@@ -464,45 +514,70 @@ class AsyncRawPlansClient:
|
|
|
464
514
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
465
515
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
466
516
|
|
|
467
|
-
async def
|
|
468
|
-
self,
|
|
469
|
-
|
|
517
|
+
async def update_invoice_by_id(
|
|
518
|
+
self,
|
|
519
|
+
id: str,
|
|
520
|
+
*,
|
|
521
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
522
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
523
|
+
) -> AsyncHttpResponse[Invoice]:
|
|
470
524
|
"""
|
|
525
|
+
Update an invoice by ID
|
|
526
|
+
|
|
471
527
|
Parameters
|
|
472
528
|
----------
|
|
473
|
-
|
|
474
|
-
|
|
529
|
+
id : str
|
|
530
|
+
|
|
531
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
475
532
|
|
|
476
533
|
request_options : typing.Optional[RequestOptions]
|
|
477
534
|
Request-specific configuration.
|
|
478
535
|
|
|
479
536
|
Returns
|
|
480
537
|
-------
|
|
481
|
-
AsyncHttpResponse[
|
|
482
|
-
|
|
538
|
+
AsyncHttpResponse[Invoice]
|
|
539
|
+
200
|
|
483
540
|
"""
|
|
484
541
|
_response = await self._client_wrapper.httpx_client.request(
|
|
485
|
-
f"
|
|
486
|
-
method="
|
|
542
|
+
f"invoices/{jsonable_encoder(id)}",
|
|
543
|
+
method="PUT",
|
|
544
|
+
json={
|
|
545
|
+
"metadata": metadata,
|
|
546
|
+
},
|
|
547
|
+
headers={
|
|
548
|
+
"content-type": "application/json",
|
|
549
|
+
},
|
|
487
550
|
request_options=request_options,
|
|
551
|
+
omit=OMIT,
|
|
488
552
|
)
|
|
489
553
|
try:
|
|
490
554
|
if 200 <= _response.status_code < 300:
|
|
491
555
|
_data = typing.cast(
|
|
492
|
-
|
|
556
|
+
Invoice,
|
|
493
557
|
parse_obj_as(
|
|
494
|
-
type_=
|
|
558
|
+
type_=Invoice, # type: ignore
|
|
495
559
|
object_=_response.json(),
|
|
496
560
|
),
|
|
497
561
|
)
|
|
498
562
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
563
|
+
if _response.status_code == 400:
|
|
564
|
+
raise BadRequestError(
|
|
565
|
+
headers=dict(_response.headers),
|
|
566
|
+
body=typing.cast(
|
|
567
|
+
ErrorResponse,
|
|
568
|
+
parse_obj_as(
|
|
569
|
+
type_=ErrorResponse, # type: ignore
|
|
570
|
+
object_=_response.json(),
|
|
571
|
+
),
|
|
572
|
+
),
|
|
573
|
+
)
|
|
499
574
|
if _response.status_code == 403:
|
|
500
575
|
raise ForbiddenError(
|
|
501
576
|
headers=dict(_response.headers),
|
|
502
577
|
body=typing.cast(
|
|
503
|
-
|
|
578
|
+
ErrorResponse,
|
|
504
579
|
parse_obj_as(
|
|
505
|
-
type_=
|
|
580
|
+
type_=ErrorResponse, # type: ignore
|
|
506
581
|
object_=_response.json(),
|
|
507
582
|
),
|
|
508
583
|
),
|
|
@@ -511,9 +586,20 @@ class AsyncRawPlansClient:
|
|
|
511
586
|
raise NotFoundError(
|
|
512
587
|
headers=dict(_response.headers),
|
|
513
588
|
body=typing.cast(
|
|
514
|
-
|
|
589
|
+
ErrorResponse,
|
|
590
|
+
parse_obj_as(
|
|
591
|
+
type_=ErrorResponse, # type: ignore
|
|
592
|
+
object_=_response.json(),
|
|
593
|
+
),
|
|
594
|
+
),
|
|
595
|
+
)
|
|
596
|
+
if _response.status_code == 500:
|
|
597
|
+
raise InternalServerError(
|
|
598
|
+
headers=dict(_response.headers),
|
|
599
|
+
body=typing.cast(
|
|
600
|
+
ErrorResponse,
|
|
515
601
|
parse_obj_as(
|
|
516
|
-
type_=
|
|
602
|
+
type_=ErrorResponse, # type: ignore
|
|
517
603
|
object_=_response.json(),
|
|
518
604
|
),
|
|
519
605
|
),
|
|
@@ -523,34 +609,48 @@ class AsyncRawPlansClient:
|
|
|
523
609
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
524
610
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
525
611
|
|
|
526
|
-
async def
|
|
527
|
-
self,
|
|
528
|
-
|
|
612
|
+
async def get_invoice_lines(
|
|
613
|
+
self,
|
|
614
|
+
id: str,
|
|
615
|
+
*,
|
|
616
|
+
limit: typing.Optional[int] = None,
|
|
617
|
+
offset: typing.Optional[int] = None,
|
|
618
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
619
|
+
) -> AsyncHttpResponse[InvoiceLinesResponse]:
|
|
529
620
|
"""
|
|
621
|
+
Get the invoice lines for an invoice by ID
|
|
622
|
+
|
|
530
623
|
Parameters
|
|
531
624
|
----------
|
|
532
|
-
|
|
533
|
-
|
|
625
|
+
id : str
|
|
626
|
+
|
|
627
|
+
limit : typing.Optional[int]
|
|
628
|
+
|
|
629
|
+
offset : typing.Optional[int]
|
|
534
630
|
|
|
535
631
|
request_options : typing.Optional[RequestOptions]
|
|
536
632
|
Request-specific configuration.
|
|
537
633
|
|
|
538
634
|
Returns
|
|
539
635
|
-------
|
|
540
|
-
AsyncHttpResponse[
|
|
541
|
-
|
|
636
|
+
AsyncHttpResponse[InvoiceLinesResponse]
|
|
637
|
+
200
|
|
542
638
|
"""
|
|
543
639
|
_response = await self._client_wrapper.httpx_client.request(
|
|
544
|
-
f"
|
|
640
|
+
f"invoices/{jsonable_encoder(id)}/lines",
|
|
545
641
|
method="GET",
|
|
642
|
+
params={
|
|
643
|
+
"limit": limit,
|
|
644
|
+
"offset": offset,
|
|
645
|
+
},
|
|
546
646
|
request_options=request_options,
|
|
547
647
|
)
|
|
548
648
|
try:
|
|
549
649
|
if 200 <= _response.status_code < 300:
|
|
550
650
|
_data = typing.cast(
|
|
551
|
-
|
|
651
|
+
InvoiceLinesResponse,
|
|
552
652
|
parse_obj_as(
|
|
553
|
-
type_=
|
|
653
|
+
type_=InvoiceLinesResponse, # type: ignore
|
|
554
654
|
object_=_response.json(),
|
|
555
655
|
),
|
|
556
656
|
)
|
|
@@ -559,9 +659,9 @@ class AsyncRawPlansClient:
|
|
|
559
659
|
raise ForbiddenError(
|
|
560
660
|
headers=dict(_response.headers),
|
|
561
661
|
body=typing.cast(
|
|
562
|
-
|
|
662
|
+
ErrorResponse,
|
|
563
663
|
parse_obj_as(
|
|
564
|
-
type_=
|
|
664
|
+
type_=ErrorResponse, # type: ignore
|
|
565
665
|
object_=_response.json(),
|
|
566
666
|
),
|
|
567
667
|
),
|
|
@@ -570,9 +670,20 @@ class AsyncRawPlansClient:
|
|
|
570
670
|
raise NotFoundError(
|
|
571
671
|
headers=dict(_response.headers),
|
|
572
672
|
body=typing.cast(
|
|
573
|
-
|
|
673
|
+
ErrorResponse,
|
|
674
|
+
parse_obj_as(
|
|
675
|
+
type_=ErrorResponse, # type: ignore
|
|
676
|
+
object_=_response.json(),
|
|
677
|
+
),
|
|
678
|
+
),
|
|
679
|
+
)
|
|
680
|
+
if _response.status_code == 500:
|
|
681
|
+
raise InternalServerError(
|
|
682
|
+
headers=dict(_response.headers),
|
|
683
|
+
body=typing.cast(
|
|
684
|
+
ErrorResponse,
|
|
574
685
|
parse_obj_as(
|
|
575
|
-
type_=
|
|
686
|
+
type_=ErrorResponse, # type: ignore
|
|
576
687
|
object_=_response.json(),
|
|
577
688
|
),
|
|
578
689
|
),
|