paid-python 0.4.1a0__py3-none-any.whl → 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- paid/__init__.py +44 -4
- paid/agents/client.py +32 -0
- paid/agents/raw_client.py +32 -0
- paid/client.py +25 -2
- paid/core/client_wrapper.py +2 -3
- paid/customers/client.py +168 -36
- paid/customers/raw_client.py +217 -36
- paid/errors/__init__.py +2 -1
- paid/errors/internal_server_error.py +11 -0
- paid/orders/client.py +10 -0
- paid/orders/lines/client.py +0 -4
- paid/orders/raw_client.py +10 -0
- paid/plans/__init__.py +4 -0
- paid/plans/client.py +332 -0
- paid/plans/raw_client.py +464 -0
- paid/products/__init__.py +7 -0
- paid/products/client.py +788 -0
- paid/products/raw_client.py +807 -0
- paid/products/types/__init__.py +7 -0
- paid/products/types/product_create_type.py +5 -0
- paid/traces/__init__.py +4 -0
- paid/traces/client.py +218 -0
- paid/traces/raw_client.py +226 -0
- paid/tracing/context_manager.py +9 -4
- paid/types/__init__.py +34 -2
- paid/types/cost_trace.py +6 -1
- paid/types/customer.py +4 -3
- paid/types/customer_update.py +4 -2
- paid/types/order_line_attribute_create_one.py +5 -0
- paid/types/order_line_create.py +26 -5
- paid/types/pagination_meta.py +26 -0
- paid/types/plan.py +81 -0
- paid/types/plan_group.py +60 -0
- paid/types/plan_plan_products_item.py +35 -0
- paid/types/plan_plan_products_item_plan_product_attribute_item.py +34 -0
- paid/types/product.py +56 -0
- paid/types/product_type.py +5 -0
- paid/types/product_update.py +36 -0
- paid/types/product_update_type.py +5 -0
- paid/types/signal.py +17 -5
- paid/types/signal_v_2.py +56 -0
- paid/types/trace.py +69 -0
- paid/types/traces_response.py +26 -0
- paid/types/{order_line_attribute_create.py → usage_pagination_meta.py} +16 -8
- paid/types/usage_summaries_response.py +26 -0
- paid/types/usage_summary.py +121 -0
- paid/types/usage_summary_order.py +26 -0
- paid/types/usage_summary_order_line.py +26 -0
- paid/usage/__init__.py +3 -0
- paid/usage/client.py +206 -0
- paid/usage/raw_client.py +283 -0
- paid/usage/types/__init__.py +7 -0
- paid/usage/types/usage_check_usage_response.py +53 -0
- {paid_python-0.4.1a0.dist-info → paid_python-0.6.0.dist-info}/METADATA +20 -20
- {paid_python-0.4.1a0.dist-info → paid_python-0.6.0.dist-info}/RECORD +57 -27
- {paid_python-0.4.1a0.dist-info → paid_python-0.6.0.dist-info}/LICENSE +0 -0
- {paid_python-0.4.1a0.dist-info → paid_python-0.6.0.dist-info}/WHEEL +0 -0
paid/customers/raw_client.py
CHANGED
|
@@ -22,6 +22,7 @@ from ..types.customer import Customer
|
|
|
22
22
|
from ..types.entitlement_usage import EntitlementUsage
|
|
23
23
|
from ..types.error import Error
|
|
24
24
|
from ..types.tax_exempt_status import TaxExemptStatus
|
|
25
|
+
from ..types.usage_summaries_response import UsageSummariesResponse
|
|
25
26
|
|
|
26
27
|
# this is used as the default value for optional parameters
|
|
27
28
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -67,7 +68,6 @@ class RawCustomersClient:
|
|
|
67
68
|
self,
|
|
68
69
|
*,
|
|
69
70
|
name: str,
|
|
70
|
-
email: typing.Optional[str] = OMIT,
|
|
71
71
|
external_id: typing.Optional[str] = OMIT,
|
|
72
72
|
phone: typing.Optional[str] = OMIT,
|
|
73
73
|
employee_count: typing.Optional[float] = OMIT,
|
|
@@ -76,6 +76,7 @@ class RawCustomersClient:
|
|
|
76
76
|
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
77
77
|
website: typing.Optional[str] = OMIT,
|
|
78
78
|
billing_address: typing.Optional[Address] = OMIT,
|
|
79
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
79
80
|
request_options: typing.Optional[RequestOptions] = None,
|
|
80
81
|
) -> HttpResponse[Customer]:
|
|
81
82
|
"""
|
|
@@ -83,8 +84,6 @@ class RawCustomersClient:
|
|
|
83
84
|
----------
|
|
84
85
|
name : str
|
|
85
86
|
|
|
86
|
-
email : typing.Optional[str]
|
|
87
|
-
|
|
88
87
|
external_id : typing.Optional[str]
|
|
89
88
|
|
|
90
89
|
phone : typing.Optional[str]
|
|
@@ -101,6 +100,9 @@ class RawCustomersClient:
|
|
|
101
100
|
|
|
102
101
|
billing_address : typing.Optional[Address]
|
|
103
102
|
|
|
103
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
104
|
+
Flexible JSON field for storing custom metadata about the customer
|
|
105
|
+
|
|
104
106
|
request_options : typing.Optional[RequestOptions]
|
|
105
107
|
Request-specific configuration.
|
|
106
108
|
|
|
@@ -114,7 +116,6 @@ class RawCustomersClient:
|
|
|
114
116
|
method="POST",
|
|
115
117
|
json={
|
|
116
118
|
"name": name,
|
|
117
|
-
"email": email,
|
|
118
119
|
"externalId": external_id,
|
|
119
120
|
"phone": phone,
|
|
120
121
|
"employeeCount": employee_count,
|
|
@@ -125,6 +126,7 @@ class RawCustomersClient:
|
|
|
125
126
|
"billingAddress": convert_and_respect_annotation_metadata(
|
|
126
127
|
object_=billing_address, annotation=Address, direction="write"
|
|
127
128
|
),
|
|
129
|
+
"metadata": metadata,
|
|
128
130
|
},
|
|
129
131
|
headers={
|
|
130
132
|
"content-type": "application/json",
|
|
@@ -188,7 +190,6 @@ class RawCustomersClient:
|
|
|
188
190
|
customer_id: str,
|
|
189
191
|
*,
|
|
190
192
|
name: typing.Optional[str] = OMIT,
|
|
191
|
-
email: typing.Optional[str] = OMIT,
|
|
192
193
|
external_id: typing.Optional[str] = OMIT,
|
|
193
194
|
phone: typing.Optional[str] = OMIT,
|
|
194
195
|
employee_count: typing.Optional[float] = OMIT,
|
|
@@ -197,7 +198,7 @@ class RawCustomersClient:
|
|
|
197
198
|
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
198
199
|
website: typing.Optional[str] = OMIT,
|
|
199
200
|
billing_address: typing.Optional[Address] = OMIT,
|
|
200
|
-
|
|
201
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
201
202
|
request_options: typing.Optional[RequestOptions] = None,
|
|
202
203
|
) -> HttpResponse[Customer]:
|
|
203
204
|
"""
|
|
@@ -207,8 +208,6 @@ class RawCustomersClient:
|
|
|
207
208
|
|
|
208
209
|
name : typing.Optional[str]
|
|
209
210
|
|
|
210
|
-
email : typing.Optional[str]
|
|
211
|
-
|
|
212
211
|
external_id : typing.Optional[str]
|
|
213
212
|
|
|
214
213
|
phone : typing.Optional[str]
|
|
@@ -225,7 +224,8 @@ class RawCustomersClient:
|
|
|
225
224
|
|
|
226
225
|
billing_address : typing.Optional[Address]
|
|
227
226
|
|
|
228
|
-
|
|
227
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
228
|
+
Flexible JSON field for storing custom metadata about the customer
|
|
229
229
|
|
|
230
230
|
request_options : typing.Optional[RequestOptions]
|
|
231
231
|
Request-specific configuration.
|
|
@@ -240,7 +240,6 @@ class RawCustomersClient:
|
|
|
240
240
|
method="PUT",
|
|
241
241
|
json={
|
|
242
242
|
"name": name,
|
|
243
|
-
"email": email,
|
|
244
243
|
"externalId": external_id,
|
|
245
244
|
"phone": phone,
|
|
246
245
|
"employeeCount": employee_count,
|
|
@@ -251,7 +250,7 @@ class RawCustomersClient:
|
|
|
251
250
|
"billingAddress": convert_and_respect_annotation_metadata(
|
|
252
251
|
object_=billing_address, annotation=Address, direction="write"
|
|
253
252
|
),
|
|
254
|
-
"
|
|
253
|
+
"metadata": metadata,
|
|
255
254
|
},
|
|
256
255
|
headers={
|
|
257
256
|
"content-type": "application/json",
|
|
@@ -391,7 +390,6 @@ class RawCustomersClient:
|
|
|
391
390
|
external_id_: str,
|
|
392
391
|
*,
|
|
393
392
|
name: typing.Optional[str] = OMIT,
|
|
394
|
-
email: typing.Optional[str] = OMIT,
|
|
395
393
|
external_id: typing.Optional[str] = OMIT,
|
|
396
394
|
phone: typing.Optional[str] = OMIT,
|
|
397
395
|
employee_count: typing.Optional[float] = OMIT,
|
|
@@ -400,7 +398,7 @@ class RawCustomersClient:
|
|
|
400
398
|
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
401
399
|
website: typing.Optional[str] = OMIT,
|
|
402
400
|
billing_address: typing.Optional[Address] = OMIT,
|
|
403
|
-
|
|
401
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
404
402
|
request_options: typing.Optional[RequestOptions] = None,
|
|
405
403
|
) -> HttpResponse[Customer]:
|
|
406
404
|
"""
|
|
@@ -410,8 +408,6 @@ class RawCustomersClient:
|
|
|
410
408
|
|
|
411
409
|
name : typing.Optional[str]
|
|
412
410
|
|
|
413
|
-
email : typing.Optional[str]
|
|
414
|
-
|
|
415
411
|
external_id : typing.Optional[str]
|
|
416
412
|
|
|
417
413
|
phone : typing.Optional[str]
|
|
@@ -428,7 +424,8 @@ class RawCustomersClient:
|
|
|
428
424
|
|
|
429
425
|
billing_address : typing.Optional[Address]
|
|
430
426
|
|
|
431
|
-
|
|
427
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
428
|
+
Flexible JSON field for storing custom metadata about the customer
|
|
432
429
|
|
|
433
430
|
request_options : typing.Optional[RequestOptions]
|
|
434
431
|
Request-specific configuration.
|
|
@@ -443,7 +440,6 @@ class RawCustomersClient:
|
|
|
443
440
|
method="PUT",
|
|
444
441
|
json={
|
|
445
442
|
"name": name,
|
|
446
|
-
"email": email,
|
|
447
443
|
"externalId": external_id,
|
|
448
444
|
"phone": phone,
|
|
449
445
|
"employeeCount": employee_count,
|
|
@@ -454,7 +450,7 @@ class RawCustomersClient:
|
|
|
454
450
|
"billingAddress": convert_and_respect_annotation_metadata(
|
|
455
451
|
object_=billing_address, annotation=Address, direction="write"
|
|
456
452
|
),
|
|
457
|
-
"
|
|
453
|
+
"metadata": metadata,
|
|
458
454
|
},
|
|
459
455
|
headers={
|
|
460
456
|
"content-type": "application/json",
|
|
@@ -600,6 +596,101 @@ class RawCustomersClient:
|
|
|
600
596
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
601
597
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
602
598
|
|
|
599
|
+
def get_usage_by_external_id(
|
|
600
|
+
self,
|
|
601
|
+
external_id: str,
|
|
602
|
+
*,
|
|
603
|
+
limit: typing.Optional[int] = None,
|
|
604
|
+
offset: typing.Optional[int] = None,
|
|
605
|
+
start_time: typing.Optional[dt.datetime] = None,
|
|
606
|
+
end_time: typing.Optional[dt.datetime] = None,
|
|
607
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
608
|
+
) -> HttpResponse[UsageSummariesResponse]:
|
|
609
|
+
"""
|
|
610
|
+
Parameters
|
|
611
|
+
----------
|
|
612
|
+
external_id : str
|
|
613
|
+
The external ID of the customer
|
|
614
|
+
|
|
615
|
+
limit : typing.Optional[int]
|
|
616
|
+
Maximum number of usage summaries to return (1-1000)
|
|
617
|
+
|
|
618
|
+
offset : typing.Optional[int]
|
|
619
|
+
Number of usage summaries to skip for pagination
|
|
620
|
+
|
|
621
|
+
start_time : typing.Optional[dt.datetime]
|
|
622
|
+
Filter usage summaries starting from this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
623
|
+
|
|
624
|
+
end_time : typing.Optional[dt.datetime]
|
|
625
|
+
Filter usage summaries up to this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
626
|
+
|
|
627
|
+
request_options : typing.Optional[RequestOptions]
|
|
628
|
+
Request-specific configuration.
|
|
629
|
+
|
|
630
|
+
Returns
|
|
631
|
+
-------
|
|
632
|
+
HttpResponse[UsageSummariesResponse]
|
|
633
|
+
Success response
|
|
634
|
+
"""
|
|
635
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
636
|
+
f"customers/external/{jsonable_encoder(external_id)}/usage",
|
|
637
|
+
method="GET",
|
|
638
|
+
params={
|
|
639
|
+
"limit": limit,
|
|
640
|
+
"offset": offset,
|
|
641
|
+
"startTime": serialize_datetime(start_time) if start_time is not None else None,
|
|
642
|
+
"endTime": serialize_datetime(end_time) if end_time is not None else None,
|
|
643
|
+
},
|
|
644
|
+
request_options=request_options,
|
|
645
|
+
)
|
|
646
|
+
try:
|
|
647
|
+
if 200 <= _response.status_code < 300:
|
|
648
|
+
_data = typing.cast(
|
|
649
|
+
UsageSummariesResponse,
|
|
650
|
+
parse_obj_as(
|
|
651
|
+
type_=UsageSummariesResponse, # type: ignore
|
|
652
|
+
object_=_response.json(),
|
|
653
|
+
),
|
|
654
|
+
)
|
|
655
|
+
return HttpResponse(response=_response, data=_data)
|
|
656
|
+
if _response.status_code == 400:
|
|
657
|
+
raise BadRequestError(
|
|
658
|
+
headers=dict(_response.headers),
|
|
659
|
+
body=typing.cast(
|
|
660
|
+
Error,
|
|
661
|
+
parse_obj_as(
|
|
662
|
+
type_=Error, # type: ignore
|
|
663
|
+
object_=_response.json(),
|
|
664
|
+
),
|
|
665
|
+
),
|
|
666
|
+
)
|
|
667
|
+
if _response.status_code == 403:
|
|
668
|
+
raise ForbiddenError(
|
|
669
|
+
headers=dict(_response.headers),
|
|
670
|
+
body=typing.cast(
|
|
671
|
+
Error,
|
|
672
|
+
parse_obj_as(
|
|
673
|
+
type_=Error, # type: ignore
|
|
674
|
+
object_=_response.json(),
|
|
675
|
+
),
|
|
676
|
+
),
|
|
677
|
+
)
|
|
678
|
+
if _response.status_code == 404:
|
|
679
|
+
raise NotFoundError(
|
|
680
|
+
headers=dict(_response.headers),
|
|
681
|
+
body=typing.cast(
|
|
682
|
+
Error,
|
|
683
|
+
parse_obj_as(
|
|
684
|
+
type_=Error, # type: ignore
|
|
685
|
+
object_=_response.json(),
|
|
686
|
+
),
|
|
687
|
+
),
|
|
688
|
+
)
|
|
689
|
+
_response_json = _response.json()
|
|
690
|
+
except JSONDecodeError:
|
|
691
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
692
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
693
|
+
|
|
603
694
|
|
|
604
695
|
class AsyncRawCustomersClient:
|
|
605
696
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -643,7 +734,6 @@ class AsyncRawCustomersClient:
|
|
|
643
734
|
self,
|
|
644
735
|
*,
|
|
645
736
|
name: str,
|
|
646
|
-
email: typing.Optional[str] = OMIT,
|
|
647
737
|
external_id: typing.Optional[str] = OMIT,
|
|
648
738
|
phone: typing.Optional[str] = OMIT,
|
|
649
739
|
employee_count: typing.Optional[float] = OMIT,
|
|
@@ -652,6 +742,7 @@ class AsyncRawCustomersClient:
|
|
|
652
742
|
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
653
743
|
website: typing.Optional[str] = OMIT,
|
|
654
744
|
billing_address: typing.Optional[Address] = OMIT,
|
|
745
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
655
746
|
request_options: typing.Optional[RequestOptions] = None,
|
|
656
747
|
) -> AsyncHttpResponse[Customer]:
|
|
657
748
|
"""
|
|
@@ -659,8 +750,6 @@ class AsyncRawCustomersClient:
|
|
|
659
750
|
----------
|
|
660
751
|
name : str
|
|
661
752
|
|
|
662
|
-
email : typing.Optional[str]
|
|
663
|
-
|
|
664
753
|
external_id : typing.Optional[str]
|
|
665
754
|
|
|
666
755
|
phone : typing.Optional[str]
|
|
@@ -677,6 +766,9 @@ class AsyncRawCustomersClient:
|
|
|
677
766
|
|
|
678
767
|
billing_address : typing.Optional[Address]
|
|
679
768
|
|
|
769
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
770
|
+
Flexible JSON field for storing custom metadata about the customer
|
|
771
|
+
|
|
680
772
|
request_options : typing.Optional[RequestOptions]
|
|
681
773
|
Request-specific configuration.
|
|
682
774
|
|
|
@@ -690,7 +782,6 @@ class AsyncRawCustomersClient:
|
|
|
690
782
|
method="POST",
|
|
691
783
|
json={
|
|
692
784
|
"name": name,
|
|
693
|
-
"email": email,
|
|
694
785
|
"externalId": external_id,
|
|
695
786
|
"phone": phone,
|
|
696
787
|
"employeeCount": employee_count,
|
|
@@ -701,6 +792,7 @@ class AsyncRawCustomersClient:
|
|
|
701
792
|
"billingAddress": convert_and_respect_annotation_metadata(
|
|
702
793
|
object_=billing_address, annotation=Address, direction="write"
|
|
703
794
|
),
|
|
795
|
+
"metadata": metadata,
|
|
704
796
|
},
|
|
705
797
|
headers={
|
|
706
798
|
"content-type": "application/json",
|
|
@@ -764,7 +856,6 @@ class AsyncRawCustomersClient:
|
|
|
764
856
|
customer_id: str,
|
|
765
857
|
*,
|
|
766
858
|
name: typing.Optional[str] = OMIT,
|
|
767
|
-
email: typing.Optional[str] = OMIT,
|
|
768
859
|
external_id: typing.Optional[str] = OMIT,
|
|
769
860
|
phone: typing.Optional[str] = OMIT,
|
|
770
861
|
employee_count: typing.Optional[float] = OMIT,
|
|
@@ -773,7 +864,7 @@ class AsyncRawCustomersClient:
|
|
|
773
864
|
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
774
865
|
website: typing.Optional[str] = OMIT,
|
|
775
866
|
billing_address: typing.Optional[Address] = OMIT,
|
|
776
|
-
|
|
867
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
777
868
|
request_options: typing.Optional[RequestOptions] = None,
|
|
778
869
|
) -> AsyncHttpResponse[Customer]:
|
|
779
870
|
"""
|
|
@@ -783,8 +874,6 @@ class AsyncRawCustomersClient:
|
|
|
783
874
|
|
|
784
875
|
name : typing.Optional[str]
|
|
785
876
|
|
|
786
|
-
email : typing.Optional[str]
|
|
787
|
-
|
|
788
877
|
external_id : typing.Optional[str]
|
|
789
878
|
|
|
790
879
|
phone : typing.Optional[str]
|
|
@@ -801,7 +890,8 @@ class AsyncRawCustomersClient:
|
|
|
801
890
|
|
|
802
891
|
billing_address : typing.Optional[Address]
|
|
803
892
|
|
|
804
|
-
|
|
893
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
894
|
+
Flexible JSON field for storing custom metadata about the customer
|
|
805
895
|
|
|
806
896
|
request_options : typing.Optional[RequestOptions]
|
|
807
897
|
Request-specific configuration.
|
|
@@ -816,7 +906,6 @@ class AsyncRawCustomersClient:
|
|
|
816
906
|
method="PUT",
|
|
817
907
|
json={
|
|
818
908
|
"name": name,
|
|
819
|
-
"email": email,
|
|
820
909
|
"externalId": external_id,
|
|
821
910
|
"phone": phone,
|
|
822
911
|
"employeeCount": employee_count,
|
|
@@ -827,7 +916,7 @@ class AsyncRawCustomersClient:
|
|
|
827
916
|
"billingAddress": convert_and_respect_annotation_metadata(
|
|
828
917
|
object_=billing_address, annotation=Address, direction="write"
|
|
829
918
|
),
|
|
830
|
-
"
|
|
919
|
+
"metadata": metadata,
|
|
831
920
|
},
|
|
832
921
|
headers={
|
|
833
922
|
"content-type": "application/json",
|
|
@@ -967,7 +1056,6 @@ class AsyncRawCustomersClient:
|
|
|
967
1056
|
external_id_: str,
|
|
968
1057
|
*,
|
|
969
1058
|
name: typing.Optional[str] = OMIT,
|
|
970
|
-
email: typing.Optional[str] = OMIT,
|
|
971
1059
|
external_id: typing.Optional[str] = OMIT,
|
|
972
1060
|
phone: typing.Optional[str] = OMIT,
|
|
973
1061
|
employee_count: typing.Optional[float] = OMIT,
|
|
@@ -976,7 +1064,7 @@ class AsyncRawCustomersClient:
|
|
|
976
1064
|
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
977
1065
|
website: typing.Optional[str] = OMIT,
|
|
978
1066
|
billing_address: typing.Optional[Address] = OMIT,
|
|
979
|
-
|
|
1067
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
980
1068
|
request_options: typing.Optional[RequestOptions] = None,
|
|
981
1069
|
) -> AsyncHttpResponse[Customer]:
|
|
982
1070
|
"""
|
|
@@ -986,8 +1074,6 @@ class AsyncRawCustomersClient:
|
|
|
986
1074
|
|
|
987
1075
|
name : typing.Optional[str]
|
|
988
1076
|
|
|
989
|
-
email : typing.Optional[str]
|
|
990
|
-
|
|
991
1077
|
external_id : typing.Optional[str]
|
|
992
1078
|
|
|
993
1079
|
phone : typing.Optional[str]
|
|
@@ -1004,7 +1090,8 @@ class AsyncRawCustomersClient:
|
|
|
1004
1090
|
|
|
1005
1091
|
billing_address : typing.Optional[Address]
|
|
1006
1092
|
|
|
1007
|
-
|
|
1093
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
1094
|
+
Flexible JSON field for storing custom metadata about the customer
|
|
1008
1095
|
|
|
1009
1096
|
request_options : typing.Optional[RequestOptions]
|
|
1010
1097
|
Request-specific configuration.
|
|
@@ -1019,7 +1106,6 @@ class AsyncRawCustomersClient:
|
|
|
1019
1106
|
method="PUT",
|
|
1020
1107
|
json={
|
|
1021
1108
|
"name": name,
|
|
1022
|
-
"email": email,
|
|
1023
1109
|
"externalId": external_id,
|
|
1024
1110
|
"phone": phone,
|
|
1025
1111
|
"employeeCount": employee_count,
|
|
@@ -1030,7 +1116,7 @@ class AsyncRawCustomersClient:
|
|
|
1030
1116
|
"billingAddress": convert_and_respect_annotation_metadata(
|
|
1031
1117
|
object_=billing_address, annotation=Address, direction="write"
|
|
1032
1118
|
),
|
|
1033
|
-
"
|
|
1119
|
+
"metadata": metadata,
|
|
1034
1120
|
},
|
|
1035
1121
|
headers={
|
|
1036
1122
|
"content-type": "application/json",
|
|
@@ -1175,3 +1261,98 @@ class AsyncRawCustomersClient:
|
|
|
1175
1261
|
except JSONDecodeError:
|
|
1176
1262
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1177
1263
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1264
|
+
|
|
1265
|
+
async def get_usage_by_external_id(
|
|
1266
|
+
self,
|
|
1267
|
+
external_id: str,
|
|
1268
|
+
*,
|
|
1269
|
+
limit: typing.Optional[int] = None,
|
|
1270
|
+
offset: typing.Optional[int] = None,
|
|
1271
|
+
start_time: typing.Optional[dt.datetime] = None,
|
|
1272
|
+
end_time: typing.Optional[dt.datetime] = None,
|
|
1273
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1274
|
+
) -> AsyncHttpResponse[UsageSummariesResponse]:
|
|
1275
|
+
"""
|
|
1276
|
+
Parameters
|
|
1277
|
+
----------
|
|
1278
|
+
external_id : str
|
|
1279
|
+
The external ID of the customer
|
|
1280
|
+
|
|
1281
|
+
limit : typing.Optional[int]
|
|
1282
|
+
Maximum number of usage summaries to return (1-1000)
|
|
1283
|
+
|
|
1284
|
+
offset : typing.Optional[int]
|
|
1285
|
+
Number of usage summaries to skip for pagination
|
|
1286
|
+
|
|
1287
|
+
start_time : typing.Optional[dt.datetime]
|
|
1288
|
+
Filter usage summaries starting from this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
1289
|
+
|
|
1290
|
+
end_time : typing.Optional[dt.datetime]
|
|
1291
|
+
Filter usage summaries up to this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
1292
|
+
|
|
1293
|
+
request_options : typing.Optional[RequestOptions]
|
|
1294
|
+
Request-specific configuration.
|
|
1295
|
+
|
|
1296
|
+
Returns
|
|
1297
|
+
-------
|
|
1298
|
+
AsyncHttpResponse[UsageSummariesResponse]
|
|
1299
|
+
Success response
|
|
1300
|
+
"""
|
|
1301
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1302
|
+
f"customers/external/{jsonable_encoder(external_id)}/usage",
|
|
1303
|
+
method="GET",
|
|
1304
|
+
params={
|
|
1305
|
+
"limit": limit,
|
|
1306
|
+
"offset": offset,
|
|
1307
|
+
"startTime": serialize_datetime(start_time) if start_time is not None else None,
|
|
1308
|
+
"endTime": serialize_datetime(end_time) if end_time is not None else None,
|
|
1309
|
+
},
|
|
1310
|
+
request_options=request_options,
|
|
1311
|
+
)
|
|
1312
|
+
try:
|
|
1313
|
+
if 200 <= _response.status_code < 300:
|
|
1314
|
+
_data = typing.cast(
|
|
1315
|
+
UsageSummariesResponse,
|
|
1316
|
+
parse_obj_as(
|
|
1317
|
+
type_=UsageSummariesResponse, # type: ignore
|
|
1318
|
+
object_=_response.json(),
|
|
1319
|
+
),
|
|
1320
|
+
)
|
|
1321
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1322
|
+
if _response.status_code == 400:
|
|
1323
|
+
raise BadRequestError(
|
|
1324
|
+
headers=dict(_response.headers),
|
|
1325
|
+
body=typing.cast(
|
|
1326
|
+
Error,
|
|
1327
|
+
parse_obj_as(
|
|
1328
|
+
type_=Error, # type: ignore
|
|
1329
|
+
object_=_response.json(),
|
|
1330
|
+
),
|
|
1331
|
+
),
|
|
1332
|
+
)
|
|
1333
|
+
if _response.status_code == 403:
|
|
1334
|
+
raise ForbiddenError(
|
|
1335
|
+
headers=dict(_response.headers),
|
|
1336
|
+
body=typing.cast(
|
|
1337
|
+
Error,
|
|
1338
|
+
parse_obj_as(
|
|
1339
|
+
type_=Error, # type: ignore
|
|
1340
|
+
object_=_response.json(),
|
|
1341
|
+
),
|
|
1342
|
+
),
|
|
1343
|
+
)
|
|
1344
|
+
if _response.status_code == 404:
|
|
1345
|
+
raise NotFoundError(
|
|
1346
|
+
headers=dict(_response.headers),
|
|
1347
|
+
body=typing.cast(
|
|
1348
|
+
Error,
|
|
1349
|
+
parse_obj_as(
|
|
1350
|
+
type_=Error, # type: ignore
|
|
1351
|
+
object_=_response.json(),
|
|
1352
|
+
),
|
|
1353
|
+
),
|
|
1354
|
+
)
|
|
1355
|
+
_response_json = _response.json()
|
|
1356
|
+
except JSONDecodeError:
|
|
1357
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1358
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
paid/errors/__init__.py
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
from .bad_request_error import BadRequestError
|
|
6
6
|
from .forbidden_error import ForbiddenError
|
|
7
|
+
from .internal_server_error import InternalServerError
|
|
7
8
|
from .not_found_error import NotFoundError
|
|
8
9
|
|
|
9
|
-
__all__ = ["BadRequestError", "ForbiddenError", "NotFoundError"]
|
|
10
|
+
__all__ = ["BadRequestError", "ForbiddenError", "InternalServerError", "NotFoundError"]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
from ..core.api_error import ApiError
|
|
6
|
+
from ..types.error import Error
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class InternalServerError(ApiError):
|
|
10
|
+
def __init__(self, body: Error, headers: typing.Optional[typing.Dict[str, str]] = None):
|
|
11
|
+
super().__init__(status_code=500, headers=headers, body=body)
|
paid/orders/client.py
CHANGED
|
@@ -64,6 +64,7 @@ class OrdersClient:
|
|
|
64
64
|
billing_contact_id: typing.Optional[str] = OMIT,
|
|
65
65
|
description: typing.Optional[str] = OMIT,
|
|
66
66
|
end_date: typing.Optional[str] = OMIT,
|
|
67
|
+
plan_id: typing.Optional[str] = OMIT,
|
|
67
68
|
order_lines: typing.Optional[typing.Sequence[OrderLineCreate]] = OMIT,
|
|
68
69
|
request_options: typing.Optional[RequestOptions] = None,
|
|
69
70
|
) -> Order:
|
|
@@ -86,6 +87,9 @@ class OrdersClient:
|
|
|
86
87
|
|
|
87
88
|
end_date : typing.Optional[str]
|
|
88
89
|
|
|
90
|
+
plan_id : typing.Optional[str]
|
|
91
|
+
Optional plan ID to associate with this order
|
|
92
|
+
|
|
89
93
|
order_lines : typing.Optional[typing.Sequence[OrderLineCreate]]
|
|
90
94
|
|
|
91
95
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -121,6 +125,7 @@ class OrdersClient:
|
|
|
121
125
|
billing_contact_id=billing_contact_id,
|
|
122
126
|
description=description,
|
|
123
127
|
end_date=end_date,
|
|
128
|
+
plan_id=plan_id,
|
|
124
129
|
order_lines=order_lines,
|
|
125
130
|
request_options=request_options,
|
|
126
131
|
)
|
|
@@ -269,6 +274,7 @@ class AsyncOrdersClient:
|
|
|
269
274
|
billing_contact_id: typing.Optional[str] = OMIT,
|
|
270
275
|
description: typing.Optional[str] = OMIT,
|
|
271
276
|
end_date: typing.Optional[str] = OMIT,
|
|
277
|
+
plan_id: typing.Optional[str] = OMIT,
|
|
272
278
|
order_lines: typing.Optional[typing.Sequence[OrderLineCreate]] = OMIT,
|
|
273
279
|
request_options: typing.Optional[RequestOptions] = None,
|
|
274
280
|
) -> Order:
|
|
@@ -291,6 +297,9 @@ class AsyncOrdersClient:
|
|
|
291
297
|
|
|
292
298
|
end_date : typing.Optional[str]
|
|
293
299
|
|
|
300
|
+
plan_id : typing.Optional[str]
|
|
301
|
+
Optional plan ID to associate with this order
|
|
302
|
+
|
|
294
303
|
order_lines : typing.Optional[typing.Sequence[OrderLineCreate]]
|
|
295
304
|
|
|
296
305
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -334,6 +343,7 @@ class AsyncOrdersClient:
|
|
|
334
343
|
billing_contact_id=billing_contact_id,
|
|
335
344
|
description=description,
|
|
336
345
|
end_date=end_date,
|
|
346
|
+
plan_id=plan_id,
|
|
337
347
|
order_lines=order_lines,
|
|
338
348
|
request_options=request_options,
|
|
339
349
|
)
|
paid/orders/lines/client.py
CHANGED
|
@@ -60,12 +60,10 @@ class LinesClient:
|
|
|
60
60
|
order_id="orderId",
|
|
61
61
|
lines=[
|
|
62
62
|
OrderLineCreate(
|
|
63
|
-
agent_external_id="acme-agent",
|
|
64
63
|
name="Order Line One",
|
|
65
64
|
description="Order Line One is an order line for Acme, Inc.",
|
|
66
65
|
),
|
|
67
66
|
OrderLineCreate(
|
|
68
|
-
agent_external_id="acme-agent-2",
|
|
69
67
|
name="Order Line Two",
|
|
70
68
|
description="Order Line Two is an order line for Acme, Inc.",
|
|
71
69
|
),
|
|
@@ -129,12 +127,10 @@ class AsyncLinesClient:
|
|
|
129
127
|
order_id="orderId",
|
|
130
128
|
lines=[
|
|
131
129
|
OrderLineCreate(
|
|
132
|
-
agent_external_id="acme-agent",
|
|
133
130
|
name="Order Line One",
|
|
134
131
|
description="Order Line One is an order line for Acme, Inc.",
|
|
135
132
|
),
|
|
136
133
|
OrderLineCreate(
|
|
137
|
-
agent_external_id="acme-agent-2",
|
|
138
134
|
name="Order Line Two",
|
|
139
135
|
description="Order Line Two is an order line for Acme, Inc.",
|
|
140
136
|
),
|
paid/orders/raw_client.py
CHANGED
|
@@ -64,6 +64,7 @@ class RawOrdersClient:
|
|
|
64
64
|
billing_contact_id: typing.Optional[str] = OMIT,
|
|
65
65
|
description: typing.Optional[str] = OMIT,
|
|
66
66
|
end_date: typing.Optional[str] = OMIT,
|
|
67
|
+
plan_id: typing.Optional[str] = OMIT,
|
|
67
68
|
order_lines: typing.Optional[typing.Sequence[OrderLineCreate]] = OMIT,
|
|
68
69
|
request_options: typing.Optional[RequestOptions] = None,
|
|
69
70
|
) -> HttpResponse[Order]:
|
|
@@ -86,6 +87,9 @@ class RawOrdersClient:
|
|
|
86
87
|
|
|
87
88
|
end_date : typing.Optional[str]
|
|
88
89
|
|
|
90
|
+
plan_id : typing.Optional[str]
|
|
91
|
+
Optional plan ID to associate with this order
|
|
92
|
+
|
|
89
93
|
order_lines : typing.Optional[typing.Sequence[OrderLineCreate]]
|
|
90
94
|
|
|
91
95
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -108,6 +112,7 @@ class RawOrdersClient:
|
|
|
108
112
|
"startDate": start_date,
|
|
109
113
|
"endDate": end_date,
|
|
110
114
|
"currency": currency,
|
|
115
|
+
"planId": plan_id,
|
|
111
116
|
"orderLines": convert_and_respect_annotation_metadata(
|
|
112
117
|
object_=order_lines, annotation=typing.Sequence[OrderLineCreate], direction="write"
|
|
113
118
|
),
|
|
@@ -279,6 +284,7 @@ class AsyncRawOrdersClient:
|
|
|
279
284
|
billing_contact_id: typing.Optional[str] = OMIT,
|
|
280
285
|
description: typing.Optional[str] = OMIT,
|
|
281
286
|
end_date: typing.Optional[str] = OMIT,
|
|
287
|
+
plan_id: typing.Optional[str] = OMIT,
|
|
282
288
|
order_lines: typing.Optional[typing.Sequence[OrderLineCreate]] = OMIT,
|
|
283
289
|
request_options: typing.Optional[RequestOptions] = None,
|
|
284
290
|
) -> AsyncHttpResponse[Order]:
|
|
@@ -301,6 +307,9 @@ class AsyncRawOrdersClient:
|
|
|
301
307
|
|
|
302
308
|
end_date : typing.Optional[str]
|
|
303
309
|
|
|
310
|
+
plan_id : typing.Optional[str]
|
|
311
|
+
Optional plan ID to associate with this order
|
|
312
|
+
|
|
304
313
|
order_lines : typing.Optional[typing.Sequence[OrderLineCreate]]
|
|
305
314
|
|
|
306
315
|
request_options : typing.Optional[RequestOptions]
|
|
@@ -323,6 +332,7 @@ class AsyncRawOrdersClient:
|
|
|
323
332
|
"startDate": start_date,
|
|
324
333
|
"endDate": end_date,
|
|
325
334
|
"currency": currency,
|
|
335
|
+
"planId": plan_id,
|
|
326
336
|
"orderLines": convert_and_respect_annotation_metadata(
|
|
327
337
|
object_=order_lines, annotation=typing.Sequence[OrderLineCreate], direction="write"
|
|
328
338
|
),
|
paid/plans/__init__.py
ADDED