paid-python 0.4.1__py3-none-any.whl → 0.5.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 +42 -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/lines/client.py +0 -4
- paid/plans/__init__.py +4 -0
- paid/plans/client.py +261 -0
- paid/plans/raw_client.py +345 -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 +32 -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_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.1.dist-info → paid_python-0.5.0.dist-info}/METADATA +20 -20
- {paid_python-0.4.1.dist-info → paid_python-0.5.0.dist-info}/RECORD +54 -25
- {paid_python-0.4.1.dist-info → paid_python-0.5.0.dist-info}/LICENSE +0 -0
- {paid_python-0.4.1.dist-info → paid_python-0.5.0.dist-info}/WHEEL +0 -0
paid/customers/client.py
CHANGED
|
@@ -11,6 +11,7 @@ from ..types.creation_source import CreationSource
|
|
|
11
11
|
from ..types.customer import Customer
|
|
12
12
|
from ..types.entitlement_usage import EntitlementUsage
|
|
13
13
|
from ..types.tax_exempt_status import TaxExemptStatus
|
|
14
|
+
from ..types.usage_summaries_response import UsageSummariesResponse
|
|
14
15
|
from .raw_client import AsyncRawCustomersClient, RawCustomersClient
|
|
15
16
|
|
|
16
17
|
# this is used as the default value for optional parameters
|
|
@@ -60,7 +61,6 @@ class CustomersClient:
|
|
|
60
61
|
self,
|
|
61
62
|
*,
|
|
62
63
|
name: str,
|
|
63
|
-
email: typing.Optional[str] = OMIT,
|
|
64
64
|
external_id: typing.Optional[str] = OMIT,
|
|
65
65
|
phone: typing.Optional[str] = OMIT,
|
|
66
66
|
employee_count: typing.Optional[float] = OMIT,
|
|
@@ -69,6 +69,7 @@ class CustomersClient:
|
|
|
69
69
|
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
70
70
|
website: typing.Optional[str] = OMIT,
|
|
71
71
|
billing_address: typing.Optional[Address] = OMIT,
|
|
72
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
72
73
|
request_options: typing.Optional[RequestOptions] = None,
|
|
73
74
|
) -> Customer:
|
|
74
75
|
"""
|
|
@@ -76,8 +77,6 @@ class CustomersClient:
|
|
|
76
77
|
----------
|
|
77
78
|
name : str
|
|
78
79
|
|
|
79
|
-
email : typing.Optional[str]
|
|
80
|
-
|
|
81
80
|
external_id : typing.Optional[str]
|
|
82
81
|
|
|
83
82
|
phone : typing.Optional[str]
|
|
@@ -94,6 +93,9 @@ class CustomersClient:
|
|
|
94
93
|
|
|
95
94
|
billing_address : typing.Optional[Address]
|
|
96
95
|
|
|
96
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
97
|
+
Flexible JSON field for storing custom metadata about the customer
|
|
98
|
+
|
|
97
99
|
request_options : typing.Optional[RequestOptions]
|
|
98
100
|
Request-specific configuration.
|
|
99
101
|
|
|
@@ -116,7 +118,6 @@ class CustomersClient:
|
|
|
116
118
|
"""
|
|
117
119
|
_response = self._raw_client.create(
|
|
118
120
|
name=name,
|
|
119
|
-
email=email,
|
|
120
121
|
external_id=external_id,
|
|
121
122
|
phone=phone,
|
|
122
123
|
employee_count=employee_count,
|
|
@@ -125,6 +126,7 @@ class CustomersClient:
|
|
|
125
126
|
creation_source=creation_source,
|
|
126
127
|
website=website,
|
|
127
128
|
billing_address=billing_address,
|
|
129
|
+
metadata=metadata,
|
|
128
130
|
request_options=request_options,
|
|
129
131
|
)
|
|
130
132
|
return _response.data
|
|
@@ -162,7 +164,6 @@ class CustomersClient:
|
|
|
162
164
|
customer_id: str,
|
|
163
165
|
*,
|
|
164
166
|
name: typing.Optional[str] = OMIT,
|
|
165
|
-
email: typing.Optional[str] = OMIT,
|
|
166
167
|
external_id: typing.Optional[str] = OMIT,
|
|
167
168
|
phone: typing.Optional[str] = OMIT,
|
|
168
169
|
employee_count: typing.Optional[float] = OMIT,
|
|
@@ -171,7 +172,7 @@ class CustomersClient:
|
|
|
171
172
|
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
172
173
|
website: typing.Optional[str] = OMIT,
|
|
173
174
|
billing_address: typing.Optional[Address] = OMIT,
|
|
174
|
-
|
|
175
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
175
176
|
request_options: typing.Optional[RequestOptions] = None,
|
|
176
177
|
) -> Customer:
|
|
177
178
|
"""
|
|
@@ -181,8 +182,6 @@ class CustomersClient:
|
|
|
181
182
|
|
|
182
183
|
name : typing.Optional[str]
|
|
183
184
|
|
|
184
|
-
email : typing.Optional[str]
|
|
185
|
-
|
|
186
185
|
external_id : typing.Optional[str]
|
|
187
186
|
|
|
188
187
|
phone : typing.Optional[str]
|
|
@@ -199,7 +198,8 @@ class CustomersClient:
|
|
|
199
198
|
|
|
200
199
|
billing_address : typing.Optional[Address]
|
|
201
200
|
|
|
202
|
-
|
|
201
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
202
|
+
Flexible JSON field for storing custom metadata about the customer
|
|
203
203
|
|
|
204
204
|
request_options : typing.Optional[RequestOptions]
|
|
205
205
|
Request-specific configuration.
|
|
@@ -227,7 +227,6 @@ class CustomersClient:
|
|
|
227
227
|
_response = self._raw_client.update(
|
|
228
228
|
customer_id,
|
|
229
229
|
name=name,
|
|
230
|
-
email=email,
|
|
231
230
|
external_id=external_id,
|
|
232
231
|
phone=phone,
|
|
233
232
|
employee_count=employee_count,
|
|
@@ -236,7 +235,7 @@ class CustomersClient:
|
|
|
236
235
|
creation_source=creation_source,
|
|
237
236
|
website=website,
|
|
238
237
|
billing_address=billing_address,
|
|
239
|
-
|
|
238
|
+
metadata=metadata,
|
|
240
239
|
request_options=request_options,
|
|
241
240
|
)
|
|
242
241
|
return _response.data
|
|
@@ -334,7 +333,6 @@ class CustomersClient:
|
|
|
334
333
|
external_id_: str,
|
|
335
334
|
*,
|
|
336
335
|
name: typing.Optional[str] = OMIT,
|
|
337
|
-
email: typing.Optional[str] = OMIT,
|
|
338
336
|
external_id: typing.Optional[str] = OMIT,
|
|
339
337
|
phone: typing.Optional[str] = OMIT,
|
|
340
338
|
employee_count: typing.Optional[float] = OMIT,
|
|
@@ -343,7 +341,7 @@ class CustomersClient:
|
|
|
343
341
|
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
344
342
|
website: typing.Optional[str] = OMIT,
|
|
345
343
|
billing_address: typing.Optional[Address] = OMIT,
|
|
346
|
-
|
|
344
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
347
345
|
request_options: typing.Optional[RequestOptions] = None,
|
|
348
346
|
) -> Customer:
|
|
349
347
|
"""
|
|
@@ -353,8 +351,6 @@ class CustomersClient:
|
|
|
353
351
|
|
|
354
352
|
name : typing.Optional[str]
|
|
355
353
|
|
|
356
|
-
email : typing.Optional[str]
|
|
357
|
-
|
|
358
354
|
external_id : typing.Optional[str]
|
|
359
355
|
|
|
360
356
|
phone : typing.Optional[str]
|
|
@@ -371,7 +367,8 @@ class CustomersClient:
|
|
|
371
367
|
|
|
372
368
|
billing_address : typing.Optional[Address]
|
|
373
369
|
|
|
374
|
-
|
|
370
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
371
|
+
Flexible JSON field for storing custom metadata about the customer
|
|
375
372
|
|
|
376
373
|
request_options : typing.Optional[RequestOptions]
|
|
377
374
|
Request-specific configuration.
|
|
@@ -395,7 +392,6 @@ class CustomersClient:
|
|
|
395
392
|
_response = self._raw_client.update_by_external_id(
|
|
396
393
|
external_id_,
|
|
397
394
|
name=name,
|
|
398
|
-
email=email,
|
|
399
395
|
external_id=external_id,
|
|
400
396
|
phone=phone,
|
|
401
397
|
employee_count=employee_count,
|
|
@@ -404,7 +400,7 @@ class CustomersClient:
|
|
|
404
400
|
creation_source=creation_source,
|
|
405
401
|
website=website,
|
|
406
402
|
billing_address=billing_address,
|
|
407
|
-
|
|
403
|
+
metadata=metadata,
|
|
408
404
|
request_options=request_options,
|
|
409
405
|
)
|
|
410
406
|
return _response.data
|
|
@@ -505,6 +501,73 @@ class CustomersClient:
|
|
|
505
501
|
)
|
|
506
502
|
return _response.data
|
|
507
503
|
|
|
504
|
+
def get_usage_by_external_id(
|
|
505
|
+
self,
|
|
506
|
+
external_id: str,
|
|
507
|
+
*,
|
|
508
|
+
limit: typing.Optional[int] = None,
|
|
509
|
+
offset: typing.Optional[int] = None,
|
|
510
|
+
start_time: typing.Optional[dt.datetime] = None,
|
|
511
|
+
end_time: typing.Optional[dt.datetime] = None,
|
|
512
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
513
|
+
) -> UsageSummariesResponse:
|
|
514
|
+
"""
|
|
515
|
+
Parameters
|
|
516
|
+
----------
|
|
517
|
+
external_id : str
|
|
518
|
+
The external ID of the customer
|
|
519
|
+
|
|
520
|
+
limit : typing.Optional[int]
|
|
521
|
+
Maximum number of usage summaries to return (1-1000)
|
|
522
|
+
|
|
523
|
+
offset : typing.Optional[int]
|
|
524
|
+
Number of usage summaries to skip for pagination
|
|
525
|
+
|
|
526
|
+
start_time : typing.Optional[dt.datetime]
|
|
527
|
+
Filter usage summaries starting from this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
528
|
+
|
|
529
|
+
end_time : typing.Optional[dt.datetime]
|
|
530
|
+
Filter usage summaries up to this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
531
|
+
|
|
532
|
+
request_options : typing.Optional[RequestOptions]
|
|
533
|
+
Request-specific configuration.
|
|
534
|
+
|
|
535
|
+
Returns
|
|
536
|
+
-------
|
|
537
|
+
UsageSummariesResponse
|
|
538
|
+
Success response
|
|
539
|
+
|
|
540
|
+
Examples
|
|
541
|
+
--------
|
|
542
|
+
import datetime
|
|
543
|
+
|
|
544
|
+
from paid import Paid
|
|
545
|
+
|
|
546
|
+
client = Paid(
|
|
547
|
+
token="YOUR_TOKEN",
|
|
548
|
+
)
|
|
549
|
+
client.customers.get_usage_by_external_id(
|
|
550
|
+
external_id="externalId",
|
|
551
|
+
limit=1,
|
|
552
|
+
offset=1,
|
|
553
|
+
start_time=datetime.datetime.fromisoformat(
|
|
554
|
+
"2024-01-15 09:30:00+00:00",
|
|
555
|
+
),
|
|
556
|
+
end_time=datetime.datetime.fromisoformat(
|
|
557
|
+
"2024-01-15 09:30:00+00:00",
|
|
558
|
+
),
|
|
559
|
+
)
|
|
560
|
+
"""
|
|
561
|
+
_response = self._raw_client.get_usage_by_external_id(
|
|
562
|
+
external_id,
|
|
563
|
+
limit=limit,
|
|
564
|
+
offset=offset,
|
|
565
|
+
start_time=start_time,
|
|
566
|
+
end_time=end_time,
|
|
567
|
+
request_options=request_options,
|
|
568
|
+
)
|
|
569
|
+
return _response.data
|
|
570
|
+
|
|
508
571
|
|
|
509
572
|
class AsyncCustomersClient:
|
|
510
573
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -557,7 +620,6 @@ class AsyncCustomersClient:
|
|
|
557
620
|
self,
|
|
558
621
|
*,
|
|
559
622
|
name: str,
|
|
560
|
-
email: typing.Optional[str] = OMIT,
|
|
561
623
|
external_id: typing.Optional[str] = OMIT,
|
|
562
624
|
phone: typing.Optional[str] = OMIT,
|
|
563
625
|
employee_count: typing.Optional[float] = OMIT,
|
|
@@ -566,6 +628,7 @@ class AsyncCustomersClient:
|
|
|
566
628
|
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
567
629
|
website: typing.Optional[str] = OMIT,
|
|
568
630
|
billing_address: typing.Optional[Address] = OMIT,
|
|
631
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
569
632
|
request_options: typing.Optional[RequestOptions] = None,
|
|
570
633
|
) -> Customer:
|
|
571
634
|
"""
|
|
@@ -573,8 +636,6 @@ class AsyncCustomersClient:
|
|
|
573
636
|
----------
|
|
574
637
|
name : str
|
|
575
638
|
|
|
576
|
-
email : typing.Optional[str]
|
|
577
|
-
|
|
578
639
|
external_id : typing.Optional[str]
|
|
579
640
|
|
|
580
641
|
phone : typing.Optional[str]
|
|
@@ -591,6 +652,9 @@ class AsyncCustomersClient:
|
|
|
591
652
|
|
|
592
653
|
billing_address : typing.Optional[Address]
|
|
593
654
|
|
|
655
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
656
|
+
Flexible JSON field for storing custom metadata about the customer
|
|
657
|
+
|
|
594
658
|
request_options : typing.Optional[RequestOptions]
|
|
595
659
|
Request-specific configuration.
|
|
596
660
|
|
|
@@ -621,7 +685,6 @@ class AsyncCustomersClient:
|
|
|
621
685
|
"""
|
|
622
686
|
_response = await self._raw_client.create(
|
|
623
687
|
name=name,
|
|
624
|
-
email=email,
|
|
625
688
|
external_id=external_id,
|
|
626
689
|
phone=phone,
|
|
627
690
|
employee_count=employee_count,
|
|
@@ -630,6 +693,7 @@ class AsyncCustomersClient:
|
|
|
630
693
|
creation_source=creation_source,
|
|
631
694
|
website=website,
|
|
632
695
|
billing_address=billing_address,
|
|
696
|
+
metadata=metadata,
|
|
633
697
|
request_options=request_options,
|
|
634
698
|
)
|
|
635
699
|
return _response.data
|
|
@@ -675,7 +739,6 @@ class AsyncCustomersClient:
|
|
|
675
739
|
customer_id: str,
|
|
676
740
|
*,
|
|
677
741
|
name: typing.Optional[str] = OMIT,
|
|
678
|
-
email: typing.Optional[str] = OMIT,
|
|
679
742
|
external_id: typing.Optional[str] = OMIT,
|
|
680
743
|
phone: typing.Optional[str] = OMIT,
|
|
681
744
|
employee_count: typing.Optional[float] = OMIT,
|
|
@@ -684,7 +747,7 @@ class AsyncCustomersClient:
|
|
|
684
747
|
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
685
748
|
website: typing.Optional[str] = OMIT,
|
|
686
749
|
billing_address: typing.Optional[Address] = OMIT,
|
|
687
|
-
|
|
750
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
688
751
|
request_options: typing.Optional[RequestOptions] = None,
|
|
689
752
|
) -> Customer:
|
|
690
753
|
"""
|
|
@@ -694,8 +757,6 @@ class AsyncCustomersClient:
|
|
|
694
757
|
|
|
695
758
|
name : typing.Optional[str]
|
|
696
759
|
|
|
697
|
-
email : typing.Optional[str]
|
|
698
|
-
|
|
699
760
|
external_id : typing.Optional[str]
|
|
700
761
|
|
|
701
762
|
phone : typing.Optional[str]
|
|
@@ -712,7 +773,8 @@ class AsyncCustomersClient:
|
|
|
712
773
|
|
|
713
774
|
billing_address : typing.Optional[Address]
|
|
714
775
|
|
|
715
|
-
|
|
776
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
777
|
+
Flexible JSON field for storing custom metadata about the customer
|
|
716
778
|
|
|
717
779
|
request_options : typing.Optional[RequestOptions]
|
|
718
780
|
Request-specific configuration.
|
|
@@ -748,7 +810,6 @@ class AsyncCustomersClient:
|
|
|
748
810
|
_response = await self._raw_client.update(
|
|
749
811
|
customer_id,
|
|
750
812
|
name=name,
|
|
751
|
-
email=email,
|
|
752
813
|
external_id=external_id,
|
|
753
814
|
phone=phone,
|
|
754
815
|
employee_count=employee_count,
|
|
@@ -757,7 +818,7 @@ class AsyncCustomersClient:
|
|
|
757
818
|
creation_source=creation_source,
|
|
758
819
|
website=website,
|
|
759
820
|
billing_address=billing_address,
|
|
760
|
-
|
|
821
|
+
metadata=metadata,
|
|
761
822
|
request_options=request_options,
|
|
762
823
|
)
|
|
763
824
|
return _response.data
|
|
@@ -879,7 +940,6 @@ class AsyncCustomersClient:
|
|
|
879
940
|
external_id_: str,
|
|
880
941
|
*,
|
|
881
942
|
name: typing.Optional[str] = OMIT,
|
|
882
|
-
email: typing.Optional[str] = OMIT,
|
|
883
943
|
external_id: typing.Optional[str] = OMIT,
|
|
884
944
|
phone: typing.Optional[str] = OMIT,
|
|
885
945
|
employee_count: typing.Optional[float] = OMIT,
|
|
@@ -888,7 +948,7 @@ class AsyncCustomersClient:
|
|
|
888
948
|
creation_source: typing.Optional[CreationSource] = OMIT,
|
|
889
949
|
website: typing.Optional[str] = OMIT,
|
|
890
950
|
billing_address: typing.Optional[Address] = OMIT,
|
|
891
|
-
|
|
951
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
|
892
952
|
request_options: typing.Optional[RequestOptions] = None,
|
|
893
953
|
) -> Customer:
|
|
894
954
|
"""
|
|
@@ -898,8 +958,6 @@ class AsyncCustomersClient:
|
|
|
898
958
|
|
|
899
959
|
name : typing.Optional[str]
|
|
900
960
|
|
|
901
|
-
email : typing.Optional[str]
|
|
902
|
-
|
|
903
961
|
external_id : typing.Optional[str]
|
|
904
962
|
|
|
905
963
|
phone : typing.Optional[str]
|
|
@@ -916,7 +974,8 @@ class AsyncCustomersClient:
|
|
|
916
974
|
|
|
917
975
|
billing_address : typing.Optional[Address]
|
|
918
976
|
|
|
919
|
-
|
|
977
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
|
978
|
+
Flexible JSON field for storing custom metadata about the customer
|
|
920
979
|
|
|
921
980
|
request_options : typing.Optional[RequestOptions]
|
|
922
981
|
Request-specific configuration.
|
|
@@ -948,7 +1007,6 @@ class AsyncCustomersClient:
|
|
|
948
1007
|
_response = await self._raw_client.update_by_external_id(
|
|
949
1008
|
external_id_,
|
|
950
1009
|
name=name,
|
|
951
|
-
email=email,
|
|
952
1010
|
external_id=external_id,
|
|
953
1011
|
phone=phone,
|
|
954
1012
|
employee_count=employee_count,
|
|
@@ -957,7 +1015,7 @@ class AsyncCustomersClient:
|
|
|
957
1015
|
creation_source=creation_source,
|
|
958
1016
|
website=website,
|
|
959
1017
|
billing_address=billing_address,
|
|
960
|
-
|
|
1018
|
+
metadata=metadata,
|
|
961
1019
|
request_options=request_options,
|
|
962
1020
|
)
|
|
963
1021
|
return _response.data
|
|
@@ -1072,3 +1130,77 @@ class AsyncCustomersClient:
|
|
|
1072
1130
|
request_options=request_options,
|
|
1073
1131
|
)
|
|
1074
1132
|
return _response.data
|
|
1133
|
+
|
|
1134
|
+
async def get_usage_by_external_id(
|
|
1135
|
+
self,
|
|
1136
|
+
external_id: str,
|
|
1137
|
+
*,
|
|
1138
|
+
limit: typing.Optional[int] = None,
|
|
1139
|
+
offset: typing.Optional[int] = None,
|
|
1140
|
+
start_time: typing.Optional[dt.datetime] = None,
|
|
1141
|
+
end_time: typing.Optional[dt.datetime] = None,
|
|
1142
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1143
|
+
) -> UsageSummariesResponse:
|
|
1144
|
+
"""
|
|
1145
|
+
Parameters
|
|
1146
|
+
----------
|
|
1147
|
+
external_id : str
|
|
1148
|
+
The external ID of the customer
|
|
1149
|
+
|
|
1150
|
+
limit : typing.Optional[int]
|
|
1151
|
+
Maximum number of usage summaries to return (1-1000)
|
|
1152
|
+
|
|
1153
|
+
offset : typing.Optional[int]
|
|
1154
|
+
Number of usage summaries to skip for pagination
|
|
1155
|
+
|
|
1156
|
+
start_time : typing.Optional[dt.datetime]
|
|
1157
|
+
Filter usage summaries starting from this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
1158
|
+
|
|
1159
|
+
end_time : typing.Optional[dt.datetime]
|
|
1160
|
+
Filter usage summaries up to this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
1161
|
+
|
|
1162
|
+
request_options : typing.Optional[RequestOptions]
|
|
1163
|
+
Request-specific configuration.
|
|
1164
|
+
|
|
1165
|
+
Returns
|
|
1166
|
+
-------
|
|
1167
|
+
UsageSummariesResponse
|
|
1168
|
+
Success response
|
|
1169
|
+
|
|
1170
|
+
Examples
|
|
1171
|
+
--------
|
|
1172
|
+
import asyncio
|
|
1173
|
+
import datetime
|
|
1174
|
+
|
|
1175
|
+
from paid import AsyncPaid
|
|
1176
|
+
|
|
1177
|
+
client = AsyncPaid(
|
|
1178
|
+
token="YOUR_TOKEN",
|
|
1179
|
+
)
|
|
1180
|
+
|
|
1181
|
+
|
|
1182
|
+
async def main() -> None:
|
|
1183
|
+
await client.customers.get_usage_by_external_id(
|
|
1184
|
+
external_id="externalId",
|
|
1185
|
+
limit=1,
|
|
1186
|
+
offset=1,
|
|
1187
|
+
start_time=datetime.datetime.fromisoformat(
|
|
1188
|
+
"2024-01-15 09:30:00+00:00",
|
|
1189
|
+
),
|
|
1190
|
+
end_time=datetime.datetime.fromisoformat(
|
|
1191
|
+
"2024-01-15 09:30:00+00:00",
|
|
1192
|
+
),
|
|
1193
|
+
)
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+
asyncio.run(main())
|
|
1197
|
+
"""
|
|
1198
|
+
_response = await self._raw_client.get_usage_by_external_id(
|
|
1199
|
+
external_id,
|
|
1200
|
+
limit=limit,
|
|
1201
|
+
offset=offset,
|
|
1202
|
+
start_time=start_time,
|
|
1203
|
+
end_time=end_time,
|
|
1204
|
+
request_options=request_options,
|
|
1205
|
+
)
|
|
1206
|
+
return _response.data
|