lark-billing 0.0.6__py3-none-any.whl → 0.0.7__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 +69 -360
- lark/checkout/client.py +8 -85
- lark/checkout/raw_client.py +6 -102
- lark/client.py +93 -27
- lark/core/client_wrapper.py +2 -2
- lark/{feature_access → customer_access}/client.py +30 -24
- lark/{feature_access → customer_access}/raw_client.py +22 -17
- lark/{types/rate_card.py → customer_portal/__init__.py} +1 -2
- lark/customer_portal/client.py +115 -0
- lark/customer_portal/raw_client.py +134 -0
- lark/environment.py +7 -0
- lark/pricing_metrics/__init__.py +38 -0
- lark/pricing_metrics/client.py +219 -0
- lark/pricing_metrics/raw_client.py +268 -0
- lark/pricing_metrics/types/__init__.py +42 -0
- lark/{types/credit_grant_resource_input_schedule.py → pricing_metrics/types/pricing_metric_aggregation.py} +7 -8
- lark/rate_cards/__init__.py +3 -30
- lark/rate_cards/client.py +28 -540
- lark/rate_cards/raw_client.py +32 -368
- lark/rate_cards/types/__init__.py +2 -29
- lark/subjects/client.py +2 -36
- lark/subjects/raw_client.py +0 -16
- lark/subscriptions/client.py +24 -184
- lark/subscriptions/raw_client.py +18 -135
- lark/types/__init__.py +41 -356
- lark/types/amount.py +5 -1
- lark/types/{create_dimension_coordinate_interface.py → billing_state_response.py} +3 -3
- lark/types/{credit_grant_schedule_one_time_resource.py → count_aggregation_pricing_metric_resource.py} +1 -1
- lark/types/{create_dimension_interface.py → create_customer_portal_session_response.py} +3 -3
- lark/types/create_fixed_rate_interface.py +1 -7
- lark/types/{pricing_metric_interface.py → create_pricing_metric_response.py} +2 -5
- lark/types/create_simple_usage_based_rate_interface.py +3 -8
- lark/types/create_subject_response.py +2 -1
- lark/types/create_subscription_checkout_session_response.py +1 -2
- lark/types/create_usage_event_summary_response.py +1 -1
- lark/types/{credit_grant_schedule_rate_cycle_start_resource.py → custom_pricing_metric_resource.py} +3 -1
- lark/types/fixed_rate_interface.py +0 -6
- lark/types/{create_pricing_metric_interface.py → get_pricing_metric_response.py} +3 -5
- lark/types/{credit_grant_schedule_one_time_interface.py → last_aggregation_pricing_metric_resource.py} +2 -2
- lark/types/{credit_grant_date_time_expiration_resource.py → max_aggregation_pricing_metric_resource.py} +2 -2
- lark/types/package_price.py +2 -2
- lark/types/package_price_input_rounding_behavior.py +5 -0
- lark/types/package_price_output_rounding_behavior.py +5 -0
- lark/types/price.py +39 -1
- lark/types/rate_card_resource.py +0 -6
- lark/types/rate_card_resource_usage_based_rates_item.py +2 -28
- lark/types/simple_usage_based_rate_interface.py +1 -2
- lark/types/status.py +1 -1
- lark/types/subject_resource.py +2 -1
- lark/types/subscription_resource.py +0 -1
- lark/types/{credit_grant_date_time_expiration_interface.py → sum_aggregation_pricing_metric_resource.py} +2 -2
- lark/types/{subject.py → value.py} +1 -1
- lark/usage_events/client.py +8 -21
- lark/usage_events/raw_client.py +6 -6
- {lark_billing-0.0.6.dist-info → lark_billing-0.0.7.dist-info}/METADATA +3 -3
- lark_billing-0.0.7.dist-info/RECORD +94 -0
- lark/rate_cards/types/create_rate_card_request_usage_based_rates_item.py +0 -56
- lark/rate_cards/types/create_rate_card_version_request_usage_based_rates_item.py +0 -58
- lark/rate_cards/types/create_rate_card_version_request_version_type.py +0 -5
- lark/types/check_feature_access_request.py +0 -24
- lark/types/check_feature_access_response.py +0 -21
- lark/types/complete_subscription_checkout_response.py +0 -21
- lark/types/create_credit_grant_interface.py +0 -27
- lark/types/create_credit_grant_interface_expiration.py +0 -27
- lark/types/create_credit_pool_request.py +0 -5
- lark/types/create_dimensional_usage_based_rate_interface.py +0 -32
- lark/types/create_pricing_matrix_cell_interface.py +0 -22
- lark/types/create_pricing_matrix_interface.py +0 -20
- lark/types/create_pricing_plan_request.py +0 -5
- lark/types/create_rate_card_response.py +0 -36
- lark/types/create_rate_card_response_billing_interval.py +0 -5
- lark/types/create_rate_card_response_usage_based_rates_item.py +0 -58
- lark/types/create_rate_card_version_response.py +0 -36
- lark/types/create_rate_card_version_response_billing_interval.py +0 -5
- lark/types/create_rate_card_version_response_usage_based_rates_item.py +0 -59
- lark/types/credit_grant.py +0 -5
- lark/types/credit_grant_duration_expiration_interface.py +0 -21
- lark/types/credit_grant_duration_expiration_resource.py +0 -21
- lark/types/credit_grant_interface.py +0 -28
- lark/types/credit_grant_interface_input_expiration.py +0 -27
- lark/types/credit_grant_interface_output_expiration.py +0 -43
- lark/types/credit_grant_interface_output_schedule.py +0 -41
- lark/types/credit_grant_resource.py +0 -28
- lark/types/credit_grant_resource_input_expiration.py +0 -27
- lark/types/credit_grant_resource_output_expiration.py +0 -43
- lark/types/credit_grant_resource_output_schedule.py +0 -39
- lark/types/credit_grant_schedule.py +0 -5
- lark/types/credit_grant_schedule_rate_cycle_start_interface.py +0 -19
- lark/types/credit_grant_subject_granting_config_interface.py +0 -20
- lark/types/credit_pool.py +0 -5
- lark/types/credit_pool_rollover_config.py +0 -5
- lark/types/custom_aggregation_pricing_metric_interface.py +0 -22
- lark/types/custom_pricing_metric.py +0 -5
- lark/types/custom_unit.py +0 -5
- lark/types/custom_unit_amount.py +0 -5
- lark/types/dimension.py +0 -5
- lark/types/dimension_coordinate.py +0 -5
- lark/types/dimension_coordinate_interface.py +0 -20
- lark/types/dimension_coordinate_set.py +0 -5
- lark/types/dimension_interface.py +0 -20
- lark/types/dimensional_rate_matrix.py +0 -5
- lark/types/dimensional_rate_matrix_cell.py +0 -5
- lark/types/dimensional_usage_based_rate.py +0 -5
- lark/types/dimensional_usage_based_rate_input.py +0 -5
- lark/types/dimensional_usage_based_rate_interface.py +0 -33
- lark/types/feature_access_resource.py +0 -21
- lark/types/get_rate_card_response.py +0 -36
- lark/types/get_rate_card_response_billing_interval.py +0 -5
- lark/types/get_rate_card_response_usage_based_rates_item.py +0 -58
- lark/types/grant_credits_request.py +0 -5
- lark/types/last_aggregation_pricing_metric_interface.py +0 -22
- lark/types/license_based_rate.py +0 -5
- lark/types/license_based_rate_input.py +0 -5
- lark/types/max_aggregation_pricing_metric_interface.py +0 -22
- lark/types/monetary_amount.py +0 -5
- lark/types/package_price_rounding_behavior.py +0 -5
- lark/types/package_price_wrapper.py +0 -5
- lark/types/pricing_matrix_cell_interface.py +0 -22
- lark/types/pricing_matrix_interface.py +0 -20
- lark/types/pricing_metric.py +0 -5
- lark/types/pricing_plan.py +0 -5
- lark/types/pricing_plan_subscription.py +0 -5
- lark/types/pricing_tier.py +0 -5
- lark/types/rate_card_version.py +0 -5
- lark/types/rate_card_version_input.py +0 -5
- lark/types/simple_usage_based_rate.py +0 -5
- lark/types/simple_usage_based_rate_input.py +0 -5
- lark/types/subject_granting_config.py +0 -5
- lark/types/subject_granting_config_resource.py +0 -20
- lark/types/tiered_price.py +0 -5
- lark/types/tiered_price_wrapper.py +0 -5
- lark/types/unit.py +0 -5
- lark/types/update_pricing_plan_request.py +0 -5
- lark/types/update_rate_card_request.py +0 -5
- lark/types/update_subscription_request.py +0 -5
- lark/types/usage_based_rate.py +0 -5
- lark/types/usage_based_rate_input.py +0 -5
- lark/types/usage_unit.py +0 -5
- lark_billing-0.0.6.dist-info/RECORD +0 -167
- /lark/{feature_access → customer_access}/__init__.py +0 -0
- {lark_billing-0.0.6.dist-info → lark_billing-0.0.7.dist-info}/WHEEL +0 -0
|
@@ -4,37 +4,39 @@ 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 .raw_client import
|
|
7
|
+
from ..types.billing_state_response import BillingStateResponse
|
|
8
|
+
from .raw_client import AsyncRawCustomerAccessClient, RawCustomerAccessClient
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
class
|
|
11
|
+
class CustomerAccessClient:
|
|
12
12
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
13
|
-
self._raw_client =
|
|
13
|
+
self._raw_client = RawCustomerAccessClient(client_wrapper=client_wrapper)
|
|
14
14
|
|
|
15
15
|
@property
|
|
16
|
-
def with_raw_response(self) ->
|
|
16
|
+
def with_raw_response(self) -> RawCustomerAccessClient:
|
|
17
17
|
"""
|
|
18
18
|
Retrieves a raw implementation of this client that returns raw responses.
|
|
19
19
|
|
|
20
20
|
Returns
|
|
21
21
|
-------
|
|
22
|
-
|
|
22
|
+
RawCustomerAccessClient
|
|
23
23
|
"""
|
|
24
24
|
return self._raw_client
|
|
25
25
|
|
|
26
|
-
def
|
|
27
|
-
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
28
|
-
) ->
|
|
26
|
+
def get_billing_state(
|
|
27
|
+
self, subject_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
28
|
+
) -> BillingStateResponse:
|
|
29
29
|
"""
|
|
30
30
|
Parameters
|
|
31
31
|
----------
|
|
32
|
+
subject_id : str
|
|
33
|
+
|
|
32
34
|
request_options : typing.Optional[RequestOptions]
|
|
33
35
|
Request-specific configuration.
|
|
34
36
|
|
|
35
37
|
Returns
|
|
36
38
|
-------
|
|
37
|
-
|
|
39
|
+
BillingStateResponse
|
|
38
40
|
Successful Response
|
|
39
41
|
|
|
40
42
|
Examples
|
|
@@ -43,41 +45,44 @@ class FeatureAccessClient:
|
|
|
43
45
|
|
|
44
46
|
client = Lark(
|
|
45
47
|
api_key="YOUR_API_KEY",
|
|
46
|
-
base_url="https://yourhost.com/path/to/api",
|
|
47
48
|
)
|
|
48
|
-
client.
|
|
49
|
+
client.customer_access.get_billing_state(
|
|
50
|
+
subject_id="subject_id",
|
|
51
|
+
)
|
|
49
52
|
"""
|
|
50
|
-
_response = self._raw_client.
|
|
53
|
+
_response = self._raw_client.get_billing_state(subject_id, request_options=request_options)
|
|
51
54
|
return _response.data
|
|
52
55
|
|
|
53
56
|
|
|
54
|
-
class
|
|
57
|
+
class AsyncCustomerAccessClient:
|
|
55
58
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
56
|
-
self._raw_client =
|
|
59
|
+
self._raw_client = AsyncRawCustomerAccessClient(client_wrapper=client_wrapper)
|
|
57
60
|
|
|
58
61
|
@property
|
|
59
|
-
def with_raw_response(self) ->
|
|
62
|
+
def with_raw_response(self) -> AsyncRawCustomerAccessClient:
|
|
60
63
|
"""
|
|
61
64
|
Retrieves a raw implementation of this client that returns raw responses.
|
|
62
65
|
|
|
63
66
|
Returns
|
|
64
67
|
-------
|
|
65
|
-
|
|
68
|
+
AsyncRawCustomerAccessClient
|
|
66
69
|
"""
|
|
67
70
|
return self._raw_client
|
|
68
71
|
|
|
69
|
-
async def
|
|
70
|
-
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
71
|
-
) ->
|
|
72
|
+
async def get_billing_state(
|
|
73
|
+
self, subject_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
74
|
+
) -> BillingStateResponse:
|
|
72
75
|
"""
|
|
73
76
|
Parameters
|
|
74
77
|
----------
|
|
78
|
+
subject_id : str
|
|
79
|
+
|
|
75
80
|
request_options : typing.Optional[RequestOptions]
|
|
76
81
|
Request-specific configuration.
|
|
77
82
|
|
|
78
83
|
Returns
|
|
79
84
|
-------
|
|
80
|
-
|
|
85
|
+
BillingStateResponse
|
|
81
86
|
Successful Response
|
|
82
87
|
|
|
83
88
|
Examples
|
|
@@ -88,15 +93,16 @@ class AsyncFeatureAccessClient:
|
|
|
88
93
|
|
|
89
94
|
client = AsyncLark(
|
|
90
95
|
api_key="YOUR_API_KEY",
|
|
91
|
-
base_url="https://yourhost.com/path/to/api",
|
|
92
96
|
)
|
|
93
97
|
|
|
94
98
|
|
|
95
99
|
async def main() -> None:
|
|
96
|
-
await client.
|
|
100
|
+
await client.customer_access.get_billing_state(
|
|
101
|
+
subject_id="subject_id",
|
|
102
|
+
)
|
|
97
103
|
|
|
98
104
|
|
|
99
105
|
asyncio.run(main())
|
|
100
106
|
"""
|
|
101
|
-
_response = await self._raw_client.
|
|
107
|
+
_response = await self._raw_client.get_billing_state(subject_id, request_options=request_options)
|
|
102
108
|
return _response.data
|
|
@@ -6,42 +6,45 @@ from json.decoder import JSONDecodeError
|
|
|
6
6
|
from ..core.api_error import ApiError
|
|
7
7
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
8
|
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
9
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
9
10
|
from ..core.pydantic_utilities import parse_obj_as
|
|
10
11
|
from ..core.request_options import RequestOptions
|
|
11
12
|
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
|
12
|
-
from ..types.
|
|
13
|
+
from ..types.billing_state_response import BillingStateResponse
|
|
13
14
|
from ..types.http_validation_error import HttpValidationError
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
class
|
|
17
|
+
class RawCustomerAccessClient:
|
|
17
18
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
18
19
|
self._client_wrapper = client_wrapper
|
|
19
20
|
|
|
20
|
-
def
|
|
21
|
-
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
22
|
-
) -> HttpResponse[
|
|
21
|
+
def get_billing_state(
|
|
22
|
+
self, subject_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
23
|
+
) -> HttpResponse[BillingStateResponse]:
|
|
23
24
|
"""
|
|
24
25
|
Parameters
|
|
25
26
|
----------
|
|
27
|
+
subject_id : str
|
|
28
|
+
|
|
26
29
|
request_options : typing.Optional[RequestOptions]
|
|
27
30
|
Request-specific configuration.
|
|
28
31
|
|
|
29
32
|
Returns
|
|
30
33
|
-------
|
|
31
|
-
HttpResponse[
|
|
34
|
+
HttpResponse[BillingStateResponse]
|
|
32
35
|
Successful Response
|
|
33
36
|
"""
|
|
34
37
|
_response = self._client_wrapper.httpx_client.request(
|
|
35
|
-
"
|
|
38
|
+
f"customer-access/{jsonable_encoder(subject_id)}/billing-state",
|
|
36
39
|
method="GET",
|
|
37
40
|
request_options=request_options,
|
|
38
41
|
)
|
|
39
42
|
try:
|
|
40
43
|
if 200 <= _response.status_code < 300:
|
|
41
44
|
_data = typing.cast(
|
|
42
|
-
|
|
45
|
+
BillingStateResponse,
|
|
43
46
|
parse_obj_as(
|
|
44
|
-
type_=
|
|
47
|
+
type_=BillingStateResponse, # type: ignore
|
|
45
48
|
object_=_response.json(),
|
|
46
49
|
),
|
|
47
50
|
)
|
|
@@ -63,35 +66,37 @@ class RawFeatureAccessClient:
|
|
|
63
66
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
64
67
|
|
|
65
68
|
|
|
66
|
-
class
|
|
69
|
+
class AsyncRawCustomerAccessClient:
|
|
67
70
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
68
71
|
self._client_wrapper = client_wrapper
|
|
69
72
|
|
|
70
|
-
async def
|
|
71
|
-
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
72
|
-
) -> AsyncHttpResponse[
|
|
73
|
+
async def get_billing_state(
|
|
74
|
+
self, subject_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
75
|
+
) -> AsyncHttpResponse[BillingStateResponse]:
|
|
73
76
|
"""
|
|
74
77
|
Parameters
|
|
75
78
|
----------
|
|
79
|
+
subject_id : str
|
|
80
|
+
|
|
76
81
|
request_options : typing.Optional[RequestOptions]
|
|
77
82
|
Request-specific configuration.
|
|
78
83
|
|
|
79
84
|
Returns
|
|
80
85
|
-------
|
|
81
|
-
AsyncHttpResponse[
|
|
86
|
+
AsyncHttpResponse[BillingStateResponse]
|
|
82
87
|
Successful Response
|
|
83
88
|
"""
|
|
84
89
|
_response = await self._client_wrapper.httpx_client.request(
|
|
85
|
-
"
|
|
90
|
+
f"customer-access/{jsonable_encoder(subject_id)}/billing-state",
|
|
86
91
|
method="GET",
|
|
87
92
|
request_options=request_options,
|
|
88
93
|
)
|
|
89
94
|
try:
|
|
90
95
|
if 200 <= _response.status_code < 300:
|
|
91
96
|
_data = typing.cast(
|
|
92
|
-
|
|
97
|
+
BillingStateResponse,
|
|
93
98
|
parse_obj_as(
|
|
94
|
-
type_=
|
|
99
|
+
type_=BillingStateResponse, # type: ignore
|
|
95
100
|
object_=_response.json(),
|
|
96
101
|
),
|
|
97
102
|
)
|
|
@@ -0,0 +1,115 @@
|
|
|
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.create_customer_portal_session_response import CreateCustomerPortalSessionResponse
|
|
8
|
+
from .raw_client import AsyncRawCustomerPortalClient, RawCustomerPortalClient
|
|
9
|
+
|
|
10
|
+
# this is used as the default value for optional parameters
|
|
11
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class CustomerPortalClient:
|
|
15
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
16
|
+
self._raw_client = RawCustomerPortalClient(client_wrapper=client_wrapper)
|
|
17
|
+
|
|
18
|
+
@property
|
|
19
|
+
def with_raw_response(self) -> RawCustomerPortalClient:
|
|
20
|
+
"""
|
|
21
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
22
|
+
|
|
23
|
+
Returns
|
|
24
|
+
-------
|
|
25
|
+
RawCustomerPortalClient
|
|
26
|
+
"""
|
|
27
|
+
return self._raw_client
|
|
28
|
+
|
|
29
|
+
def create_customer_portal_session(
|
|
30
|
+
self, *, subject_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
31
|
+
) -> CreateCustomerPortalSessionResponse:
|
|
32
|
+
"""
|
|
33
|
+
Parameters
|
|
34
|
+
----------
|
|
35
|
+
subject_id : str
|
|
36
|
+
|
|
37
|
+
request_options : typing.Optional[RequestOptions]
|
|
38
|
+
Request-specific configuration.
|
|
39
|
+
|
|
40
|
+
Returns
|
|
41
|
+
-------
|
|
42
|
+
CreateCustomerPortalSessionResponse
|
|
43
|
+
Successful Response
|
|
44
|
+
|
|
45
|
+
Examples
|
|
46
|
+
--------
|
|
47
|
+
from lark import Lark
|
|
48
|
+
|
|
49
|
+
client = Lark(
|
|
50
|
+
api_key="YOUR_API_KEY",
|
|
51
|
+
)
|
|
52
|
+
client.customer_portal.create_customer_portal_session(
|
|
53
|
+
subject_id="subject_id",
|
|
54
|
+
)
|
|
55
|
+
"""
|
|
56
|
+
_response = self._raw_client.create_customer_portal_session(
|
|
57
|
+
subject_id=subject_id, request_options=request_options
|
|
58
|
+
)
|
|
59
|
+
return _response.data
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class AsyncCustomerPortalClient:
|
|
63
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
64
|
+
self._raw_client = AsyncRawCustomerPortalClient(client_wrapper=client_wrapper)
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def with_raw_response(self) -> AsyncRawCustomerPortalClient:
|
|
68
|
+
"""
|
|
69
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
|
70
|
+
|
|
71
|
+
Returns
|
|
72
|
+
-------
|
|
73
|
+
AsyncRawCustomerPortalClient
|
|
74
|
+
"""
|
|
75
|
+
return self._raw_client
|
|
76
|
+
|
|
77
|
+
async def create_customer_portal_session(
|
|
78
|
+
self, *, subject_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
79
|
+
) -> CreateCustomerPortalSessionResponse:
|
|
80
|
+
"""
|
|
81
|
+
Parameters
|
|
82
|
+
----------
|
|
83
|
+
subject_id : str
|
|
84
|
+
|
|
85
|
+
request_options : typing.Optional[RequestOptions]
|
|
86
|
+
Request-specific configuration.
|
|
87
|
+
|
|
88
|
+
Returns
|
|
89
|
+
-------
|
|
90
|
+
CreateCustomerPortalSessionResponse
|
|
91
|
+
Successful Response
|
|
92
|
+
|
|
93
|
+
Examples
|
|
94
|
+
--------
|
|
95
|
+
import asyncio
|
|
96
|
+
|
|
97
|
+
from lark import AsyncLark
|
|
98
|
+
|
|
99
|
+
client = AsyncLark(
|
|
100
|
+
api_key="YOUR_API_KEY",
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
async def main() -> None:
|
|
105
|
+
await client.customer_portal.create_customer_portal_session(
|
|
106
|
+
subject_id="subject_id",
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
asyncio.run(main())
|
|
111
|
+
"""
|
|
112
|
+
_response = await self._raw_client.create_customer_portal_session(
|
|
113
|
+
subject_id=subject_id, request_options=request_options
|
|
114
|
+
)
|
|
115
|
+
return _response.data
|
|
@@ -0,0 +1,134 @@
|
|
|
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.create_customer_portal_session_response import CreateCustomerPortalSessionResponse
|
|
13
|
+
from ..types.http_validation_error import HttpValidationError
|
|
14
|
+
|
|
15
|
+
# this is used as the default value for optional parameters
|
|
16
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class RawCustomerPortalClient:
|
|
20
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
21
|
+
self._client_wrapper = client_wrapper
|
|
22
|
+
|
|
23
|
+
def create_customer_portal_session(
|
|
24
|
+
self, *, subject_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
25
|
+
) -> HttpResponse[CreateCustomerPortalSessionResponse]:
|
|
26
|
+
"""
|
|
27
|
+
Parameters
|
|
28
|
+
----------
|
|
29
|
+
subject_id : str
|
|
30
|
+
|
|
31
|
+
request_options : typing.Optional[RequestOptions]
|
|
32
|
+
Request-specific configuration.
|
|
33
|
+
|
|
34
|
+
Returns
|
|
35
|
+
-------
|
|
36
|
+
HttpResponse[CreateCustomerPortalSessionResponse]
|
|
37
|
+
Successful Response
|
|
38
|
+
"""
|
|
39
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
40
|
+
"customer-portal/sessions",
|
|
41
|
+
method="POST",
|
|
42
|
+
json={
|
|
43
|
+
"subject_id": subject_id,
|
|
44
|
+
},
|
|
45
|
+
headers={
|
|
46
|
+
"content-type": "application/json",
|
|
47
|
+
},
|
|
48
|
+
request_options=request_options,
|
|
49
|
+
omit=OMIT,
|
|
50
|
+
)
|
|
51
|
+
try:
|
|
52
|
+
if 200 <= _response.status_code < 300:
|
|
53
|
+
_data = typing.cast(
|
|
54
|
+
CreateCustomerPortalSessionResponse,
|
|
55
|
+
parse_obj_as(
|
|
56
|
+
type_=CreateCustomerPortalSessionResponse, # type: ignore
|
|
57
|
+
object_=_response.json(),
|
|
58
|
+
),
|
|
59
|
+
)
|
|
60
|
+
return HttpResponse(response=_response, data=_data)
|
|
61
|
+
if _response.status_code == 422:
|
|
62
|
+
raise UnprocessableEntityError(
|
|
63
|
+
headers=dict(_response.headers),
|
|
64
|
+
body=typing.cast(
|
|
65
|
+
HttpValidationError,
|
|
66
|
+
parse_obj_as(
|
|
67
|
+
type_=HttpValidationError, # type: ignore
|
|
68
|
+
object_=_response.json(),
|
|
69
|
+
),
|
|
70
|
+
),
|
|
71
|
+
)
|
|
72
|
+
_response_json = _response.json()
|
|
73
|
+
except JSONDecodeError:
|
|
74
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
75
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class AsyncRawCustomerPortalClient:
|
|
79
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
80
|
+
self._client_wrapper = client_wrapper
|
|
81
|
+
|
|
82
|
+
async def create_customer_portal_session(
|
|
83
|
+
self, *, subject_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
84
|
+
) -> AsyncHttpResponse[CreateCustomerPortalSessionResponse]:
|
|
85
|
+
"""
|
|
86
|
+
Parameters
|
|
87
|
+
----------
|
|
88
|
+
subject_id : str
|
|
89
|
+
|
|
90
|
+
request_options : typing.Optional[RequestOptions]
|
|
91
|
+
Request-specific configuration.
|
|
92
|
+
|
|
93
|
+
Returns
|
|
94
|
+
-------
|
|
95
|
+
AsyncHttpResponse[CreateCustomerPortalSessionResponse]
|
|
96
|
+
Successful Response
|
|
97
|
+
"""
|
|
98
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
99
|
+
"customer-portal/sessions",
|
|
100
|
+
method="POST",
|
|
101
|
+
json={
|
|
102
|
+
"subject_id": subject_id,
|
|
103
|
+
},
|
|
104
|
+
headers={
|
|
105
|
+
"content-type": "application/json",
|
|
106
|
+
},
|
|
107
|
+
request_options=request_options,
|
|
108
|
+
omit=OMIT,
|
|
109
|
+
)
|
|
110
|
+
try:
|
|
111
|
+
if 200 <= _response.status_code < 300:
|
|
112
|
+
_data = typing.cast(
|
|
113
|
+
CreateCustomerPortalSessionResponse,
|
|
114
|
+
parse_obj_as(
|
|
115
|
+
type_=CreateCustomerPortalSessionResponse, # type: ignore
|
|
116
|
+
object_=_response.json(),
|
|
117
|
+
),
|
|
118
|
+
)
|
|
119
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
120
|
+
if _response.status_code == 422:
|
|
121
|
+
raise UnprocessableEntityError(
|
|
122
|
+
headers=dict(_response.headers),
|
|
123
|
+
body=typing.cast(
|
|
124
|
+
HttpValidationError,
|
|
125
|
+
parse_obj_as(
|
|
126
|
+
type_=HttpValidationError, # type: ignore
|
|
127
|
+
object_=_response.json(),
|
|
128
|
+
),
|
|
129
|
+
),
|
|
130
|
+
)
|
|
131
|
+
_response_json = _response.json()
|
|
132
|
+
except JSONDecodeError:
|
|
133
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
134
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
lark/environment.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
import typing
|
|
6
|
+
from importlib import import_module
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from .types import PricingMetricAggregation, PricingMetricAggregation_Count, PricingMetricAggregation_Sum
|
|
10
|
+
_dynamic_imports: typing.Dict[str, str] = {
|
|
11
|
+
"PricingMetricAggregation": ".types",
|
|
12
|
+
"PricingMetricAggregation_Count": ".types",
|
|
13
|
+
"PricingMetricAggregation_Sum": ".types",
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
18
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
19
|
+
if module_name is None:
|
|
20
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
21
|
+
try:
|
|
22
|
+
module = import_module(module_name, __package__)
|
|
23
|
+
if module_name == f".{attr_name}":
|
|
24
|
+
return module
|
|
25
|
+
else:
|
|
26
|
+
return getattr(module, attr_name)
|
|
27
|
+
except ImportError as e:
|
|
28
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
29
|
+
except AttributeError as e:
|
|
30
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def __dir__():
|
|
34
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
35
|
+
return sorted(lazy_attrs)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
__all__ = ["PricingMetricAggregation", "PricingMetricAggregation_Count", "PricingMetricAggregation_Sum"]
|