lark-billing 0.0.7__py3-none-any.whl → 0.0.9__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.
Potentially problematic release.
This version of lark-billing might be problematic. Click here for more details.
- lark/__init__.py +45 -29
- lark/checkout/client.py +34 -12
- lark/checkout/raw_client.py +22 -6
- lark/client.py +19 -0
- lark/core/client_wrapper.py +2 -2
- lark/core/http_sse/__init__.py +42 -0
- lark/core/http_sse/_api.py +112 -0
- lark/core/http_sse/_decoders.py +61 -0
- lark/core/http_sse/_exceptions.py +7 -0
- lark/core/http_sse/_models.py +17 -0
- lark/core/pydantic_utilities.py +3 -1
- lark/customer_portal/client.py +4 -2
- lark/customer_portal/raw_client.py +2 -0
- lark/invoices/__init__.py +4 -0
- lark/invoices/client.py +136 -0
- lark/invoices/raw_client.py +147 -0
- lark/pricing_metrics/client.py +69 -0
- lark/pricing_metrics/raw_client.py +101 -0
- lark/rate_cards/__init__.py +15 -3
- lark/rate_cards/client.py +20 -14
- lark/rate_cards/raw_client.py +26 -20
- lark/rate_cards/types/__init__.py +12 -2
- lark/rate_cards/types/create_rate_card_request_usage_based_rates_item.py +30 -0
- lark/subjects/client.py +16 -18
- lark/subjects/raw_client.py +14 -8
- lark/subscriptions/client.py +194 -8
- lark/subscriptions/raw_client.py +256 -4
- lark/types/__init__.py +31 -32
- lark/types/aggregation.py +1 -43
- lark/types/amount.py +4 -1
- lark/types/create_customer_portal_session_response.py +9 -2
- lark/types/{create_simple_usage_based_rate_interface.py → create_fixed_rate_request.py} +11 -6
- lark/types/create_simple_usage_based_rate_request.py +39 -0
- lark/types/create_subject_response.py +29 -6
- lark/types/create_subscription_checkout_session_response.py +14 -3
- lark/types/fixed_rate_interface.py +1 -1
- lark/types/{custom_pricing_metric_resource.py → invoice_line_item_resource.py} +6 -2
- lark/types/invoice_resource.py +56 -0
- lark/types/invoice_status.py +5 -0
- lark/types/{max_aggregation_pricing_metric_resource.py → list_invoices_response.py} +4 -2
- lark/types/{create_fixed_rate_interface.py → list_pricing_metrics_response.py} +4 -5
- lark/types/period_resource.py +23 -0
- lark/types/{last_aggregation_pricing_metric_resource.py → pricing_metric_resource.py} +7 -2
- lark/types/rate_card_resource.py +36 -7
- lark/types/rate_card_resource_usage_based_rates_item.py +1 -2
- lark/types/simple_usage_based_rate_interface.py +1 -6
- lark/types/subject_resource.py +29 -6
- lark/types/subscription_resource.py +42 -8
- lark/types/subscription_status.py +5 -0
- lark/usage_events/__init__.py +6 -3
- lark/usage_events/client.py +15 -4
- lark/usage_events/raw_client.py +21 -6
- lark/usage_events/types/__init__.py +4 -2
- lark/{types/status.py → usage_events/types/create_usage_event_request_data_value.py} +1 -1
- {lark_billing-0.0.7.dist-info → lark_billing-0.0.9.dist-info}/METADATA +8 -7
- lark_billing-0.0.9.dist-info/RECORD +108 -0
- lark_billing-0.0.7.dist-info/RECORD +0 -94
- {lark_billing-0.0.7.dist-info → lark_billing-0.0.9.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import Any, Optional
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(frozen=True)
|
|
9
|
+
class ServerSentEvent:
|
|
10
|
+
event: str = "message"
|
|
11
|
+
data: str = ""
|
|
12
|
+
id: str = ""
|
|
13
|
+
retry: Optional[int] = None
|
|
14
|
+
|
|
15
|
+
def json(self) -> Any:
|
|
16
|
+
"""Parse the data field as JSON."""
|
|
17
|
+
return json.loads(self.data)
|
lark/core/pydantic_utilities.py
CHANGED
|
@@ -220,7 +220,9 @@ def universal_root_validator(
|
|
|
220
220
|
) -> Callable[[AnyCallable], AnyCallable]:
|
|
221
221
|
def decorator(func: AnyCallable) -> AnyCallable:
|
|
222
222
|
if IS_PYDANTIC_V2:
|
|
223
|
-
|
|
223
|
+
# In Pydantic v2, for RootModel we always use "before" mode
|
|
224
|
+
# The custom validators transform the input value before the model is created
|
|
225
|
+
return cast(AnyCallable, pydantic.model_validator(mode="before")(func)) # type: ignore[attr-defined]
|
|
224
226
|
return cast(AnyCallable, pydantic.root_validator(pre=pre)(func)) # type: ignore[call-overload]
|
|
225
227
|
|
|
226
228
|
return decorator
|
lark/customer_portal/client.py
CHANGED
|
@@ -33,6 +33,7 @@ class CustomerPortalClient:
|
|
|
33
33
|
Parameters
|
|
34
34
|
----------
|
|
35
35
|
subject_id : str
|
|
36
|
+
The ID of the subject to create the customer portal session for.
|
|
36
37
|
|
|
37
38
|
request_options : typing.Optional[RequestOptions]
|
|
38
39
|
Request-specific configuration.
|
|
@@ -50,7 +51,7 @@ class CustomerPortalClient:
|
|
|
50
51
|
api_key="YOUR_API_KEY",
|
|
51
52
|
)
|
|
52
53
|
client.customer_portal.create_customer_portal_session(
|
|
53
|
-
subject_id="
|
|
54
|
+
subject_id="subj_VyX6Q96h5avMho8O7QWlKeXE",
|
|
54
55
|
)
|
|
55
56
|
"""
|
|
56
57
|
_response = self._raw_client.create_customer_portal_session(
|
|
@@ -81,6 +82,7 @@ class AsyncCustomerPortalClient:
|
|
|
81
82
|
Parameters
|
|
82
83
|
----------
|
|
83
84
|
subject_id : str
|
|
85
|
+
The ID of the subject to create the customer portal session for.
|
|
84
86
|
|
|
85
87
|
request_options : typing.Optional[RequestOptions]
|
|
86
88
|
Request-specific configuration.
|
|
@@ -103,7 +105,7 @@ class AsyncCustomerPortalClient:
|
|
|
103
105
|
|
|
104
106
|
async def main() -> None:
|
|
105
107
|
await client.customer_portal.create_customer_portal_session(
|
|
106
|
-
subject_id="
|
|
108
|
+
subject_id="subj_VyX6Q96h5avMho8O7QWlKeXE",
|
|
107
109
|
)
|
|
108
110
|
|
|
109
111
|
|
|
@@ -27,6 +27,7 @@ class RawCustomerPortalClient:
|
|
|
27
27
|
Parameters
|
|
28
28
|
----------
|
|
29
29
|
subject_id : str
|
|
30
|
+
The ID of the subject to create the customer portal session for.
|
|
30
31
|
|
|
31
32
|
request_options : typing.Optional[RequestOptions]
|
|
32
33
|
Request-specific configuration.
|
|
@@ -86,6 +87,7 @@ class AsyncRawCustomerPortalClient:
|
|
|
86
87
|
Parameters
|
|
87
88
|
----------
|
|
88
89
|
subject_id : str
|
|
90
|
+
The ID of the subject to create the customer portal session for.
|
|
89
91
|
|
|
90
92
|
request_options : typing.Optional[RequestOptions]
|
|
91
93
|
Request-specific configuration.
|
lark/invoices/client.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
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.list_invoices_response import ListInvoicesResponse
|
|
8
|
+
from .raw_client import AsyncRawInvoicesClient, RawInvoicesClient
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class InvoicesClient:
|
|
12
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
13
|
+
self._raw_client = RawInvoicesClient(client_wrapper=client_wrapper)
|
|
14
|
+
|
|
15
|
+
@property
|
|
16
|
+
def with_raw_response(self) -> RawInvoicesClient:
|
|
17
|
+
"""
|
|
18
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
19
|
+
|
|
20
|
+
Returns
|
|
21
|
+
-------
|
|
22
|
+
RawInvoicesClient
|
|
23
|
+
"""
|
|
24
|
+
return self._raw_client
|
|
25
|
+
|
|
26
|
+
def list_invoices(
|
|
27
|
+
self,
|
|
28
|
+
*,
|
|
29
|
+
subject_id: str,
|
|
30
|
+
limit: typing.Optional[int] = None,
|
|
31
|
+
offset: typing.Optional[int] = None,
|
|
32
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
33
|
+
) -> ListInvoicesResponse:
|
|
34
|
+
"""
|
|
35
|
+
Parameters
|
|
36
|
+
----------
|
|
37
|
+
subject_id : str
|
|
38
|
+
The ID of the subject to list invoices for.
|
|
39
|
+
|
|
40
|
+
limit : typing.Optional[int]
|
|
41
|
+
|
|
42
|
+
offset : typing.Optional[int]
|
|
43
|
+
|
|
44
|
+
request_options : typing.Optional[RequestOptions]
|
|
45
|
+
Request-specific configuration.
|
|
46
|
+
|
|
47
|
+
Returns
|
|
48
|
+
-------
|
|
49
|
+
ListInvoicesResponse
|
|
50
|
+
Successful Response
|
|
51
|
+
|
|
52
|
+
Examples
|
|
53
|
+
--------
|
|
54
|
+
from lark import Lark
|
|
55
|
+
|
|
56
|
+
client = Lark(
|
|
57
|
+
api_key="YOUR_API_KEY",
|
|
58
|
+
)
|
|
59
|
+
client.invoices.list_invoices(
|
|
60
|
+
subject_id="subject_id",
|
|
61
|
+
limit=1,
|
|
62
|
+
offset=1,
|
|
63
|
+
)
|
|
64
|
+
"""
|
|
65
|
+
_response = self._raw_client.list_invoices(
|
|
66
|
+
subject_id=subject_id, limit=limit, offset=offset, request_options=request_options
|
|
67
|
+
)
|
|
68
|
+
return _response.data
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class AsyncInvoicesClient:
|
|
72
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
73
|
+
self._raw_client = AsyncRawInvoicesClient(client_wrapper=client_wrapper)
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def with_raw_response(self) -> AsyncRawInvoicesClient:
|
|
77
|
+
"""
|
|
78
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
79
|
+
|
|
80
|
+
Returns
|
|
81
|
+
-------
|
|
82
|
+
AsyncRawInvoicesClient
|
|
83
|
+
"""
|
|
84
|
+
return self._raw_client
|
|
85
|
+
|
|
86
|
+
async def list_invoices(
|
|
87
|
+
self,
|
|
88
|
+
*,
|
|
89
|
+
subject_id: str,
|
|
90
|
+
limit: typing.Optional[int] = None,
|
|
91
|
+
offset: typing.Optional[int] = None,
|
|
92
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
93
|
+
) -> ListInvoicesResponse:
|
|
94
|
+
"""
|
|
95
|
+
Parameters
|
|
96
|
+
----------
|
|
97
|
+
subject_id : str
|
|
98
|
+
The ID of the subject to list invoices for.
|
|
99
|
+
|
|
100
|
+
limit : typing.Optional[int]
|
|
101
|
+
|
|
102
|
+
offset : typing.Optional[int]
|
|
103
|
+
|
|
104
|
+
request_options : typing.Optional[RequestOptions]
|
|
105
|
+
Request-specific configuration.
|
|
106
|
+
|
|
107
|
+
Returns
|
|
108
|
+
-------
|
|
109
|
+
ListInvoicesResponse
|
|
110
|
+
Successful Response
|
|
111
|
+
|
|
112
|
+
Examples
|
|
113
|
+
--------
|
|
114
|
+
import asyncio
|
|
115
|
+
|
|
116
|
+
from lark import AsyncLark
|
|
117
|
+
|
|
118
|
+
client = AsyncLark(
|
|
119
|
+
api_key="YOUR_API_KEY",
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
async def main() -> None:
|
|
124
|
+
await client.invoices.list_invoices(
|
|
125
|
+
subject_id="subject_id",
|
|
126
|
+
limit=1,
|
|
127
|
+
offset=1,
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
asyncio.run(main())
|
|
132
|
+
"""
|
|
133
|
+
_response = await self._raw_client.list_invoices(
|
|
134
|
+
subject_id=subject_id, limit=limit, offset=offset, request_options=request_options
|
|
135
|
+
)
|
|
136
|
+
return _response.data
|
|
@@ -0,0 +1,147 @@
|
|
|
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.pydantic_utilities import parse_obj_as
|
|
10
|
+
from ..core.request_options import RequestOptions
|
|
11
|
+
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
12
|
+
from ..types.http_validation_error import HttpValidationError
|
|
13
|
+
from ..types.list_invoices_response import ListInvoicesResponse
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class RawInvoicesClient:
|
|
17
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
18
|
+
self._client_wrapper = client_wrapper
|
|
19
|
+
|
|
20
|
+
def list_invoices(
|
|
21
|
+
self,
|
|
22
|
+
*,
|
|
23
|
+
subject_id: str,
|
|
24
|
+
limit: typing.Optional[int] = None,
|
|
25
|
+
offset: typing.Optional[int] = None,
|
|
26
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
27
|
+
) -> HttpResponse[ListInvoicesResponse]:
|
|
28
|
+
"""
|
|
29
|
+
Parameters
|
|
30
|
+
----------
|
|
31
|
+
subject_id : str
|
|
32
|
+
The ID of the subject to list invoices for.
|
|
33
|
+
|
|
34
|
+
limit : typing.Optional[int]
|
|
35
|
+
|
|
36
|
+
offset : typing.Optional[int]
|
|
37
|
+
|
|
38
|
+
request_options : typing.Optional[RequestOptions]
|
|
39
|
+
Request-specific configuration.
|
|
40
|
+
|
|
41
|
+
Returns
|
|
42
|
+
-------
|
|
43
|
+
HttpResponse[ListInvoicesResponse]
|
|
44
|
+
Successful Response
|
|
45
|
+
"""
|
|
46
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
47
|
+
"invoices",
|
|
48
|
+
method="GET",
|
|
49
|
+
params={
|
|
50
|
+
"subject_id": subject_id,
|
|
51
|
+
"limit": limit,
|
|
52
|
+
"offset": offset,
|
|
53
|
+
},
|
|
54
|
+
request_options=request_options,
|
|
55
|
+
)
|
|
56
|
+
try:
|
|
57
|
+
if 200 <= _response.status_code < 300:
|
|
58
|
+
_data = typing.cast(
|
|
59
|
+
ListInvoicesResponse,
|
|
60
|
+
parse_obj_as(
|
|
61
|
+
type_=ListInvoicesResponse, # type: ignore
|
|
62
|
+
object_=_response.json(),
|
|
63
|
+
),
|
|
64
|
+
)
|
|
65
|
+
return HttpResponse(response=_response, data=_data)
|
|
66
|
+
if _response.status_code == 422:
|
|
67
|
+
raise UnprocessableEntityError(
|
|
68
|
+
headers=dict(_response.headers),
|
|
69
|
+
body=typing.cast(
|
|
70
|
+
HttpValidationError,
|
|
71
|
+
parse_obj_as(
|
|
72
|
+
type_=HttpValidationError, # type: ignore
|
|
73
|
+
object_=_response.json(),
|
|
74
|
+
),
|
|
75
|
+
),
|
|
76
|
+
)
|
|
77
|
+
_response_json = _response.json()
|
|
78
|
+
except JSONDecodeError:
|
|
79
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
80
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class AsyncRawInvoicesClient:
|
|
84
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
85
|
+
self._client_wrapper = client_wrapper
|
|
86
|
+
|
|
87
|
+
async def list_invoices(
|
|
88
|
+
self,
|
|
89
|
+
*,
|
|
90
|
+
subject_id: str,
|
|
91
|
+
limit: typing.Optional[int] = None,
|
|
92
|
+
offset: typing.Optional[int] = None,
|
|
93
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
94
|
+
) -> AsyncHttpResponse[ListInvoicesResponse]:
|
|
95
|
+
"""
|
|
96
|
+
Parameters
|
|
97
|
+
----------
|
|
98
|
+
subject_id : str
|
|
99
|
+
The ID of the subject to list invoices for.
|
|
100
|
+
|
|
101
|
+
limit : typing.Optional[int]
|
|
102
|
+
|
|
103
|
+
offset : typing.Optional[int]
|
|
104
|
+
|
|
105
|
+
request_options : typing.Optional[RequestOptions]
|
|
106
|
+
Request-specific configuration.
|
|
107
|
+
|
|
108
|
+
Returns
|
|
109
|
+
-------
|
|
110
|
+
AsyncHttpResponse[ListInvoicesResponse]
|
|
111
|
+
Successful Response
|
|
112
|
+
"""
|
|
113
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
114
|
+
"invoices",
|
|
115
|
+
method="GET",
|
|
116
|
+
params={
|
|
117
|
+
"subject_id": subject_id,
|
|
118
|
+
"limit": limit,
|
|
119
|
+
"offset": offset,
|
|
120
|
+
},
|
|
121
|
+
request_options=request_options,
|
|
122
|
+
)
|
|
123
|
+
try:
|
|
124
|
+
if 200 <= _response.status_code < 300:
|
|
125
|
+
_data = typing.cast(
|
|
126
|
+
ListInvoicesResponse,
|
|
127
|
+
parse_obj_as(
|
|
128
|
+
type_=ListInvoicesResponse, # type: ignore
|
|
129
|
+
object_=_response.json(),
|
|
130
|
+
),
|
|
131
|
+
)
|
|
132
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
133
|
+
if _response.status_code == 422:
|
|
134
|
+
raise UnprocessableEntityError(
|
|
135
|
+
headers=dict(_response.headers),
|
|
136
|
+
body=typing.cast(
|
|
137
|
+
HttpValidationError,
|
|
138
|
+
parse_obj_as(
|
|
139
|
+
type_=HttpValidationError, # type: ignore
|
|
140
|
+
object_=_response.json(),
|
|
141
|
+
),
|
|
142
|
+
),
|
|
143
|
+
)
|
|
144
|
+
_response_json = _response.json()
|
|
145
|
+
except JSONDecodeError:
|
|
146
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
147
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
lark/pricing_metrics/client.py
CHANGED
|
@@ -6,6 +6,7 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
|
6
6
|
from ..core.request_options import RequestOptions
|
|
7
7
|
from ..types.create_pricing_metric_response import CreatePricingMetricResponse
|
|
8
8
|
from ..types.get_pricing_metric_response import GetPricingMetricResponse
|
|
9
|
+
from ..types.list_pricing_metrics_response import ListPricingMetricsResponse
|
|
9
10
|
from .raw_client import AsyncRawPricingMetricsClient, RawPricingMetricsClient
|
|
10
11
|
from .types.pricing_metric_aggregation import PricingMetricAggregation
|
|
11
12
|
|
|
@@ -28,6 +29,36 @@ class PricingMetricsClient:
|
|
|
28
29
|
"""
|
|
29
30
|
return self._raw_client
|
|
30
31
|
|
|
32
|
+
def list_pricing_metrics(
|
|
33
|
+
self, *, limit: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
34
|
+
) -> ListPricingMetricsResponse:
|
|
35
|
+
"""
|
|
36
|
+
Parameters
|
|
37
|
+
----------
|
|
38
|
+
limit : typing.Optional[int]
|
|
39
|
+
|
|
40
|
+
request_options : typing.Optional[RequestOptions]
|
|
41
|
+
Request-specific configuration.
|
|
42
|
+
|
|
43
|
+
Returns
|
|
44
|
+
-------
|
|
45
|
+
ListPricingMetricsResponse
|
|
46
|
+
Successful Response
|
|
47
|
+
|
|
48
|
+
Examples
|
|
49
|
+
--------
|
|
50
|
+
from lark import Lark
|
|
51
|
+
|
|
52
|
+
client = Lark(
|
|
53
|
+
api_key="YOUR_API_KEY",
|
|
54
|
+
)
|
|
55
|
+
client.pricing_metrics.list_pricing_metrics(
|
|
56
|
+
limit=1,
|
|
57
|
+
)
|
|
58
|
+
"""
|
|
59
|
+
_response = self._raw_client.list_pricing_metrics(limit=limit, request_options=request_options)
|
|
60
|
+
return _response.data
|
|
61
|
+
|
|
31
62
|
def create_pricing_metric(
|
|
32
63
|
self,
|
|
33
64
|
*,
|
|
@@ -123,6 +154,44 @@ class AsyncPricingMetricsClient:
|
|
|
123
154
|
"""
|
|
124
155
|
return self._raw_client
|
|
125
156
|
|
|
157
|
+
async def list_pricing_metrics(
|
|
158
|
+
self, *, limit: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
159
|
+
) -> ListPricingMetricsResponse:
|
|
160
|
+
"""
|
|
161
|
+
Parameters
|
|
162
|
+
----------
|
|
163
|
+
limit : typing.Optional[int]
|
|
164
|
+
|
|
165
|
+
request_options : typing.Optional[RequestOptions]
|
|
166
|
+
Request-specific configuration.
|
|
167
|
+
|
|
168
|
+
Returns
|
|
169
|
+
-------
|
|
170
|
+
ListPricingMetricsResponse
|
|
171
|
+
Successful Response
|
|
172
|
+
|
|
173
|
+
Examples
|
|
174
|
+
--------
|
|
175
|
+
import asyncio
|
|
176
|
+
|
|
177
|
+
from lark import AsyncLark
|
|
178
|
+
|
|
179
|
+
client = AsyncLark(
|
|
180
|
+
api_key="YOUR_API_KEY",
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
async def main() -> None:
|
|
185
|
+
await client.pricing_metrics.list_pricing_metrics(
|
|
186
|
+
limit=1,
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
asyncio.run(main())
|
|
191
|
+
"""
|
|
192
|
+
_response = await self._raw_client.list_pricing_metrics(limit=limit, request_options=request_options)
|
|
193
|
+
return _response.data
|
|
194
|
+
|
|
126
195
|
async def create_pricing_metric(
|
|
127
196
|
self,
|
|
128
197
|
*,
|
|
@@ -14,6 +14,7 @@ from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
|
14
14
|
from ..types.create_pricing_metric_response import CreatePricingMetricResponse
|
|
15
15
|
from ..types.get_pricing_metric_response import GetPricingMetricResponse
|
|
16
16
|
from ..types.http_validation_error import HttpValidationError
|
|
17
|
+
from ..types.list_pricing_metrics_response import ListPricingMetricsResponse
|
|
17
18
|
from .types.pricing_metric_aggregation import PricingMetricAggregation
|
|
18
19
|
|
|
19
20
|
# this is used as the default value for optional parameters
|
|
@@ -24,6 +25,56 @@ class RawPricingMetricsClient:
|
|
|
24
25
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
25
26
|
self._client_wrapper = client_wrapper
|
|
26
27
|
|
|
28
|
+
def list_pricing_metrics(
|
|
29
|
+
self, *, limit: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
30
|
+
) -> HttpResponse[ListPricingMetricsResponse]:
|
|
31
|
+
"""
|
|
32
|
+
Parameters
|
|
33
|
+
----------
|
|
34
|
+
limit : typing.Optional[int]
|
|
35
|
+
|
|
36
|
+
request_options : typing.Optional[RequestOptions]
|
|
37
|
+
Request-specific configuration.
|
|
38
|
+
|
|
39
|
+
Returns
|
|
40
|
+
-------
|
|
41
|
+
HttpResponse[ListPricingMetricsResponse]
|
|
42
|
+
Successful Response
|
|
43
|
+
"""
|
|
44
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
45
|
+
"pricing-metrics",
|
|
46
|
+
method="GET",
|
|
47
|
+
params={
|
|
48
|
+
"limit": limit,
|
|
49
|
+
},
|
|
50
|
+
request_options=request_options,
|
|
51
|
+
)
|
|
52
|
+
try:
|
|
53
|
+
if 200 <= _response.status_code < 300:
|
|
54
|
+
_data = typing.cast(
|
|
55
|
+
ListPricingMetricsResponse,
|
|
56
|
+
parse_obj_as(
|
|
57
|
+
type_=ListPricingMetricsResponse, # type: ignore
|
|
58
|
+
object_=_response.json(),
|
|
59
|
+
),
|
|
60
|
+
)
|
|
61
|
+
return HttpResponse(response=_response, data=_data)
|
|
62
|
+
if _response.status_code == 422:
|
|
63
|
+
raise UnprocessableEntityError(
|
|
64
|
+
headers=dict(_response.headers),
|
|
65
|
+
body=typing.cast(
|
|
66
|
+
HttpValidationError,
|
|
67
|
+
parse_obj_as(
|
|
68
|
+
type_=HttpValidationError, # type: ignore
|
|
69
|
+
object_=_response.json(),
|
|
70
|
+
),
|
|
71
|
+
),
|
|
72
|
+
)
|
|
73
|
+
_response_json = _response.json()
|
|
74
|
+
except JSONDecodeError:
|
|
75
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
76
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
77
|
+
|
|
27
78
|
def create_pricing_metric(
|
|
28
79
|
self,
|
|
29
80
|
*,
|
|
@@ -148,6 +199,56 @@ class AsyncRawPricingMetricsClient:
|
|
|
148
199
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
149
200
|
self._client_wrapper = client_wrapper
|
|
150
201
|
|
|
202
|
+
async def list_pricing_metrics(
|
|
203
|
+
self, *, limit: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
204
|
+
) -> AsyncHttpResponse[ListPricingMetricsResponse]:
|
|
205
|
+
"""
|
|
206
|
+
Parameters
|
|
207
|
+
----------
|
|
208
|
+
limit : typing.Optional[int]
|
|
209
|
+
|
|
210
|
+
request_options : typing.Optional[RequestOptions]
|
|
211
|
+
Request-specific configuration.
|
|
212
|
+
|
|
213
|
+
Returns
|
|
214
|
+
-------
|
|
215
|
+
AsyncHttpResponse[ListPricingMetricsResponse]
|
|
216
|
+
Successful Response
|
|
217
|
+
"""
|
|
218
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
219
|
+
"pricing-metrics",
|
|
220
|
+
method="GET",
|
|
221
|
+
params={
|
|
222
|
+
"limit": limit,
|
|
223
|
+
},
|
|
224
|
+
request_options=request_options,
|
|
225
|
+
)
|
|
226
|
+
try:
|
|
227
|
+
if 200 <= _response.status_code < 300:
|
|
228
|
+
_data = typing.cast(
|
|
229
|
+
ListPricingMetricsResponse,
|
|
230
|
+
parse_obj_as(
|
|
231
|
+
type_=ListPricingMetricsResponse, # type: ignore
|
|
232
|
+
object_=_response.json(),
|
|
233
|
+
),
|
|
234
|
+
)
|
|
235
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
236
|
+
if _response.status_code == 422:
|
|
237
|
+
raise UnprocessableEntityError(
|
|
238
|
+
headers=dict(_response.headers),
|
|
239
|
+
body=typing.cast(
|
|
240
|
+
HttpValidationError,
|
|
241
|
+
parse_obj_as(
|
|
242
|
+
type_=HttpValidationError, # type: ignore
|
|
243
|
+
object_=_response.json(),
|
|
244
|
+
),
|
|
245
|
+
),
|
|
246
|
+
)
|
|
247
|
+
_response_json = _response.json()
|
|
248
|
+
except JSONDecodeError:
|
|
249
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
250
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
251
|
+
|
|
151
252
|
async def create_pricing_metric(
|
|
152
253
|
self,
|
|
153
254
|
*,
|
lark/rate_cards/__init__.py
CHANGED
|
@@ -6,8 +6,16 @@ import typing
|
|
|
6
6
|
from importlib import import_module
|
|
7
7
|
|
|
8
8
|
if typing.TYPE_CHECKING:
|
|
9
|
-
from .types import
|
|
10
|
-
|
|
9
|
+
from .types import (
|
|
10
|
+
CreateRateCardRequestBillingInterval,
|
|
11
|
+
CreateRateCardRequestUsageBasedRatesItem,
|
|
12
|
+
CreateRateCardRequestUsageBasedRatesItem_Simple,
|
|
13
|
+
)
|
|
14
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
15
|
+
"CreateRateCardRequestBillingInterval": ".types",
|
|
16
|
+
"CreateRateCardRequestUsageBasedRatesItem": ".types",
|
|
17
|
+
"CreateRateCardRequestUsageBasedRatesItem_Simple": ".types",
|
|
18
|
+
}
|
|
11
19
|
|
|
12
20
|
|
|
13
21
|
def __getattr__(attr_name: str) -> typing.Any:
|
|
@@ -31,4 +39,8 @@ def __dir__():
|
|
|
31
39
|
return sorted(lazy_attrs)
|
|
32
40
|
|
|
33
41
|
|
|
34
|
-
__all__ = [
|
|
42
|
+
__all__ = [
|
|
43
|
+
"CreateRateCardRequestBillingInterval",
|
|
44
|
+
"CreateRateCardRequestUsageBasedRatesItem",
|
|
45
|
+
"CreateRateCardRequestUsageBasedRatesItem_Simple",
|
|
46
|
+
]
|