lark-billing 0.0.7__py3-none-any.whl → 0.0.8__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 +42 -28
- lark/checkout/client.py +26 -8
- lark/checkout/raw_client.py +18 -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/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 +10 -10
- lark/rate_cards/raw_client.py +14 -14
- 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 +192 -8
- lark/subscriptions/raw_client.py +254 -4
- lark/types/__init__.py +31 -32
- lark/types/aggregation.py +1 -43
- lark/types/{create_fixed_rate_interface.py → create_fixed_rate_request.py} +1 -1
- lark/types/{create_simple_usage_based_rate_interface.py → create_simple_usage_based_rate_request.py} +5 -3
- lark/types/create_subject_response.py +29 -6
- lark/types/{custom_pricing_metric_resource.py → invoice_line_item_resource.py} +6 -2
- lark/types/invoice_resource.py +31 -0
- lark/types/invoice_status.py +5 -0
- lark/types/{max_aggregation_pricing_metric_resource.py → list_invoices_response.py} +4 -2
- lark/types/list_pricing_metrics_response.py +21 -0
- 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_usage_based_rates_item.py +0 -1
- lark/types/simple_usage_based_rate_interface.py +0 -5
- lark/types/subject_resource.py +29 -6
- lark/types/subscription_resource.py +6 -3
- lark/types/subscription_status.py +5 -0
- {lark_billing-0.0.7.dist-info → lark_billing-0.0.8.dist-info}/METADATA +4 -3
- {lark_billing-0.0.7.dist-info → lark_billing-0.0.8.dist-info}/RECORD +45 -32
- lark/types/status.py +0 -5
- {lark_billing-0.0.7.dist-info → lark_billing-0.0.8.dist-info}/WHEEL +0 -0
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/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
|
+
]
|
lark/rate_cards/client.py
CHANGED
|
@@ -4,12 +4,12 @@ import typing
|
|
|
4
4
|
|
|
5
5
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
6
|
from ..core.request_options import RequestOptions
|
|
7
|
-
from ..types.
|
|
8
|
-
from ..types.create_simple_usage_based_rate_interface import CreateSimpleUsageBasedRateInterface
|
|
7
|
+
from ..types.create_fixed_rate_request import CreateFixedRateRequest
|
|
9
8
|
from ..types.list_rate_cards_response import ListRateCardsResponse
|
|
10
9
|
from ..types.rate_card_resource import RateCardResource
|
|
11
10
|
from .raw_client import AsyncRawRateCardsClient, RawRateCardsClient
|
|
12
11
|
from .types.create_rate_card_request_billing_interval import CreateRateCardRequestBillingInterval
|
|
12
|
+
from .types.create_rate_card_request_usage_based_rates_item import CreateRateCardRequestUsageBasedRatesItem
|
|
13
13
|
|
|
14
14
|
# this is used as the default value for optional parameters
|
|
15
15
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -66,8 +66,8 @@ class RateCardsClient:
|
|
|
66
66
|
name: str,
|
|
67
67
|
billing_interval: CreateRateCardRequestBillingInterval,
|
|
68
68
|
description: typing.Optional[str] = OMIT,
|
|
69
|
-
usage_based_rates: typing.Optional[typing.Sequence[
|
|
70
|
-
fixed_rates: typing.Optional[typing.Sequence[
|
|
69
|
+
usage_based_rates: typing.Optional[typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]] = OMIT,
|
|
70
|
+
fixed_rates: typing.Optional[typing.Sequence[CreateFixedRateRequest]] = OMIT,
|
|
71
71
|
metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
72
72
|
request_options: typing.Optional[RequestOptions] = None,
|
|
73
73
|
) -> RateCardResource:
|
|
@@ -80,9 +80,9 @@ class RateCardsClient:
|
|
|
80
80
|
|
|
81
81
|
description : typing.Optional[str]
|
|
82
82
|
|
|
83
|
-
usage_based_rates : typing.Optional[typing.Sequence[
|
|
83
|
+
usage_based_rates : typing.Optional[typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]]
|
|
84
84
|
|
|
85
|
-
fixed_rates : typing.Optional[typing.Sequence[
|
|
85
|
+
fixed_rates : typing.Optional[typing.Sequence[CreateFixedRateRequest]]
|
|
86
86
|
|
|
87
87
|
metadata : typing.Optional[typing.Dict[str, str]]
|
|
88
88
|
|
|
@@ -207,8 +207,8 @@ class AsyncRateCardsClient:
|
|
|
207
207
|
name: str,
|
|
208
208
|
billing_interval: CreateRateCardRequestBillingInterval,
|
|
209
209
|
description: typing.Optional[str] = OMIT,
|
|
210
|
-
usage_based_rates: typing.Optional[typing.Sequence[
|
|
211
|
-
fixed_rates: typing.Optional[typing.Sequence[
|
|
210
|
+
usage_based_rates: typing.Optional[typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]] = OMIT,
|
|
211
|
+
fixed_rates: typing.Optional[typing.Sequence[CreateFixedRateRequest]] = OMIT,
|
|
212
212
|
metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
213
213
|
request_options: typing.Optional[RequestOptions] = None,
|
|
214
214
|
) -> RateCardResource:
|
|
@@ -221,9 +221,9 @@ class AsyncRateCardsClient:
|
|
|
221
221
|
|
|
222
222
|
description : typing.Optional[str]
|
|
223
223
|
|
|
224
|
-
usage_based_rates : typing.Optional[typing.Sequence[
|
|
224
|
+
usage_based_rates : typing.Optional[typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]]
|
|
225
225
|
|
|
226
|
-
fixed_rates : typing.Optional[typing.Sequence[
|
|
226
|
+
fixed_rates : typing.Optional[typing.Sequence[CreateFixedRateRequest]]
|
|
227
227
|
|
|
228
228
|
metadata : typing.Optional[typing.Dict[str, str]]
|
|
229
229
|
|
lark/rate_cards/raw_client.py
CHANGED
|
@@ -11,12 +11,12 @@ from ..core.pydantic_utilities import parse_obj_as
|
|
|
11
11
|
from ..core.request_options import RequestOptions
|
|
12
12
|
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
13
13
|
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
14
|
-
from ..types.
|
|
15
|
-
from ..types.create_simple_usage_based_rate_interface import CreateSimpleUsageBasedRateInterface
|
|
14
|
+
from ..types.create_fixed_rate_request import CreateFixedRateRequest
|
|
16
15
|
from ..types.http_validation_error import HttpValidationError
|
|
17
16
|
from ..types.list_rate_cards_response import ListRateCardsResponse
|
|
18
17
|
from ..types.rate_card_resource import RateCardResource
|
|
19
18
|
from .types.create_rate_card_request_billing_interval import CreateRateCardRequestBillingInterval
|
|
19
|
+
from .types.create_rate_card_request_usage_based_rates_item import CreateRateCardRequestUsageBasedRatesItem
|
|
20
20
|
|
|
21
21
|
# this is used as the default value for optional parameters
|
|
22
22
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -82,8 +82,8 @@ class RawRateCardsClient:
|
|
|
82
82
|
name: str,
|
|
83
83
|
billing_interval: CreateRateCardRequestBillingInterval,
|
|
84
84
|
description: typing.Optional[str] = OMIT,
|
|
85
|
-
usage_based_rates: typing.Optional[typing.Sequence[
|
|
86
|
-
fixed_rates: typing.Optional[typing.Sequence[
|
|
85
|
+
usage_based_rates: typing.Optional[typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]] = OMIT,
|
|
86
|
+
fixed_rates: typing.Optional[typing.Sequence[CreateFixedRateRequest]] = OMIT,
|
|
87
87
|
metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
88
88
|
request_options: typing.Optional[RequestOptions] = None,
|
|
89
89
|
) -> HttpResponse[RateCardResource]:
|
|
@@ -96,9 +96,9 @@ class RawRateCardsClient:
|
|
|
96
96
|
|
|
97
97
|
description : typing.Optional[str]
|
|
98
98
|
|
|
99
|
-
usage_based_rates : typing.Optional[typing.Sequence[
|
|
99
|
+
usage_based_rates : typing.Optional[typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]]
|
|
100
100
|
|
|
101
|
-
fixed_rates : typing.Optional[typing.Sequence[
|
|
101
|
+
fixed_rates : typing.Optional[typing.Sequence[CreateFixedRateRequest]]
|
|
102
102
|
|
|
103
103
|
metadata : typing.Optional[typing.Dict[str, str]]
|
|
104
104
|
|
|
@@ -118,11 +118,11 @@ class RawRateCardsClient:
|
|
|
118
118
|
"description": description,
|
|
119
119
|
"usage_based_rates": convert_and_respect_annotation_metadata(
|
|
120
120
|
object_=usage_based_rates,
|
|
121
|
-
annotation=typing.Sequence[
|
|
121
|
+
annotation=typing.Sequence[CreateRateCardRequestUsageBasedRatesItem],
|
|
122
122
|
direction="write",
|
|
123
123
|
),
|
|
124
124
|
"fixed_rates": convert_and_respect_annotation_metadata(
|
|
125
|
-
object_=fixed_rates, annotation=typing.Sequence[
|
|
125
|
+
object_=fixed_rates, annotation=typing.Sequence[CreateFixedRateRequest], direction="write"
|
|
126
126
|
),
|
|
127
127
|
"billing_interval": billing_interval,
|
|
128
128
|
"metadata": metadata,
|
|
@@ -267,8 +267,8 @@ class AsyncRawRateCardsClient:
|
|
|
267
267
|
name: str,
|
|
268
268
|
billing_interval: CreateRateCardRequestBillingInterval,
|
|
269
269
|
description: typing.Optional[str] = OMIT,
|
|
270
|
-
usage_based_rates: typing.Optional[typing.Sequence[
|
|
271
|
-
fixed_rates: typing.Optional[typing.Sequence[
|
|
270
|
+
usage_based_rates: typing.Optional[typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]] = OMIT,
|
|
271
|
+
fixed_rates: typing.Optional[typing.Sequence[CreateFixedRateRequest]] = OMIT,
|
|
272
272
|
metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
273
273
|
request_options: typing.Optional[RequestOptions] = None,
|
|
274
274
|
) -> AsyncHttpResponse[RateCardResource]:
|
|
@@ -281,9 +281,9 @@ class AsyncRawRateCardsClient:
|
|
|
281
281
|
|
|
282
282
|
description : typing.Optional[str]
|
|
283
283
|
|
|
284
|
-
usage_based_rates : typing.Optional[typing.Sequence[
|
|
284
|
+
usage_based_rates : typing.Optional[typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]]
|
|
285
285
|
|
|
286
|
-
fixed_rates : typing.Optional[typing.Sequence[
|
|
286
|
+
fixed_rates : typing.Optional[typing.Sequence[CreateFixedRateRequest]]
|
|
287
287
|
|
|
288
288
|
metadata : typing.Optional[typing.Dict[str, str]]
|
|
289
289
|
|
|
@@ -303,11 +303,11 @@ class AsyncRawRateCardsClient:
|
|
|
303
303
|
"description": description,
|
|
304
304
|
"usage_based_rates": convert_and_respect_annotation_metadata(
|
|
305
305
|
object_=usage_based_rates,
|
|
306
|
-
annotation=typing.Sequence[
|
|
306
|
+
annotation=typing.Sequence[CreateRateCardRequestUsageBasedRatesItem],
|
|
307
307
|
direction="write",
|
|
308
308
|
),
|
|
309
309
|
"fixed_rates": convert_and_respect_annotation_metadata(
|
|
310
|
-
object_=fixed_rates, annotation=typing.Sequence[
|
|
310
|
+
object_=fixed_rates, annotation=typing.Sequence[CreateFixedRateRequest], direction="write"
|
|
311
311
|
),
|
|
312
312
|
"billing_interval": billing_interval,
|
|
313
313
|
"metadata": metadata,
|