paid-python 0.6.0__py3-none-any.whl → 1.0.0a1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- paid/__init__.py +65 -95
- paid/client.py +17 -494
- paid/contacts/client.py +415 -133
- paid/contacts/raw_client.py +1046 -118
- paid/core/client_wrapper.py +9 -10
- paid/customers/client.py +270 -566
- paid/customers/raw_client.py +731 -537
- paid/environment.py +1 -1
- paid/errors/bad_request_error.py +2 -2
- paid/errors/forbidden_error.py +2 -2
- paid/errors/internal_server_error.py +2 -2
- paid/errors/not_found_error.py +2 -2
- paid/invoices/client.py +369 -0
- paid/invoices/raw_client.py +692 -0
- paid/orders/__init__.py +0 -3
- paid/orders/client.py +371 -128
- paid/orders/raw_client.py +829 -121
- paid/products/__init__.py +0 -3
- paid/products/client.py +129 -265
- paid/products/raw_client.py +563 -233
- paid/signals/client.py +130 -0
- paid/signals/raw_client.py +190 -0
- paid/tracing/autoinstrumentation.py +12 -6
- paid/tracing/context_manager.py +2 -6
- paid/tracing/distributed_tracing.py +3 -3
- paid/tracing/signal.py +3 -3
- paid/tracing/wrappers/openai_agents/openaiAgentsHook.py +1 -1
- paid/types/__init__.py +62 -86
- paid/types/attribution.py +8 -0
- paid/types/{agent_attribute.py → bulk_signals_response.py} +4 -5
- paid/types/contact.py +12 -20
- paid/types/{address.py → contact_billing_address.py} +6 -7
- paid/types/{traces_response.py → contact_list_response.py} +5 -9
- paid/types/customer.py +15 -22
- paid/types/customer_attribution.py +8 -0
- paid/types/customer_billing_address.py +26 -0
- paid/types/{usage_summary_order.py → customer_by_external_id.py} +3 -5
- paid/types/{usage_summary_order_line.py → customer_by_id.py} +3 -5
- paid/types/customer_creation_state.py +5 -0
- paid/types/customer_list_response.py +22 -0
- paid/types/empty_response.py +17 -0
- paid/types/{error.py → error_response.py} +4 -7
- paid/types/invoice.py +57 -0
- paid/types/invoice_line.py +42 -0
- paid/types/invoice_line_payment_status.py +7 -0
- paid/types/invoice_lines_response.py +22 -0
- paid/types/invoice_list_response.py +22 -0
- paid/types/invoice_payment_status.py +5 -0
- paid/types/invoice_source.py +5 -0
- paid/types/invoice_status.py +7 -0
- paid/types/invoice_tax_status.py +7 -0
- paid/types/order.py +30 -29
- paid/types/order_creation_state.py +5 -0
- paid/types/order_line.py +6 -24
- paid/types/order_lines_response.py +22 -0
- paid/types/order_list_response.py +22 -0
- paid/types/pagination.py +24 -0
- paid/types/product.py +4 -29
- paid/types/{tier.py → product_by_external_id.py} +5 -4
- paid/types/{cost_amount.py → product_by_id.py} +5 -12
- paid/types/product_list_response.py +22 -0
- paid/types/signal.py +8 -34
- paid/types/{agent.py → update_contact_request.py} +10 -11
- paid/types/update_customer_request.py +38 -0
- paid/types/{product_update.py → update_product_request.py} +2 -12
- {paid_python-0.6.0.dist-info → paid_python-1.0.0a1.dist-info}/METADATA +27 -11
- paid_python-1.0.0a1.dist-info/RECORD +110 -0
- opentelemetry/instrumentation/openai/__init__.py +0 -54
- opentelemetry/instrumentation/openai/shared/__init__.py +0 -399
- opentelemetry/instrumentation/openai/shared/audio_wrappers.py +0 -247
- opentelemetry/instrumentation/openai/shared/chat_wrappers.py +0 -1192
- opentelemetry/instrumentation/openai/shared/completion_wrappers.py +0 -292
- opentelemetry/instrumentation/openai/shared/config.py +0 -15
- opentelemetry/instrumentation/openai/shared/embeddings_wrappers.py +0 -311
- opentelemetry/instrumentation/openai/shared/event_emitter.py +0 -108
- opentelemetry/instrumentation/openai/shared/event_models.py +0 -41
- opentelemetry/instrumentation/openai/shared/image_gen_wrappers.py +0 -68
- opentelemetry/instrumentation/openai/shared/span_utils.py +0 -0
- opentelemetry/instrumentation/openai/utils.py +0 -213
- opentelemetry/instrumentation/openai/v0/__init__.py +0 -176
- opentelemetry/instrumentation/openai/v1/__init__.py +0 -394
- opentelemetry/instrumentation/openai/v1/assistant_wrappers.py +0 -329
- opentelemetry/instrumentation/openai/v1/event_handler_wrapper.py +0 -134
- opentelemetry/instrumentation/openai/v1/responses_wrappers.py +0 -1113
- opentelemetry/instrumentation/openai/version.py +0 -1
- paid/agents/client.py +0 -880
- paid/agents/raw_client.py +0 -785
- paid/orders/lines/client.py +0 -144
- paid/orders/lines/raw_client.py +0 -129
- paid/plans/__init__.py +0 -4
- paid/plans/client.py +0 -332
- paid/plans/raw_client.py +0 -464
- paid/products/types/__init__.py +0 -7
- paid/products/types/product_create_type.py +0 -5
- paid/traces/__init__.py +0 -4
- paid/traces/client.py +0 -218
- paid/traces/raw_client.py +0 -226
- paid/types/agent_price_point.py +0 -27
- paid/types/agent_price_point_tiers.py +0 -23
- paid/types/agent_update.py +0 -29
- paid/types/api_error.py +0 -29
- paid/types/billing_frequency.py +0 -5
- paid/types/charge_type.py +0 -5
- paid/types/cost_trace.py +0 -55
- paid/types/cost_traces_response.py +0 -26
- paid/types/creation_source.py +0 -5
- paid/types/creation_state.py +0 -5
- paid/types/customer_update.py +0 -40
- paid/types/entitlement_usage.py +0 -48
- paid/types/order_line_attribute.py +0 -27
- paid/types/order_line_attribute_create_one.py +0 -5
- paid/types/order_line_attribute_pricing.py +0 -33
- paid/types/order_line_create.py +0 -72
- paid/types/pagination_meta.py +0 -84
- paid/types/plan.py +0 -81
- paid/types/plan_group.py +0 -60
- paid/types/plan_plan_products_item.py +0 -35
- paid/types/plan_plan_products_item_plan_product_attribute_item.py +0 -34
- paid/types/price_point.py +0 -25
- paid/types/pricing.py +0 -31
- paid/types/pricing_model_type.py +0 -7
- paid/types/product_type.py +0 -5
- paid/types/product_update_type.py +0 -5
- paid/types/salutation.py +0 -5
- paid/types/signal_v_2.py +0 -56
- paid/types/tax_exempt_status.py +0 -5
- paid/types/trace.py +0 -69
- paid/types/usage_pagination_meta.py +0 -43
- paid/types/usage_summaries_response.py +0 -26
- paid/types/usage_summary.py +0 -121
- paid/usage/__init__.py +0 -7
- paid/usage/client.py +0 -321
- paid/usage/raw_client.py +0 -387
- paid/usage/types/__init__.py +0 -7
- paid/usage/types/usage_check_usage_response.py +0 -53
- paid_python-0.6.0.dist-info/RECORD +0 -153
- /paid/{agents → invoices}/__init__.py +0 -0
- /paid/{orders/lines → signals}/__init__.py +0 -0
- {paid_python-0.6.0.dist-info → paid_python-1.0.0a1.dist-info}/LICENSE +0 -0
- {paid_python-0.6.0.dist-info → paid_python-1.0.0a1.dist-info}/WHEEL +0 -0
paid/types/usage_summary.py
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
import datetime as dt
|
|
4
|
-
import typing
|
|
5
|
-
|
|
6
|
-
import pydantic
|
|
7
|
-
import typing_extensions
|
|
8
|
-
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
9
|
-
from ..core.serialization import FieldMetadata
|
|
10
|
-
from .usage_summary_order import UsageSummaryOrder
|
|
11
|
-
from .usage_summary_order_line import UsageSummaryOrderLine
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class UsageSummary(UniversalBaseModel):
|
|
15
|
-
"""
|
|
16
|
-
A single usage summary record
|
|
17
|
-
"""
|
|
18
|
-
|
|
19
|
-
id: str = pydantic.Field()
|
|
20
|
-
"""
|
|
21
|
-
The unique identifier of the usage summary
|
|
22
|
-
"""
|
|
23
|
-
|
|
24
|
-
event_name: typing_extensions.Annotated[str, FieldMetadata(alias="eventName")] = pydantic.Field()
|
|
25
|
-
"""
|
|
26
|
-
The name of the event being tracked
|
|
27
|
-
"""
|
|
28
|
-
|
|
29
|
-
events_quantity: typing_extensions.Annotated[int, FieldMetadata(alias="eventsQuantity")] = pydantic.Field()
|
|
30
|
-
"""
|
|
31
|
-
The quantity of events in this usage period
|
|
32
|
-
"""
|
|
33
|
-
|
|
34
|
-
start_date: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="startDate")] = pydantic.Field()
|
|
35
|
-
"""
|
|
36
|
-
The start date of the usage period
|
|
37
|
-
"""
|
|
38
|
-
|
|
39
|
-
end_date: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="endDate")] = pydantic.Field()
|
|
40
|
-
"""
|
|
41
|
-
The end date of the usage period
|
|
42
|
-
"""
|
|
43
|
-
|
|
44
|
-
subtotal: int = pydantic.Field()
|
|
45
|
-
"""
|
|
46
|
-
The subtotal amount in the smallest currency unit (e.g., cents)
|
|
47
|
-
"""
|
|
48
|
-
|
|
49
|
-
next_billing_date: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="nextBillingDate")] = (
|
|
50
|
-
pydantic.Field()
|
|
51
|
-
)
|
|
52
|
-
"""
|
|
53
|
-
The next billing date for this usage
|
|
54
|
-
"""
|
|
55
|
-
|
|
56
|
-
customer_id: typing_extensions.Annotated[str, FieldMetadata(alias="customerId")] = pydantic.Field()
|
|
57
|
-
"""
|
|
58
|
-
The internal customer ID
|
|
59
|
-
"""
|
|
60
|
-
|
|
61
|
-
order_id: typing_extensions.Annotated[str, FieldMetadata(alias="orderId")] = pydantic.Field()
|
|
62
|
-
"""
|
|
63
|
-
The order ID associated with this usage
|
|
64
|
-
"""
|
|
65
|
-
|
|
66
|
-
order_line_id: typing_extensions.Annotated[str, FieldMetadata(alias="orderLineId")] = pydantic.Field()
|
|
67
|
-
"""
|
|
68
|
-
The order line ID associated with this usage
|
|
69
|
-
"""
|
|
70
|
-
|
|
71
|
-
order_line_attribute_id: typing_extensions.Annotated[str, FieldMetadata(alias="orderLineAttributeId")] = (
|
|
72
|
-
pydantic.Field()
|
|
73
|
-
)
|
|
74
|
-
"""
|
|
75
|
-
The order line attribute ID associated with this usage
|
|
76
|
-
"""
|
|
77
|
-
|
|
78
|
-
invoice_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="invoiceId")] = pydantic.Field(
|
|
79
|
-
default=None
|
|
80
|
-
)
|
|
81
|
-
"""
|
|
82
|
-
The invoice ID if this usage has been invoiced
|
|
83
|
-
"""
|
|
84
|
-
|
|
85
|
-
invoice_line_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="invoiceLineId")] = (
|
|
86
|
-
pydantic.Field(default=None)
|
|
87
|
-
)
|
|
88
|
-
"""
|
|
89
|
-
The invoice line ID if this usage has been invoiced
|
|
90
|
-
"""
|
|
91
|
-
|
|
92
|
-
created_at: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="createdAt")] = pydantic.Field()
|
|
93
|
-
"""
|
|
94
|
-
When the usage summary was created
|
|
95
|
-
"""
|
|
96
|
-
|
|
97
|
-
updated_at: typing_extensions.Annotated[dt.datetime, FieldMetadata(alias="updatedAt")] = pydantic.Field()
|
|
98
|
-
"""
|
|
99
|
-
When the usage summary was last updated
|
|
100
|
-
"""
|
|
101
|
-
|
|
102
|
-
order: typing.Optional[UsageSummaryOrder] = pydantic.Field(default=None)
|
|
103
|
-
"""
|
|
104
|
-
Associated order information
|
|
105
|
-
"""
|
|
106
|
-
|
|
107
|
-
order_line: typing_extensions.Annotated[
|
|
108
|
-
typing.Optional[UsageSummaryOrderLine], FieldMetadata(alias="orderLine")
|
|
109
|
-
] = pydantic.Field(default=None)
|
|
110
|
-
"""
|
|
111
|
-
Associated order line information
|
|
112
|
-
"""
|
|
113
|
-
|
|
114
|
-
if IS_PYDANTIC_V2:
|
|
115
|
-
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
116
|
-
else:
|
|
117
|
-
|
|
118
|
-
class Config:
|
|
119
|
-
frozen = True
|
|
120
|
-
smart_union = True
|
|
121
|
-
extra = pydantic.Extra.allow
|
paid/usage/__init__.py
DELETED
paid/usage/client.py
DELETED
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
import typing
|
|
4
|
-
|
|
5
|
-
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
|
-
from ..core.request_options import RequestOptions
|
|
7
|
-
from ..types.signal import Signal
|
|
8
|
-
from ..types.signal_v_2 import SignalV2
|
|
9
|
-
from .raw_client import AsyncRawUsageClient, RawUsageClient
|
|
10
|
-
from .types.usage_check_usage_response import UsageCheckUsageResponse
|
|
11
|
-
|
|
12
|
-
# this is used as the default value for optional parameters
|
|
13
|
-
OMIT = typing.cast(typing.Any, ...)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class UsageClient:
|
|
17
|
-
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
18
|
-
self._raw_client = RawUsageClient(client_wrapper=client_wrapper)
|
|
19
|
-
|
|
20
|
-
@property
|
|
21
|
-
def with_raw_response(self) -> RawUsageClient:
|
|
22
|
-
"""
|
|
23
|
-
Retrieves a raw implementation of this client that returns raw responses.
|
|
24
|
-
|
|
25
|
-
Returns
|
|
26
|
-
-------
|
|
27
|
-
RawUsageClient
|
|
28
|
-
"""
|
|
29
|
-
return self._raw_client
|
|
30
|
-
|
|
31
|
-
def record_bulk(
|
|
32
|
-
self,
|
|
33
|
-
*,
|
|
34
|
-
signals: typing.Optional[typing.Sequence[Signal]] = OMIT,
|
|
35
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
36
|
-
) -> None:
|
|
37
|
-
"""
|
|
38
|
-
DEPRECATED: Use POST /usage/v2/signals/bulk instead for cleaner field names.
|
|
39
|
-
|
|
40
|
-
Parameters
|
|
41
|
-
----------
|
|
42
|
-
signals : typing.Optional[typing.Sequence[Signal]]
|
|
43
|
-
|
|
44
|
-
request_options : typing.Optional[RequestOptions]
|
|
45
|
-
Request-specific configuration.
|
|
46
|
-
|
|
47
|
-
Returns
|
|
48
|
-
-------
|
|
49
|
-
None
|
|
50
|
-
|
|
51
|
-
Examples
|
|
52
|
-
--------
|
|
53
|
-
from paid import Paid, Signal
|
|
54
|
-
|
|
55
|
-
client = Paid(
|
|
56
|
-
token="YOUR_TOKEN",
|
|
57
|
-
)
|
|
58
|
-
client.usage.record_bulk(
|
|
59
|
-
signals=[Signal(), Signal(), Signal()],
|
|
60
|
-
)
|
|
61
|
-
"""
|
|
62
|
-
_response = self._raw_client.record_bulk(signals=signals, request_options=request_options)
|
|
63
|
-
return _response.data
|
|
64
|
-
|
|
65
|
-
def usage_record_bulk_v_2(
|
|
66
|
-
self,
|
|
67
|
-
*,
|
|
68
|
-
signals: typing.Optional[typing.Sequence[SignalV2]] = OMIT,
|
|
69
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
70
|
-
) -> None:
|
|
71
|
-
"""
|
|
72
|
-
Parameters
|
|
73
|
-
----------
|
|
74
|
-
signals : typing.Optional[typing.Sequence[SignalV2]]
|
|
75
|
-
|
|
76
|
-
request_options : typing.Optional[RequestOptions]
|
|
77
|
-
Request-specific configuration.
|
|
78
|
-
|
|
79
|
-
Returns
|
|
80
|
-
-------
|
|
81
|
-
None
|
|
82
|
-
|
|
83
|
-
Examples
|
|
84
|
-
--------
|
|
85
|
-
from paid import Paid, SignalV2
|
|
86
|
-
|
|
87
|
-
client = Paid(
|
|
88
|
-
token="YOUR_TOKEN",
|
|
89
|
-
)
|
|
90
|
-
client.usage.usage_record_bulk_v_2(
|
|
91
|
-
signals=[
|
|
92
|
-
SignalV2(
|
|
93
|
-
event_name="emails_sent",
|
|
94
|
-
product_id="63fd642c-569d-44f9-8d67-5cf4944a16cc",
|
|
95
|
-
customer_id="7d0b6fce-d82a-433d-8315-c994f8f1d68d",
|
|
96
|
-
),
|
|
97
|
-
SignalV2(
|
|
98
|
-
event_name="emails_sent",
|
|
99
|
-
external_product_id="acme-product",
|
|
100
|
-
external_customer_id="acme-inc",
|
|
101
|
-
),
|
|
102
|
-
SignalV2(
|
|
103
|
-
event_name="meeting_booked",
|
|
104
|
-
product_id="63fd642c-569d-44f9-8d67-5cf4944a16cc",
|
|
105
|
-
external_customer_id="acme-inc",
|
|
106
|
-
data={"meeting_duration": 30, "meeting_type": "demo"},
|
|
107
|
-
),
|
|
108
|
-
],
|
|
109
|
-
)
|
|
110
|
-
"""
|
|
111
|
-
_response = self._raw_client.usage_record_bulk_v_2(signals=signals, request_options=request_options)
|
|
112
|
-
return _response.data
|
|
113
|
-
|
|
114
|
-
def check_usage(
|
|
115
|
-
self,
|
|
116
|
-
*,
|
|
117
|
-
external_customer_id: str,
|
|
118
|
-
external_product_id: str,
|
|
119
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
120
|
-
) -> UsageCheckUsageResponse:
|
|
121
|
-
"""
|
|
122
|
-
Parameters
|
|
123
|
-
----------
|
|
124
|
-
external_customer_id : str
|
|
125
|
-
External customer ID
|
|
126
|
-
|
|
127
|
-
external_product_id : str
|
|
128
|
-
External product ID (the external ID of the product/agent)
|
|
129
|
-
|
|
130
|
-
request_options : typing.Optional[RequestOptions]
|
|
131
|
-
Request-specific configuration.
|
|
132
|
-
|
|
133
|
-
Returns
|
|
134
|
-
-------
|
|
135
|
-
UsageCheckUsageResponse
|
|
136
|
-
Usage check response
|
|
137
|
-
|
|
138
|
-
Examples
|
|
139
|
-
--------
|
|
140
|
-
from paid import Paid
|
|
141
|
-
|
|
142
|
-
client = Paid(
|
|
143
|
-
token="YOUR_TOKEN",
|
|
144
|
-
)
|
|
145
|
-
client.usage.check_usage(
|
|
146
|
-
external_customer_id="acme-inc",
|
|
147
|
-
external_product_id="acme-agent",
|
|
148
|
-
)
|
|
149
|
-
"""
|
|
150
|
-
_response = self._raw_client.check_usage(
|
|
151
|
-
external_customer_id=external_customer_id,
|
|
152
|
-
external_product_id=external_product_id,
|
|
153
|
-
request_options=request_options,
|
|
154
|
-
)
|
|
155
|
-
return _response.data
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
class AsyncUsageClient:
|
|
159
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
160
|
-
self._raw_client = AsyncRawUsageClient(client_wrapper=client_wrapper)
|
|
161
|
-
|
|
162
|
-
@property
|
|
163
|
-
def with_raw_response(self) -> AsyncRawUsageClient:
|
|
164
|
-
"""
|
|
165
|
-
Retrieves a raw implementation of this client that returns raw responses.
|
|
166
|
-
|
|
167
|
-
Returns
|
|
168
|
-
-------
|
|
169
|
-
AsyncRawUsageClient
|
|
170
|
-
"""
|
|
171
|
-
return self._raw_client
|
|
172
|
-
|
|
173
|
-
async def record_bulk(
|
|
174
|
-
self,
|
|
175
|
-
*,
|
|
176
|
-
signals: typing.Optional[typing.Sequence[Signal]] = OMIT,
|
|
177
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
178
|
-
) -> None:
|
|
179
|
-
"""
|
|
180
|
-
DEPRECATED: Use POST /usage/v2/signals/bulk instead for cleaner field names.
|
|
181
|
-
|
|
182
|
-
Parameters
|
|
183
|
-
----------
|
|
184
|
-
signals : typing.Optional[typing.Sequence[Signal]]
|
|
185
|
-
|
|
186
|
-
request_options : typing.Optional[RequestOptions]
|
|
187
|
-
Request-specific configuration.
|
|
188
|
-
|
|
189
|
-
Returns
|
|
190
|
-
-------
|
|
191
|
-
None
|
|
192
|
-
|
|
193
|
-
Examples
|
|
194
|
-
--------
|
|
195
|
-
import asyncio
|
|
196
|
-
|
|
197
|
-
from paid import AsyncPaid, Signal
|
|
198
|
-
|
|
199
|
-
client = AsyncPaid(
|
|
200
|
-
token="YOUR_TOKEN",
|
|
201
|
-
)
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
async def main() -> None:
|
|
205
|
-
await client.usage.record_bulk(
|
|
206
|
-
signals=[Signal(), Signal(), Signal()],
|
|
207
|
-
)
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
asyncio.run(main())
|
|
211
|
-
"""
|
|
212
|
-
_response = await self._raw_client.record_bulk(signals=signals, request_options=request_options)
|
|
213
|
-
return _response.data
|
|
214
|
-
|
|
215
|
-
async def usage_record_bulk_v_2(
|
|
216
|
-
self,
|
|
217
|
-
*,
|
|
218
|
-
signals: typing.Optional[typing.Sequence[SignalV2]] = OMIT,
|
|
219
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
220
|
-
) -> None:
|
|
221
|
-
"""
|
|
222
|
-
Parameters
|
|
223
|
-
----------
|
|
224
|
-
signals : typing.Optional[typing.Sequence[SignalV2]]
|
|
225
|
-
|
|
226
|
-
request_options : typing.Optional[RequestOptions]
|
|
227
|
-
Request-specific configuration.
|
|
228
|
-
|
|
229
|
-
Returns
|
|
230
|
-
-------
|
|
231
|
-
None
|
|
232
|
-
|
|
233
|
-
Examples
|
|
234
|
-
--------
|
|
235
|
-
import asyncio
|
|
236
|
-
|
|
237
|
-
from paid import AsyncPaid, SignalV2
|
|
238
|
-
|
|
239
|
-
client = AsyncPaid(
|
|
240
|
-
token="YOUR_TOKEN",
|
|
241
|
-
)
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
async def main() -> None:
|
|
245
|
-
await client.usage.usage_record_bulk_v_2(
|
|
246
|
-
signals=[
|
|
247
|
-
SignalV2(
|
|
248
|
-
event_name="emails_sent",
|
|
249
|
-
product_id="63fd642c-569d-44f9-8d67-5cf4944a16cc",
|
|
250
|
-
customer_id="7d0b6fce-d82a-433d-8315-c994f8f1d68d",
|
|
251
|
-
),
|
|
252
|
-
SignalV2(
|
|
253
|
-
event_name="emails_sent",
|
|
254
|
-
external_product_id="acme-product",
|
|
255
|
-
external_customer_id="acme-inc",
|
|
256
|
-
),
|
|
257
|
-
SignalV2(
|
|
258
|
-
event_name="meeting_booked",
|
|
259
|
-
product_id="63fd642c-569d-44f9-8d67-5cf4944a16cc",
|
|
260
|
-
external_customer_id="acme-inc",
|
|
261
|
-
data={"meeting_duration": 30, "meeting_type": "demo"},
|
|
262
|
-
),
|
|
263
|
-
],
|
|
264
|
-
)
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
asyncio.run(main())
|
|
268
|
-
"""
|
|
269
|
-
_response = await self._raw_client.usage_record_bulk_v_2(signals=signals, request_options=request_options)
|
|
270
|
-
return _response.data
|
|
271
|
-
|
|
272
|
-
async def check_usage(
|
|
273
|
-
self,
|
|
274
|
-
*,
|
|
275
|
-
external_customer_id: str,
|
|
276
|
-
external_product_id: str,
|
|
277
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
278
|
-
) -> UsageCheckUsageResponse:
|
|
279
|
-
"""
|
|
280
|
-
Parameters
|
|
281
|
-
----------
|
|
282
|
-
external_customer_id : str
|
|
283
|
-
External customer ID
|
|
284
|
-
|
|
285
|
-
external_product_id : str
|
|
286
|
-
External product ID (the external ID of the product/agent)
|
|
287
|
-
|
|
288
|
-
request_options : typing.Optional[RequestOptions]
|
|
289
|
-
Request-specific configuration.
|
|
290
|
-
|
|
291
|
-
Returns
|
|
292
|
-
-------
|
|
293
|
-
UsageCheckUsageResponse
|
|
294
|
-
Usage check response
|
|
295
|
-
|
|
296
|
-
Examples
|
|
297
|
-
--------
|
|
298
|
-
import asyncio
|
|
299
|
-
|
|
300
|
-
from paid import AsyncPaid
|
|
301
|
-
|
|
302
|
-
client = AsyncPaid(
|
|
303
|
-
token="YOUR_TOKEN",
|
|
304
|
-
)
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
async def main() -> None:
|
|
308
|
-
await client.usage.check_usage(
|
|
309
|
-
external_customer_id="acme-inc",
|
|
310
|
-
external_product_id="acme-agent",
|
|
311
|
-
)
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
asyncio.run(main())
|
|
315
|
-
"""
|
|
316
|
-
_response = await self._raw_client.check_usage(
|
|
317
|
-
external_customer_id=external_customer_id,
|
|
318
|
-
external_product_id=external_product_id,
|
|
319
|
-
request_options=request_options,
|
|
320
|
-
)
|
|
321
|
-
return _response.data
|