lark-billing 0.0.6__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 (167) hide show
  1. lark/__init__.py +522 -0
  2. lark/checkout/__init__.py +4 -0
  3. lark/checkout/client.py +214 -0
  4. lark/checkout/raw_client.py +252 -0
  5. lark/client.py +240 -0
  6. lark/core/__init__.py +105 -0
  7. lark/core/api_error.py +23 -0
  8. lark/core/client_wrapper.py +79 -0
  9. lark/core/datetime_utils.py +28 -0
  10. lark/core/file.py +67 -0
  11. lark/core/force_multipart.py +18 -0
  12. lark/core/http_client.py +543 -0
  13. lark/core/http_response.py +55 -0
  14. lark/core/jsonable_encoder.py +100 -0
  15. lark/core/pydantic_utilities.py +258 -0
  16. lark/core/query_encoder.py +58 -0
  17. lark/core/remove_none_from_dict.py +11 -0
  18. lark/core/request_options.py +35 -0
  19. lark/core/serialization.py +276 -0
  20. lark/errors/__init__.py +34 -0
  21. lark/errors/unprocessable_entity_error.py +11 -0
  22. lark/feature_access/__init__.py +4 -0
  23. lark/feature_access/client.py +102 -0
  24. lark/feature_access/raw_client.py +113 -0
  25. lark/py.typed +0 -0
  26. lark/rate_cards/__init__.py +61 -0
  27. lark/rate_cards/client.py +817 -0
  28. lark/rate_cards/raw_client.py +728 -0
  29. lark/rate_cards/types/__init__.py +63 -0
  30. lark/rate_cards/types/create_rate_card_request_billing_interval.py +5 -0
  31. lark/rate_cards/types/create_rate_card_request_usage_based_rates_item.py +56 -0
  32. lark/rate_cards/types/create_rate_card_version_request_usage_based_rates_item.py +58 -0
  33. lark/rate_cards/types/create_rate_card_version_request_version_type.py +5 -0
  34. lark/subjects/__init__.py +4 -0
  35. lark/subjects/client.py +501 -0
  36. lark/subjects/raw_client.py +633 -0
  37. lark/subscriptions/__init__.py +4 -0
  38. lark/subscriptions/client.py +462 -0
  39. lark/subscriptions/raw_client.py +495 -0
  40. lark/types/__init__.py +493 -0
  41. lark/types/aggregation.py +80 -0
  42. lark/types/amount.py +20 -0
  43. lark/types/check_feature_access_request.py +24 -0
  44. lark/types/check_feature_access_response.py +21 -0
  45. lark/types/complete_subscription_checkout_response.py +21 -0
  46. lark/types/count_aggregation_pricing_metric_interface.py +17 -0
  47. lark/types/create_credit_grant_interface.py +27 -0
  48. lark/types/create_credit_grant_interface_expiration.py +27 -0
  49. lark/types/create_credit_pool_request.py +5 -0
  50. lark/types/create_dimension_coordinate_interface.py +20 -0
  51. lark/types/create_dimension_interface.py +20 -0
  52. lark/types/create_dimensional_usage_based_rate_interface.py +32 -0
  53. lark/types/create_fixed_rate_interface.py +28 -0
  54. lark/types/create_pricing_matrix_cell_interface.py +22 -0
  55. lark/types/create_pricing_matrix_interface.py +20 -0
  56. lark/types/create_pricing_metric_interface.py +26 -0
  57. lark/types/create_pricing_plan_request.py +5 -0
  58. lark/types/create_rate_card_response.py +36 -0
  59. lark/types/create_rate_card_response_billing_interval.py +5 -0
  60. lark/types/create_rate_card_response_usage_based_rates_item.py +58 -0
  61. lark/types/create_rate_card_version_response.py +36 -0
  62. lark/types/create_rate_card_version_response_billing_interval.py +5 -0
  63. lark/types/create_rate_card_version_response_usage_based_rates_item.py +59 -0
  64. lark/types/create_simple_usage_based_rate_interface.py +30 -0
  65. lark/types/create_subject_response.py +24 -0
  66. lark/types/create_subscription_checkout_session_response.py +23 -0
  67. lark/types/create_usage_event_summary_response.py +23 -0
  68. lark/types/credit_grant.py +5 -0
  69. lark/types/credit_grant_date_time_expiration_interface.py +19 -0
  70. lark/types/credit_grant_date_time_expiration_resource.py +19 -0
  71. lark/types/credit_grant_duration_expiration_interface.py +21 -0
  72. lark/types/credit_grant_duration_expiration_resource.py +21 -0
  73. lark/types/credit_grant_interface.py +28 -0
  74. lark/types/credit_grant_interface_input_expiration.py +27 -0
  75. lark/types/credit_grant_interface_output_expiration.py +43 -0
  76. lark/types/credit_grant_interface_output_schedule.py +41 -0
  77. lark/types/credit_grant_resource.py +28 -0
  78. lark/types/credit_grant_resource_input_expiration.py +27 -0
  79. lark/types/credit_grant_resource_input_schedule.py +39 -0
  80. lark/types/credit_grant_resource_output_expiration.py +43 -0
  81. lark/types/credit_grant_resource_output_schedule.py +39 -0
  82. lark/types/credit_grant_schedule.py +5 -0
  83. lark/types/credit_grant_schedule_one_time_interface.py +19 -0
  84. lark/types/credit_grant_schedule_one_time_resource.py +17 -0
  85. lark/types/credit_grant_schedule_rate_cycle_start_interface.py +19 -0
  86. lark/types/credit_grant_schedule_rate_cycle_start_resource.py +17 -0
  87. lark/types/credit_grant_subject_granting_config_interface.py +20 -0
  88. lark/types/credit_pool.py +5 -0
  89. lark/types/credit_pool_rollover_config.py +5 -0
  90. lark/types/custom_aggregation_pricing_metric_interface.py +22 -0
  91. lark/types/custom_pricing_metric.py +5 -0
  92. lark/types/custom_unit.py +5 -0
  93. lark/types/custom_unit_amount.py +5 -0
  94. lark/types/dimension.py +5 -0
  95. lark/types/dimension_coordinate.py +5 -0
  96. lark/types/dimension_coordinate_interface.py +20 -0
  97. lark/types/dimension_coordinate_set.py +5 -0
  98. lark/types/dimension_interface.py +20 -0
  99. lark/types/dimensional_rate_matrix.py +5 -0
  100. lark/types/dimensional_rate_matrix_cell.py +5 -0
  101. lark/types/dimensional_usage_based_rate.py +5 -0
  102. lark/types/dimensional_usage_based_rate_input.py +5 -0
  103. lark/types/dimensional_usage_based_rate_interface.py +33 -0
  104. lark/types/feature_access_resource.py +21 -0
  105. lark/types/fixed_rate_interface.py +29 -0
  106. lark/types/flat_price.py +24 -0
  107. lark/types/get_rate_card_response.py +36 -0
  108. lark/types/get_rate_card_response_billing_interval.py +5 -0
  109. lark/types/get_rate_card_response_usage_based_rates_item.py +58 -0
  110. lark/types/grant_credits_request.py +5 -0
  111. lark/types/http_validation_error.py +20 -0
  112. lark/types/last_aggregation_pricing_metric_interface.py +22 -0
  113. lark/types/license_based_rate.py +5 -0
  114. lark/types/license_based_rate_input.py +5 -0
  115. lark/types/list_rate_cards_response.py +21 -0
  116. lark/types/list_subjects_response.py +21 -0
  117. lark/types/list_subscriptions_response.py +21 -0
  118. lark/types/max_aggregation_pricing_metric_interface.py +22 -0
  119. lark/types/monetary_amount.py +5 -0
  120. lark/types/package_price.py +27 -0
  121. lark/types/package_price_rounding_behavior.py +5 -0
  122. lark/types/package_price_wrapper.py +5 -0
  123. lark/types/period.py +22 -0
  124. lark/types/price.py +5 -0
  125. lark/types/pricing_matrix_cell_interface.py +22 -0
  126. lark/types/pricing_matrix_interface.py +20 -0
  127. lark/types/pricing_metric.py +5 -0
  128. lark/types/pricing_metric_interface.py +27 -0
  129. lark/types/pricing_plan.py +5 -0
  130. lark/types/pricing_plan_subscription.py +5 -0
  131. lark/types/pricing_tier.py +5 -0
  132. lark/types/rate_card.py +5 -0
  133. lark/types/rate_card_resource.py +36 -0
  134. lark/types/rate_card_resource_billing_interval.py +5 -0
  135. lark/types/rate_card_resource_usage_based_rates_item.py +58 -0
  136. lark/types/rate_card_version.py +5 -0
  137. lark/types/rate_card_version_input.py +5 -0
  138. lark/types/simple_usage_based_rate.py +5 -0
  139. lark/types/simple_usage_based_rate_input.py +5 -0
  140. lark/types/simple_usage_based_rate_interface.py +31 -0
  141. lark/types/status.py +5 -0
  142. lark/types/subject.py +5 -0
  143. lark/types/subject_granting_config.py +5 -0
  144. lark/types/subject_granting_config_resource.py +20 -0
  145. lark/types/subject_resource.py +24 -0
  146. lark/types/subscription_resource.py +28 -0
  147. lark/types/sum_aggregation_pricing_metric_interface.py +22 -0
  148. lark/types/tiered_price.py +5 -0
  149. lark/types/tiered_price_wrapper.py +5 -0
  150. lark/types/unit.py +5 -0
  151. lark/types/update_pricing_plan_request.py +5 -0
  152. lark/types/update_rate_card_request.py +5 -0
  153. lark/types/update_subscription_request.py +5 -0
  154. lark/types/usage_based_rate.py +5 -0
  155. lark/types/usage_based_rate_input.py +5 -0
  156. lark/types/usage_unit.py +5 -0
  157. lark/types/validation_error.py +22 -0
  158. lark/types/validation_error_loc_item.py +5 -0
  159. lark/usage_events/__init__.py +34 -0
  160. lark/usage_events/client.py +293 -0
  161. lark/usage_events/raw_client.py +318 -0
  162. lark/usage_events/types/__init__.py +36 -0
  163. lark/usage_events/types/create_usage_event_summary_request_aggregation_type.py +5 -0
  164. lark/version.py +3 -0
  165. lark_billing-0.0.6.dist-info/METADATA +188 -0
  166. lark_billing-0.0.6.dist-info/RECORD +167 -0
  167. lark_billing-0.0.6.dist-info/WHEEL +4 -0
@@ -0,0 +1,63 @@
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 .create_rate_card_request_billing_interval import CreateRateCardRequestBillingInterval
10
+ from .create_rate_card_request_usage_based_rates_item import (
11
+ CreateRateCardRequestUsageBasedRatesItem,
12
+ CreateRateCardRequestUsageBasedRatesItem_Dimensional,
13
+ CreateRateCardRequestUsageBasedRatesItem_Simple,
14
+ )
15
+ from .create_rate_card_version_request_usage_based_rates_item import (
16
+ CreateRateCardVersionRequestUsageBasedRatesItem,
17
+ CreateRateCardVersionRequestUsageBasedRatesItem_Dimensional,
18
+ CreateRateCardVersionRequestUsageBasedRatesItem_Simple,
19
+ )
20
+ from .create_rate_card_version_request_version_type import CreateRateCardVersionRequestVersionType
21
+ _dynamic_imports: typing.Dict[str, str] = {
22
+ "CreateRateCardRequestBillingInterval": ".create_rate_card_request_billing_interval",
23
+ "CreateRateCardRequestUsageBasedRatesItem": ".create_rate_card_request_usage_based_rates_item",
24
+ "CreateRateCardRequestUsageBasedRatesItem_Dimensional": ".create_rate_card_request_usage_based_rates_item",
25
+ "CreateRateCardRequestUsageBasedRatesItem_Simple": ".create_rate_card_request_usage_based_rates_item",
26
+ "CreateRateCardVersionRequestUsageBasedRatesItem": ".create_rate_card_version_request_usage_based_rates_item",
27
+ "CreateRateCardVersionRequestUsageBasedRatesItem_Dimensional": ".create_rate_card_version_request_usage_based_rates_item",
28
+ "CreateRateCardVersionRequestUsageBasedRatesItem_Simple": ".create_rate_card_version_request_usage_based_rates_item",
29
+ "CreateRateCardVersionRequestVersionType": ".create_rate_card_version_request_version_type",
30
+ }
31
+
32
+
33
+ def __getattr__(attr_name: str) -> typing.Any:
34
+ module_name = _dynamic_imports.get(attr_name)
35
+ if module_name is None:
36
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
37
+ try:
38
+ module = import_module(module_name, __package__)
39
+ if module_name == f".{attr_name}":
40
+ return module
41
+ else:
42
+ return getattr(module, attr_name)
43
+ except ImportError as e:
44
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
45
+ except AttributeError as e:
46
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
47
+
48
+
49
+ def __dir__():
50
+ lazy_attrs = list(_dynamic_imports.keys())
51
+ return sorted(lazy_attrs)
52
+
53
+
54
+ __all__ = [
55
+ "CreateRateCardRequestBillingInterval",
56
+ "CreateRateCardRequestUsageBasedRatesItem",
57
+ "CreateRateCardRequestUsageBasedRatesItem_Dimensional",
58
+ "CreateRateCardRequestUsageBasedRatesItem_Simple",
59
+ "CreateRateCardVersionRequestUsageBasedRatesItem",
60
+ "CreateRateCardVersionRequestUsageBasedRatesItem_Dimensional",
61
+ "CreateRateCardVersionRequestUsageBasedRatesItem_Simple",
62
+ "CreateRateCardVersionRequestVersionType",
63
+ ]
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ CreateRateCardRequestBillingInterval = typing.Union[typing.Literal["monthly", "yearly"], typing.Any]
@@ -0,0 +1,56 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from __future__ import annotations
4
+
5
+ import typing
6
+
7
+ import pydantic
8
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
9
+ from ...types.create_dimension_interface import CreateDimensionInterface
10
+ from ...types.create_pricing_matrix_interface import CreatePricingMatrixInterface
11
+ from ...types.create_pricing_metric_interface import CreatePricingMetricInterface
12
+ from ...types.price import Price
13
+
14
+
15
+ class CreateRateCardRequestUsageBasedRatesItem_Dimensional(UniversalBaseModel):
16
+ usage_based_rate_type: typing.Literal["dimensional"] = "dimensional"
17
+ code: str
18
+ name: str
19
+ description: typing.Optional[str] = None
20
+ included_units: typing.Optional[int] = None
21
+ pricing_metric: CreatePricingMetricInterface
22
+ dimensions: typing.List[CreateDimensionInterface]
23
+ pricing_matrix: CreatePricingMatrixInterface
24
+
25
+ if IS_PYDANTIC_V2:
26
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
27
+ else:
28
+
29
+ class Config:
30
+ frozen = True
31
+ smart_union = True
32
+ extra = pydantic.Extra.allow
33
+
34
+
35
+ class CreateRateCardRequestUsageBasedRatesItem_Simple(UniversalBaseModel):
36
+ usage_based_rate_type: typing.Literal["simple"] = "simple"
37
+ code: str
38
+ name: str
39
+ description: typing.Optional[str] = None
40
+ price: Price
41
+ included_units: typing.Optional[int] = None
42
+ pricing_metric: CreatePricingMetricInterface
43
+
44
+ if IS_PYDANTIC_V2:
45
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
46
+ else:
47
+
48
+ class Config:
49
+ frozen = True
50
+ smart_union = True
51
+ extra = pydantic.Extra.allow
52
+
53
+
54
+ CreateRateCardRequestUsageBasedRatesItem = typing.Union[
55
+ CreateRateCardRequestUsageBasedRatesItem_Dimensional, CreateRateCardRequestUsageBasedRatesItem_Simple
56
+ ]
@@ -0,0 +1,58 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from __future__ import annotations
4
+
5
+ import typing
6
+
7
+ import pydantic
8
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
9
+ from ...types.dimension_interface import DimensionInterface
10
+ from ...types.price import Price
11
+ from ...types.pricing_matrix_interface import PricingMatrixInterface
12
+ from ...types.pricing_metric_interface import PricingMetricInterface
13
+
14
+
15
+ class CreateRateCardVersionRequestUsageBasedRatesItem_Dimensional(UniversalBaseModel):
16
+ usage_based_rate_type: typing.Literal["dimensional"] = "dimensional"
17
+ id: str
18
+ code: str
19
+ name: str
20
+ description: str
21
+ included_units: int
22
+ pricing_metric: PricingMetricInterface
23
+ dimensions: typing.List[DimensionInterface]
24
+ pricing_matrix: PricingMatrixInterface
25
+
26
+ if IS_PYDANTIC_V2:
27
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
28
+ else:
29
+
30
+ class Config:
31
+ frozen = True
32
+ smart_union = True
33
+ extra = pydantic.Extra.allow
34
+
35
+
36
+ class CreateRateCardVersionRequestUsageBasedRatesItem_Simple(UniversalBaseModel):
37
+ usage_based_rate_type: typing.Literal["simple"] = "simple"
38
+ id: str
39
+ code: str
40
+ name: str
41
+ description: str
42
+ price: Price
43
+ included_units: int
44
+ pricing_metric: PricingMetricInterface
45
+
46
+ if IS_PYDANTIC_V2:
47
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
48
+ else:
49
+
50
+ class Config:
51
+ frozen = True
52
+ smart_union = True
53
+ extra = pydantic.Extra.allow
54
+
55
+
56
+ CreateRateCardVersionRequestUsageBasedRatesItem = typing.Union[
57
+ CreateRateCardVersionRequestUsageBasedRatesItem_Dimensional, CreateRateCardVersionRequestUsageBasedRatesItem_Simple
58
+ ]
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ CreateRateCardVersionRequestVersionType = typing.Union[typing.Literal["major", "minor"], typing.Any]
@@ -0,0 +1,4 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
@@ -0,0 +1,501 @@
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_subject_response import CreateSubjectResponse
8
+ from ..types.list_subjects_response import ListSubjectsResponse
9
+ from ..types.subject_resource import SubjectResource
10
+ from .raw_client import AsyncRawSubjectsClient, RawSubjectsClient
11
+
12
+ # this is used as the default value for optional parameters
13
+ OMIT = typing.cast(typing.Any, ...)
14
+
15
+
16
+ class SubjectsClient:
17
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
18
+ self._raw_client = RawSubjectsClient(client_wrapper=client_wrapper)
19
+
20
+ @property
21
+ def with_raw_response(self) -> RawSubjectsClient:
22
+ """
23
+ Retrieves a raw implementation of this client that returns raw responses.
24
+
25
+ Returns
26
+ -------
27
+ RawSubjectsClient
28
+ """
29
+ return self._raw_client
30
+
31
+ def list_subjects(
32
+ self,
33
+ *,
34
+ limit: typing.Optional[int] = None,
35
+ offset: typing.Optional[int] = None,
36
+ request_options: typing.Optional[RequestOptions] = None,
37
+ ) -> ListSubjectsResponse:
38
+ """
39
+ Parameters
40
+ ----------
41
+ limit : typing.Optional[int]
42
+
43
+ offset : typing.Optional[int]
44
+
45
+ request_options : typing.Optional[RequestOptions]
46
+ Request-specific configuration.
47
+
48
+ Returns
49
+ -------
50
+ ListSubjectsResponse
51
+ Successful Response
52
+
53
+ Examples
54
+ --------
55
+ from lark import Lark
56
+
57
+ client = Lark(
58
+ api_key="YOUR_API_KEY",
59
+ base_url="https://yourhost.com/path/to/api",
60
+ )
61
+ client.subjects.list_subjects(
62
+ limit=1,
63
+ offset=1,
64
+ )
65
+ """
66
+ _response = self._raw_client.list_subjects(limit=limit, offset=offset, request_options=request_options)
67
+ return _response.data
68
+
69
+ def create_subject(
70
+ self,
71
+ *,
72
+ external_id: typing.Optional[str] = OMIT,
73
+ name: typing.Optional[str] = OMIT,
74
+ email: typing.Optional[str] = OMIT,
75
+ parent_subject_id: typing.Optional[str] = OMIT,
76
+ metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
77
+ request_options: typing.Optional[RequestOptions] = None,
78
+ ) -> CreateSubjectResponse:
79
+ """
80
+ Parameters
81
+ ----------
82
+ external_id : typing.Optional[str]
83
+
84
+ name : typing.Optional[str]
85
+
86
+ email : typing.Optional[str]
87
+
88
+ parent_subject_id : typing.Optional[str]
89
+
90
+ metadata : typing.Optional[typing.Dict[str, str]]
91
+
92
+ request_options : typing.Optional[RequestOptions]
93
+ Request-specific configuration.
94
+
95
+ Returns
96
+ -------
97
+ CreateSubjectResponse
98
+ Successful Response
99
+
100
+ Examples
101
+ --------
102
+ from lark import Lark
103
+
104
+ client = Lark(
105
+ api_key="YOUR_API_KEY",
106
+ base_url="https://yourhost.com/path/to/api",
107
+ )
108
+ client.subjects.create_subject()
109
+ """
110
+ _response = self._raw_client.create_subject(
111
+ external_id=external_id,
112
+ name=name,
113
+ email=email,
114
+ parent_subject_id=parent_subject_id,
115
+ metadata=metadata,
116
+ request_options=request_options,
117
+ )
118
+ return _response.data
119
+
120
+ def get_subject(
121
+ self, subject_id: str, *, request_options: typing.Optional[RequestOptions] = None
122
+ ) -> SubjectResource:
123
+ """
124
+ Parameters
125
+ ----------
126
+ subject_id : str
127
+
128
+ request_options : typing.Optional[RequestOptions]
129
+ Request-specific configuration.
130
+
131
+ Returns
132
+ -------
133
+ SubjectResource
134
+ Successful Response
135
+
136
+ Examples
137
+ --------
138
+ from lark import Lark
139
+
140
+ client = Lark(
141
+ api_key="YOUR_API_KEY",
142
+ base_url="https://yourhost.com/path/to/api",
143
+ )
144
+ client.subjects.get_subject(
145
+ subject_id="subject_id",
146
+ )
147
+ """
148
+ _response = self._raw_client.get_subject(subject_id, request_options=request_options)
149
+ return _response.data
150
+
151
+ def update_subject(
152
+ self,
153
+ subject_id: str,
154
+ *,
155
+ external_id: typing.Optional[str] = OMIT,
156
+ name: typing.Optional[str] = OMIT,
157
+ email: typing.Optional[str] = OMIT,
158
+ parent_subject_id: typing.Optional[str] = OMIT,
159
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
160
+ request_options: typing.Optional[RequestOptions] = None,
161
+ ) -> SubjectResource:
162
+ """
163
+ Parameters
164
+ ----------
165
+ subject_id : str
166
+
167
+ external_id : typing.Optional[str]
168
+
169
+ name : typing.Optional[str]
170
+
171
+ email : typing.Optional[str]
172
+
173
+ parent_subject_id : typing.Optional[str]
174
+
175
+ metadata : typing.Optional[typing.Dict[str, typing.Optional[str]]]
176
+
177
+ request_options : typing.Optional[RequestOptions]
178
+ Request-specific configuration.
179
+
180
+ Returns
181
+ -------
182
+ SubjectResource
183
+ Successful Response
184
+
185
+ Examples
186
+ --------
187
+ from lark import Lark
188
+
189
+ client = Lark(
190
+ api_key="YOUR_API_KEY",
191
+ base_url="https://yourhost.com/path/to/api",
192
+ )
193
+ client.subjects.update_subject(
194
+ subject_id="subject_id",
195
+ )
196
+ """
197
+ _response = self._raw_client.update_subject(
198
+ subject_id,
199
+ external_id=external_id,
200
+ name=name,
201
+ email=email,
202
+ parent_subject_id=parent_subject_id,
203
+ metadata=metadata,
204
+ request_options=request_options,
205
+ )
206
+ return _response.data
207
+
208
+ def delete_subject(
209
+ self, subject_id: str, *, request_options: typing.Optional[RequestOptions] = None
210
+ ) -> typing.Optional[typing.Any]:
211
+ """
212
+ Parameters
213
+ ----------
214
+ subject_id : str
215
+
216
+ request_options : typing.Optional[RequestOptions]
217
+ Request-specific configuration.
218
+
219
+ Returns
220
+ -------
221
+ typing.Optional[typing.Any]
222
+ Successful Response
223
+
224
+ Examples
225
+ --------
226
+ from lark import Lark
227
+
228
+ client = Lark(
229
+ api_key="YOUR_API_KEY",
230
+ base_url="https://yourhost.com/path/to/api",
231
+ )
232
+ client.subjects.delete_subject(
233
+ subject_id="subject_id",
234
+ )
235
+ """
236
+ _response = self._raw_client.delete_subject(subject_id, request_options=request_options)
237
+ return _response.data
238
+
239
+
240
+ class AsyncSubjectsClient:
241
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
242
+ self._raw_client = AsyncRawSubjectsClient(client_wrapper=client_wrapper)
243
+
244
+ @property
245
+ def with_raw_response(self) -> AsyncRawSubjectsClient:
246
+ """
247
+ Retrieves a raw implementation of this client that returns raw responses.
248
+
249
+ Returns
250
+ -------
251
+ AsyncRawSubjectsClient
252
+ """
253
+ return self._raw_client
254
+
255
+ async def list_subjects(
256
+ self,
257
+ *,
258
+ limit: typing.Optional[int] = None,
259
+ offset: typing.Optional[int] = None,
260
+ request_options: typing.Optional[RequestOptions] = None,
261
+ ) -> ListSubjectsResponse:
262
+ """
263
+ Parameters
264
+ ----------
265
+ limit : typing.Optional[int]
266
+
267
+ offset : typing.Optional[int]
268
+
269
+ request_options : typing.Optional[RequestOptions]
270
+ Request-specific configuration.
271
+
272
+ Returns
273
+ -------
274
+ ListSubjectsResponse
275
+ Successful Response
276
+
277
+ Examples
278
+ --------
279
+ import asyncio
280
+
281
+ from lark import AsyncLark
282
+
283
+ client = AsyncLark(
284
+ api_key="YOUR_API_KEY",
285
+ base_url="https://yourhost.com/path/to/api",
286
+ )
287
+
288
+
289
+ async def main() -> None:
290
+ await client.subjects.list_subjects(
291
+ limit=1,
292
+ offset=1,
293
+ )
294
+
295
+
296
+ asyncio.run(main())
297
+ """
298
+ _response = await self._raw_client.list_subjects(limit=limit, offset=offset, request_options=request_options)
299
+ return _response.data
300
+
301
+ async def create_subject(
302
+ self,
303
+ *,
304
+ external_id: typing.Optional[str] = OMIT,
305
+ name: typing.Optional[str] = OMIT,
306
+ email: typing.Optional[str] = OMIT,
307
+ parent_subject_id: typing.Optional[str] = OMIT,
308
+ metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
309
+ request_options: typing.Optional[RequestOptions] = None,
310
+ ) -> CreateSubjectResponse:
311
+ """
312
+ Parameters
313
+ ----------
314
+ external_id : typing.Optional[str]
315
+
316
+ name : typing.Optional[str]
317
+
318
+ email : typing.Optional[str]
319
+
320
+ parent_subject_id : typing.Optional[str]
321
+
322
+ metadata : typing.Optional[typing.Dict[str, str]]
323
+
324
+ request_options : typing.Optional[RequestOptions]
325
+ Request-specific configuration.
326
+
327
+ Returns
328
+ -------
329
+ CreateSubjectResponse
330
+ Successful Response
331
+
332
+ Examples
333
+ --------
334
+ import asyncio
335
+
336
+ from lark import AsyncLark
337
+
338
+ client = AsyncLark(
339
+ api_key="YOUR_API_KEY",
340
+ base_url="https://yourhost.com/path/to/api",
341
+ )
342
+
343
+
344
+ async def main() -> None:
345
+ await client.subjects.create_subject()
346
+
347
+
348
+ asyncio.run(main())
349
+ """
350
+ _response = await self._raw_client.create_subject(
351
+ external_id=external_id,
352
+ name=name,
353
+ email=email,
354
+ parent_subject_id=parent_subject_id,
355
+ metadata=metadata,
356
+ request_options=request_options,
357
+ )
358
+ return _response.data
359
+
360
+ async def get_subject(
361
+ self, subject_id: str, *, request_options: typing.Optional[RequestOptions] = None
362
+ ) -> SubjectResource:
363
+ """
364
+ Parameters
365
+ ----------
366
+ subject_id : str
367
+
368
+ request_options : typing.Optional[RequestOptions]
369
+ Request-specific configuration.
370
+
371
+ Returns
372
+ -------
373
+ SubjectResource
374
+ Successful Response
375
+
376
+ Examples
377
+ --------
378
+ import asyncio
379
+
380
+ from lark import AsyncLark
381
+
382
+ client = AsyncLark(
383
+ api_key="YOUR_API_KEY",
384
+ base_url="https://yourhost.com/path/to/api",
385
+ )
386
+
387
+
388
+ async def main() -> None:
389
+ await client.subjects.get_subject(
390
+ subject_id="subject_id",
391
+ )
392
+
393
+
394
+ asyncio.run(main())
395
+ """
396
+ _response = await self._raw_client.get_subject(subject_id, request_options=request_options)
397
+ return _response.data
398
+
399
+ async def update_subject(
400
+ self,
401
+ subject_id: str,
402
+ *,
403
+ external_id: typing.Optional[str] = OMIT,
404
+ name: typing.Optional[str] = OMIT,
405
+ email: typing.Optional[str] = OMIT,
406
+ parent_subject_id: typing.Optional[str] = OMIT,
407
+ metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
408
+ request_options: typing.Optional[RequestOptions] = None,
409
+ ) -> SubjectResource:
410
+ """
411
+ Parameters
412
+ ----------
413
+ subject_id : str
414
+
415
+ external_id : typing.Optional[str]
416
+
417
+ name : typing.Optional[str]
418
+
419
+ email : typing.Optional[str]
420
+
421
+ parent_subject_id : typing.Optional[str]
422
+
423
+ metadata : typing.Optional[typing.Dict[str, typing.Optional[str]]]
424
+
425
+ request_options : typing.Optional[RequestOptions]
426
+ Request-specific configuration.
427
+
428
+ Returns
429
+ -------
430
+ SubjectResource
431
+ Successful Response
432
+
433
+ Examples
434
+ --------
435
+ import asyncio
436
+
437
+ from lark import AsyncLark
438
+
439
+ client = AsyncLark(
440
+ api_key="YOUR_API_KEY",
441
+ base_url="https://yourhost.com/path/to/api",
442
+ )
443
+
444
+
445
+ async def main() -> None:
446
+ await client.subjects.update_subject(
447
+ subject_id="subject_id",
448
+ )
449
+
450
+
451
+ asyncio.run(main())
452
+ """
453
+ _response = await self._raw_client.update_subject(
454
+ subject_id,
455
+ external_id=external_id,
456
+ name=name,
457
+ email=email,
458
+ parent_subject_id=parent_subject_id,
459
+ metadata=metadata,
460
+ request_options=request_options,
461
+ )
462
+ return _response.data
463
+
464
+ async def delete_subject(
465
+ self, subject_id: str, *, request_options: typing.Optional[RequestOptions] = None
466
+ ) -> typing.Optional[typing.Any]:
467
+ """
468
+ Parameters
469
+ ----------
470
+ subject_id : str
471
+
472
+ request_options : typing.Optional[RequestOptions]
473
+ Request-specific configuration.
474
+
475
+ Returns
476
+ -------
477
+ typing.Optional[typing.Any]
478
+ Successful Response
479
+
480
+ Examples
481
+ --------
482
+ import asyncio
483
+
484
+ from lark import AsyncLark
485
+
486
+ client = AsyncLark(
487
+ api_key="YOUR_API_KEY",
488
+ base_url="https://yourhost.com/path/to/api",
489
+ )
490
+
491
+
492
+ async def main() -> None:
493
+ await client.subjects.delete_subject(
494
+ subject_id="subject_id",
495
+ )
496
+
497
+
498
+ asyncio.run(main())
499
+ """
500
+ _response = await self._raw_client.delete_subject(subject_id, request_options=request_options)
501
+ return _response.data