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.

Files changed (141) hide show
  1. lark/__init__.py +69 -360
  2. lark/checkout/client.py +8 -85
  3. lark/checkout/raw_client.py +6 -102
  4. lark/client.py +93 -27
  5. lark/core/client_wrapper.py +2 -2
  6. lark/{feature_access → customer_access}/client.py +30 -24
  7. lark/{feature_access → customer_access}/raw_client.py +22 -17
  8. lark/{types/rate_card.py → customer_portal/__init__.py} +1 -2
  9. lark/customer_portal/client.py +115 -0
  10. lark/customer_portal/raw_client.py +134 -0
  11. lark/environment.py +7 -0
  12. lark/pricing_metrics/__init__.py +38 -0
  13. lark/pricing_metrics/client.py +219 -0
  14. lark/pricing_metrics/raw_client.py +268 -0
  15. lark/pricing_metrics/types/__init__.py +42 -0
  16. lark/{types/credit_grant_resource_input_schedule.py → pricing_metrics/types/pricing_metric_aggregation.py} +7 -8
  17. lark/rate_cards/__init__.py +3 -30
  18. lark/rate_cards/client.py +28 -540
  19. lark/rate_cards/raw_client.py +32 -368
  20. lark/rate_cards/types/__init__.py +2 -29
  21. lark/subjects/client.py +2 -36
  22. lark/subjects/raw_client.py +0 -16
  23. lark/subscriptions/client.py +24 -184
  24. lark/subscriptions/raw_client.py +18 -135
  25. lark/types/__init__.py +41 -356
  26. lark/types/amount.py +5 -1
  27. lark/types/{create_dimension_coordinate_interface.py → billing_state_response.py} +3 -3
  28. lark/types/{credit_grant_schedule_one_time_resource.py → count_aggregation_pricing_metric_resource.py} +1 -1
  29. lark/types/{create_dimension_interface.py → create_customer_portal_session_response.py} +3 -3
  30. lark/types/create_fixed_rate_interface.py +1 -7
  31. lark/types/{pricing_metric_interface.py → create_pricing_metric_response.py} +2 -5
  32. lark/types/create_simple_usage_based_rate_interface.py +3 -8
  33. lark/types/create_subject_response.py +2 -1
  34. lark/types/create_subscription_checkout_session_response.py +1 -2
  35. lark/types/create_usage_event_summary_response.py +1 -1
  36. lark/types/{credit_grant_schedule_rate_cycle_start_resource.py → custom_pricing_metric_resource.py} +3 -1
  37. lark/types/fixed_rate_interface.py +0 -6
  38. lark/types/{create_pricing_metric_interface.py → get_pricing_metric_response.py} +3 -5
  39. lark/types/{credit_grant_schedule_one_time_interface.py → last_aggregation_pricing_metric_resource.py} +2 -2
  40. lark/types/{credit_grant_date_time_expiration_resource.py → max_aggregation_pricing_metric_resource.py} +2 -2
  41. lark/types/package_price.py +2 -2
  42. lark/types/package_price_input_rounding_behavior.py +5 -0
  43. lark/types/package_price_output_rounding_behavior.py +5 -0
  44. lark/types/price.py +39 -1
  45. lark/types/rate_card_resource.py +0 -6
  46. lark/types/rate_card_resource_usage_based_rates_item.py +2 -28
  47. lark/types/simple_usage_based_rate_interface.py +1 -2
  48. lark/types/status.py +1 -1
  49. lark/types/subject_resource.py +2 -1
  50. lark/types/subscription_resource.py +0 -1
  51. lark/types/{credit_grant_date_time_expiration_interface.py → sum_aggregation_pricing_metric_resource.py} +2 -2
  52. lark/types/{subject.py → value.py} +1 -1
  53. lark/usage_events/client.py +8 -21
  54. lark/usage_events/raw_client.py +6 -6
  55. {lark_billing-0.0.6.dist-info → lark_billing-0.0.7.dist-info}/METADATA +3 -3
  56. lark_billing-0.0.7.dist-info/RECORD +94 -0
  57. lark/rate_cards/types/create_rate_card_request_usage_based_rates_item.py +0 -56
  58. lark/rate_cards/types/create_rate_card_version_request_usage_based_rates_item.py +0 -58
  59. lark/rate_cards/types/create_rate_card_version_request_version_type.py +0 -5
  60. lark/types/check_feature_access_request.py +0 -24
  61. lark/types/check_feature_access_response.py +0 -21
  62. lark/types/complete_subscription_checkout_response.py +0 -21
  63. lark/types/create_credit_grant_interface.py +0 -27
  64. lark/types/create_credit_grant_interface_expiration.py +0 -27
  65. lark/types/create_credit_pool_request.py +0 -5
  66. lark/types/create_dimensional_usage_based_rate_interface.py +0 -32
  67. lark/types/create_pricing_matrix_cell_interface.py +0 -22
  68. lark/types/create_pricing_matrix_interface.py +0 -20
  69. lark/types/create_pricing_plan_request.py +0 -5
  70. lark/types/create_rate_card_response.py +0 -36
  71. lark/types/create_rate_card_response_billing_interval.py +0 -5
  72. lark/types/create_rate_card_response_usage_based_rates_item.py +0 -58
  73. lark/types/create_rate_card_version_response.py +0 -36
  74. lark/types/create_rate_card_version_response_billing_interval.py +0 -5
  75. lark/types/create_rate_card_version_response_usage_based_rates_item.py +0 -59
  76. lark/types/credit_grant.py +0 -5
  77. lark/types/credit_grant_duration_expiration_interface.py +0 -21
  78. lark/types/credit_grant_duration_expiration_resource.py +0 -21
  79. lark/types/credit_grant_interface.py +0 -28
  80. lark/types/credit_grant_interface_input_expiration.py +0 -27
  81. lark/types/credit_grant_interface_output_expiration.py +0 -43
  82. lark/types/credit_grant_interface_output_schedule.py +0 -41
  83. lark/types/credit_grant_resource.py +0 -28
  84. lark/types/credit_grant_resource_input_expiration.py +0 -27
  85. lark/types/credit_grant_resource_output_expiration.py +0 -43
  86. lark/types/credit_grant_resource_output_schedule.py +0 -39
  87. lark/types/credit_grant_schedule.py +0 -5
  88. lark/types/credit_grant_schedule_rate_cycle_start_interface.py +0 -19
  89. lark/types/credit_grant_subject_granting_config_interface.py +0 -20
  90. lark/types/credit_pool.py +0 -5
  91. lark/types/credit_pool_rollover_config.py +0 -5
  92. lark/types/custom_aggregation_pricing_metric_interface.py +0 -22
  93. lark/types/custom_pricing_metric.py +0 -5
  94. lark/types/custom_unit.py +0 -5
  95. lark/types/custom_unit_amount.py +0 -5
  96. lark/types/dimension.py +0 -5
  97. lark/types/dimension_coordinate.py +0 -5
  98. lark/types/dimension_coordinate_interface.py +0 -20
  99. lark/types/dimension_coordinate_set.py +0 -5
  100. lark/types/dimension_interface.py +0 -20
  101. lark/types/dimensional_rate_matrix.py +0 -5
  102. lark/types/dimensional_rate_matrix_cell.py +0 -5
  103. lark/types/dimensional_usage_based_rate.py +0 -5
  104. lark/types/dimensional_usage_based_rate_input.py +0 -5
  105. lark/types/dimensional_usage_based_rate_interface.py +0 -33
  106. lark/types/feature_access_resource.py +0 -21
  107. lark/types/get_rate_card_response.py +0 -36
  108. lark/types/get_rate_card_response_billing_interval.py +0 -5
  109. lark/types/get_rate_card_response_usage_based_rates_item.py +0 -58
  110. lark/types/grant_credits_request.py +0 -5
  111. lark/types/last_aggregation_pricing_metric_interface.py +0 -22
  112. lark/types/license_based_rate.py +0 -5
  113. lark/types/license_based_rate_input.py +0 -5
  114. lark/types/max_aggregation_pricing_metric_interface.py +0 -22
  115. lark/types/monetary_amount.py +0 -5
  116. lark/types/package_price_rounding_behavior.py +0 -5
  117. lark/types/package_price_wrapper.py +0 -5
  118. lark/types/pricing_matrix_cell_interface.py +0 -22
  119. lark/types/pricing_matrix_interface.py +0 -20
  120. lark/types/pricing_metric.py +0 -5
  121. lark/types/pricing_plan.py +0 -5
  122. lark/types/pricing_plan_subscription.py +0 -5
  123. lark/types/pricing_tier.py +0 -5
  124. lark/types/rate_card_version.py +0 -5
  125. lark/types/rate_card_version_input.py +0 -5
  126. lark/types/simple_usage_based_rate.py +0 -5
  127. lark/types/simple_usage_based_rate_input.py +0 -5
  128. lark/types/subject_granting_config.py +0 -5
  129. lark/types/subject_granting_config_resource.py +0 -20
  130. lark/types/tiered_price.py +0 -5
  131. lark/types/tiered_price_wrapper.py +0 -5
  132. lark/types/unit.py +0 -5
  133. lark/types/update_pricing_plan_request.py +0 -5
  134. lark/types/update_rate_card_request.py +0 -5
  135. lark/types/update_subscription_request.py +0 -5
  136. lark/types/usage_based_rate.py +0 -5
  137. lark/types/usage_based_rate_input.py +0 -5
  138. lark/types/usage_unit.py +0 -5
  139. lark_billing-0.0.6.dist-info/RECORD +0 -167
  140. /lark/{feature_access → customer_access}/__init__.py +0 -0
  141. {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.check_feature_access_response import CheckFeatureAccessResponse
8
- from .raw_client import AsyncRawFeatureAccessClient, RawFeatureAccessClient
7
+ from ..types.billing_state_response import BillingStateResponse
8
+ from .raw_client import AsyncRawCustomerAccessClient, RawCustomerAccessClient
9
9
 
10
10
 
11
- class FeatureAccessClient:
11
+ class CustomerAccessClient:
12
12
  def __init__(self, *, client_wrapper: SyncClientWrapper):
13
- self._raw_client = RawFeatureAccessClient(client_wrapper=client_wrapper)
13
+ self._raw_client = RawCustomerAccessClient(client_wrapper=client_wrapper)
14
14
 
15
15
  @property
16
- def with_raw_response(self) -> RawFeatureAccessClient:
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
- RawFeatureAccessClient
22
+ RawCustomerAccessClient
23
23
  """
24
24
  return self._raw_client
25
25
 
26
- def get_feature_access(
27
- self, *, request_options: typing.Optional[RequestOptions] = None
28
- ) -> CheckFeatureAccessResponse:
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
- CheckFeatureAccessResponse
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.feature_access.get_feature_access()
49
+ client.customer_access.get_billing_state(
50
+ subject_id="subject_id",
51
+ )
49
52
  """
50
- _response = self._raw_client.get_feature_access(request_options=request_options)
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 AsyncFeatureAccessClient:
57
+ class AsyncCustomerAccessClient:
55
58
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
56
- self._raw_client = AsyncRawFeatureAccessClient(client_wrapper=client_wrapper)
59
+ self._raw_client = AsyncRawCustomerAccessClient(client_wrapper=client_wrapper)
57
60
 
58
61
  @property
59
- def with_raw_response(self) -> AsyncRawFeatureAccessClient:
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
- AsyncRawFeatureAccessClient
68
+ AsyncRawCustomerAccessClient
66
69
  """
67
70
  return self._raw_client
68
71
 
69
- async def get_feature_access(
70
- self, *, request_options: typing.Optional[RequestOptions] = None
71
- ) -> CheckFeatureAccessResponse:
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
- CheckFeatureAccessResponse
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.feature_access.get_feature_access()
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.get_feature_access(request_options=request_options)
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.check_feature_access_response import CheckFeatureAccessResponse
13
+ from ..types.billing_state_response import BillingStateResponse
13
14
  from ..types.http_validation_error import HttpValidationError
14
15
 
15
16
 
16
- class RawFeatureAccessClient:
17
+ class RawCustomerAccessClient:
17
18
  def __init__(self, *, client_wrapper: SyncClientWrapper):
18
19
  self._client_wrapper = client_wrapper
19
20
 
20
- def get_feature_access(
21
- self, *, request_options: typing.Optional[RequestOptions] = None
22
- ) -> HttpResponse[CheckFeatureAccessResponse]:
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[CheckFeatureAccessResponse]
34
+ HttpResponse[BillingStateResponse]
32
35
  Successful Response
33
36
  """
34
37
  _response = self._client_wrapper.httpx_client.request(
35
- "feature-access",
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
- CheckFeatureAccessResponse,
45
+ BillingStateResponse,
43
46
  parse_obj_as(
44
- type_=CheckFeatureAccessResponse, # type: ignore
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 AsyncRawFeatureAccessClient:
69
+ class AsyncRawCustomerAccessClient:
67
70
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
68
71
  self._client_wrapper = client_wrapper
69
72
 
70
- async def get_feature_access(
71
- self, *, request_options: typing.Optional[RequestOptions] = None
72
- ) -> AsyncHttpResponse[CheckFeatureAccessResponse]:
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[CheckFeatureAccessResponse]
86
+ AsyncHttpResponse[BillingStateResponse]
82
87
  Successful Response
83
88
  """
84
89
  _response = await self._client_wrapper.httpx_client.request(
85
- "feature-access",
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
- CheckFeatureAccessResponse,
97
+ BillingStateResponse,
93
98
  parse_obj_as(
94
- type_=CheckFeatureAccessResponse, # type: ignore
99
+ type_=BillingStateResponse, # type: ignore
95
100
  object_=_response.json(),
96
101
  ),
97
102
  )
@@ -1,5 +1,4 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import typing
3
+ # isort: skip_file
4
4
 
5
- RateCard = typing.Optional[typing.Any]
@@ -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,7 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import enum
4
+
5
+
6
+ class LarkEnvironment(enum.Enum):
7
+ DEFAULT = "https://api.uselark.ai"
@@ -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"]