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/orders/lines/client.py
DELETED
|
@@ -1,144 +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.order import Order
|
|
8
|
-
from ...types.order_line_create import OrderLineCreate
|
|
9
|
-
from .raw_client import AsyncRawLinesClient, RawLinesClient
|
|
10
|
-
|
|
11
|
-
# this is used as the default value for optional parameters
|
|
12
|
-
OMIT = typing.cast(typing.Any, ...)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class LinesClient:
|
|
16
|
-
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
17
|
-
self._raw_client = RawLinesClient(client_wrapper=client_wrapper)
|
|
18
|
-
|
|
19
|
-
@property
|
|
20
|
-
def with_raw_response(self) -> RawLinesClient:
|
|
21
|
-
"""
|
|
22
|
-
Retrieves a raw implementation of this client that returns raw responses.
|
|
23
|
-
|
|
24
|
-
Returns
|
|
25
|
-
-------
|
|
26
|
-
RawLinesClient
|
|
27
|
-
"""
|
|
28
|
-
return self._raw_client
|
|
29
|
-
|
|
30
|
-
def update(
|
|
31
|
-
self,
|
|
32
|
-
order_id: str,
|
|
33
|
-
*,
|
|
34
|
-
lines: typing.Optional[typing.Sequence[OrderLineCreate]] = OMIT,
|
|
35
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
36
|
-
) -> Order:
|
|
37
|
-
"""
|
|
38
|
-
Parameters
|
|
39
|
-
----------
|
|
40
|
-
order_id : str
|
|
41
|
-
|
|
42
|
-
lines : typing.Optional[typing.Sequence[OrderLineCreate]]
|
|
43
|
-
|
|
44
|
-
request_options : typing.Optional[RequestOptions]
|
|
45
|
-
Request-specific configuration.
|
|
46
|
-
|
|
47
|
-
Returns
|
|
48
|
-
-------
|
|
49
|
-
Order
|
|
50
|
-
Success response
|
|
51
|
-
|
|
52
|
-
Examples
|
|
53
|
-
--------
|
|
54
|
-
from paid import OrderLineCreate, Paid
|
|
55
|
-
|
|
56
|
-
client = Paid(
|
|
57
|
-
token="YOUR_TOKEN",
|
|
58
|
-
)
|
|
59
|
-
client.orders.lines.update(
|
|
60
|
-
order_id="orderId",
|
|
61
|
-
lines=[
|
|
62
|
-
OrderLineCreate(
|
|
63
|
-
name="Order Line One",
|
|
64
|
-
description="Order Line One is an order line for Acme, Inc.",
|
|
65
|
-
),
|
|
66
|
-
OrderLineCreate(
|
|
67
|
-
name="Order Line Two",
|
|
68
|
-
description="Order Line Two is an order line for Acme, Inc.",
|
|
69
|
-
),
|
|
70
|
-
],
|
|
71
|
-
)
|
|
72
|
-
"""
|
|
73
|
-
_response = self._raw_client.update(order_id, lines=lines, request_options=request_options)
|
|
74
|
-
return _response.data
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
class AsyncLinesClient:
|
|
78
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
79
|
-
self._raw_client = AsyncRawLinesClient(client_wrapper=client_wrapper)
|
|
80
|
-
|
|
81
|
-
@property
|
|
82
|
-
def with_raw_response(self) -> AsyncRawLinesClient:
|
|
83
|
-
"""
|
|
84
|
-
Retrieves a raw implementation of this client that returns raw responses.
|
|
85
|
-
|
|
86
|
-
Returns
|
|
87
|
-
-------
|
|
88
|
-
AsyncRawLinesClient
|
|
89
|
-
"""
|
|
90
|
-
return self._raw_client
|
|
91
|
-
|
|
92
|
-
async def update(
|
|
93
|
-
self,
|
|
94
|
-
order_id: str,
|
|
95
|
-
*,
|
|
96
|
-
lines: typing.Optional[typing.Sequence[OrderLineCreate]] = OMIT,
|
|
97
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
98
|
-
) -> Order:
|
|
99
|
-
"""
|
|
100
|
-
Parameters
|
|
101
|
-
----------
|
|
102
|
-
order_id : str
|
|
103
|
-
|
|
104
|
-
lines : typing.Optional[typing.Sequence[OrderLineCreate]]
|
|
105
|
-
|
|
106
|
-
request_options : typing.Optional[RequestOptions]
|
|
107
|
-
Request-specific configuration.
|
|
108
|
-
|
|
109
|
-
Returns
|
|
110
|
-
-------
|
|
111
|
-
Order
|
|
112
|
-
Success response
|
|
113
|
-
|
|
114
|
-
Examples
|
|
115
|
-
--------
|
|
116
|
-
import asyncio
|
|
117
|
-
|
|
118
|
-
from paid import AsyncPaid, OrderLineCreate
|
|
119
|
-
|
|
120
|
-
client = AsyncPaid(
|
|
121
|
-
token="YOUR_TOKEN",
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
async def main() -> None:
|
|
126
|
-
await client.orders.lines.update(
|
|
127
|
-
order_id="orderId",
|
|
128
|
-
lines=[
|
|
129
|
-
OrderLineCreate(
|
|
130
|
-
name="Order Line One",
|
|
131
|
-
description="Order Line One is an order line for Acme, Inc.",
|
|
132
|
-
),
|
|
133
|
-
OrderLineCreate(
|
|
134
|
-
name="Order Line Two",
|
|
135
|
-
description="Order Line Two is an order line for Acme, Inc.",
|
|
136
|
-
),
|
|
137
|
-
],
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
asyncio.run(main())
|
|
142
|
-
"""
|
|
143
|
-
_response = await self._raw_client.update(order_id, lines=lines, request_options=request_options)
|
|
144
|
-
return _response.data
|
paid/orders/lines/raw_client.py
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
-
|
|
3
|
-
import typing
|
|
4
|
-
from json.decoder import JSONDecodeError
|
|
5
|
-
|
|
6
|
-
from ...core.api_error import ApiError
|
|
7
|
-
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
-
from ...core.http_response import AsyncHttpResponse, HttpResponse
|
|
9
|
-
from ...core.jsonable_encoder import jsonable_encoder
|
|
10
|
-
from ...core.pydantic_utilities import parse_obj_as
|
|
11
|
-
from ...core.request_options import RequestOptions
|
|
12
|
-
from ...core.serialization import convert_and_respect_annotation_metadata
|
|
13
|
-
from ...types.order import Order
|
|
14
|
-
from ...types.order_line_create import OrderLineCreate
|
|
15
|
-
|
|
16
|
-
# this is used as the default value for optional parameters
|
|
17
|
-
OMIT = typing.cast(typing.Any, ...)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class RawLinesClient:
|
|
21
|
-
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
22
|
-
self._client_wrapper = client_wrapper
|
|
23
|
-
|
|
24
|
-
def update(
|
|
25
|
-
self,
|
|
26
|
-
order_id: str,
|
|
27
|
-
*,
|
|
28
|
-
lines: typing.Optional[typing.Sequence[OrderLineCreate]] = OMIT,
|
|
29
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
30
|
-
) -> HttpResponse[Order]:
|
|
31
|
-
"""
|
|
32
|
-
Parameters
|
|
33
|
-
----------
|
|
34
|
-
order_id : str
|
|
35
|
-
|
|
36
|
-
lines : typing.Optional[typing.Sequence[OrderLineCreate]]
|
|
37
|
-
|
|
38
|
-
request_options : typing.Optional[RequestOptions]
|
|
39
|
-
Request-specific configuration.
|
|
40
|
-
|
|
41
|
-
Returns
|
|
42
|
-
-------
|
|
43
|
-
HttpResponse[Order]
|
|
44
|
-
Success response
|
|
45
|
-
"""
|
|
46
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
47
|
-
f"orders/{jsonable_encoder(order_id)}/lines",
|
|
48
|
-
method="PUT",
|
|
49
|
-
json={
|
|
50
|
-
"lines": convert_and_respect_annotation_metadata(
|
|
51
|
-
object_=lines, annotation=typing.Sequence[OrderLineCreate], direction="write"
|
|
52
|
-
),
|
|
53
|
-
},
|
|
54
|
-
headers={
|
|
55
|
-
"content-type": "application/json",
|
|
56
|
-
},
|
|
57
|
-
request_options=request_options,
|
|
58
|
-
omit=OMIT,
|
|
59
|
-
)
|
|
60
|
-
try:
|
|
61
|
-
if 200 <= _response.status_code < 300:
|
|
62
|
-
_data = typing.cast(
|
|
63
|
-
Order,
|
|
64
|
-
parse_obj_as(
|
|
65
|
-
type_=Order, # type: ignore
|
|
66
|
-
object_=_response.json(),
|
|
67
|
-
),
|
|
68
|
-
)
|
|
69
|
-
return HttpResponse(response=_response, data=_data)
|
|
70
|
-
_response_json = _response.json()
|
|
71
|
-
except JSONDecodeError:
|
|
72
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
73
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
class AsyncRawLinesClient:
|
|
77
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
78
|
-
self._client_wrapper = client_wrapper
|
|
79
|
-
|
|
80
|
-
async def update(
|
|
81
|
-
self,
|
|
82
|
-
order_id: str,
|
|
83
|
-
*,
|
|
84
|
-
lines: typing.Optional[typing.Sequence[OrderLineCreate]] = OMIT,
|
|
85
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
86
|
-
) -> AsyncHttpResponse[Order]:
|
|
87
|
-
"""
|
|
88
|
-
Parameters
|
|
89
|
-
----------
|
|
90
|
-
order_id : str
|
|
91
|
-
|
|
92
|
-
lines : typing.Optional[typing.Sequence[OrderLineCreate]]
|
|
93
|
-
|
|
94
|
-
request_options : typing.Optional[RequestOptions]
|
|
95
|
-
Request-specific configuration.
|
|
96
|
-
|
|
97
|
-
Returns
|
|
98
|
-
-------
|
|
99
|
-
AsyncHttpResponse[Order]
|
|
100
|
-
Success response
|
|
101
|
-
"""
|
|
102
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
103
|
-
f"orders/{jsonable_encoder(order_id)}/lines",
|
|
104
|
-
method="PUT",
|
|
105
|
-
json={
|
|
106
|
-
"lines": convert_and_respect_annotation_metadata(
|
|
107
|
-
object_=lines, annotation=typing.Sequence[OrderLineCreate], direction="write"
|
|
108
|
-
),
|
|
109
|
-
},
|
|
110
|
-
headers={
|
|
111
|
-
"content-type": "application/json",
|
|
112
|
-
},
|
|
113
|
-
request_options=request_options,
|
|
114
|
-
omit=OMIT,
|
|
115
|
-
)
|
|
116
|
-
try:
|
|
117
|
-
if 200 <= _response.status_code < 300:
|
|
118
|
-
_data = typing.cast(
|
|
119
|
-
Order,
|
|
120
|
-
parse_obj_as(
|
|
121
|
-
type_=Order, # type: ignore
|
|
122
|
-
object_=_response.json(),
|
|
123
|
-
),
|
|
124
|
-
)
|
|
125
|
-
return AsyncHttpResponse(response=_response, data=_data)
|
|
126
|
-
_response_json = _response.json()
|
|
127
|
-
except JSONDecodeError:
|
|
128
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
129
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
paid/plans/__init__.py
DELETED
paid/plans/client.py
DELETED
|
@@ -1,332 +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
|
-
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
7
|
-
from ..core.request_options import RequestOptions
|
|
8
|
-
from ..types.plan import Plan
|
|
9
|
-
from ..types.plan_group import PlanGroup
|
|
10
|
-
from ..types.usage_summaries_response import UsageSummariesResponse
|
|
11
|
-
from .raw_client import AsyncRawPlansClient, RawPlansClient
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class PlansClient:
|
|
15
|
-
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
16
|
-
self._raw_client = RawPlansClient(client_wrapper=client_wrapper)
|
|
17
|
-
|
|
18
|
-
@property
|
|
19
|
-
def with_raw_response(self) -> RawPlansClient:
|
|
20
|
-
"""
|
|
21
|
-
Retrieves a raw implementation of this client that returns raw responses.
|
|
22
|
-
|
|
23
|
-
Returns
|
|
24
|
-
-------
|
|
25
|
-
RawPlansClient
|
|
26
|
-
"""
|
|
27
|
-
return self._raw_client
|
|
28
|
-
|
|
29
|
-
def get_by_id(self, plan_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Plan:
|
|
30
|
-
"""
|
|
31
|
-
Parameters
|
|
32
|
-
----------
|
|
33
|
-
plan_id : str
|
|
34
|
-
The ID of the plan
|
|
35
|
-
|
|
36
|
-
request_options : typing.Optional[RequestOptions]
|
|
37
|
-
Request-specific configuration.
|
|
38
|
-
|
|
39
|
-
Returns
|
|
40
|
-
-------
|
|
41
|
-
Plan
|
|
42
|
-
Success response
|
|
43
|
-
|
|
44
|
-
Examples
|
|
45
|
-
--------
|
|
46
|
-
from paid import Paid
|
|
47
|
-
|
|
48
|
-
client = Paid(
|
|
49
|
-
token="YOUR_TOKEN",
|
|
50
|
-
)
|
|
51
|
-
client.plans.get_by_id(
|
|
52
|
-
plan_id="planId",
|
|
53
|
-
)
|
|
54
|
-
"""
|
|
55
|
-
_response = self._raw_client.get_by_id(plan_id, request_options=request_options)
|
|
56
|
-
return _response.data
|
|
57
|
-
|
|
58
|
-
def get_usage(
|
|
59
|
-
self,
|
|
60
|
-
plan_id: str,
|
|
61
|
-
*,
|
|
62
|
-
external_id: str,
|
|
63
|
-
limit: typing.Optional[int] = None,
|
|
64
|
-
offset: typing.Optional[int] = None,
|
|
65
|
-
start_time: typing.Optional[dt.datetime] = None,
|
|
66
|
-
end_time: typing.Optional[dt.datetime] = None,
|
|
67
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
68
|
-
) -> UsageSummariesResponse:
|
|
69
|
-
"""
|
|
70
|
-
Parameters
|
|
71
|
-
----------
|
|
72
|
-
plan_id : str
|
|
73
|
-
The ID of the plan
|
|
74
|
-
|
|
75
|
-
external_id : str
|
|
76
|
-
The external ID of the customer
|
|
77
|
-
|
|
78
|
-
limit : typing.Optional[int]
|
|
79
|
-
Maximum number of usage summaries to return (1-1000)
|
|
80
|
-
|
|
81
|
-
offset : typing.Optional[int]
|
|
82
|
-
Number of usage summaries to skip for pagination
|
|
83
|
-
|
|
84
|
-
start_time : typing.Optional[dt.datetime]
|
|
85
|
-
Filter usage summaries starting from this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
86
|
-
|
|
87
|
-
end_time : typing.Optional[dt.datetime]
|
|
88
|
-
Filter usage summaries up to this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
89
|
-
|
|
90
|
-
request_options : typing.Optional[RequestOptions]
|
|
91
|
-
Request-specific configuration.
|
|
92
|
-
|
|
93
|
-
Returns
|
|
94
|
-
-------
|
|
95
|
-
UsageSummariesResponse
|
|
96
|
-
Success response
|
|
97
|
-
|
|
98
|
-
Examples
|
|
99
|
-
--------
|
|
100
|
-
import datetime
|
|
101
|
-
|
|
102
|
-
from paid import Paid
|
|
103
|
-
|
|
104
|
-
client = Paid(
|
|
105
|
-
token="YOUR_TOKEN",
|
|
106
|
-
)
|
|
107
|
-
client.plans.get_usage(
|
|
108
|
-
plan_id="planId",
|
|
109
|
-
external_id="externalId",
|
|
110
|
-
limit=1,
|
|
111
|
-
offset=1,
|
|
112
|
-
start_time=datetime.datetime.fromisoformat(
|
|
113
|
-
"2024-01-15 09:30:00+00:00",
|
|
114
|
-
),
|
|
115
|
-
end_time=datetime.datetime.fromisoformat(
|
|
116
|
-
"2024-01-15 09:30:00+00:00",
|
|
117
|
-
),
|
|
118
|
-
)
|
|
119
|
-
"""
|
|
120
|
-
_response = self._raw_client.get_usage(
|
|
121
|
-
plan_id,
|
|
122
|
-
external_id=external_id,
|
|
123
|
-
limit=limit,
|
|
124
|
-
offset=offset,
|
|
125
|
-
start_time=start_time,
|
|
126
|
-
end_time=end_time,
|
|
127
|
-
request_options=request_options,
|
|
128
|
-
)
|
|
129
|
-
return _response.data
|
|
130
|
-
|
|
131
|
-
def get_group_by_id(
|
|
132
|
-
self, plan_group_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
133
|
-
) -> PlanGroup:
|
|
134
|
-
"""
|
|
135
|
-
Parameters
|
|
136
|
-
----------
|
|
137
|
-
plan_group_id : str
|
|
138
|
-
The ID of the plan group
|
|
139
|
-
|
|
140
|
-
request_options : typing.Optional[RequestOptions]
|
|
141
|
-
Request-specific configuration.
|
|
142
|
-
|
|
143
|
-
Returns
|
|
144
|
-
-------
|
|
145
|
-
PlanGroup
|
|
146
|
-
Success response
|
|
147
|
-
|
|
148
|
-
Examples
|
|
149
|
-
--------
|
|
150
|
-
from paid import Paid
|
|
151
|
-
|
|
152
|
-
client = Paid(
|
|
153
|
-
token="YOUR_TOKEN",
|
|
154
|
-
)
|
|
155
|
-
client.plans.get_group_by_id(
|
|
156
|
-
plan_group_id="planGroupId",
|
|
157
|
-
)
|
|
158
|
-
"""
|
|
159
|
-
_response = self._raw_client.get_group_by_id(plan_group_id, request_options=request_options)
|
|
160
|
-
return _response.data
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
class AsyncPlansClient:
|
|
164
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
165
|
-
self._raw_client = AsyncRawPlansClient(client_wrapper=client_wrapper)
|
|
166
|
-
|
|
167
|
-
@property
|
|
168
|
-
def with_raw_response(self) -> AsyncRawPlansClient:
|
|
169
|
-
"""
|
|
170
|
-
Retrieves a raw implementation of this client that returns raw responses.
|
|
171
|
-
|
|
172
|
-
Returns
|
|
173
|
-
-------
|
|
174
|
-
AsyncRawPlansClient
|
|
175
|
-
"""
|
|
176
|
-
return self._raw_client
|
|
177
|
-
|
|
178
|
-
async def get_by_id(self, plan_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Plan:
|
|
179
|
-
"""
|
|
180
|
-
Parameters
|
|
181
|
-
----------
|
|
182
|
-
plan_id : str
|
|
183
|
-
The ID of the plan
|
|
184
|
-
|
|
185
|
-
request_options : typing.Optional[RequestOptions]
|
|
186
|
-
Request-specific configuration.
|
|
187
|
-
|
|
188
|
-
Returns
|
|
189
|
-
-------
|
|
190
|
-
Plan
|
|
191
|
-
Success response
|
|
192
|
-
|
|
193
|
-
Examples
|
|
194
|
-
--------
|
|
195
|
-
import asyncio
|
|
196
|
-
|
|
197
|
-
from paid import AsyncPaid
|
|
198
|
-
|
|
199
|
-
client = AsyncPaid(
|
|
200
|
-
token="YOUR_TOKEN",
|
|
201
|
-
)
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
async def main() -> None:
|
|
205
|
-
await client.plans.get_by_id(
|
|
206
|
-
plan_id="planId",
|
|
207
|
-
)
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
asyncio.run(main())
|
|
211
|
-
"""
|
|
212
|
-
_response = await self._raw_client.get_by_id(plan_id, request_options=request_options)
|
|
213
|
-
return _response.data
|
|
214
|
-
|
|
215
|
-
async def get_usage(
|
|
216
|
-
self,
|
|
217
|
-
plan_id: str,
|
|
218
|
-
*,
|
|
219
|
-
external_id: str,
|
|
220
|
-
limit: typing.Optional[int] = None,
|
|
221
|
-
offset: typing.Optional[int] = None,
|
|
222
|
-
start_time: typing.Optional[dt.datetime] = None,
|
|
223
|
-
end_time: typing.Optional[dt.datetime] = None,
|
|
224
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
225
|
-
) -> UsageSummariesResponse:
|
|
226
|
-
"""
|
|
227
|
-
Parameters
|
|
228
|
-
----------
|
|
229
|
-
plan_id : str
|
|
230
|
-
The ID of the plan
|
|
231
|
-
|
|
232
|
-
external_id : str
|
|
233
|
-
The external ID of the customer
|
|
234
|
-
|
|
235
|
-
limit : typing.Optional[int]
|
|
236
|
-
Maximum number of usage summaries to return (1-1000)
|
|
237
|
-
|
|
238
|
-
offset : typing.Optional[int]
|
|
239
|
-
Number of usage summaries to skip for pagination
|
|
240
|
-
|
|
241
|
-
start_time : typing.Optional[dt.datetime]
|
|
242
|
-
Filter usage summaries starting from this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
243
|
-
|
|
244
|
-
end_time : typing.Optional[dt.datetime]
|
|
245
|
-
Filter usage summaries up to this time (ISO 8601 format). Returns summaries that overlap with the time range.
|
|
246
|
-
|
|
247
|
-
request_options : typing.Optional[RequestOptions]
|
|
248
|
-
Request-specific configuration.
|
|
249
|
-
|
|
250
|
-
Returns
|
|
251
|
-
-------
|
|
252
|
-
UsageSummariesResponse
|
|
253
|
-
Success response
|
|
254
|
-
|
|
255
|
-
Examples
|
|
256
|
-
--------
|
|
257
|
-
import asyncio
|
|
258
|
-
import datetime
|
|
259
|
-
|
|
260
|
-
from paid import AsyncPaid
|
|
261
|
-
|
|
262
|
-
client = AsyncPaid(
|
|
263
|
-
token="YOUR_TOKEN",
|
|
264
|
-
)
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
async def main() -> None:
|
|
268
|
-
await client.plans.get_usage(
|
|
269
|
-
plan_id="planId",
|
|
270
|
-
external_id="externalId",
|
|
271
|
-
limit=1,
|
|
272
|
-
offset=1,
|
|
273
|
-
start_time=datetime.datetime.fromisoformat(
|
|
274
|
-
"2024-01-15 09:30:00+00:00",
|
|
275
|
-
),
|
|
276
|
-
end_time=datetime.datetime.fromisoformat(
|
|
277
|
-
"2024-01-15 09:30:00+00:00",
|
|
278
|
-
),
|
|
279
|
-
)
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
asyncio.run(main())
|
|
283
|
-
"""
|
|
284
|
-
_response = await self._raw_client.get_usage(
|
|
285
|
-
plan_id,
|
|
286
|
-
external_id=external_id,
|
|
287
|
-
limit=limit,
|
|
288
|
-
offset=offset,
|
|
289
|
-
start_time=start_time,
|
|
290
|
-
end_time=end_time,
|
|
291
|
-
request_options=request_options,
|
|
292
|
-
)
|
|
293
|
-
return _response.data
|
|
294
|
-
|
|
295
|
-
async def get_group_by_id(
|
|
296
|
-
self, plan_group_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
297
|
-
) -> PlanGroup:
|
|
298
|
-
"""
|
|
299
|
-
Parameters
|
|
300
|
-
----------
|
|
301
|
-
plan_group_id : str
|
|
302
|
-
The ID of the plan group
|
|
303
|
-
|
|
304
|
-
request_options : typing.Optional[RequestOptions]
|
|
305
|
-
Request-specific configuration.
|
|
306
|
-
|
|
307
|
-
Returns
|
|
308
|
-
-------
|
|
309
|
-
PlanGroup
|
|
310
|
-
Success response
|
|
311
|
-
|
|
312
|
-
Examples
|
|
313
|
-
--------
|
|
314
|
-
import asyncio
|
|
315
|
-
|
|
316
|
-
from paid import AsyncPaid
|
|
317
|
-
|
|
318
|
-
client = AsyncPaid(
|
|
319
|
-
token="YOUR_TOKEN",
|
|
320
|
-
)
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
async def main() -> None:
|
|
324
|
-
await client.plans.get_group_by_id(
|
|
325
|
-
plan_group_id="planGroupId",
|
|
326
|
-
)
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
asyncio.run(main())
|
|
330
|
-
"""
|
|
331
|
-
_response = await self._raw_client.get_group_by_id(plan_group_id, request_options=request_options)
|
|
332
|
-
return _response.data
|