lark-billing 0.0.8 → 0.0.9

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.
Files changed (55) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/Client.js +2 -2
  3. package/dist/cjs/api/resources/checkout/client/Client.d.ts +2 -2
  4. package/dist/cjs/api/resources/checkout/client/Client.js +2 -2
  5. package/dist/cjs/api/resources/checkout/client/requests/CreateSubscriptionCheckoutSessionRequest.d.ts +4 -2
  6. package/dist/cjs/api/resources/customerPortal/client/Client.d.ts +1 -1
  7. package/dist/cjs/api/resources/customerPortal/client/Client.js +1 -1
  8. package/dist/cjs/api/resources/customerPortal/client/requests/CreateCustomerPortalSessionRequest.d.ts +2 -1
  9. package/dist/cjs/api/resources/rateCards/client/Client.d.ts +1 -1
  10. package/dist/cjs/api/resources/rateCards/client/Client.js +1 -1
  11. package/dist/cjs/api/resources/rateCards/client/requests/CreateRateCardRequest.d.ts +9 -3
  12. package/dist/cjs/api/resources/subscriptions/client/Client.d.ts +1 -1
  13. package/dist/cjs/api/resources/subscriptions/client/Client.js +1 -1
  14. package/dist/cjs/api/resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.d.ts +2 -1
  15. package/dist/cjs/api/resources/usageEvents/client/requests/CreateUsageEventRequest.d.ts +11 -1
  16. package/dist/cjs/api/types/Amount.d.ts +1 -0
  17. package/dist/cjs/api/types/CreateCustomerPortalSessionResponse.d.ts +2 -0
  18. package/dist/cjs/api/types/CreateFixedRateRequest.d.ts +3 -1
  19. package/dist/cjs/api/types/CreateSimpleUsageBasedRateRequest.d.ts +4 -1
  20. package/dist/cjs/api/types/CreateSubscriptionCheckoutSessionResponse.d.ts +3 -0
  21. package/dist/cjs/api/types/FixedRateInterface.d.ts +1 -1
  22. package/dist/cjs/api/types/InvoiceResource.d.ts +10 -2
  23. package/dist/cjs/api/types/RateCardResource.d.ts +8 -1
  24. package/dist/cjs/api/types/SimpleUsageBasedRateInterface.d.ts +1 -1
  25. package/dist/cjs/api/types/SubscriptionResource.d.ts +11 -0
  26. package/dist/cjs/version.d.ts +1 -1
  27. package/dist/cjs/version.js +1 -1
  28. package/dist/esm/Client.mjs +2 -2
  29. package/dist/esm/api/resources/checkout/client/Client.d.mts +2 -2
  30. package/dist/esm/api/resources/checkout/client/Client.mjs +2 -2
  31. package/dist/esm/api/resources/checkout/client/requests/CreateSubscriptionCheckoutSessionRequest.d.mts +4 -2
  32. package/dist/esm/api/resources/customerPortal/client/Client.d.mts +1 -1
  33. package/dist/esm/api/resources/customerPortal/client/Client.mjs +1 -1
  34. package/dist/esm/api/resources/customerPortal/client/requests/CreateCustomerPortalSessionRequest.d.mts +2 -1
  35. package/dist/esm/api/resources/rateCards/client/Client.d.mts +1 -1
  36. package/dist/esm/api/resources/rateCards/client/Client.mjs +1 -1
  37. package/dist/esm/api/resources/rateCards/client/requests/CreateRateCardRequest.d.mts +9 -3
  38. package/dist/esm/api/resources/subscriptions/client/Client.d.mts +1 -1
  39. package/dist/esm/api/resources/subscriptions/client/Client.mjs +1 -1
  40. package/dist/esm/api/resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.d.mts +2 -1
  41. package/dist/esm/api/resources/usageEvents/client/requests/CreateUsageEventRequest.d.mts +11 -1
  42. package/dist/esm/api/types/Amount.d.mts +1 -0
  43. package/dist/esm/api/types/CreateCustomerPortalSessionResponse.d.mts +2 -0
  44. package/dist/esm/api/types/CreateFixedRateRequest.d.mts +3 -1
  45. package/dist/esm/api/types/CreateSimpleUsageBasedRateRequest.d.mts +4 -1
  46. package/dist/esm/api/types/CreateSubscriptionCheckoutSessionResponse.d.mts +3 -0
  47. package/dist/esm/api/types/FixedRateInterface.d.mts +1 -1
  48. package/dist/esm/api/types/InvoiceResource.d.mts +10 -2
  49. package/dist/esm/api/types/RateCardResource.d.mts +8 -1
  50. package/dist/esm/api/types/SimpleUsageBasedRateInterface.d.mts +1 -1
  51. package/dist/esm/api/types/SubscriptionResource.d.mts +11 -0
  52. package/dist/esm/version.d.mts +1 -1
  53. package/dist/esm/version.mjs +1 -1
  54. package/package.json +1 -1
  55. package/reference.md +5 -5
package/README.md CHANGED
@@ -24,8 +24,8 @@ import { LarkClient } from "lark-billing";
24
24
 
25
25
  const client = new LarkClient({ apiKey: "YOUR_API_KEY" });
26
26
  await client.checkout.createSubscriptionCheckoutSession({
27
- subject_id: "subject_id",
28
- rate_card_id: "rate_card_id",
27
+ subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
28
+ rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
29
29
  success_callback_url: "https://example.com/callback",
30
30
  });
31
31
  ```
@@ -53,8 +53,8 @@ class LarkClient {
53
53
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
54
54
  "X-Fern-Language": "JavaScript",
55
55
  "X-Fern-SDK-Name": "lark-billing",
56
- "X-Fern-SDK-Version": "0.0.8",
57
- "User-Agent": "lark-billing/0.0.8",
56
+ "X-Fern-SDK-Version": "0.0.9",
57
+ "User-Agent": "lark-billing/0.0.9",
58
58
  "X-Fern-Runtime": core.RUNTIME.type,
59
59
  "X-Fern-Runtime-Version": core.RUNTIME.version,
60
60
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -37,8 +37,8 @@ export declare class Checkout {
37
37
  *
38
38
  * @example
39
39
  * await client.checkout.createSubscriptionCheckoutSession({
40
- * subject_id: "subject_id",
41
- * rate_card_id: "rate_card_id",
40
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
41
+ * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
42
42
  * success_callback_url: "https://example.com/callback"
43
43
  * })
44
44
  */
@@ -63,8 +63,8 @@ class Checkout {
63
63
  *
64
64
  * @example
65
65
  * await client.checkout.createSubscriptionCheckoutSession({
66
- * subject_id: "subject_id",
67
- * rate_card_id: "rate_card_id",
66
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
67
+ * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
68
68
  * success_callback_url: "https://example.com/callback"
69
69
  * })
70
70
  */
@@ -4,13 +4,15 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * subject_id: "subject_id",
8
- * rate_card_id: "rate_card_id",
7
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
8
+ * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
9
9
  * success_callback_url: "https://example.com/callback"
10
10
  * }
11
11
  */
12
12
  export interface CreateSubscriptionCheckoutSessionRequest {
13
+ /** The ID of the subject to create the checkout for. */
13
14
  subject_id: string;
15
+ /** The ID of the rate card to subscribe to. */
14
16
  rate_card_id: string;
15
17
  /** The URL to redirect to after the checkout is successful. */
16
18
  success_callback_url: string;
@@ -37,7 +37,7 @@ export declare class CustomerPortal {
37
37
  *
38
38
  * @example
39
39
  * await client.customerPortal.createCustomerPortalSession({
40
- * subject_id: "subject_id"
40
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE"
41
41
  * })
42
42
  */
43
43
  createCustomerPortalSession(request: Lark.CreateCustomerPortalSessionRequest, requestOptions?: CustomerPortal.RequestOptions): core.HttpResponsePromise<Lark.CreateCustomerPortalSessionResponse>;
@@ -63,7 +63,7 @@ class CustomerPortal {
63
63
  *
64
64
  * @example
65
65
  * await client.customerPortal.createCustomerPortalSession({
66
- * subject_id: "subject_id"
66
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE"
67
67
  * })
68
68
  */
69
69
  createCustomerPortalSession(request, requestOptions) {
@@ -4,9 +4,10 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * subject_id: "subject_id"
7
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE"
8
8
  * }
9
9
  */
10
10
  export interface CreateCustomerPortalSessionRequest {
11
+ /** The ID of the subject to create the customer portal session for. */
11
12
  subject_id: string;
12
13
  }
@@ -50,7 +50,7 @@ export declare class RateCards {
50
50
  *
51
51
  * @example
52
52
  * await client.rateCards.createRateCard({
53
- * name: "name",
53
+ * name: "Pro Plan",
54
54
  * billing_interval: "monthly"
55
55
  * })
56
56
  */
@@ -127,7 +127,7 @@ class RateCards {
127
127
  *
128
128
  * @example
129
129
  * await client.rateCards.createRateCard({
130
- * name: "name",
130
+ * name: "Pro Plan",
131
131
  * billing_interval: "monthly"
132
132
  * })
133
133
  */
@@ -5,19 +5,25 @@ import * as Lark from "../../../../index.js";
5
5
  /**
6
6
  * @example
7
7
  * {
8
- * name: "name",
8
+ * name: "Pro Plan",
9
9
  * billing_interval: "monthly"
10
10
  * }
11
11
  */
12
12
  export interface CreateRateCardRequest {
13
+ /** The name of the rate card displayed to the customer. */
13
14
  name: string;
15
+ /** The description of the rate card displayed to the customer. */
14
16
  description?: string;
15
- usage_based_rates?: Lark.CreateRateCardRequestUsageBasedRatesItem[];
16
- fixed_rates?: Lark.CreateFixedRateRequest[];
17
+ /** How often the customer will be billed for this rate card. */
17
18
  billing_interval: CreateRateCardRequest.BillingInterval;
19
+ fixed_rates?: Lark.CreateFixedRateRequest[];
20
+ usage_based_rates?: Lark.CreateRateCardRequestUsageBasedRatesItem[];
18
21
  metadata?: Record<string, string>;
19
22
  }
20
23
  export declare namespace CreateRateCardRequest {
24
+ /**
25
+ * How often the customer will be billed for this rate card.
26
+ */
21
27
  type BillingInterval = "monthly" | "yearly";
22
28
  const BillingInterval: {
23
29
  readonly Monthly: "monthly";
@@ -90,7 +90,7 @@ export declare class Subscriptions {
90
90
  *
91
91
  * @example
92
92
  * await client.subscriptions.changeSubscriptionRateCard("subscription_id", {
93
- * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB"
93
+ * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g"
94
94
  * })
95
95
  */
96
96
  changeSubscriptionRateCard(subscriptionId: string, request: Lark.ChangeSubscriptionRateCardRequest, requestOptions?: Subscriptions.RequestOptions): core.HttpResponsePromise<Lark.SubscriptionResource>;
@@ -317,7 +317,7 @@ class Subscriptions {
317
317
  *
318
318
  * @example
319
319
  * await client.subscriptions.changeSubscriptionRateCard("subscription_id", {
320
- * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB"
320
+ * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g"
321
321
  * })
322
322
  */
323
323
  changeSubscriptionRateCard(subscriptionId, request, requestOptions) {
@@ -4,9 +4,10 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB"
7
+ * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g"
8
8
  * }
9
9
  */
10
10
  export interface ChangeSubscriptionRateCardRequest {
11
+ /** The ID of the rate card to change the subscription to. */
11
12
  rate_card_id: string;
12
13
  }
@@ -13,9 +13,19 @@
13
13
  * }
14
14
  */
15
15
  export interface CreateUsageEventRequest {
16
+ /** The idempotency key for the usage event. This ensures that the same event is not processed multiple times. */
16
17
  idempotency_key: string;
18
+ /** The name of the event. This is used by pricing metrics to aggregate usage events. */
17
19
  event_name: string;
20
+ /** The ID of the subject that the usage event is for. */
18
21
  subject_id: string;
22
+ /** The timestamp of the usage event. It is highly recommended to provide a timestamp. If not provided, the current timestamp will be used. */
19
23
  timestamp?: string;
20
- data: Record<string, unknown>;
24
+ /** The data of the usage event. This should contain any data that is needed to aggregate the usage event. */
25
+ data: Record<string, CreateUsageEventRequest.Data.Value>;
26
+ }
27
+ export declare namespace CreateUsageEventRequest {
28
+ namespace Data {
29
+ type Value = string | number | number | boolean;
30
+ }
21
31
  }
@@ -4,5 +4,6 @@
4
4
  export interface Amount {
5
5
  /** The value of the amount in the smallest unit of the currency. */
6
6
  value: string;
7
+ /** The currency code of the amount. */
7
8
  currency_code: string;
8
9
  }
@@ -2,6 +2,8 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  export interface CreateCustomerPortalSessionResponse {
5
+ /** The ID of the subject for the customer portal session. */
5
6
  subject_id: string;
7
+ /** The URL to redirect to the customer portal session. */
6
8
  url: string;
7
9
  }
@@ -3,7 +3,9 @@
3
3
  */
4
4
  import * as Lark from "../index.js";
5
5
  export interface CreateFixedRateRequest {
6
- name?: string;
6
+ /** The name of the rate displayed to the customer. */
7
+ name: string;
8
+ /** The description of the rate displayed to the customer. */
7
9
  description?: string;
8
10
  price: Lark.Price;
9
11
  }
@@ -3,9 +3,12 @@
3
3
  */
4
4
  import * as Lark from "../index.js";
5
5
  export interface CreateSimpleUsageBasedRateRequest {
6
- name?: string;
6
+ /** The name of the rate displayed to the customer. */
7
+ name: string;
8
+ /** The description of the rate displayed to the customer. */
7
9
  description?: string;
8
10
  price: Lark.Price;
11
+ /** The number of units included in the rate before the price is applied. */
9
12
  included_units?: number;
10
13
  /** The ID of the pricing metric to use for this rate. */
11
14
  pricing_metric_id: string;
@@ -3,7 +3,10 @@
3
3
  */
4
4
  import * as Lark from "../index.js";
5
5
  export interface CreateSubscriptionCheckoutSessionResponse {
6
+ /** The ID of the checkout session. */
6
7
  id: string;
8
+ /** The amount of the checkout session. */
7
9
  amount: Lark.Amount;
10
+ /** The URL to redirect to the checkout session. */
8
11
  url: string;
9
12
  }
@@ -5,6 +5,6 @@ import * as Lark from "../index.js";
5
5
  export interface FixedRateInterface {
6
6
  id: string;
7
7
  name: string;
8
- description: string;
8
+ description?: string;
9
9
  price: Lark.Price;
10
10
  }
@@ -3,17 +3,25 @@
3
3
  */
4
4
  import * as Lark from "../index.js";
5
5
  export interface InvoiceResource {
6
+ /** The ID of the invoice. */
6
7
  id: string;
7
- merchant_id: string;
8
- bill_id?: string;
8
+ /** The total amount of the invoice. */
9
9
  total_amount: Lark.Amount;
10
+ /** The ID of the subject for the invoice. */
10
11
  subject_id: string;
12
+ /** The date and time the invoice was created. */
11
13
  created_at: string;
14
+ /** The status of the invoice. */
12
15
  status: InvoiceResource.Status;
16
+ /** The URL of the hosted invoice. */
13
17
  hosted_url?: string;
18
+ /** The line items of the invoice. */
14
19
  line_items: Lark.InvoiceLineItemResource[];
15
20
  }
16
21
  export declare namespace InvoiceResource {
22
+ /**
23
+ * The status of the invoice.
24
+ */
17
25
  type Status = "draft" | "open" | "paid" | "uncollectible" | "void";
18
26
  const Status: {
19
27
  readonly Draft: "draft";
@@ -3,13 +3,20 @@
3
3
  */
4
4
  import * as Lark from "../index.js";
5
5
  export interface RateCardResource {
6
+ /** The ID of the rate card. */
6
7
  id: string;
8
+ /** The name of the rate card. */
7
9
  name: string;
8
- description: string;
10
+ /** The description of the rate card. */
11
+ description?: string;
12
+ /** The usage based rates of the rate card. */
9
13
  usage_based_rates: Lark.RateCardResourceUsageBasedRatesItem[];
14
+ /** The fixed rates of the rate card. */
10
15
  fixed_rates: Lark.FixedRateInterface[];
11
16
  billing_interval: RateCardResource.BillingInterval;
17
+ /** The date and time the rate card was created. */
12
18
  created_at: string;
19
+ /** The date and time the rate card was last updated. */
13
20
  updated_at: string;
14
21
  metadata: Record<string, string>;
15
22
  }
@@ -5,7 +5,7 @@ import * as Lark from "../index.js";
5
5
  export interface SimpleUsageBasedRateInterface {
6
6
  id: string;
7
7
  name: string;
8
- description: string;
8
+ description?: string;
9
9
  price: Lark.Price;
10
10
  included_units: number;
11
11
  pricing_metric_id: string;
@@ -3,17 +3,28 @@
3
3
  */
4
4
  import * as Lark from "../index.js";
5
5
  export interface SubscriptionResource {
6
+ /** The ID of the subscription. */
6
7
  id: string;
8
+ /** The ID of the subject that the subscription is for. */
7
9
  subject_id: string;
10
+ /** The ID of the rate card of the subscription. */
8
11
  rate_card_id: string;
12
+ /** The date and time the subscription became effective. */
9
13
  effective_at: string;
14
+ /** The date and time the next cycle of the subscription will start. */
10
15
  cycles_next_at?: string;
16
+ /** The current period of the subscription if it is active. */
11
17
  current_period?: Lark.PeriodResource;
12
18
  metadata: Record<string, string>;
19
+ /** The status of the subscription. */
13
20
  status: SubscriptionResource.Status;
21
+ /** Whether the subscription will be cancelled at the end of the current cycle. */
14
22
  cancels_at_end_of_cycle: boolean;
15
23
  }
16
24
  export declare namespace SubscriptionResource {
25
+ /**
26
+ * The status of the subscription.
27
+ */
17
28
  type Status = "active" | "cancelled" | "paused";
18
29
  const Status: {
19
30
  readonly Active: "active";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.8";
1
+ export declare const SDK_VERSION = "0.0.9";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.0.8";
4
+ exports.SDK_VERSION = "0.0.9";
@@ -17,8 +17,8 @@ export class LarkClient {
17
17
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
18
18
  "X-Fern-Language": "JavaScript",
19
19
  "X-Fern-SDK-Name": "lark-billing",
20
- "X-Fern-SDK-Version": "0.0.8",
21
- "User-Agent": "lark-billing/0.0.8",
20
+ "X-Fern-SDK-Version": "0.0.9",
21
+ "User-Agent": "lark-billing/0.0.9",
22
22
  "X-Fern-Runtime": core.RUNTIME.type,
23
23
  "X-Fern-Runtime-Version": core.RUNTIME.version,
24
24
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -37,8 +37,8 @@ export declare class Checkout {
37
37
  *
38
38
  * @example
39
39
  * await client.checkout.createSubscriptionCheckoutSession({
40
- * subject_id: "subject_id",
41
- * rate_card_id: "rate_card_id",
40
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
41
+ * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
42
42
  * success_callback_url: "https://example.com/callback"
43
43
  * })
44
44
  */
@@ -27,8 +27,8 @@ export class Checkout {
27
27
  *
28
28
  * @example
29
29
  * await client.checkout.createSubscriptionCheckoutSession({
30
- * subject_id: "subject_id",
31
- * rate_card_id: "rate_card_id",
30
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
31
+ * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
32
32
  * success_callback_url: "https://example.com/callback"
33
33
  * })
34
34
  */
@@ -4,13 +4,15 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * subject_id: "subject_id",
8
- * rate_card_id: "rate_card_id",
7
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
8
+ * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
9
9
  * success_callback_url: "https://example.com/callback"
10
10
  * }
11
11
  */
12
12
  export interface CreateSubscriptionCheckoutSessionRequest {
13
+ /** The ID of the subject to create the checkout for. */
13
14
  subject_id: string;
15
+ /** The ID of the rate card to subscribe to. */
14
16
  rate_card_id: string;
15
17
  /** The URL to redirect to after the checkout is successful. */
16
18
  success_callback_url: string;
@@ -37,7 +37,7 @@ export declare class CustomerPortal {
37
37
  *
38
38
  * @example
39
39
  * await client.customerPortal.createCustomerPortalSession({
40
- * subject_id: "subject_id"
40
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE"
41
41
  * })
42
42
  */
43
43
  createCustomerPortalSession(request: Lark.CreateCustomerPortalSessionRequest, requestOptions?: CustomerPortal.RequestOptions): core.HttpResponsePromise<Lark.CreateCustomerPortalSessionResponse>;
@@ -27,7 +27,7 @@ export class CustomerPortal {
27
27
  *
28
28
  * @example
29
29
  * await client.customerPortal.createCustomerPortalSession({
30
- * subject_id: "subject_id"
30
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE"
31
31
  * })
32
32
  */
33
33
  createCustomerPortalSession(request, requestOptions) {
@@ -4,9 +4,10 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * subject_id: "subject_id"
7
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE"
8
8
  * }
9
9
  */
10
10
  export interface CreateCustomerPortalSessionRequest {
11
+ /** The ID of the subject to create the customer portal session for. */
11
12
  subject_id: string;
12
13
  }
@@ -50,7 +50,7 @@ export declare class RateCards {
50
50
  *
51
51
  * @example
52
52
  * await client.rateCards.createRateCard({
53
- * name: "name",
53
+ * name: "Pro Plan",
54
54
  * billing_interval: "monthly"
55
55
  * })
56
56
  */
@@ -91,7 +91,7 @@ export class RateCards {
91
91
  *
92
92
  * @example
93
93
  * await client.rateCards.createRateCard({
94
- * name: "name",
94
+ * name: "Pro Plan",
95
95
  * billing_interval: "monthly"
96
96
  * })
97
97
  */
@@ -5,19 +5,25 @@ import * as Lark from "../../../../index.mjs";
5
5
  /**
6
6
  * @example
7
7
  * {
8
- * name: "name",
8
+ * name: "Pro Plan",
9
9
  * billing_interval: "monthly"
10
10
  * }
11
11
  */
12
12
  export interface CreateRateCardRequest {
13
+ /** The name of the rate card displayed to the customer. */
13
14
  name: string;
15
+ /** The description of the rate card displayed to the customer. */
14
16
  description?: string;
15
- usage_based_rates?: Lark.CreateRateCardRequestUsageBasedRatesItem[];
16
- fixed_rates?: Lark.CreateFixedRateRequest[];
17
+ /** How often the customer will be billed for this rate card. */
17
18
  billing_interval: CreateRateCardRequest.BillingInterval;
19
+ fixed_rates?: Lark.CreateFixedRateRequest[];
20
+ usage_based_rates?: Lark.CreateRateCardRequestUsageBasedRatesItem[];
18
21
  metadata?: Record<string, string>;
19
22
  }
20
23
  export declare namespace CreateRateCardRequest {
24
+ /**
25
+ * How often the customer will be billed for this rate card.
26
+ */
21
27
  type BillingInterval = "monthly" | "yearly";
22
28
  const BillingInterval: {
23
29
  readonly Monthly: "monthly";
@@ -90,7 +90,7 @@ export declare class Subscriptions {
90
90
  *
91
91
  * @example
92
92
  * await client.subscriptions.changeSubscriptionRateCard("subscription_id", {
93
- * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB"
93
+ * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g"
94
94
  * })
95
95
  */
96
96
  changeSubscriptionRateCard(subscriptionId: string, request: Lark.ChangeSubscriptionRateCardRequest, requestOptions?: Subscriptions.RequestOptions): core.HttpResponsePromise<Lark.SubscriptionResource>;
@@ -281,7 +281,7 @@ export class Subscriptions {
281
281
  *
282
282
  * @example
283
283
  * await client.subscriptions.changeSubscriptionRateCard("subscription_id", {
284
- * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB"
284
+ * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g"
285
285
  * })
286
286
  */
287
287
  changeSubscriptionRateCard(subscriptionId, request, requestOptions) {
@@ -4,9 +4,10 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB"
7
+ * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g"
8
8
  * }
9
9
  */
10
10
  export interface ChangeSubscriptionRateCardRequest {
11
+ /** The ID of the rate card to change the subscription to. */
11
12
  rate_card_id: string;
12
13
  }
@@ -13,9 +13,19 @@
13
13
  * }
14
14
  */
15
15
  export interface CreateUsageEventRequest {
16
+ /** The idempotency key for the usage event. This ensures that the same event is not processed multiple times. */
16
17
  idempotency_key: string;
18
+ /** The name of the event. This is used by pricing metrics to aggregate usage events. */
17
19
  event_name: string;
20
+ /** The ID of the subject that the usage event is for. */
18
21
  subject_id: string;
22
+ /** The timestamp of the usage event. It is highly recommended to provide a timestamp. If not provided, the current timestamp will be used. */
19
23
  timestamp?: string;
20
- data: Record<string, unknown>;
24
+ /** The data of the usage event. This should contain any data that is needed to aggregate the usage event. */
25
+ data: Record<string, CreateUsageEventRequest.Data.Value>;
26
+ }
27
+ export declare namespace CreateUsageEventRequest {
28
+ namespace Data {
29
+ type Value = string | number | number | boolean;
30
+ }
21
31
  }
@@ -4,5 +4,6 @@
4
4
  export interface Amount {
5
5
  /** The value of the amount in the smallest unit of the currency. */
6
6
  value: string;
7
+ /** The currency code of the amount. */
7
8
  currency_code: string;
8
9
  }
@@ -2,6 +2,8 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  export interface CreateCustomerPortalSessionResponse {
5
+ /** The ID of the subject for the customer portal session. */
5
6
  subject_id: string;
7
+ /** The URL to redirect to the customer portal session. */
6
8
  url: string;
7
9
  }
@@ -3,7 +3,9 @@
3
3
  */
4
4
  import * as Lark from "../index.mjs";
5
5
  export interface CreateFixedRateRequest {
6
- name?: string;
6
+ /** The name of the rate displayed to the customer. */
7
+ name: string;
8
+ /** The description of the rate displayed to the customer. */
7
9
  description?: string;
8
10
  price: Lark.Price;
9
11
  }
@@ -3,9 +3,12 @@
3
3
  */
4
4
  import * as Lark from "../index.mjs";
5
5
  export interface CreateSimpleUsageBasedRateRequest {
6
- name?: string;
6
+ /** The name of the rate displayed to the customer. */
7
+ name: string;
8
+ /** The description of the rate displayed to the customer. */
7
9
  description?: string;
8
10
  price: Lark.Price;
11
+ /** The number of units included in the rate before the price is applied. */
9
12
  included_units?: number;
10
13
  /** The ID of the pricing metric to use for this rate. */
11
14
  pricing_metric_id: string;
@@ -3,7 +3,10 @@
3
3
  */
4
4
  import * as Lark from "../index.mjs";
5
5
  export interface CreateSubscriptionCheckoutSessionResponse {
6
+ /** The ID of the checkout session. */
6
7
  id: string;
8
+ /** The amount of the checkout session. */
7
9
  amount: Lark.Amount;
10
+ /** The URL to redirect to the checkout session. */
8
11
  url: string;
9
12
  }
@@ -5,6 +5,6 @@ import * as Lark from "../index.mjs";
5
5
  export interface FixedRateInterface {
6
6
  id: string;
7
7
  name: string;
8
- description: string;
8
+ description?: string;
9
9
  price: Lark.Price;
10
10
  }
@@ -3,17 +3,25 @@
3
3
  */
4
4
  import * as Lark from "../index.mjs";
5
5
  export interface InvoiceResource {
6
+ /** The ID of the invoice. */
6
7
  id: string;
7
- merchant_id: string;
8
- bill_id?: string;
8
+ /** The total amount of the invoice. */
9
9
  total_amount: Lark.Amount;
10
+ /** The ID of the subject for the invoice. */
10
11
  subject_id: string;
12
+ /** The date and time the invoice was created. */
11
13
  created_at: string;
14
+ /** The status of the invoice. */
12
15
  status: InvoiceResource.Status;
16
+ /** The URL of the hosted invoice. */
13
17
  hosted_url?: string;
18
+ /** The line items of the invoice. */
14
19
  line_items: Lark.InvoiceLineItemResource[];
15
20
  }
16
21
  export declare namespace InvoiceResource {
22
+ /**
23
+ * The status of the invoice.
24
+ */
17
25
  type Status = "draft" | "open" | "paid" | "uncollectible" | "void";
18
26
  const Status: {
19
27
  readonly Draft: "draft";
@@ -3,13 +3,20 @@
3
3
  */
4
4
  import * as Lark from "../index.mjs";
5
5
  export interface RateCardResource {
6
+ /** The ID of the rate card. */
6
7
  id: string;
8
+ /** The name of the rate card. */
7
9
  name: string;
8
- description: string;
10
+ /** The description of the rate card. */
11
+ description?: string;
12
+ /** The usage based rates of the rate card. */
9
13
  usage_based_rates: Lark.RateCardResourceUsageBasedRatesItem[];
14
+ /** The fixed rates of the rate card. */
10
15
  fixed_rates: Lark.FixedRateInterface[];
11
16
  billing_interval: RateCardResource.BillingInterval;
17
+ /** The date and time the rate card was created. */
12
18
  created_at: string;
19
+ /** The date and time the rate card was last updated. */
13
20
  updated_at: string;
14
21
  metadata: Record<string, string>;
15
22
  }
@@ -5,7 +5,7 @@ import * as Lark from "../index.mjs";
5
5
  export interface SimpleUsageBasedRateInterface {
6
6
  id: string;
7
7
  name: string;
8
- description: string;
8
+ description?: string;
9
9
  price: Lark.Price;
10
10
  included_units: number;
11
11
  pricing_metric_id: string;
@@ -3,17 +3,28 @@
3
3
  */
4
4
  import * as Lark from "../index.mjs";
5
5
  export interface SubscriptionResource {
6
+ /** The ID of the subscription. */
6
7
  id: string;
8
+ /** The ID of the subject that the subscription is for. */
7
9
  subject_id: string;
10
+ /** The ID of the rate card of the subscription. */
8
11
  rate_card_id: string;
12
+ /** The date and time the subscription became effective. */
9
13
  effective_at: string;
14
+ /** The date and time the next cycle of the subscription will start. */
10
15
  cycles_next_at?: string;
16
+ /** The current period of the subscription if it is active. */
11
17
  current_period?: Lark.PeriodResource;
12
18
  metadata: Record<string, string>;
19
+ /** The status of the subscription. */
13
20
  status: SubscriptionResource.Status;
21
+ /** Whether the subscription will be cancelled at the end of the current cycle. */
14
22
  cancels_at_end_of_cycle: boolean;
15
23
  }
16
24
  export declare namespace SubscriptionResource {
25
+ /**
26
+ * The status of the subscription.
27
+ */
17
28
  type Status = "active" | "cancelled" | "paused";
18
29
  const Status: {
19
30
  readonly Active: "active";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.8";
1
+ export declare const SDK_VERSION = "0.0.9";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.0.8";
1
+ export const SDK_VERSION = "0.0.9";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lark-billing",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "private": false,
5
5
  "repository": "github:fern-demo/lark-ts-sdk",
6
6
  "type": "commonjs",
package/reference.md CHANGED
@@ -16,8 +16,8 @@
16
16
 
17
17
  ```typescript
18
18
  await client.checkout.createSubscriptionCheckoutSession({
19
- subject_id: "subject_id",
20
- rate_card_id: "rate_card_id",
19
+ subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
20
+ rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
21
21
  success_callback_url: "https://example.com/callback",
22
22
  });
23
23
  ```
@@ -70,7 +70,7 @@ await client.checkout.createSubscriptionCheckoutSession({
70
70
 
71
71
  ```typescript
72
72
  await client.customerPortal.createCustomerPortalSession({
73
- subject_id: "subject_id",
73
+ subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
74
74
  });
75
75
  ```
76
76
 
@@ -172,7 +172,7 @@ await client.rateCards.listRateCards({
172
172
 
173
173
  ```typescript
174
174
  await client.rateCards.createRateCard({
175
- name: "name",
175
+ name: "Pro Plan",
176
176
  billing_interval: "monthly",
177
177
  });
178
178
  ```
@@ -593,7 +593,7 @@ await client.subscriptions.cancelSubscription("subscription_id");
593
593
 
594
594
  ```typescript
595
595
  await client.subscriptions.changeSubscriptionRateCard("subscription_id", {
596
- rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
596
+ rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g",
597
597
  });
598
598
  ```
599
599