lark-billing 0.0.9__py3-none-any.whl → 0.1.0__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 (34) hide show
  1. lark/__init__.py +39 -16
  2. lark/core/client_wrapper.py +2 -2
  3. lark/pricing_metrics/__init__.py +19 -2
  4. lark/pricing_metrics/client.py +148 -22
  5. lark/pricing_metrics/raw_client.py +159 -20
  6. lark/pricing_metrics/types/__init__.py +14 -1
  7. lark/pricing_metrics/types/pricing_metric_aggregation.py +69 -1
  8. lark/rate_cards/client.py +58 -2
  9. lark/rate_cards/raw_client.py +4 -0
  10. lark/subjects/client.py +12 -2
  11. lark/types/__init__.py +23 -13
  12. lark/types/aggregation.py +45 -1
  13. lark/types/billing_state_response.py +9 -2
  14. lark/types/count_aggregation_pricing_metric_interface.py +4 -0
  15. lark/types/custom_aggregation_pricing_metric_interface.py +26 -0
  16. lark/types/last_aggregation_pricing_metric_interface.py +26 -0
  17. lark/types/{get_pricing_metric_response.py → last_aggregation_pricing_metric_resource.py} +5 -7
  18. lark/types/{create_usage_event_summary_response.py → max_aggregation_pricing_metric_interface.py} +9 -6
  19. lark/types/{create_pricing_metric_response.py → max_aggregation_pricing_metric_resource.py} +5 -7
  20. lark/types/period.py +3 -2
  21. lark/types/pricing_metric_resource.py +24 -5
  22. lark/types/pricing_metric_summary_resource.py +43 -0
  23. lark/types/sum_aggregation_pricing_metric_interface.py +4 -0
  24. lark/types/sum_aggregation_pricing_metric_resource.py +4 -1
  25. lark/usage_events/__init__.py +3 -6
  26. lark/usage_events/client.py +25 -127
  27. lark/usage_events/raw_client.py +0 -141
  28. lark/usage_events/types/__init__.py +2 -6
  29. lark/usage_events/types/create_usage_event_request_data_value.py +1 -1
  30. {lark_billing-0.0.9.dist-info → lark_billing-0.1.0.dist-info}/METADATA +1 -1
  31. {lark_billing-0.0.9.dist-info → lark_billing-0.1.0.dist-info}/RECORD +32 -31
  32. lark/types/value.py +0 -5
  33. lark/usage_events/types/create_usage_event_summary_request_aggregation_type.py +0 -5
  34. {lark_billing-0.0.9.dist-info → lark_billing-0.1.0.dist-info}/WHEEL +0 -0
@@ -11,10 +11,11 @@ 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.create_pricing_metric_response import CreatePricingMetricResponse
15
- from ..types.get_pricing_metric_response import GetPricingMetricResponse
16
14
  from ..types.http_validation_error import HttpValidationError
17
15
  from ..types.list_pricing_metrics_response import ListPricingMetricsResponse
16
+ from ..types.period import Period
17
+ from ..types.pricing_metric_resource import PricingMetricResource
18
+ from ..types.pricing_metric_summary_resource import PricingMetricSummaryResource
18
19
  from .types.pricing_metric_aggregation import PricingMetricAggregation
19
20
 
20
21
  # this is used as the default value for optional parameters
@@ -83,25 +84,28 @@ class RawPricingMetricsClient:
83
84
  aggregation: PricingMetricAggregation,
84
85
  unit: str,
85
86
  request_options: typing.Optional[RequestOptions] = None,
86
- ) -> HttpResponse[CreatePricingMetricResponse]:
87
+ ) -> HttpResponse[PricingMetricResource]:
87
88
  """
88
89
  Parameters
89
90
  ----------
90
91
  name : str
92
+ The name of the pricing metric.
91
93
 
92
94
  event_name : str
95
+ The name of the event that the pricing metric is computed on.
93
96
 
94
97
  aggregation : PricingMetricAggregation
98
+ The aggregation function used to compute the value of the pricing metric.
95
99
 
96
100
  unit : str
97
- Unit of measurement for the pricing metric
101
+ Unit of measurement for the pricing metric.
98
102
 
99
103
  request_options : typing.Optional[RequestOptions]
100
104
  Request-specific configuration.
101
105
 
102
106
  Returns
103
107
  -------
104
- HttpResponse[CreatePricingMetricResponse]
108
+ HttpResponse[PricingMetricResource]
105
109
  Successful Response
106
110
  """
107
111
  _response = self._client_wrapper.httpx_client.request(
@@ -124,9 +128,9 @@ class RawPricingMetricsClient:
124
128
  try:
125
129
  if 200 <= _response.status_code < 300:
126
130
  _data = typing.cast(
127
- CreatePricingMetricResponse,
131
+ PricingMetricResource,
128
132
  parse_obj_as(
129
- type_=CreatePricingMetricResponse, # type: ignore
133
+ type_=PricingMetricResource, # type: ignore
130
134
  object_=_response.json(),
131
135
  ),
132
136
  )
@@ -149,7 +153,7 @@ class RawPricingMetricsClient:
149
153
 
150
154
  def get_pricing_metric(
151
155
  self, pricing_metric_id: str, *, request_options: typing.Optional[RequestOptions] = None
152
- ) -> HttpResponse[GetPricingMetricResponse]:
156
+ ) -> HttpResponse[PricingMetricResource]:
153
157
  """
154
158
  Parameters
155
159
  ----------
@@ -160,7 +164,7 @@ class RawPricingMetricsClient:
160
164
 
161
165
  Returns
162
166
  -------
163
- HttpResponse[GetPricingMetricResponse]
167
+ HttpResponse[PricingMetricResource]
164
168
  Successful Response
165
169
  """
166
170
  _response = self._client_wrapper.httpx_client.request(
@@ -171,9 +175,75 @@ class RawPricingMetricsClient:
171
175
  try:
172
176
  if 200 <= _response.status_code < 300:
173
177
  _data = typing.cast(
174
- GetPricingMetricResponse,
178
+ PricingMetricResource,
175
179
  parse_obj_as(
176
- type_=GetPricingMetricResponse, # type: ignore
180
+ type_=PricingMetricResource, # type: ignore
181
+ object_=_response.json(),
182
+ ),
183
+ )
184
+ return HttpResponse(response=_response, data=_data)
185
+ if _response.status_code == 422:
186
+ raise UnprocessableEntityError(
187
+ headers=dict(_response.headers),
188
+ body=typing.cast(
189
+ HttpValidationError,
190
+ parse_obj_as(
191
+ type_=HttpValidationError, # type: ignore
192
+ object_=_response.json(),
193
+ ),
194
+ ),
195
+ )
196
+ _response_json = _response.json()
197
+ except JSONDecodeError:
198
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
199
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
200
+
201
+ def create_pricing_metric_summary(
202
+ self,
203
+ pricing_metric_id: str,
204
+ *,
205
+ subject_id: str,
206
+ period: Period,
207
+ request_options: typing.Optional[RequestOptions] = None,
208
+ ) -> HttpResponse[PricingMetricSummaryResource]:
209
+ """
210
+ Parameters
211
+ ----------
212
+ pricing_metric_id : str
213
+
214
+ subject_id : str
215
+ The ID of the subject that the summary should be computed for.
216
+
217
+ period : Period
218
+ The period that the summary should be computed over.
219
+
220
+ request_options : typing.Optional[RequestOptions]
221
+ Request-specific configuration.
222
+
223
+ Returns
224
+ -------
225
+ HttpResponse[PricingMetricSummaryResource]
226
+ Successful Response
227
+ """
228
+ _response = self._client_wrapper.httpx_client.request(
229
+ f"pricing-metrics/{jsonable_encoder(pricing_metric_id)}/summary",
230
+ method="POST",
231
+ json={
232
+ "subject_id": subject_id,
233
+ "period": convert_and_respect_annotation_metadata(object_=period, annotation=Period, direction="write"),
234
+ },
235
+ headers={
236
+ "content-type": "application/json",
237
+ },
238
+ request_options=request_options,
239
+ omit=OMIT,
240
+ )
241
+ try:
242
+ if 200 <= _response.status_code < 300:
243
+ _data = typing.cast(
244
+ PricingMetricSummaryResource,
245
+ parse_obj_as(
246
+ type_=PricingMetricSummaryResource, # type: ignore
177
247
  object_=_response.json(),
178
248
  ),
179
249
  )
@@ -257,25 +327,28 @@ class AsyncRawPricingMetricsClient:
257
327
  aggregation: PricingMetricAggregation,
258
328
  unit: str,
259
329
  request_options: typing.Optional[RequestOptions] = None,
260
- ) -> AsyncHttpResponse[CreatePricingMetricResponse]:
330
+ ) -> AsyncHttpResponse[PricingMetricResource]:
261
331
  """
262
332
  Parameters
263
333
  ----------
264
334
  name : str
335
+ The name of the pricing metric.
265
336
 
266
337
  event_name : str
338
+ The name of the event that the pricing metric is computed on.
267
339
 
268
340
  aggregation : PricingMetricAggregation
341
+ The aggregation function used to compute the value of the pricing metric.
269
342
 
270
343
  unit : str
271
- Unit of measurement for the pricing metric
344
+ Unit of measurement for the pricing metric.
272
345
 
273
346
  request_options : typing.Optional[RequestOptions]
274
347
  Request-specific configuration.
275
348
 
276
349
  Returns
277
350
  -------
278
- AsyncHttpResponse[CreatePricingMetricResponse]
351
+ AsyncHttpResponse[PricingMetricResource]
279
352
  Successful Response
280
353
  """
281
354
  _response = await self._client_wrapper.httpx_client.request(
@@ -298,9 +371,9 @@ class AsyncRawPricingMetricsClient:
298
371
  try:
299
372
  if 200 <= _response.status_code < 300:
300
373
  _data = typing.cast(
301
- CreatePricingMetricResponse,
374
+ PricingMetricResource,
302
375
  parse_obj_as(
303
- type_=CreatePricingMetricResponse, # type: ignore
376
+ type_=PricingMetricResource, # type: ignore
304
377
  object_=_response.json(),
305
378
  ),
306
379
  )
@@ -323,7 +396,7 @@ class AsyncRawPricingMetricsClient:
323
396
 
324
397
  async def get_pricing_metric(
325
398
  self, pricing_metric_id: str, *, request_options: typing.Optional[RequestOptions] = None
326
- ) -> AsyncHttpResponse[GetPricingMetricResponse]:
399
+ ) -> AsyncHttpResponse[PricingMetricResource]:
327
400
  """
328
401
  Parameters
329
402
  ----------
@@ -334,7 +407,7 @@ class AsyncRawPricingMetricsClient:
334
407
 
335
408
  Returns
336
409
  -------
337
- AsyncHttpResponse[GetPricingMetricResponse]
410
+ AsyncHttpResponse[PricingMetricResource]
338
411
  Successful Response
339
412
  """
340
413
  _response = await self._client_wrapper.httpx_client.request(
@@ -345,9 +418,75 @@ class AsyncRawPricingMetricsClient:
345
418
  try:
346
419
  if 200 <= _response.status_code < 300:
347
420
  _data = typing.cast(
348
- GetPricingMetricResponse,
421
+ PricingMetricResource,
422
+ parse_obj_as(
423
+ type_=PricingMetricResource, # type: ignore
424
+ object_=_response.json(),
425
+ ),
426
+ )
427
+ return AsyncHttpResponse(response=_response, data=_data)
428
+ if _response.status_code == 422:
429
+ raise UnprocessableEntityError(
430
+ headers=dict(_response.headers),
431
+ body=typing.cast(
432
+ HttpValidationError,
433
+ parse_obj_as(
434
+ type_=HttpValidationError, # type: ignore
435
+ object_=_response.json(),
436
+ ),
437
+ ),
438
+ )
439
+ _response_json = _response.json()
440
+ except JSONDecodeError:
441
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
442
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
443
+
444
+ async def create_pricing_metric_summary(
445
+ self,
446
+ pricing_metric_id: str,
447
+ *,
448
+ subject_id: str,
449
+ period: Period,
450
+ request_options: typing.Optional[RequestOptions] = None,
451
+ ) -> AsyncHttpResponse[PricingMetricSummaryResource]:
452
+ """
453
+ Parameters
454
+ ----------
455
+ pricing_metric_id : str
456
+
457
+ subject_id : str
458
+ The ID of the subject that the summary should be computed for.
459
+
460
+ period : Period
461
+ The period that the summary should be computed over.
462
+
463
+ request_options : typing.Optional[RequestOptions]
464
+ Request-specific configuration.
465
+
466
+ Returns
467
+ -------
468
+ AsyncHttpResponse[PricingMetricSummaryResource]
469
+ Successful Response
470
+ """
471
+ _response = await self._client_wrapper.httpx_client.request(
472
+ f"pricing-metrics/{jsonable_encoder(pricing_metric_id)}/summary",
473
+ method="POST",
474
+ json={
475
+ "subject_id": subject_id,
476
+ "period": convert_and_respect_annotation_metadata(object_=period, annotation=Period, direction="write"),
477
+ },
478
+ headers={
479
+ "content-type": "application/json",
480
+ },
481
+ request_options=request_options,
482
+ omit=OMIT,
483
+ )
484
+ try:
485
+ if 200 <= _response.status_code < 300:
486
+ _data = typing.cast(
487
+ PricingMetricSummaryResource,
349
488
  parse_obj_as(
350
- type_=GetPricingMetricResponse, # type: ignore
489
+ type_=PricingMetricSummaryResource, # type: ignore
351
490
  object_=_response.json(),
352
491
  ),
353
492
  )
@@ -9,11 +9,17 @@ if typing.TYPE_CHECKING:
9
9
  from .pricing_metric_aggregation import (
10
10
  PricingMetricAggregation,
11
11
  PricingMetricAggregation_Count,
12
+ PricingMetricAggregation_Custom,
13
+ PricingMetricAggregation_Last,
14
+ PricingMetricAggregation_Max,
12
15
  PricingMetricAggregation_Sum,
13
16
  )
14
17
  _dynamic_imports: typing.Dict[str, str] = {
15
18
  "PricingMetricAggregation": ".pricing_metric_aggregation",
16
19
  "PricingMetricAggregation_Count": ".pricing_metric_aggregation",
20
+ "PricingMetricAggregation_Custom": ".pricing_metric_aggregation",
21
+ "PricingMetricAggregation_Last": ".pricing_metric_aggregation",
22
+ "PricingMetricAggregation_Max": ".pricing_metric_aggregation",
17
23
  "PricingMetricAggregation_Sum": ".pricing_metric_aggregation",
18
24
  }
19
25
 
@@ -39,4 +45,11 @@ def __dir__():
39
45
  return sorted(lazy_attrs)
40
46
 
41
47
 
42
- __all__ = ["PricingMetricAggregation", "PricingMetricAggregation_Count", "PricingMetricAggregation_Sum"]
48
+ __all__ = [
49
+ "PricingMetricAggregation",
50
+ "PricingMetricAggregation_Count",
51
+ "PricingMetricAggregation_Custom",
52
+ "PricingMetricAggregation_Last",
53
+ "PricingMetricAggregation_Max",
54
+ "PricingMetricAggregation_Sum",
55
+ ]
@@ -9,6 +9,10 @@ from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
9
9
 
10
10
 
11
11
  class PricingMetricAggregation_Count(UniversalBaseModel):
12
+ """
13
+ The aggregation function used to compute the value of the pricing metric.
14
+ """
15
+
12
16
  aggregation_type: typing.Literal["count"] = "count"
13
17
 
14
18
  if IS_PYDANTIC_V2:
@@ -21,7 +25,65 @@ class PricingMetricAggregation_Count(UniversalBaseModel):
21
25
  extra = pydantic.Extra.allow
22
26
 
23
27
 
28
+ class PricingMetricAggregation_Custom(UniversalBaseModel):
29
+ """
30
+ The aggregation function used to compute the value of the pricing metric.
31
+ """
32
+
33
+ aggregation_type: typing.Literal["custom"] = "custom"
34
+ custom_expression: str
35
+
36
+ if IS_PYDANTIC_V2:
37
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
38
+ else:
39
+
40
+ class Config:
41
+ frozen = True
42
+ smart_union = True
43
+ extra = pydantic.Extra.allow
44
+
45
+
46
+ class PricingMetricAggregation_Last(UniversalBaseModel):
47
+ """
48
+ The aggregation function used to compute the value of the pricing metric.
49
+ """
50
+
51
+ aggregation_type: typing.Literal["last"] = "last"
52
+ value_field: str
53
+
54
+ if IS_PYDANTIC_V2:
55
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
56
+ else:
57
+
58
+ class Config:
59
+ frozen = True
60
+ smart_union = True
61
+ extra = pydantic.Extra.allow
62
+
63
+
64
+ class PricingMetricAggregation_Max(UniversalBaseModel):
65
+ """
66
+ The aggregation function used to compute the value of the pricing metric.
67
+ """
68
+
69
+ aggregation_type: typing.Literal["max"] = "max"
70
+ value_field: str
71
+
72
+ if IS_PYDANTIC_V2:
73
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
74
+ else:
75
+
76
+ class Config:
77
+ frozen = True
78
+ smart_union = True
79
+ extra = pydantic.Extra.allow
80
+
81
+
24
82
  class PricingMetricAggregation_Sum(UniversalBaseModel):
83
+ """
84
+ The aggregation function used to compute the value of the pricing metric.
85
+ """
86
+
25
87
  aggregation_type: typing.Literal["sum"] = "sum"
26
88
  value_field: str
27
89
 
@@ -35,4 +97,10 @@ class PricingMetricAggregation_Sum(UniversalBaseModel):
35
97
  extra = pydantic.Extra.allow
36
98
 
37
99
 
38
- PricingMetricAggregation = typing.Union[PricingMetricAggregation_Count, PricingMetricAggregation_Sum]
100
+ PricingMetricAggregation = typing.Union[
101
+ PricingMetricAggregation_Count,
102
+ PricingMetricAggregation_Custom,
103
+ PricingMetricAggregation_Last,
104
+ PricingMetricAggregation_Max,
105
+ PricingMetricAggregation_Sum,
106
+ ]
lark/rate_cards/client.py CHANGED
@@ -84,8 +84,10 @@ class RateCardsClient:
84
84
  The description of the rate card displayed to the customer.
85
85
 
86
86
  fixed_rates : typing.Optional[typing.Sequence[CreateFixedRateRequest]]
87
+ The fixed rates of the rate card. These are billed at the start of each billing cycle.
87
88
 
88
89
  usage_based_rates : typing.Optional[typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]]
90
+ The usage based rates of the rate card. These are billed at the end of each billing cycle.
89
91
 
90
92
  metadata : typing.Optional[typing.Dict[str, str]]
91
93
 
@@ -99,14 +101,40 @@ class RateCardsClient:
99
101
 
100
102
  Examples
101
103
  --------
102
- from lark import Lark
104
+ from lark import Amount, CreateFixedRateRequest, Lark, Price_Flat
105
+ from lark.rate_cards import CreateRateCardRequestUsageBasedRatesItem_Simple
103
106
 
104
107
  client = Lark(
105
108
  api_key="YOUR_API_KEY",
106
109
  )
107
110
  client.rate_cards.create_rate_card(
108
111
  name="Pro Plan",
112
+ description="For production applications with moderate usage.",
109
113
  billing_interval="monthly",
114
+ fixed_rates=[
115
+ CreateFixedRateRequest(
116
+ name="Base Rate",
117
+ price=Price_Flat(
118
+ amount=Amount(
119
+ value="2500",
120
+ currency_code="usd",
121
+ ),
122
+ ),
123
+ )
124
+ ],
125
+ usage_based_rates=[
126
+ CreateRateCardRequestUsageBasedRatesItem_Simple(
127
+ name="name",
128
+ price=Price_Flat(
129
+ amount=Amount(
130
+ value="2500",
131
+ currency_code="usd",
132
+ ),
133
+ ),
134
+ pricing_metric_id="pricing_metric_id",
135
+ )
136
+ ],
137
+ metadata={"key": "value"},
110
138
  )
111
139
  """
112
140
  _response = self._raw_client.create_rate_card(
@@ -228,8 +256,10 @@ class AsyncRateCardsClient:
228
256
  The description of the rate card displayed to the customer.
229
257
 
230
258
  fixed_rates : typing.Optional[typing.Sequence[CreateFixedRateRequest]]
259
+ The fixed rates of the rate card. These are billed at the start of each billing cycle.
231
260
 
232
261
  usage_based_rates : typing.Optional[typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]]
262
+ The usage based rates of the rate card. These are billed at the end of each billing cycle.
233
263
 
234
264
  metadata : typing.Optional[typing.Dict[str, str]]
235
265
 
@@ -245,7 +275,8 @@ class AsyncRateCardsClient:
245
275
  --------
246
276
  import asyncio
247
277
 
248
- from lark import AsyncLark
278
+ from lark import Amount, AsyncLark, CreateFixedRateRequest, Price_Flat
279
+ from lark.rate_cards import CreateRateCardRequestUsageBasedRatesItem_Simple
249
280
 
250
281
  client = AsyncLark(
251
282
  api_key="YOUR_API_KEY",
@@ -255,7 +286,32 @@ class AsyncRateCardsClient:
255
286
  async def main() -> None:
256
287
  await client.rate_cards.create_rate_card(
257
288
  name="Pro Plan",
289
+ description="For production applications with moderate usage.",
258
290
  billing_interval="monthly",
291
+ fixed_rates=[
292
+ CreateFixedRateRequest(
293
+ name="Base Rate",
294
+ price=Price_Flat(
295
+ amount=Amount(
296
+ value="2500",
297
+ currency_code="usd",
298
+ ),
299
+ ),
300
+ )
301
+ ],
302
+ usage_based_rates=[
303
+ CreateRateCardRequestUsageBasedRatesItem_Simple(
304
+ name="name",
305
+ price=Price_Flat(
306
+ amount=Amount(
307
+ value="2500",
308
+ currency_code="usd",
309
+ ),
310
+ ),
311
+ pricing_metric_id="pricing_metric_id",
312
+ )
313
+ ],
314
+ metadata={"key": "value"},
259
315
  )
260
316
 
261
317
 
@@ -100,8 +100,10 @@ class RawRateCardsClient:
100
100
  The description of the rate card displayed to the customer.
101
101
 
102
102
  fixed_rates : typing.Optional[typing.Sequence[CreateFixedRateRequest]]
103
+ The fixed rates of the rate card. These are billed at the start of each billing cycle.
103
104
 
104
105
  usage_based_rates : typing.Optional[typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]]
106
+ The usage based rates of the rate card. These are billed at the end of each billing cycle.
105
107
 
106
108
  metadata : typing.Optional[typing.Dict[str, str]]
107
109
 
@@ -288,8 +290,10 @@ class AsyncRawRateCardsClient:
288
290
  The description of the rate card displayed to the customer.
289
291
 
290
292
  fixed_rates : typing.Optional[typing.Sequence[CreateFixedRateRequest]]
293
+ The fixed rates of the rate card. These are billed at the start of each billing cycle.
291
294
 
292
295
  usage_based_rates : typing.Optional[typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]]
296
+ The usage based rates of the rate card. These are billed at the end of each billing cycle.
293
297
 
294
298
  metadata : typing.Optional[typing.Dict[str, str]]
295
299
 
lark/subjects/client.py CHANGED
@@ -104,7 +104,12 @@ class SubjectsClient:
104
104
  client = Lark(
105
105
  api_key="YOUR_API_KEY",
106
106
  )
107
- client.subjects.create_subject()
107
+ client.subjects.create_subject(
108
+ external_id="user_1234567890",
109
+ name="John Doe",
110
+ email="john.doe@example.com",
111
+ metadata={"key": "value"},
112
+ )
108
113
  """
109
114
  _response = self._raw_client.create_subject(
110
115
  external_id=external_id, name=name, email=email, metadata=metadata, request_options=request_options
@@ -323,7 +328,12 @@ class AsyncSubjectsClient:
323
328
 
324
329
 
325
330
  async def main() -> None:
326
- await client.subjects.create_subject()
331
+ await client.subjects.create_subject(
332
+ external_id="user_1234567890",
333
+ name="John Doe",
334
+ email="john.doe@example.com",
335
+ metadata={"key": "value"},
336
+ )
327
337
 
328
338
 
329
339
  asyncio.run(main())