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.
- paid/__init__.py +61 -122
- paid/client.py +16 -22
- paid/contacts/client.py +415 -133
- paid/contacts/raw_client.py +1046 -118
- paid/core/client_wrapper.py +8 -10
- paid/customers/__init__.py +0 -3
- paid/customers/client.py +392 -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 +310 -201
- paid/orders/__init__.py +0 -3
- paid/orders/client.py +279 -471
- paid/orders/raw_client.py +551 -538
- 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 +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.0a1.dist-info}/METADATA +22 -8
- paid_python-1.0.0a1.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.0a1.dist-info}/LICENSE +0 -0
- {paid_python-1.0.0a0.dist-info → paid_python-1.0.0a1.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,66 @@ 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
|
-
plan_id: str,
|
|
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(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Invoice]:
|
|
96
111
|
"""
|
|
112
|
+
Get an invoice by its ID
|
|
113
|
+
|
|
97
114
|
Parameters
|
|
98
115
|
----------
|
|
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.
|
|
116
|
+
id : str
|
|
116
117
|
|
|
117
118
|
request_options : typing.Optional[RequestOptions]
|
|
118
119
|
Request-specific configuration.
|
|
119
120
|
|
|
120
121
|
Returns
|
|
121
122
|
-------
|
|
122
|
-
HttpResponse[
|
|
123
|
-
|
|
123
|
+
HttpResponse[Invoice]
|
|
124
|
+
200
|
|
124
125
|
"""
|
|
125
126
|
_response = self._client_wrapper.httpx_client.request(
|
|
126
|
-
f"
|
|
127
|
+
f"invoices/{jsonable_encoder(id)}",
|
|
127
128
|
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
129
|
request_options=request_options,
|
|
136
130
|
)
|
|
137
131
|
try:
|
|
138
132
|
if 200 <= _response.status_code < 300:
|
|
139
133
|
_data = typing.cast(
|
|
140
|
-
|
|
134
|
+
Invoice,
|
|
141
135
|
parse_obj_as(
|
|
142
|
-
type_=
|
|
136
|
+
type_=Invoice, # type: ignore
|
|
143
137
|
object_=_response.json(),
|
|
144
138
|
),
|
|
145
139
|
)
|
|
146
140
|
return HttpResponse(response=_response, data=_data)
|
|
147
|
-
if _response.status_code ==
|
|
148
|
-
raise
|
|
141
|
+
if _response.status_code == 403:
|
|
142
|
+
raise ForbiddenError(
|
|
149
143
|
headers=dict(_response.headers),
|
|
150
144
|
body=typing.cast(
|
|
151
|
-
|
|
145
|
+
ErrorResponse,
|
|
152
146
|
parse_obj_as(
|
|
153
|
-
type_=
|
|
147
|
+
type_=ErrorResponse, # type: ignore
|
|
154
148
|
object_=_response.json(),
|
|
155
149
|
),
|
|
156
150
|
),
|
|
157
151
|
)
|
|
158
|
-
if _response.status_code ==
|
|
159
|
-
raise
|
|
152
|
+
if _response.status_code == 404:
|
|
153
|
+
raise NotFoundError(
|
|
160
154
|
headers=dict(_response.headers),
|
|
161
155
|
body=typing.cast(
|
|
162
|
-
|
|
156
|
+
ErrorResponse,
|
|
163
157
|
parse_obj_as(
|
|
164
|
-
type_=
|
|
158
|
+
type_=ErrorResponse, # type: ignore
|
|
165
159
|
object_=_response.json(),
|
|
166
160
|
),
|
|
167
161
|
),
|
|
168
162
|
)
|
|
169
|
-
if _response.status_code ==
|
|
170
|
-
raise
|
|
163
|
+
if _response.status_code == 500:
|
|
164
|
+
raise InternalServerError(
|
|
171
165
|
headers=dict(_response.headers),
|
|
172
166
|
body=typing.cast(
|
|
173
|
-
|
|
167
|
+
ErrorResponse,
|
|
174
168
|
parse_obj_as(
|
|
175
|
-
type_=
|
|
169
|
+
type_=ErrorResponse, # type: ignore
|
|
176
170
|
object_=_response.json(),
|
|
177
171
|
),
|
|
178
172
|
),
|
|
@@ -182,45 +176,70 @@ class RawPlansClient:
|
|
|
182
176
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
183
177
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
184
178
|
|
|
185
|
-
def
|
|
186
|
-
self,
|
|
187
|
-
|
|
179
|
+
def update_invoice(
|
|
180
|
+
self,
|
|
181
|
+
id: str,
|
|
182
|
+
*,
|
|
183
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
184
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
185
|
+
) -> HttpResponse[Invoice]:
|
|
188
186
|
"""
|
|
187
|
+
Update an invoice by its ID (limited fields)
|
|
188
|
+
|
|
189
189
|
Parameters
|
|
190
190
|
----------
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
id : str
|
|
192
|
+
|
|
193
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
193
194
|
|
|
194
195
|
request_options : typing.Optional[RequestOptions]
|
|
195
196
|
Request-specific configuration.
|
|
196
197
|
|
|
197
198
|
Returns
|
|
198
199
|
-------
|
|
199
|
-
HttpResponse[
|
|
200
|
-
|
|
200
|
+
HttpResponse[Invoice]
|
|
201
|
+
200
|
|
201
202
|
"""
|
|
202
203
|
_response = self._client_wrapper.httpx_client.request(
|
|
203
|
-
f"
|
|
204
|
-
method="
|
|
204
|
+
f"invoices/{jsonable_encoder(id)}",
|
|
205
|
+
method="PUT",
|
|
206
|
+
json={
|
|
207
|
+
"metadata": metadata,
|
|
208
|
+
},
|
|
209
|
+
headers={
|
|
210
|
+
"content-type": "application/json",
|
|
211
|
+
},
|
|
205
212
|
request_options=request_options,
|
|
213
|
+
omit=OMIT,
|
|
206
214
|
)
|
|
207
215
|
try:
|
|
208
216
|
if 200 <= _response.status_code < 300:
|
|
209
217
|
_data = typing.cast(
|
|
210
|
-
|
|
218
|
+
Invoice,
|
|
211
219
|
parse_obj_as(
|
|
212
|
-
type_=
|
|
220
|
+
type_=Invoice, # type: ignore
|
|
213
221
|
object_=_response.json(),
|
|
214
222
|
),
|
|
215
223
|
)
|
|
216
224
|
return HttpResponse(response=_response, data=_data)
|
|
225
|
+
if _response.status_code == 400:
|
|
226
|
+
raise BadRequestError(
|
|
227
|
+
headers=dict(_response.headers),
|
|
228
|
+
body=typing.cast(
|
|
229
|
+
ErrorResponse,
|
|
230
|
+
parse_obj_as(
|
|
231
|
+
type_=ErrorResponse, # type: ignore
|
|
232
|
+
object_=_response.json(),
|
|
233
|
+
),
|
|
234
|
+
),
|
|
235
|
+
)
|
|
217
236
|
if _response.status_code == 403:
|
|
218
237
|
raise ForbiddenError(
|
|
219
238
|
headers=dict(_response.headers),
|
|
220
239
|
body=typing.cast(
|
|
221
|
-
|
|
240
|
+
ErrorResponse,
|
|
222
241
|
parse_obj_as(
|
|
223
|
-
type_=
|
|
242
|
+
type_=ErrorResponse, # type: ignore
|
|
224
243
|
object_=_response.json(),
|
|
225
244
|
),
|
|
226
245
|
),
|
|
@@ -229,9 +248,20 @@ class RawPlansClient:
|
|
|
229
248
|
raise NotFoundError(
|
|
230
249
|
headers=dict(_response.headers),
|
|
231
250
|
body=typing.cast(
|
|
232
|
-
|
|
251
|
+
ErrorResponse,
|
|
252
|
+
parse_obj_as(
|
|
253
|
+
type_=ErrorResponse, # type: ignore
|
|
254
|
+
object_=_response.json(),
|
|
255
|
+
),
|
|
256
|
+
),
|
|
257
|
+
)
|
|
258
|
+
if _response.status_code == 500:
|
|
259
|
+
raise InternalServerError(
|
|
260
|
+
headers=dict(_response.headers),
|
|
261
|
+
body=typing.cast(
|
|
262
|
+
ErrorResponse,
|
|
233
263
|
parse_obj_as(
|
|
234
|
-
type_=
|
|
264
|
+
type_=ErrorResponse, # type: ignore
|
|
235
265
|
object_=_response.json(),
|
|
236
266
|
),
|
|
237
267
|
),
|
|
@@ -241,34 +271,48 @@ class RawPlansClient:
|
|
|
241
271
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
242
272
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
243
273
|
|
|
244
|
-
def
|
|
245
|
-
self,
|
|
246
|
-
|
|
274
|
+
def get_invoice_lines(
|
|
275
|
+
self,
|
|
276
|
+
id: str,
|
|
277
|
+
*,
|
|
278
|
+
limit: typing.Optional[int] = None,
|
|
279
|
+
offset: typing.Optional[int] = None,
|
|
280
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
281
|
+
) -> HttpResponse[InvoiceLinesResponse]:
|
|
247
282
|
"""
|
|
283
|
+
Get the invoice lines for an invoice by its ID
|
|
284
|
+
|
|
248
285
|
Parameters
|
|
249
286
|
----------
|
|
250
|
-
|
|
251
|
-
|
|
287
|
+
id : str
|
|
288
|
+
|
|
289
|
+
limit : typing.Optional[int]
|
|
290
|
+
|
|
291
|
+
offset : typing.Optional[int]
|
|
252
292
|
|
|
253
293
|
request_options : typing.Optional[RequestOptions]
|
|
254
294
|
Request-specific configuration.
|
|
255
295
|
|
|
256
296
|
Returns
|
|
257
297
|
-------
|
|
258
|
-
HttpResponse[
|
|
259
|
-
|
|
298
|
+
HttpResponse[InvoiceLinesResponse]
|
|
299
|
+
200
|
|
260
300
|
"""
|
|
261
301
|
_response = self._client_wrapper.httpx_client.request(
|
|
262
|
-
f"
|
|
302
|
+
f"invoices/{jsonable_encoder(id)}/lines",
|
|
263
303
|
method="GET",
|
|
304
|
+
params={
|
|
305
|
+
"limit": limit,
|
|
306
|
+
"offset": offset,
|
|
307
|
+
},
|
|
264
308
|
request_options=request_options,
|
|
265
309
|
)
|
|
266
310
|
try:
|
|
267
311
|
if 200 <= _response.status_code < 300:
|
|
268
312
|
_data = typing.cast(
|
|
269
|
-
|
|
313
|
+
InvoiceLinesResponse,
|
|
270
314
|
parse_obj_as(
|
|
271
|
-
type_=
|
|
315
|
+
type_=InvoiceLinesResponse, # type: ignore
|
|
272
316
|
object_=_response.json(),
|
|
273
317
|
),
|
|
274
318
|
)
|
|
@@ -277,9 +321,9 @@ class RawPlansClient:
|
|
|
277
321
|
raise ForbiddenError(
|
|
278
322
|
headers=dict(_response.headers),
|
|
279
323
|
body=typing.cast(
|
|
280
|
-
|
|
324
|
+
ErrorResponse,
|
|
281
325
|
parse_obj_as(
|
|
282
|
-
type_=
|
|
326
|
+
type_=ErrorResponse, # type: ignore
|
|
283
327
|
object_=_response.json(),
|
|
284
328
|
),
|
|
285
329
|
),
|
|
@@ -288,9 +332,20 @@ class RawPlansClient:
|
|
|
288
332
|
raise NotFoundError(
|
|
289
333
|
headers=dict(_response.headers),
|
|
290
334
|
body=typing.cast(
|
|
291
|
-
|
|
335
|
+
ErrorResponse,
|
|
336
|
+
parse_obj_as(
|
|
337
|
+
type_=ErrorResponse, # type: ignore
|
|
338
|
+
object_=_response.json(),
|
|
339
|
+
),
|
|
340
|
+
),
|
|
341
|
+
)
|
|
342
|
+
if _response.status_code == 500:
|
|
343
|
+
raise InternalServerError(
|
|
344
|
+
headers=dict(_response.headers),
|
|
345
|
+
body=typing.cast(
|
|
346
|
+
ErrorResponse,
|
|
292
347
|
parse_obj_as(
|
|
293
|
-
type_=
|
|
348
|
+
type_=ErrorResponse, # type: ignore
|
|
294
349
|
object_=_response.json(),
|
|
295
350
|
),
|
|
296
351
|
),
|
|
@@ -301,60 +356,82 @@ class RawPlansClient:
|
|
|
301
356
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
302
357
|
|
|
303
358
|
|
|
304
|
-
class
|
|
359
|
+
class AsyncRawInvoicesClient:
|
|
305
360
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
306
361
|
self._client_wrapper = client_wrapper
|
|
307
362
|
|
|
308
|
-
async def
|
|
309
|
-
self,
|
|
310
|
-
|
|
363
|
+
async def list_invoices(
|
|
364
|
+
self,
|
|
365
|
+
*,
|
|
366
|
+
limit: typing.Optional[int] = None,
|
|
367
|
+
offset: typing.Optional[int] = None,
|
|
368
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
369
|
+
) -> AsyncHttpResponse[InvoiceListResponse]:
|
|
311
370
|
"""
|
|
371
|
+
Get a list of invoices for the organization
|
|
372
|
+
|
|
312
373
|
Parameters
|
|
313
374
|
----------
|
|
314
|
-
|
|
315
|
-
|
|
375
|
+
limit : typing.Optional[int]
|
|
376
|
+
|
|
377
|
+
offset : typing.Optional[int]
|
|
316
378
|
|
|
317
379
|
request_options : typing.Optional[RequestOptions]
|
|
318
380
|
Request-specific configuration.
|
|
319
381
|
|
|
320
382
|
Returns
|
|
321
383
|
-------
|
|
322
|
-
AsyncHttpResponse[
|
|
323
|
-
|
|
384
|
+
AsyncHttpResponse[InvoiceListResponse]
|
|
385
|
+
200
|
|
324
386
|
"""
|
|
325
387
|
_response = await self._client_wrapper.httpx_client.request(
|
|
326
|
-
|
|
388
|
+
"invoices/",
|
|
327
389
|
method="GET",
|
|
390
|
+
params={
|
|
391
|
+
"limit": limit,
|
|
392
|
+
"offset": offset,
|
|
393
|
+
},
|
|
328
394
|
request_options=request_options,
|
|
329
395
|
)
|
|
330
396
|
try:
|
|
331
397
|
if 200 <= _response.status_code < 300:
|
|
332
398
|
_data = typing.cast(
|
|
333
|
-
|
|
399
|
+
InvoiceListResponse,
|
|
334
400
|
parse_obj_as(
|
|
335
|
-
type_=
|
|
401
|
+
type_=InvoiceListResponse, # type: ignore
|
|
336
402
|
object_=_response.json(),
|
|
337
403
|
),
|
|
338
404
|
)
|
|
339
405
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
406
|
+
if _response.status_code == 400:
|
|
407
|
+
raise BadRequestError(
|
|
408
|
+
headers=dict(_response.headers),
|
|
409
|
+
body=typing.cast(
|
|
410
|
+
ErrorResponse,
|
|
411
|
+
parse_obj_as(
|
|
412
|
+
type_=ErrorResponse, # type: ignore
|
|
413
|
+
object_=_response.json(),
|
|
414
|
+
),
|
|
415
|
+
),
|
|
416
|
+
)
|
|
340
417
|
if _response.status_code == 403:
|
|
341
418
|
raise ForbiddenError(
|
|
342
419
|
headers=dict(_response.headers),
|
|
343
420
|
body=typing.cast(
|
|
344
|
-
|
|
421
|
+
ErrorResponse,
|
|
345
422
|
parse_obj_as(
|
|
346
|
-
type_=
|
|
423
|
+
type_=ErrorResponse, # type: ignore
|
|
347
424
|
object_=_response.json(),
|
|
348
425
|
),
|
|
349
426
|
),
|
|
350
427
|
)
|
|
351
|
-
if _response.status_code ==
|
|
352
|
-
raise
|
|
428
|
+
if _response.status_code == 500:
|
|
429
|
+
raise InternalServerError(
|
|
353
430
|
headers=dict(_response.headers),
|
|
354
431
|
body=typing.cast(
|
|
355
|
-
|
|
432
|
+
ErrorResponse,
|
|
356
433
|
parse_obj_as(
|
|
357
|
-
type_=
|
|
434
|
+
type_=ErrorResponse, # type: ignore
|
|
358
435
|
object_=_response.json(),
|
|
359
436
|
),
|
|
360
437
|
),
|
|
@@ -364,97 +441,68 @@ class AsyncRawPlansClient:
|
|
|
364
441
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
365
442
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
366
443
|
|
|
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]:
|
|
444
|
+
async def get_invoice(
|
|
445
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
446
|
+
) -> AsyncHttpResponse[Invoice]:
|
|
378
447
|
"""
|
|
448
|
+
Get an invoice by its ID
|
|
449
|
+
|
|
379
450
|
Parameters
|
|
380
451
|
----------
|
|
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.
|
|
452
|
+
id : str
|
|
398
453
|
|
|
399
454
|
request_options : typing.Optional[RequestOptions]
|
|
400
455
|
Request-specific configuration.
|
|
401
456
|
|
|
402
457
|
Returns
|
|
403
458
|
-------
|
|
404
|
-
AsyncHttpResponse[
|
|
405
|
-
|
|
459
|
+
AsyncHttpResponse[Invoice]
|
|
460
|
+
200
|
|
406
461
|
"""
|
|
407
462
|
_response = await self._client_wrapper.httpx_client.request(
|
|
408
|
-
f"
|
|
463
|
+
f"invoices/{jsonable_encoder(id)}",
|
|
409
464
|
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
465
|
request_options=request_options,
|
|
418
466
|
)
|
|
419
467
|
try:
|
|
420
468
|
if 200 <= _response.status_code < 300:
|
|
421
469
|
_data = typing.cast(
|
|
422
|
-
|
|
470
|
+
Invoice,
|
|
423
471
|
parse_obj_as(
|
|
424
|
-
type_=
|
|
472
|
+
type_=Invoice, # type: ignore
|
|
425
473
|
object_=_response.json(),
|
|
426
474
|
),
|
|
427
475
|
)
|
|
428
476
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
429
|
-
if _response.status_code ==
|
|
430
|
-
raise
|
|
477
|
+
if _response.status_code == 403:
|
|
478
|
+
raise ForbiddenError(
|
|
431
479
|
headers=dict(_response.headers),
|
|
432
480
|
body=typing.cast(
|
|
433
|
-
|
|
481
|
+
ErrorResponse,
|
|
434
482
|
parse_obj_as(
|
|
435
|
-
type_=
|
|
483
|
+
type_=ErrorResponse, # type: ignore
|
|
436
484
|
object_=_response.json(),
|
|
437
485
|
),
|
|
438
486
|
),
|
|
439
487
|
)
|
|
440
|
-
if _response.status_code ==
|
|
441
|
-
raise
|
|
488
|
+
if _response.status_code == 404:
|
|
489
|
+
raise NotFoundError(
|
|
442
490
|
headers=dict(_response.headers),
|
|
443
491
|
body=typing.cast(
|
|
444
|
-
|
|
492
|
+
ErrorResponse,
|
|
445
493
|
parse_obj_as(
|
|
446
|
-
type_=
|
|
494
|
+
type_=ErrorResponse, # type: ignore
|
|
447
495
|
object_=_response.json(),
|
|
448
496
|
),
|
|
449
497
|
),
|
|
450
498
|
)
|
|
451
|
-
if _response.status_code ==
|
|
452
|
-
raise
|
|
499
|
+
if _response.status_code == 500:
|
|
500
|
+
raise InternalServerError(
|
|
453
501
|
headers=dict(_response.headers),
|
|
454
502
|
body=typing.cast(
|
|
455
|
-
|
|
503
|
+
ErrorResponse,
|
|
456
504
|
parse_obj_as(
|
|
457
|
-
type_=
|
|
505
|
+
type_=ErrorResponse, # type: ignore
|
|
458
506
|
object_=_response.json(),
|
|
459
507
|
),
|
|
460
508
|
),
|
|
@@ -464,45 +512,70 @@ class AsyncRawPlansClient:
|
|
|
464
512
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
465
513
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
466
514
|
|
|
467
|
-
async def
|
|
468
|
-
self,
|
|
469
|
-
|
|
515
|
+
async def update_invoice(
|
|
516
|
+
self,
|
|
517
|
+
id: str,
|
|
518
|
+
*,
|
|
519
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
520
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
521
|
+
) -> AsyncHttpResponse[Invoice]:
|
|
470
522
|
"""
|
|
523
|
+
Update an invoice by its ID (limited fields)
|
|
524
|
+
|
|
471
525
|
Parameters
|
|
472
526
|
----------
|
|
473
|
-
|
|
474
|
-
|
|
527
|
+
id : str
|
|
528
|
+
|
|
529
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
475
530
|
|
|
476
531
|
request_options : typing.Optional[RequestOptions]
|
|
477
532
|
Request-specific configuration.
|
|
478
533
|
|
|
479
534
|
Returns
|
|
480
535
|
-------
|
|
481
|
-
AsyncHttpResponse[
|
|
482
|
-
|
|
536
|
+
AsyncHttpResponse[Invoice]
|
|
537
|
+
200
|
|
483
538
|
"""
|
|
484
539
|
_response = await self._client_wrapper.httpx_client.request(
|
|
485
|
-
f"
|
|
486
|
-
method="
|
|
540
|
+
f"invoices/{jsonable_encoder(id)}",
|
|
541
|
+
method="PUT",
|
|
542
|
+
json={
|
|
543
|
+
"metadata": metadata,
|
|
544
|
+
},
|
|
545
|
+
headers={
|
|
546
|
+
"content-type": "application/json",
|
|
547
|
+
},
|
|
487
548
|
request_options=request_options,
|
|
549
|
+
omit=OMIT,
|
|
488
550
|
)
|
|
489
551
|
try:
|
|
490
552
|
if 200 <= _response.status_code < 300:
|
|
491
553
|
_data = typing.cast(
|
|
492
|
-
|
|
554
|
+
Invoice,
|
|
493
555
|
parse_obj_as(
|
|
494
|
-
type_=
|
|
556
|
+
type_=Invoice, # type: ignore
|
|
495
557
|
object_=_response.json(),
|
|
496
558
|
),
|
|
497
559
|
)
|
|
498
560
|
return AsyncHttpResponse(response=_response, data=_data)
|
|
561
|
+
if _response.status_code == 400:
|
|
562
|
+
raise BadRequestError(
|
|
563
|
+
headers=dict(_response.headers),
|
|
564
|
+
body=typing.cast(
|
|
565
|
+
ErrorResponse,
|
|
566
|
+
parse_obj_as(
|
|
567
|
+
type_=ErrorResponse, # type: ignore
|
|
568
|
+
object_=_response.json(),
|
|
569
|
+
),
|
|
570
|
+
),
|
|
571
|
+
)
|
|
499
572
|
if _response.status_code == 403:
|
|
500
573
|
raise ForbiddenError(
|
|
501
574
|
headers=dict(_response.headers),
|
|
502
575
|
body=typing.cast(
|
|
503
|
-
|
|
576
|
+
ErrorResponse,
|
|
504
577
|
parse_obj_as(
|
|
505
|
-
type_=
|
|
578
|
+
type_=ErrorResponse, # type: ignore
|
|
506
579
|
object_=_response.json(),
|
|
507
580
|
),
|
|
508
581
|
),
|
|
@@ -511,9 +584,20 @@ class AsyncRawPlansClient:
|
|
|
511
584
|
raise NotFoundError(
|
|
512
585
|
headers=dict(_response.headers),
|
|
513
586
|
body=typing.cast(
|
|
514
|
-
|
|
587
|
+
ErrorResponse,
|
|
588
|
+
parse_obj_as(
|
|
589
|
+
type_=ErrorResponse, # type: ignore
|
|
590
|
+
object_=_response.json(),
|
|
591
|
+
),
|
|
592
|
+
),
|
|
593
|
+
)
|
|
594
|
+
if _response.status_code == 500:
|
|
595
|
+
raise InternalServerError(
|
|
596
|
+
headers=dict(_response.headers),
|
|
597
|
+
body=typing.cast(
|
|
598
|
+
ErrorResponse,
|
|
515
599
|
parse_obj_as(
|
|
516
|
-
type_=
|
|
600
|
+
type_=ErrorResponse, # type: ignore
|
|
517
601
|
object_=_response.json(),
|
|
518
602
|
),
|
|
519
603
|
),
|
|
@@ -523,34 +607,48 @@ class AsyncRawPlansClient:
|
|
|
523
607
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
524
608
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
525
609
|
|
|
526
|
-
async def
|
|
527
|
-
self,
|
|
528
|
-
|
|
610
|
+
async def get_invoice_lines(
|
|
611
|
+
self,
|
|
612
|
+
id: str,
|
|
613
|
+
*,
|
|
614
|
+
limit: typing.Optional[int] = None,
|
|
615
|
+
offset: typing.Optional[int] = None,
|
|
616
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
617
|
+
) -> AsyncHttpResponse[InvoiceLinesResponse]:
|
|
529
618
|
"""
|
|
619
|
+
Get the invoice lines for an invoice by its ID
|
|
620
|
+
|
|
530
621
|
Parameters
|
|
531
622
|
----------
|
|
532
|
-
|
|
533
|
-
|
|
623
|
+
id : str
|
|
624
|
+
|
|
625
|
+
limit : typing.Optional[int]
|
|
626
|
+
|
|
627
|
+
offset : typing.Optional[int]
|
|
534
628
|
|
|
535
629
|
request_options : typing.Optional[RequestOptions]
|
|
536
630
|
Request-specific configuration.
|
|
537
631
|
|
|
538
632
|
Returns
|
|
539
633
|
-------
|
|
540
|
-
AsyncHttpResponse[
|
|
541
|
-
|
|
634
|
+
AsyncHttpResponse[InvoiceLinesResponse]
|
|
635
|
+
200
|
|
542
636
|
"""
|
|
543
637
|
_response = await self._client_wrapper.httpx_client.request(
|
|
544
|
-
f"
|
|
638
|
+
f"invoices/{jsonable_encoder(id)}/lines",
|
|
545
639
|
method="GET",
|
|
640
|
+
params={
|
|
641
|
+
"limit": limit,
|
|
642
|
+
"offset": offset,
|
|
643
|
+
},
|
|
546
644
|
request_options=request_options,
|
|
547
645
|
)
|
|
548
646
|
try:
|
|
549
647
|
if 200 <= _response.status_code < 300:
|
|
550
648
|
_data = typing.cast(
|
|
551
|
-
|
|
649
|
+
InvoiceLinesResponse,
|
|
552
650
|
parse_obj_as(
|
|
553
|
-
type_=
|
|
651
|
+
type_=InvoiceLinesResponse, # type: ignore
|
|
554
652
|
object_=_response.json(),
|
|
555
653
|
),
|
|
556
654
|
)
|
|
@@ -559,9 +657,9 @@ class AsyncRawPlansClient:
|
|
|
559
657
|
raise ForbiddenError(
|
|
560
658
|
headers=dict(_response.headers),
|
|
561
659
|
body=typing.cast(
|
|
562
|
-
|
|
660
|
+
ErrorResponse,
|
|
563
661
|
parse_obj_as(
|
|
564
|
-
type_=
|
|
662
|
+
type_=ErrorResponse, # type: ignore
|
|
565
663
|
object_=_response.json(),
|
|
566
664
|
),
|
|
567
665
|
),
|
|
@@ -570,9 +668,20 @@ class AsyncRawPlansClient:
|
|
|
570
668
|
raise NotFoundError(
|
|
571
669
|
headers=dict(_response.headers),
|
|
572
670
|
body=typing.cast(
|
|
573
|
-
|
|
671
|
+
ErrorResponse,
|
|
672
|
+
parse_obj_as(
|
|
673
|
+
type_=ErrorResponse, # type: ignore
|
|
674
|
+
object_=_response.json(),
|
|
675
|
+
),
|
|
676
|
+
),
|
|
677
|
+
)
|
|
678
|
+
if _response.status_code == 500:
|
|
679
|
+
raise InternalServerError(
|
|
680
|
+
headers=dict(_response.headers),
|
|
681
|
+
body=typing.cast(
|
|
682
|
+
ErrorResponse,
|
|
574
683
|
parse_obj_as(
|
|
575
|
-
type_=
|
|
684
|
+
type_=ErrorResponse, # type: ignore
|
|
576
685
|
object_=_response.json(),
|
|
577
686
|
),
|
|
578
687
|
),
|