lark-billing 0.1.1 → 0.1.3

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 (57) hide show
  1. package/README.md +4 -1
  2. package/dist/cjs/Client.js +2 -2
  3. package/dist/cjs/api/resources/checkout/client/Client.d.ts +4 -1
  4. package/dist/cjs/api/resources/checkout/client/Client.js +4 -1
  5. package/dist/cjs/api/resources/checkout/client/requests/CreateSubscriptionCheckoutSessionRequest.d.ts +7 -5
  6. package/dist/cjs/api/resources/subscriptions/client/Client.d.ts +6 -2
  7. package/dist/cjs/api/resources/subscriptions/client/Client.js +9 -2
  8. package/dist/cjs/api/resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.d.ts +20 -1
  9. package/dist/cjs/api/resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.js +8 -0
  10. package/dist/cjs/api/resources/usageEvents/client/Client.d.ts +2 -2
  11. package/dist/cjs/api/resources/usageEvents/client/Client.js +2 -2
  12. package/dist/cjs/api/resources/usageEvents/client/requests/CreateUsageEventRequest.d.ts +2 -2
  13. package/dist/cjs/api/types/ChangeSubscriptionRateCardResponse.d.ts +7 -0
  14. package/dist/cjs/api/types/ChangeSubscriptionRateCardResponse.js +5 -0
  15. package/dist/cjs/api/types/CheckoutAction.d.ts +7 -0
  16. package/dist/cjs/api/types/CheckoutAction.js +5 -0
  17. package/dist/cjs/api/types/CheckoutCallback.d.ts +9 -0
  18. package/dist/cjs/api/types/CheckoutCallback.js +5 -0
  19. package/dist/cjs/api/types/RequiresActionResponse.d.ts +7 -0
  20. package/dist/cjs/api/types/RequiresActionResponse.js +5 -0
  21. package/dist/cjs/api/types/Result.d.ts +13 -0
  22. package/dist/cjs/api/types/Result.js +5 -0
  23. package/dist/cjs/api/types/SuccessResponse.d.ts +7 -0
  24. package/dist/cjs/api/types/SuccessResponse.js +5 -0
  25. package/dist/cjs/api/types/index.d.ts +6 -0
  26. package/dist/cjs/api/types/index.js +6 -0
  27. package/dist/cjs/version.d.ts +1 -1
  28. package/dist/cjs/version.js +1 -1
  29. package/dist/esm/Client.mjs +2 -2
  30. package/dist/esm/api/resources/checkout/client/Client.d.mts +4 -1
  31. package/dist/esm/api/resources/checkout/client/Client.mjs +4 -1
  32. package/dist/esm/api/resources/checkout/client/requests/CreateSubscriptionCheckoutSessionRequest.d.mts +7 -5
  33. package/dist/esm/api/resources/subscriptions/client/Client.d.mts +6 -2
  34. package/dist/esm/api/resources/subscriptions/client/Client.mjs +9 -2
  35. package/dist/esm/api/resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.d.mts +20 -1
  36. package/dist/esm/api/resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.mjs +7 -1
  37. package/dist/esm/api/resources/usageEvents/client/Client.d.mts +2 -2
  38. package/dist/esm/api/resources/usageEvents/client/Client.mjs +2 -2
  39. package/dist/esm/api/resources/usageEvents/client/requests/CreateUsageEventRequest.d.mts +2 -2
  40. package/dist/esm/api/types/ChangeSubscriptionRateCardResponse.d.mts +7 -0
  41. package/dist/esm/api/types/ChangeSubscriptionRateCardResponse.mjs +4 -0
  42. package/dist/esm/api/types/CheckoutAction.d.mts +7 -0
  43. package/dist/esm/api/types/CheckoutAction.mjs +4 -0
  44. package/dist/esm/api/types/CheckoutCallback.d.mts +9 -0
  45. package/dist/esm/api/types/CheckoutCallback.mjs +4 -0
  46. package/dist/esm/api/types/RequiresActionResponse.d.mts +7 -0
  47. package/dist/esm/api/types/RequiresActionResponse.mjs +4 -0
  48. package/dist/esm/api/types/Result.d.mts +13 -0
  49. package/dist/esm/api/types/Result.mjs +4 -0
  50. package/dist/esm/api/types/SuccessResponse.d.mts +7 -0
  51. package/dist/esm/api/types/SuccessResponse.mjs +4 -0
  52. package/dist/esm/api/types/index.d.mts +6 -0
  53. package/dist/esm/api/types/index.mjs +6 -0
  54. package/dist/esm/version.d.mts +1 -1
  55. package/dist/esm/version.mjs +1 -1
  56. package/package.json +1 -1
  57. package/reference.md +11 -4
package/README.md CHANGED
@@ -26,7 +26,10 @@ const client = new LarkClient({ apiKey: "YOUR_API_KEY" });
26
26
  await client.checkout.createSubscriptionCheckoutSession({
27
27
  subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
28
28
  rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
29
- success_callback_url: "https://example.com/callback",
29
+ checkout_callback_urls: {
30
+ cancelled_url: "https://example.com/callback",
31
+ success_url: "https://example.com/callback",
32
+ },
30
33
  });
31
34
  ```
32
35
 
@@ -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.1.1",
57
- "User-Agent": "lark-billing/0.1.1",
56
+ "X-Fern-SDK-Version": "0.1.3",
57
+ "User-Agent": "lark-billing/0.1.3",
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) });
@@ -39,7 +39,10 @@ export declare class Checkout {
39
39
  * await client.checkout.createSubscriptionCheckoutSession({
40
40
  * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
41
41
  * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
42
- * success_callback_url: "https://example.com/callback"
42
+ * checkout_callback_urls: {
43
+ * cancelled_url: "https://example.com/callback",
44
+ * success_url: "https://example.com/callback"
45
+ * }
43
46
  * })
44
47
  */
45
48
  createSubscriptionCheckoutSession(request: Lark.CreateSubscriptionCheckoutSessionRequest, requestOptions?: Checkout.RequestOptions): core.HttpResponsePromise<Lark.CreateSubscriptionCheckoutSessionResponse>;
@@ -65,7 +65,10 @@ class Checkout {
65
65
  * await client.checkout.createSubscriptionCheckoutSession({
66
66
  * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
67
67
  * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
68
- * success_callback_url: "https://example.com/callback"
68
+ * checkout_callback_urls: {
69
+ * cancelled_url: "https://example.com/callback",
70
+ * success_url: "https://example.com/callback"
71
+ * }
69
72
  * })
70
73
  */
71
74
  createSubscriptionCheckoutSession(request, requestOptions) {
@@ -1,12 +1,16 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as Lark from "../../../../index.js";
4
5
  /**
5
6
  * @example
6
7
  * {
7
8
  * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
8
9
  * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
9
- * success_callback_url: "https://example.com/callback"
10
+ * checkout_callback_urls: {
11
+ * cancelled_url: "https://example.com/callback",
12
+ * success_url: "https://example.com/callback"
13
+ * }
10
14
  * }
11
15
  */
12
16
  export interface CreateSubscriptionCheckoutSessionRequest {
@@ -14,8 +18,6 @@ export interface CreateSubscriptionCheckoutSessionRequest {
14
18
  subject_id: string;
15
19
  /** The ID of the rate card to subscribe to. */
16
20
  rate_card_id: string;
17
- /** The URL to redirect to after the checkout is successful. */
18
- success_callback_url: string;
19
- /** The URL to redirect to after the checkout is cancelled. */
20
- cancel_url?: string;
21
+ /** The URLs to redirect to after the checkout is completed or cancelled. */
22
+ checkout_callback_urls: Lark.CheckoutCallback;
21
23
  }
@@ -90,10 +90,14 @@ export declare class Subscriptions {
90
90
  *
91
91
  * @example
92
92
  * await client.subscriptions.changeSubscriptionRateCard("subscription_id", {
93
- * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g"
93
+ * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g",
94
+ * checkout_callback_urls: {
95
+ * cancelled_url: "https://example.com/callback",
96
+ * success_url: "https://example.com/callback"
97
+ * }
94
98
  * })
95
99
  */
96
- changeSubscriptionRateCard(subscriptionId: string, request: Lark.ChangeSubscriptionRateCardRequest, requestOptions?: Subscriptions.RequestOptions): core.HttpResponsePromise<Lark.SubscriptionResource>;
100
+ changeSubscriptionRateCard(subscriptionId: string, request: Lark.ChangeSubscriptionRateCardRequest, requestOptions?: Subscriptions.RequestOptions): core.HttpResponsePromise<Lark.ChangeSubscriptionRateCardResponse>;
97
101
  private __changeSubscriptionRateCard;
98
102
  protected _getCustomAuthorizationHeaders(): Promise<{
99
103
  "X-API-Key": string;
@@ -317,7 +317,11 @@ class Subscriptions {
317
317
  *
318
318
  * @example
319
319
  * await client.subscriptions.changeSubscriptionRateCard("subscription_id", {
320
- * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g"
320
+ * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g",
321
+ * checkout_callback_urls: {
322
+ * cancelled_url: "https://example.com/callback",
323
+ * success_url: "https://example.com/callback"
324
+ * }
321
325
  * })
322
326
  */
323
327
  changeSubscriptionRateCard(subscriptionId, request, requestOptions) {
@@ -340,7 +344,10 @@ class Subscriptions {
340
344
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
341
345
  });
342
346
  if (_response.ok) {
343
- return { data: _response.body, rawResponse: _response.rawResponse };
347
+ return {
348
+ data: _response.body,
349
+ rawResponse: _response.rawResponse,
350
+ };
344
351
  }
345
352
  if (_response.error.reason === "status-code") {
346
353
  switch (_response.error.statusCode) {
@@ -1,13 +1,32 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as Lark from "../../../../index.js";
4
5
  /**
5
6
  * @example
6
7
  * {
7
- * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g"
8
+ * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g",
9
+ * checkout_callback_urls: {
10
+ * cancelled_url: "https://example.com/callback",
11
+ * success_url: "https://example.com/callback"
12
+ * }
8
13
  * }
9
14
  */
10
15
  export interface ChangeSubscriptionRateCardRequest {
11
16
  /** The ID of the rate card to change the subscription to. */
12
17
  rate_card_id: string;
18
+ /** The behavior to use when upgrading the subscription. If 'prorate', the customer will be charged for the prorated difference. If 'rate_difference', the customer will be charged for the difference in the rate cards without respect to time. */
19
+ upgrade_behavior?: ChangeSubscriptionRateCardRequest.UpgradeBehavior;
20
+ /** The URLs to redirect to after the checkout is completed or cancelled, if a checkout is required. */
21
+ checkout_callback_urls: Lark.CheckoutCallback;
22
+ }
23
+ export declare namespace ChangeSubscriptionRateCardRequest {
24
+ /**
25
+ * The behavior to use when upgrading the subscription. If 'prorate', the customer will be charged for the prorated difference. If 'rate_difference', the customer will be charged for the difference in the rate cards without respect to time.
26
+ */
27
+ type UpgradeBehavior = "prorate" | "rate_difference";
28
+ const UpgradeBehavior: {
29
+ readonly Prorate: "prorate";
30
+ readonly RateDifference: "rate_difference";
31
+ };
13
32
  }
@@ -3,3 +3,11 @@
3
3
  * This file was auto-generated by Fern from our API Definition.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ChangeSubscriptionRateCardRequest = void 0;
7
+ var ChangeSubscriptionRateCardRequest;
8
+ (function (ChangeSubscriptionRateCardRequest) {
9
+ ChangeSubscriptionRateCardRequest.UpgradeBehavior = {
10
+ Prorate: "prorate",
11
+ RateDifference: "rate_difference",
12
+ };
13
+ })(ChangeSubscriptionRateCardRequest || (exports.ChangeSubscriptionRateCardRequest = ChangeSubscriptionRateCardRequest = {}));
@@ -37,10 +37,10 @@ export declare class UsageEvents {
37
37
  *
38
38
  * @example
39
39
  * await client.usageEvents.createUsageEvent({
40
- * idempotency_key: "f283b3d1-41b2-43b1-9d00-dd7935cb6263",
40
+ * idempotency_key: "cdd158d3-c865-4dc3-a652-053d81906a30",
41
41
  * event_name: "compute_hours",
42
42
  * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
43
- * timestamp: "2025-11-03T18:37:02Z",
43
+ * timestamp: "2025-11-06T20:22:47Z",
44
44
  * data: {
45
45
  * "compute_hours": 100,
46
46
  * "instance_type": "t2.micro",
@@ -63,10 +63,10 @@ class UsageEvents {
63
63
  *
64
64
  * @example
65
65
  * await client.usageEvents.createUsageEvent({
66
- * idempotency_key: "f283b3d1-41b2-43b1-9d00-dd7935cb6263",
66
+ * idempotency_key: "cdd158d3-c865-4dc3-a652-053d81906a30",
67
67
  * event_name: "compute_hours",
68
68
  * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
69
- * timestamp: "2025-11-03T18:37:02Z",
69
+ * timestamp: "2025-11-06T20:22:47Z",
70
70
  * data: {
71
71
  * "compute_hours": 100,
72
72
  * "instance_type": "t2.micro",
@@ -4,10 +4,10 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * idempotency_key: "f283b3d1-41b2-43b1-9d00-dd7935cb6263",
7
+ * idempotency_key: "cdd158d3-c865-4dc3-a652-053d81906a30",
8
8
  * event_name: "compute_hours",
9
9
  * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
10
- * timestamp: "2025-11-03T18:37:02Z",
10
+ * timestamp: "2025-11-06T20:22:47Z",
11
11
  * data: {
12
12
  * "compute_hours": 100,
13
13
  * "instance_type": "t2.micro",
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Lark from "../index.js";
5
+ export interface ChangeSubscriptionRateCardResponse {
6
+ result: Lark.Result;
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface CheckoutAction {
5
+ type: "checkout";
6
+ checkout_url: string;
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface CheckoutCallback {
5
+ /** The URL to redirect to after the checkout is cancelled. */
6
+ cancelled_url: string;
7
+ /** The URL to redirect to after the checkout is successful. */
8
+ success_url: string;
9
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Lark from "../index.js";
5
+ export interface RequiresActionResponse {
6
+ action: Lark.CheckoutAction;
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Lark from "../index.js";
5
+ export type Result = Lark.Result.RequiresAction | Lark.Result.Success;
6
+ export declare namespace Result {
7
+ interface RequiresAction extends Lark.RequiresActionResponse {
8
+ type: "requires_action";
9
+ }
10
+ interface Success extends Lark.SuccessResponse {
11
+ type: "success";
12
+ }
13
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Lark from "../index.js";
5
+ export interface SuccessResponse {
6
+ subscription: Lark.SubscriptionResource;
7
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,9 @@
1
1
  export * from "./ActiveSubscription.js";
2
2
  export * from "./Amount.js";
3
3
  export * from "./BillingStateResponse.js";
4
+ export * from "./Result.js";
5
+ export * from "./ChangeSubscriptionRateCardResponse.js";
6
+ export * from "./CheckoutAction.js";
4
7
  export * from "./CountAggregationPricingMetricInterface.js";
5
8
  export * from "./CountAggregationPricingMetricResource.js";
6
9
  export * from "./CreateCustomerPortalSessionResponse.js";
@@ -32,10 +35,13 @@ export * from "./PricingMetricResource.js";
32
35
  export * from "./PricingMetricSummaryResource.js";
33
36
  export * from "./RateCardResourceUsageBasedRatesItem.js";
34
37
  export * from "./RateCardResource.js";
38
+ export * from "./RequiresActionResponse.js";
35
39
  export * from "./SimpleUsageBasedRateInterface.js";
36
40
  export * from "./SubjectResource.js";
37
41
  export * from "./SubscriptionResource.js";
42
+ export * from "./SuccessResponse.js";
38
43
  export * from "./SumAggregationPricingMetricInterface.js";
39
44
  export * from "./SumAggregationPricingMetricResource.js";
40
45
  export * from "./UsageDataForRate.js";
41
46
  export * from "./ValidationError.js";
47
+ export * from "./CheckoutCallback.js";
@@ -17,6 +17,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./ActiveSubscription.js"), exports);
18
18
  __exportStar(require("./Amount.js"), exports);
19
19
  __exportStar(require("./BillingStateResponse.js"), exports);
20
+ __exportStar(require("./Result.js"), exports);
21
+ __exportStar(require("./ChangeSubscriptionRateCardResponse.js"), exports);
22
+ __exportStar(require("./CheckoutAction.js"), exports);
20
23
  __exportStar(require("./CountAggregationPricingMetricInterface.js"), exports);
21
24
  __exportStar(require("./CountAggregationPricingMetricResource.js"), exports);
22
25
  __exportStar(require("./CreateCustomerPortalSessionResponse.js"), exports);
@@ -48,10 +51,13 @@ __exportStar(require("./PricingMetricResource.js"), exports);
48
51
  __exportStar(require("./PricingMetricSummaryResource.js"), exports);
49
52
  __exportStar(require("./RateCardResourceUsageBasedRatesItem.js"), exports);
50
53
  __exportStar(require("./RateCardResource.js"), exports);
54
+ __exportStar(require("./RequiresActionResponse.js"), exports);
51
55
  __exportStar(require("./SimpleUsageBasedRateInterface.js"), exports);
52
56
  __exportStar(require("./SubjectResource.js"), exports);
53
57
  __exportStar(require("./SubscriptionResource.js"), exports);
58
+ __exportStar(require("./SuccessResponse.js"), exports);
54
59
  __exportStar(require("./SumAggregationPricingMetricInterface.js"), exports);
55
60
  __exportStar(require("./SumAggregationPricingMetricResource.js"), exports);
56
61
  __exportStar(require("./UsageDataForRate.js"), exports);
57
62
  __exportStar(require("./ValidationError.js"), exports);
63
+ __exportStar(require("./CheckoutCallback.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.1.1";
1
+ export declare const SDK_VERSION = "0.1.3";
@@ -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.1.1";
4
+ exports.SDK_VERSION = "0.1.3";
@@ -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.1.1",
21
- "User-Agent": "lark-billing/0.1.1",
20
+ "X-Fern-SDK-Version": "0.1.3",
21
+ "User-Agent": "lark-billing/0.1.3",
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) });
@@ -39,7 +39,10 @@ export declare class Checkout {
39
39
  * await client.checkout.createSubscriptionCheckoutSession({
40
40
  * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
41
41
  * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
42
- * success_callback_url: "https://example.com/callback"
42
+ * checkout_callback_urls: {
43
+ * cancelled_url: "https://example.com/callback",
44
+ * success_url: "https://example.com/callback"
45
+ * }
43
46
  * })
44
47
  */
45
48
  createSubscriptionCheckoutSession(request: Lark.CreateSubscriptionCheckoutSessionRequest, requestOptions?: Checkout.RequestOptions): core.HttpResponsePromise<Lark.CreateSubscriptionCheckoutSessionResponse>;
@@ -29,7 +29,10 @@ export class Checkout {
29
29
  * await client.checkout.createSubscriptionCheckoutSession({
30
30
  * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
31
31
  * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
32
- * success_callback_url: "https://example.com/callback"
32
+ * checkout_callback_urls: {
33
+ * cancelled_url: "https://example.com/callback",
34
+ * success_url: "https://example.com/callback"
35
+ * }
33
36
  * })
34
37
  */
35
38
  createSubscriptionCheckoutSession(request, requestOptions) {
@@ -1,12 +1,16 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as Lark from "../../../../index.mjs";
4
5
  /**
5
6
  * @example
6
7
  * {
7
8
  * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
8
9
  * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
9
- * success_callback_url: "https://example.com/callback"
10
+ * checkout_callback_urls: {
11
+ * cancelled_url: "https://example.com/callback",
12
+ * success_url: "https://example.com/callback"
13
+ * }
10
14
  * }
11
15
  */
12
16
  export interface CreateSubscriptionCheckoutSessionRequest {
@@ -14,8 +18,6 @@ export interface CreateSubscriptionCheckoutSessionRequest {
14
18
  subject_id: string;
15
19
  /** The ID of the rate card to subscribe to. */
16
20
  rate_card_id: string;
17
- /** The URL to redirect to after the checkout is successful. */
18
- success_callback_url: string;
19
- /** The URL to redirect to after the checkout is cancelled. */
20
- cancel_url?: string;
21
+ /** The URLs to redirect to after the checkout is completed or cancelled. */
22
+ checkout_callback_urls: Lark.CheckoutCallback;
21
23
  }
@@ -90,10 +90,14 @@ export declare class Subscriptions {
90
90
  *
91
91
  * @example
92
92
  * await client.subscriptions.changeSubscriptionRateCard("subscription_id", {
93
- * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g"
93
+ * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g",
94
+ * checkout_callback_urls: {
95
+ * cancelled_url: "https://example.com/callback",
96
+ * success_url: "https://example.com/callback"
97
+ * }
94
98
  * })
95
99
  */
96
- changeSubscriptionRateCard(subscriptionId: string, request: Lark.ChangeSubscriptionRateCardRequest, requestOptions?: Subscriptions.RequestOptions): core.HttpResponsePromise<Lark.SubscriptionResource>;
100
+ changeSubscriptionRateCard(subscriptionId: string, request: Lark.ChangeSubscriptionRateCardRequest, requestOptions?: Subscriptions.RequestOptions): core.HttpResponsePromise<Lark.ChangeSubscriptionRateCardResponse>;
97
101
  private __changeSubscriptionRateCard;
98
102
  protected _getCustomAuthorizationHeaders(): Promise<{
99
103
  "X-API-Key": string;
@@ -281,7 +281,11 @@ export class Subscriptions {
281
281
  *
282
282
  * @example
283
283
  * await client.subscriptions.changeSubscriptionRateCard("subscription_id", {
284
- * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g"
284
+ * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g",
285
+ * checkout_callback_urls: {
286
+ * cancelled_url: "https://example.com/callback",
287
+ * success_url: "https://example.com/callback"
288
+ * }
285
289
  * })
286
290
  */
287
291
  changeSubscriptionRateCard(subscriptionId, request, requestOptions) {
@@ -304,7 +308,10 @@ export class Subscriptions {
304
308
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
305
309
  });
306
310
  if (_response.ok) {
307
- return { data: _response.body, rawResponse: _response.rawResponse };
311
+ return {
312
+ data: _response.body,
313
+ rawResponse: _response.rawResponse,
314
+ };
308
315
  }
309
316
  if (_response.error.reason === "status-code") {
310
317
  switch (_response.error.statusCode) {
@@ -1,13 +1,32 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as Lark from "../../../../index.mjs";
4
5
  /**
5
6
  * @example
6
7
  * {
7
- * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g"
8
+ * rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g",
9
+ * checkout_callback_urls: {
10
+ * cancelled_url: "https://example.com/callback",
11
+ * success_url: "https://example.com/callback"
12
+ * }
8
13
  * }
9
14
  */
10
15
  export interface ChangeSubscriptionRateCardRequest {
11
16
  /** The ID of the rate card to change the subscription to. */
12
17
  rate_card_id: string;
18
+ /** The behavior to use when upgrading the subscription. If 'prorate', the customer will be charged for the prorated difference. If 'rate_difference', the customer will be charged for the difference in the rate cards without respect to time. */
19
+ upgrade_behavior?: ChangeSubscriptionRateCardRequest.UpgradeBehavior;
20
+ /** The URLs to redirect to after the checkout is completed or cancelled, if a checkout is required. */
21
+ checkout_callback_urls: Lark.CheckoutCallback;
22
+ }
23
+ export declare namespace ChangeSubscriptionRateCardRequest {
24
+ /**
25
+ * The behavior to use when upgrading the subscription. If 'prorate', the customer will be charged for the prorated difference. If 'rate_difference', the customer will be charged for the difference in the rate cards without respect to time.
26
+ */
27
+ type UpgradeBehavior = "prorate" | "rate_difference";
28
+ const UpgradeBehavior: {
29
+ readonly Prorate: "prorate";
30
+ readonly RateDifference: "rate_difference";
31
+ };
13
32
  }
@@ -1,4 +1,10 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- export {};
4
+ export var ChangeSubscriptionRateCardRequest;
5
+ (function (ChangeSubscriptionRateCardRequest) {
6
+ ChangeSubscriptionRateCardRequest.UpgradeBehavior = {
7
+ Prorate: "prorate",
8
+ RateDifference: "rate_difference",
9
+ };
10
+ })(ChangeSubscriptionRateCardRequest || (ChangeSubscriptionRateCardRequest = {}));
@@ -37,10 +37,10 @@ export declare class UsageEvents {
37
37
  *
38
38
  * @example
39
39
  * await client.usageEvents.createUsageEvent({
40
- * idempotency_key: "f283b3d1-41b2-43b1-9d00-dd7935cb6263",
40
+ * idempotency_key: "cdd158d3-c865-4dc3-a652-053d81906a30",
41
41
  * event_name: "compute_hours",
42
42
  * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
43
- * timestamp: "2025-11-03T18:37:02Z",
43
+ * timestamp: "2025-11-06T20:22:47Z",
44
44
  * data: {
45
45
  * "compute_hours": 100,
46
46
  * "instance_type": "t2.micro",
@@ -27,10 +27,10 @@ export class UsageEvents {
27
27
  *
28
28
  * @example
29
29
  * await client.usageEvents.createUsageEvent({
30
- * idempotency_key: "f283b3d1-41b2-43b1-9d00-dd7935cb6263",
30
+ * idempotency_key: "cdd158d3-c865-4dc3-a652-053d81906a30",
31
31
  * event_name: "compute_hours",
32
32
  * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
33
- * timestamp: "2025-11-03T18:37:02Z",
33
+ * timestamp: "2025-11-06T20:22:47Z",
34
34
  * data: {
35
35
  * "compute_hours": 100,
36
36
  * "instance_type": "t2.micro",
@@ -4,10 +4,10 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * idempotency_key: "f283b3d1-41b2-43b1-9d00-dd7935cb6263",
7
+ * idempotency_key: "cdd158d3-c865-4dc3-a652-053d81906a30",
8
8
  * event_name: "compute_hours",
9
9
  * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
10
- * timestamp: "2025-11-03T18:37:02Z",
10
+ * timestamp: "2025-11-06T20:22:47Z",
11
11
  * data: {
12
12
  * "compute_hours": 100,
13
13
  * "instance_type": "t2.micro",
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Lark from "../index.mjs";
5
+ export interface ChangeSubscriptionRateCardResponse {
6
+ result: Lark.Result;
7
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface CheckoutAction {
5
+ type: "checkout";
6
+ checkout_url: string;
7
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface CheckoutCallback {
5
+ /** The URL to redirect to after the checkout is cancelled. */
6
+ cancelled_url: string;
7
+ /** The URL to redirect to after the checkout is successful. */
8
+ success_url: string;
9
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Lark from "../index.mjs";
5
+ export interface RequiresActionResponse {
6
+ action: Lark.CheckoutAction;
7
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Lark from "../index.mjs";
5
+ export type Result = Lark.Result.RequiresAction | Lark.Result.Success;
6
+ export declare namespace Result {
7
+ interface RequiresAction extends Lark.RequiresActionResponse {
8
+ type: "requires_action";
9
+ }
10
+ interface Success extends Lark.SuccessResponse {
11
+ type: "success";
12
+ }
13
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Lark from "../index.mjs";
5
+ export interface SuccessResponse {
6
+ subscription: Lark.SubscriptionResource;
7
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export {};
@@ -1,6 +1,9 @@
1
1
  export * from "./ActiveSubscription.mjs";
2
2
  export * from "./Amount.mjs";
3
3
  export * from "./BillingStateResponse.mjs";
4
+ export * from "./Result.mjs";
5
+ export * from "./ChangeSubscriptionRateCardResponse.mjs";
6
+ export * from "./CheckoutAction.mjs";
4
7
  export * from "./CountAggregationPricingMetricInterface.mjs";
5
8
  export * from "./CountAggregationPricingMetricResource.mjs";
6
9
  export * from "./CreateCustomerPortalSessionResponse.mjs";
@@ -32,10 +35,13 @@ export * from "./PricingMetricResource.mjs";
32
35
  export * from "./PricingMetricSummaryResource.mjs";
33
36
  export * from "./RateCardResourceUsageBasedRatesItem.mjs";
34
37
  export * from "./RateCardResource.mjs";
38
+ export * from "./RequiresActionResponse.mjs";
35
39
  export * from "./SimpleUsageBasedRateInterface.mjs";
36
40
  export * from "./SubjectResource.mjs";
37
41
  export * from "./SubscriptionResource.mjs";
42
+ export * from "./SuccessResponse.mjs";
38
43
  export * from "./SumAggregationPricingMetricInterface.mjs";
39
44
  export * from "./SumAggregationPricingMetricResource.mjs";
40
45
  export * from "./UsageDataForRate.mjs";
41
46
  export * from "./ValidationError.mjs";
47
+ export * from "./CheckoutCallback.mjs";
@@ -1,6 +1,9 @@
1
1
  export * from "./ActiveSubscription.mjs";
2
2
  export * from "./Amount.mjs";
3
3
  export * from "./BillingStateResponse.mjs";
4
+ export * from "./Result.mjs";
5
+ export * from "./ChangeSubscriptionRateCardResponse.mjs";
6
+ export * from "./CheckoutAction.mjs";
4
7
  export * from "./CountAggregationPricingMetricInterface.mjs";
5
8
  export * from "./CountAggregationPricingMetricResource.mjs";
6
9
  export * from "./CreateCustomerPortalSessionResponse.mjs";
@@ -32,10 +35,13 @@ export * from "./PricingMetricResource.mjs";
32
35
  export * from "./PricingMetricSummaryResource.mjs";
33
36
  export * from "./RateCardResourceUsageBasedRatesItem.mjs";
34
37
  export * from "./RateCardResource.mjs";
38
+ export * from "./RequiresActionResponse.mjs";
35
39
  export * from "./SimpleUsageBasedRateInterface.mjs";
36
40
  export * from "./SubjectResource.mjs";
37
41
  export * from "./SubscriptionResource.mjs";
42
+ export * from "./SuccessResponse.mjs";
38
43
  export * from "./SumAggregationPricingMetricInterface.mjs";
39
44
  export * from "./SumAggregationPricingMetricResource.mjs";
40
45
  export * from "./UsageDataForRate.mjs";
41
46
  export * from "./ValidationError.mjs";
47
+ export * from "./CheckoutCallback.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.1.1";
1
+ export declare const SDK_VERSION = "0.1.3";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.1.1";
1
+ export const SDK_VERSION = "0.1.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lark-billing",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "private": false,
5
5
  "repository": "github:fern-demo/lark-ts-sdk",
6
6
  "type": "commonjs",
package/reference.md CHANGED
@@ -18,7 +18,10 @@
18
18
  await client.checkout.createSubscriptionCheckoutSession({
19
19
  subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
20
20
  rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
21
- success_callback_url: "https://example.com/callback",
21
+ checkout_callback_urls: {
22
+ cancelled_url: "https://example.com/callback",
23
+ success_url: "https://example.com/callback",
24
+ },
22
25
  });
23
26
  ```
24
27
 
@@ -303,10 +306,10 @@ await client.rateCards.getRateCard("rate_card_id");
303
306
 
304
307
  ```typescript
305
308
  await client.usageEvents.createUsageEvent({
306
- idempotency_key: "f283b3d1-41b2-43b1-9d00-dd7935cb6263",
309
+ idempotency_key: "cdd158d3-c865-4dc3-a652-053d81906a30",
307
310
  event_name: "compute_hours",
308
311
  subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
309
- timestamp: "2025-11-03T18:37:02Z",
312
+ timestamp: "2025-11-06T20:22:47Z",
310
313
  data: {
311
314
  compute_hours: 100,
312
315
  instance_type: "t2.micro",
@@ -556,7 +559,7 @@ await client.subscriptions.cancelSubscription("subscription_id");
556
559
  </dl>
557
560
  </details>
558
561
 
559
- <details><summary><code>client.subscriptions.<a href="/src/api/resources/subscriptions/client/Client.ts">changeSubscriptionRateCard</a>(subscriptionId, { ...params }) -> Lark.SubscriptionResource</code></summary>
562
+ <details><summary><code>client.subscriptions.<a href="/src/api/resources/subscriptions/client/Client.ts">changeSubscriptionRateCard</a>(subscriptionId, { ...params }) -> Lark.ChangeSubscriptionRateCardResponse</code></summary>
560
563
  <dl>
561
564
  <dd>
562
565
 
@@ -571,6 +574,10 @@ await client.subscriptions.cancelSubscription("subscription_id");
571
574
  ```typescript
572
575
  await client.subscriptions.changeSubscriptionRateCard("subscription_id", {
573
576
  rate_card_id: "rc_jQK2n0wutCj6bBcAIrL6o07g",
577
+ checkout_callback_urls: {
578
+ cancelled_url: "https://example.com/callback",
579
+ success_url: "https://example.com/callback",
580
+ },
574
581
  });
575
582
  ```
576
583