lark-billing 0.0.7 → 0.0.8

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 (139) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +7 -2
  4. package/dist/cjs/api/resources/checkout/client/Client.d.ts +1 -1
  5. package/dist/cjs/api/resources/checkout/client/Client.js +1 -1
  6. package/dist/cjs/api/resources/checkout/client/requests/CreateSubscriptionCheckoutSessionRequest.d.ts +5 -2
  7. package/dist/cjs/api/resources/index.d.ts +4 -1
  8. package/dist/cjs/api/resources/index.js +5 -2
  9. package/dist/cjs/api/resources/invoices/client/Client.d.ts +50 -0
  10. package/dist/cjs/api/resources/invoices/client/Client.js +135 -0
  11. package/dist/cjs/api/resources/invoices/client/index.d.ts +2 -0
  12. package/dist/cjs/api/resources/invoices/client/index.js +17 -0
  13. package/dist/cjs/api/resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.d.ts +17 -0
  14. package/dist/cjs/api/resources/invoices/client/requests/index.d.ts +1 -0
  15. package/dist/cjs/api/resources/invoices/client/requests/index.js +2 -0
  16. package/dist/cjs/api/resources/invoices/index.d.ts +1 -0
  17. package/dist/cjs/api/resources/invoices/index.js +17 -0
  18. package/dist/cjs/api/resources/pricingMetrics/client/Client.d.ts +13 -0
  19. package/dist/cjs/api/resources/pricingMetrics/client/Client.js +64 -0
  20. package/dist/cjs/api/resources/pricingMetrics/client/requests/ListPricingMetricsPricingMetricsGetRequest.d.ts +12 -0
  21. package/dist/cjs/api/resources/pricingMetrics/client/requests/index.d.ts +1 -0
  22. package/dist/cjs/api/resources/rateCards/client/requests/CreateRateCardRequest.d.ts +2 -2
  23. package/dist/cjs/api/resources/rateCards/index.d.ts +1 -0
  24. package/dist/cjs/api/resources/rateCards/index.js +1 -0
  25. package/dist/cjs/api/resources/rateCards/types/CreateRateCardRequestUsageBasedRatesItem.d.ts +10 -0
  26. package/dist/cjs/api/resources/rateCards/types/index.d.ts +1 -0
  27. package/dist/cjs/api/resources/rateCards/types/index.js +17 -0
  28. package/dist/cjs/api/resources/subjects/client/requests/CreateSubjectRequest.d.ts +4 -0
  29. package/dist/cjs/api/resources/subjects/client/requests/UpdateSubjectRequest.d.ts +3 -1
  30. package/dist/cjs/api/resources/subscriptions/client/Client.d.ts +28 -2
  31. package/dist/cjs/api/resources/subscriptions/client/Client.js +126 -2
  32. package/dist/cjs/api/resources/subscriptions/client/requests/CancelSubscriptionRequest.d.ts +13 -0
  33. package/dist/cjs/api/resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.d.ts +12 -0
  34. package/dist/cjs/api/resources/subscriptions/client/requests/CreateSubscriptionRequest.d.ts +6 -3
  35. package/dist/cjs/api/resources/subscriptions/client/requests/index.d.ts +2 -0
  36. package/dist/cjs/api/types/Aggregation.d.ts +1 -10
  37. package/dist/cjs/api/types/{CreateFixedRateInterface.d.ts → CreateFixedRateRequest.d.ts} +1 -1
  38. package/dist/cjs/api/types/CreateFixedRateRequest.js +5 -0
  39. package/dist/cjs/api/types/{CreateSimpleUsageBasedRateInterface.d.ts → CreateSimpleUsageBasedRateRequest.d.ts} +2 -2
  40. package/dist/cjs/api/types/CreateSimpleUsageBasedRateRequest.js +5 -0
  41. package/dist/cjs/api/types/CreateSubjectResponse.d.ts +6 -0
  42. package/dist/cjs/api/types/InvoiceLineItemResource.d.ts +10 -0
  43. package/dist/cjs/api/types/InvoiceLineItemResource.js +5 -0
  44. package/dist/cjs/api/types/InvoiceResource.d.ts +25 -0
  45. package/dist/cjs/api/types/InvoiceResource.js +16 -0
  46. package/dist/cjs/api/types/ListInvoicesResponse.d.ts +8 -0
  47. package/dist/cjs/api/types/ListInvoicesResponse.js +5 -0
  48. package/dist/cjs/api/types/ListPricingMetricsResponse.d.ts +8 -0
  49. package/dist/cjs/api/types/ListPricingMetricsResponse.js +5 -0
  50. package/dist/cjs/api/types/PeriodResource.d.ts +9 -0
  51. package/dist/cjs/api/types/PeriodResource.js +5 -0
  52. package/dist/cjs/api/types/PricingMetricResource.d.ts +11 -0
  53. package/dist/cjs/api/types/PricingMetricResource.js +5 -0
  54. package/dist/cjs/api/types/SimpleUsageBasedRateInterface.d.ts +0 -2
  55. package/dist/cjs/api/types/SubjectResource.d.ts +6 -0
  56. package/dist/cjs/api/types/SubscriptionResource.d.ts +6 -2
  57. package/dist/cjs/api/types/SubscriptionResource.js +1 -0
  58. package/dist/cjs/api/types/index.d.ts +8 -5
  59. package/dist/cjs/api/types/index.js +8 -5
  60. package/dist/cjs/version.d.ts +1 -1
  61. package/dist/cjs/version.js +1 -1
  62. package/dist/esm/Client.d.mts +3 -0
  63. package/dist/esm/Client.mjs +7 -2
  64. package/dist/esm/api/resources/checkout/client/Client.d.mts +1 -1
  65. package/dist/esm/api/resources/checkout/client/Client.mjs +1 -1
  66. package/dist/esm/api/resources/checkout/client/requests/CreateSubscriptionCheckoutSessionRequest.d.mts +5 -2
  67. package/dist/esm/api/resources/index.d.mts +4 -1
  68. package/dist/esm/api/resources/index.mjs +4 -1
  69. package/dist/esm/api/resources/invoices/client/Client.d.mts +50 -0
  70. package/dist/esm/api/resources/invoices/client/Client.mjs +98 -0
  71. package/dist/esm/api/resources/invoices/client/index.d.mts +2 -0
  72. package/dist/esm/api/resources/invoices/client/index.mjs +1 -0
  73. package/dist/esm/api/resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.d.mts +17 -0
  74. package/dist/esm/api/resources/invoices/client/requests/index.d.mts +1 -0
  75. package/dist/esm/api/resources/invoices/client/requests/index.mjs +1 -0
  76. package/dist/esm/api/resources/invoices/index.d.mts +1 -0
  77. package/dist/esm/api/resources/invoices/index.mjs +1 -0
  78. package/dist/esm/api/resources/pricingMetrics/client/Client.d.mts +13 -0
  79. package/dist/esm/api/resources/pricingMetrics/client/Client.mjs +64 -0
  80. package/dist/esm/api/resources/pricingMetrics/client/requests/ListPricingMetricsPricingMetricsGetRequest.d.mts +12 -0
  81. package/dist/esm/api/resources/pricingMetrics/client/requests/index.d.mts +1 -0
  82. package/dist/esm/api/resources/rateCards/client/requests/CreateRateCardRequest.d.mts +2 -2
  83. package/dist/esm/api/resources/rateCards/index.d.mts +1 -0
  84. package/dist/esm/api/resources/rateCards/index.mjs +1 -0
  85. package/dist/esm/api/resources/rateCards/types/CreateRateCardRequestUsageBasedRatesItem.d.mts +10 -0
  86. package/dist/esm/api/resources/rateCards/types/index.d.mts +1 -0
  87. package/dist/esm/api/resources/rateCards/types/index.mjs +1 -0
  88. package/dist/esm/api/resources/subjects/client/requests/CreateSubjectRequest.d.mts +4 -0
  89. package/dist/esm/api/resources/subjects/client/requests/UpdateSubjectRequest.d.mts +3 -1
  90. package/dist/esm/api/resources/subscriptions/client/Client.d.mts +28 -2
  91. package/dist/esm/api/resources/subscriptions/client/Client.mjs +126 -2
  92. package/dist/esm/api/resources/subscriptions/client/requests/CancelSubscriptionRequest.d.mts +13 -0
  93. package/dist/esm/api/resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.d.mts +12 -0
  94. package/dist/esm/api/resources/subscriptions/client/requests/CreateSubscriptionRequest.d.mts +6 -3
  95. package/dist/esm/api/resources/subscriptions/client/requests/index.d.mts +2 -0
  96. package/dist/esm/api/types/Aggregation.d.mts +1 -10
  97. package/dist/esm/api/types/{CreateFixedRateInterface.d.mts → CreateFixedRateRequest.d.mts} +1 -1
  98. package/dist/esm/api/types/CreateFixedRateRequest.mjs +4 -0
  99. package/dist/esm/api/types/{CreateSimpleUsageBasedRateInterface.d.mts → CreateSimpleUsageBasedRateRequest.d.mts} +2 -2
  100. package/dist/esm/api/types/CreateSimpleUsageBasedRateRequest.mjs +4 -0
  101. package/dist/esm/api/types/CreateSubjectResponse.d.mts +6 -0
  102. package/dist/esm/api/types/InvoiceLineItemResource.d.mts +10 -0
  103. package/dist/esm/api/types/InvoiceLineItemResource.mjs +4 -0
  104. package/dist/esm/api/types/InvoiceResource.d.mts +25 -0
  105. package/dist/esm/api/types/InvoiceResource.mjs +13 -0
  106. package/dist/esm/api/types/ListInvoicesResponse.d.mts +8 -0
  107. package/dist/esm/api/types/ListInvoicesResponse.mjs +4 -0
  108. package/dist/esm/api/types/ListPricingMetricsResponse.d.mts +8 -0
  109. package/dist/esm/api/types/ListPricingMetricsResponse.mjs +4 -0
  110. package/dist/esm/api/types/PeriodResource.d.mts +9 -0
  111. package/dist/esm/api/types/PeriodResource.mjs +4 -0
  112. package/dist/esm/api/types/PricingMetricResource.d.mts +11 -0
  113. package/dist/esm/api/types/PricingMetricResource.mjs +4 -0
  114. package/dist/esm/api/types/SimpleUsageBasedRateInterface.d.mts +0 -2
  115. package/dist/esm/api/types/SubjectResource.d.mts +6 -0
  116. package/dist/esm/api/types/SubscriptionResource.d.mts +6 -2
  117. package/dist/esm/api/types/SubscriptionResource.mjs +1 -0
  118. package/dist/esm/api/types/index.d.mts +8 -5
  119. package/dist/esm/api/types/index.mjs +8 -5
  120. package/dist/esm/version.d.mts +1 -1
  121. package/dist/esm/version.mjs +1 -1
  122. package/package.json +1 -1
  123. package/reference.md +221 -3
  124. package/dist/cjs/api/types/CustomPricingMetricResource.d.ts +0 -6
  125. package/dist/cjs/api/types/LastAggregationPricingMetricResource.d.ts +0 -6
  126. package/dist/cjs/api/types/MaxAggregationPricingMetricResource.d.ts +0 -6
  127. package/dist/esm/api/types/CustomPricingMetricResource.d.mts +0 -6
  128. package/dist/esm/api/types/LastAggregationPricingMetricResource.d.mts +0 -6
  129. package/dist/esm/api/types/MaxAggregationPricingMetricResource.d.mts +0 -6
  130. /package/dist/cjs/api/{types/CreateFixedRateInterface.js → resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.js} +0 -0
  131. /package/dist/cjs/api/{types/CreateSimpleUsageBasedRateInterface.js → resources/pricingMetrics/client/requests/ListPricingMetricsPricingMetricsGetRequest.js} +0 -0
  132. /package/dist/cjs/api/{types/CustomPricingMetricResource.js → resources/rateCards/types/CreateRateCardRequestUsageBasedRatesItem.js} +0 -0
  133. /package/dist/cjs/api/{types/LastAggregationPricingMetricResource.js → resources/subscriptions/client/requests/CancelSubscriptionRequest.js} +0 -0
  134. /package/dist/cjs/api/{types/MaxAggregationPricingMetricResource.js → resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.js} +0 -0
  135. /package/dist/esm/api/{types/CreateFixedRateInterface.mjs → resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.mjs} +0 -0
  136. /package/dist/esm/api/{types/CreateSimpleUsageBasedRateInterface.mjs → resources/pricingMetrics/client/requests/ListPricingMetricsPricingMetricsGetRequest.mjs} +0 -0
  137. /package/dist/esm/api/{types/CustomPricingMetricResource.mjs → resources/rateCards/types/CreateRateCardRequestUsageBasedRatesItem.mjs} +0 -0
  138. /package/dist/esm/api/{types/LastAggregationPricingMetricResource.mjs → resources/subscriptions/client/requests/CancelSubscriptionRequest.mjs} +0 -0
  139. /package/dist/esm/api/{types/MaxAggregationPricingMetricResource.mjs → resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.mjs} +0 -0
package/README.md CHANGED
@@ -26,7 +26,7 @@ const client = new LarkClient({ apiKey: "YOUR_API_KEY" });
26
26
  await client.checkout.createSubscriptionCheckoutSession({
27
27
  subject_id: "subject_id",
28
28
  rate_card_id: "rate_card_id",
29
- callback_url: "callback_url",
29
+ success_callback_url: "https://example.com/callback",
30
30
  });
31
31
  ```
32
32
 
@@ -11,6 +11,7 @@ import { Subscriptions } from "./api/resources/subscriptions/client/Client.js";
11
11
  import { Subjects } from "./api/resources/subjects/client/Client.js";
12
12
  import { PricingMetrics } from "./api/resources/pricingMetrics/client/Client.js";
13
13
  import { CustomerAccess } from "./api/resources/customerAccess/client/Client.js";
14
+ import { Invoices } from "./api/resources/invoices/client/Client.js";
14
15
  export declare namespace LarkClient {
15
16
  interface Options {
16
17
  environment?: core.Supplier<environments.LarkEnvironment | string>;
@@ -43,6 +44,7 @@ export declare class LarkClient {
43
44
  protected _subjects: Subjects | undefined;
44
45
  protected _pricingMetrics: PricingMetrics | undefined;
45
46
  protected _customerAccess: CustomerAccess | undefined;
47
+ protected _invoices: Invoices | undefined;
46
48
  constructor(_options: LarkClient.Options);
47
49
  get checkout(): Checkout;
48
50
  get customerPortal(): CustomerPortal;
@@ -52,4 +54,5 @@ export declare class LarkClient {
52
54
  get subjects(): Subjects;
53
55
  get pricingMetrics(): PricingMetrics;
54
56
  get customerAccess(): CustomerAccess;
57
+ get invoices(): Invoices;
55
58
  }
@@ -47,13 +47,14 @@ const Client_js_5 = require("./api/resources/subscriptions/client/Client.js");
47
47
  const Client_js_6 = require("./api/resources/subjects/client/Client.js");
48
48
  const Client_js_7 = require("./api/resources/pricingMetrics/client/Client.js");
49
49
  const Client_js_8 = require("./api/resources/customerAccess/client/Client.js");
50
+ const Client_js_9 = require("./api/resources/invoices/client/Client.js");
50
51
  class LarkClient {
51
52
  constructor(_options) {
52
53
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
53
54
  "X-Fern-Language": "JavaScript",
54
55
  "X-Fern-SDK-Name": "lark-billing",
55
- "X-Fern-SDK-Version": "0.0.7",
56
- "User-Agent": "lark-billing/0.0.7",
56
+ "X-Fern-SDK-Version": "0.0.8",
57
+ "User-Agent": "lark-billing/0.0.8",
57
58
  "X-Fern-Runtime": core.RUNTIME.type,
58
59
  "X-Fern-Runtime-Version": core.RUNTIME.version,
59
60
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -90,5 +91,9 @@ class LarkClient {
90
91
  var _a;
91
92
  return ((_a = this._customerAccess) !== null && _a !== void 0 ? _a : (this._customerAccess = new Client_js_8.CustomerAccess(this._options)));
92
93
  }
94
+ get invoices() {
95
+ var _a;
96
+ return ((_a = this._invoices) !== null && _a !== void 0 ? _a : (this._invoices = new Client_js_9.Invoices(this._options)));
97
+ }
93
98
  }
94
99
  exports.LarkClient = LarkClient;
@@ -39,7 +39,7 @@ export declare class Checkout {
39
39
  * await client.checkout.createSubscriptionCheckoutSession({
40
40
  * subject_id: "subject_id",
41
41
  * rate_card_id: "rate_card_id",
42
- * callback_url: "callback_url"
42
+ * success_callback_url: "https://example.com/callback"
43
43
  * })
44
44
  */
45
45
  createSubscriptionCheckoutSession(request: Lark.CreateSubscriptionCheckoutSessionRequest, requestOptions?: Checkout.RequestOptions): core.HttpResponsePromise<Lark.CreateSubscriptionCheckoutSessionResponse>;
@@ -65,7 +65,7 @@ class Checkout {
65
65
  * await client.checkout.createSubscriptionCheckoutSession({
66
66
  * subject_id: "subject_id",
67
67
  * rate_card_id: "rate_card_id",
68
- * callback_url: "callback_url"
68
+ * success_callback_url: "https://example.com/callback"
69
69
  * })
70
70
  */
71
71
  createSubscriptionCheckoutSession(request, requestOptions) {
@@ -6,11 +6,14 @@
6
6
  * {
7
7
  * subject_id: "subject_id",
8
8
  * rate_card_id: "rate_card_id",
9
- * callback_url: "callback_url"
9
+ * success_callback_url: "https://example.com/callback"
10
10
  * }
11
11
  */
12
12
  export interface CreateSubscriptionCheckoutSessionRequest {
13
13
  subject_id: string;
14
14
  rate_card_id: string;
15
- callback_url: string;
15
+ /** The URL to redirect to after the checkout is successful. */
16
+ success_callback_url: string;
17
+ /** The URL to redirect to after the checkout is cancelled. */
18
+ cancel_url?: string;
16
19
  }
@@ -1,12 +1,14 @@
1
+ export * as rateCards from "./rateCards/index.js";
2
+ export * from "./rateCards/types/index.js";
1
3
  export * as pricingMetrics from "./pricingMetrics/index.js";
2
4
  export * from "./pricingMetrics/types/index.js";
3
5
  export * as checkout from "./checkout/index.js";
4
6
  export * as customerPortal from "./customerPortal/index.js";
5
- export * as rateCards from "./rateCards/index.js";
6
7
  export * as usageEvents from "./usageEvents/index.js";
7
8
  export * as subscriptions from "./subscriptions/index.js";
8
9
  export * as subjects from "./subjects/index.js";
9
10
  export * as customerAccess from "./customerAccess/index.js";
11
+ export * as invoices from "./invoices/index.js";
10
12
  export * from "./checkout/client/requests/index.js";
11
13
  export * from "./customerPortal/client/requests/index.js";
12
14
  export * from "./rateCards/client/requests/index.js";
@@ -14,3 +16,4 @@ export * from "./usageEvents/client/requests/index.js";
14
16
  export * from "./subscriptions/client/requests/index.js";
15
17
  export * from "./subjects/client/requests/index.js";
16
18
  export * from "./pricingMetrics/client/requests/index.js";
19
+ export * from "./invoices/client/requests/index.js";
@@ -36,16 +36,18 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.customerAccess = exports.subjects = exports.subscriptions = exports.usageEvents = exports.rateCards = exports.customerPortal = exports.checkout = exports.pricingMetrics = void 0;
39
+ exports.invoices = exports.customerAccess = exports.subjects = exports.subscriptions = exports.usageEvents = exports.customerPortal = exports.checkout = exports.pricingMetrics = exports.rateCards = void 0;
40
+ exports.rateCards = __importStar(require("./rateCards/index.js"));
41
+ __exportStar(require("./rateCards/types/index.js"), exports);
40
42
  exports.pricingMetrics = __importStar(require("./pricingMetrics/index.js"));
41
43
  __exportStar(require("./pricingMetrics/types/index.js"), exports);
42
44
  exports.checkout = __importStar(require("./checkout/index.js"));
43
45
  exports.customerPortal = __importStar(require("./customerPortal/index.js"));
44
- exports.rateCards = __importStar(require("./rateCards/index.js"));
45
46
  exports.usageEvents = __importStar(require("./usageEvents/index.js"));
46
47
  exports.subscriptions = __importStar(require("./subscriptions/index.js"));
47
48
  exports.subjects = __importStar(require("./subjects/index.js"));
48
49
  exports.customerAccess = __importStar(require("./customerAccess/index.js"));
50
+ exports.invoices = __importStar(require("./invoices/index.js"));
49
51
  __exportStar(require("./checkout/client/requests/index.js"), exports);
50
52
  __exportStar(require("./customerPortal/client/requests/index.js"), exports);
51
53
  __exportStar(require("./rateCards/client/requests/index.js"), exports);
@@ -53,3 +55,4 @@ __exportStar(require("./usageEvents/client/requests/index.js"), exports);
53
55
  __exportStar(require("./subscriptions/client/requests/index.js"), exports);
54
56
  __exportStar(require("./subjects/client/requests/index.js"), exports);
55
57
  __exportStar(require("./pricingMetrics/client/requests/index.js"), exports);
58
+ __exportStar(require("./invoices/client/requests/index.js"), exports);
@@ -0,0 +1,50 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "../../../../environments.js";
5
+ import * as core from "../../../../core/index.js";
6
+ import * as Lark from "../../../index.js";
7
+ export declare namespace Invoices {
8
+ interface Options {
9
+ environment?: core.Supplier<environments.LarkEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
12
+ apiKey: core.Supplier<string>;
13
+ /** Additional headers to include in requests. */
14
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
15
+ }
16
+ interface RequestOptions {
17
+ /** The maximum time to wait for a response in seconds. */
18
+ timeoutInSeconds?: number;
19
+ /** The number of times to retry the request. Defaults to 2. */
20
+ maxRetries?: number;
21
+ /** A hook to abort the request. */
22
+ abortSignal?: AbortSignal;
23
+ /** Additional query string parameters to include in the request. */
24
+ queryParams?: Record<string, unknown>;
25
+ /** Additional headers to include in the request. */
26
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
27
+ }
28
+ }
29
+ export declare class Invoices {
30
+ protected readonly _options: Invoices.Options;
31
+ constructor(_options: Invoices.Options);
32
+ /**
33
+ * @param {Lark.ListInvoicesInvoicesGetRequest} request
34
+ * @param {Invoices.RequestOptions} requestOptions - Request-specific configuration.
35
+ *
36
+ * @throws {@link Lark.UnprocessableEntityError}
37
+ *
38
+ * @example
39
+ * await client.invoices.listInvoices({
40
+ * subject_id: "subject_id",
41
+ * limit: 1,
42
+ * offset: 1
43
+ * })
44
+ */
45
+ listInvoices(request: Lark.ListInvoicesInvoicesGetRequest, requestOptions?: Invoices.RequestOptions): core.HttpResponsePromise<Lark.ListInvoicesResponse>;
46
+ private __listInvoices;
47
+ protected _getCustomAuthorizationHeaders(): Promise<{
48
+ "X-API-Key": string;
49
+ }>;
50
+ }
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
39
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
40
+ return new (P || (P = Promise))(function (resolve, reject) {
41
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
42
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
43
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
44
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
45
+ });
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.Invoices = void 0;
49
+ const environments = __importStar(require("../../../../environments.js"));
50
+ const core = __importStar(require("../../../../core/index.js"));
51
+ const Lark = __importStar(require("../../../index.js"));
52
+ const headers_js_1 = require("../../../../core/headers.js");
53
+ const errors = __importStar(require("../../../../errors/index.js"));
54
+ class Invoices {
55
+ constructor(_options) {
56
+ this._options = _options;
57
+ }
58
+ /**
59
+ * @param {Lark.ListInvoicesInvoicesGetRequest} request
60
+ * @param {Invoices.RequestOptions} requestOptions - Request-specific configuration.
61
+ *
62
+ * @throws {@link Lark.UnprocessableEntityError}
63
+ *
64
+ * @example
65
+ * await client.invoices.listInvoices({
66
+ * subject_id: "subject_id",
67
+ * limit: 1,
68
+ * offset: 1
69
+ * })
70
+ */
71
+ listInvoices(request, requestOptions) {
72
+ return core.HttpResponsePromise.fromPromise(this.__listInvoices(request, requestOptions));
73
+ }
74
+ __listInvoices(request, requestOptions) {
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ var _a, _b, _c;
77
+ const { subject_id: subjectId, limit, offset } = request;
78
+ const _queryParams = {};
79
+ _queryParams["subject_id"] = subjectId;
80
+ if (limit != null) {
81
+ _queryParams["limit"] = limit.toString();
82
+ }
83
+ if (offset != null) {
84
+ _queryParams["offset"] = offset.toString();
85
+ }
86
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
87
+ const _response = yield core.fetcher({
88
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LarkEnvironment.Default, "invoices"),
89
+ method: "GET",
90
+ headers: _headers,
91
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
92
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
93
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
94
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
95
+ });
96
+ if (_response.ok) {
97
+ return { data: _response.body, rawResponse: _response.rawResponse };
98
+ }
99
+ if (_response.error.reason === "status-code") {
100
+ switch (_response.error.statusCode) {
101
+ case 422:
102
+ throw new Lark.UnprocessableEntityError(_response.error.body, _response.rawResponse);
103
+ default:
104
+ throw new errors.LarkError({
105
+ statusCode: _response.error.statusCode,
106
+ body: _response.error.body,
107
+ rawResponse: _response.rawResponse,
108
+ });
109
+ }
110
+ }
111
+ switch (_response.error.reason) {
112
+ case "non-json":
113
+ throw new errors.LarkError({
114
+ statusCode: _response.error.statusCode,
115
+ body: _response.error.rawBody,
116
+ rawResponse: _response.rawResponse,
117
+ });
118
+ case "timeout":
119
+ throw new errors.LarkTimeoutError("Timeout exceeded when calling GET /invoices.");
120
+ case "unknown":
121
+ throw new errors.LarkError({
122
+ message: _response.error.errorMessage,
123
+ rawResponse: _response.rawResponse,
124
+ });
125
+ }
126
+ });
127
+ }
128
+ _getCustomAuthorizationHeaders() {
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
131
+ return { "X-API-Key": apiKeyValue };
132
+ });
133
+ }
134
+ }
135
+ exports.Invoices = Invoices;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * subject_id: "subject_id",
8
+ * limit: 1,
9
+ * offset: 1
10
+ * }
11
+ */
12
+ export interface ListInvoicesInvoicesGetRequest {
13
+ /** The ID of the subject to list invoices for. */
14
+ subject_id: string;
15
+ limit?: number;
16
+ offset?: number;
17
+ }
@@ -0,0 +1 @@
1
+ export { type ListInvoicesInvoicesGetRequest } from "./ListInvoicesInvoicesGetRequest.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./client/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
@@ -29,6 +29,19 @@ export declare namespace PricingMetrics {
29
29
  export declare class PricingMetrics {
30
30
  protected readonly _options: PricingMetrics.Options;
31
31
  constructor(_options: PricingMetrics.Options);
32
+ /**
33
+ * @param {Lark.ListPricingMetricsPricingMetricsGetRequest} request
34
+ * @param {PricingMetrics.RequestOptions} requestOptions - Request-specific configuration.
35
+ *
36
+ * @throws {@link Lark.UnprocessableEntityError}
37
+ *
38
+ * @example
39
+ * await client.pricingMetrics.listPricingMetrics({
40
+ * limit: 1
41
+ * })
42
+ */
43
+ listPricingMetrics(request?: Lark.ListPricingMetricsPricingMetricsGetRequest, requestOptions?: PricingMetrics.RequestOptions): core.HttpResponsePromise<Lark.ListPricingMetricsResponse>;
44
+ private __listPricingMetrics;
32
45
  /**
33
46
  * @param {Lark.CreatePricingMetricRequest} request
34
47
  * @param {PricingMetrics.RequestOptions} requestOptions - Request-specific configuration.
@@ -55,6 +55,70 @@ class PricingMetrics {
55
55
  constructor(_options) {
56
56
  this._options = _options;
57
57
  }
58
+ /**
59
+ * @param {Lark.ListPricingMetricsPricingMetricsGetRequest} request
60
+ * @param {PricingMetrics.RequestOptions} requestOptions - Request-specific configuration.
61
+ *
62
+ * @throws {@link Lark.UnprocessableEntityError}
63
+ *
64
+ * @example
65
+ * await client.pricingMetrics.listPricingMetrics({
66
+ * limit: 1
67
+ * })
68
+ */
69
+ listPricingMetrics(request = {}, requestOptions) {
70
+ return core.HttpResponsePromise.fromPromise(this.__listPricingMetrics(request, requestOptions));
71
+ }
72
+ __listPricingMetrics() {
73
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
74
+ var _a, _b, _c;
75
+ const { limit } = request;
76
+ const _queryParams = {};
77
+ if (limit != null) {
78
+ _queryParams["limit"] = limit.toString();
79
+ }
80
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
81
+ const _response = yield core.fetcher({
82
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LarkEnvironment.Default, "pricing-metrics"),
83
+ method: "GET",
84
+ headers: _headers,
85
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
86
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
87
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
88
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
89
+ });
90
+ if (_response.ok) {
91
+ return { data: _response.body, rawResponse: _response.rawResponse };
92
+ }
93
+ if (_response.error.reason === "status-code") {
94
+ switch (_response.error.statusCode) {
95
+ case 422:
96
+ throw new Lark.UnprocessableEntityError(_response.error.body, _response.rawResponse);
97
+ default:
98
+ throw new errors.LarkError({
99
+ statusCode: _response.error.statusCode,
100
+ body: _response.error.body,
101
+ rawResponse: _response.rawResponse,
102
+ });
103
+ }
104
+ }
105
+ switch (_response.error.reason) {
106
+ case "non-json":
107
+ throw new errors.LarkError({
108
+ statusCode: _response.error.statusCode,
109
+ body: _response.error.rawBody,
110
+ rawResponse: _response.rawResponse,
111
+ });
112
+ case "timeout":
113
+ throw new errors.LarkTimeoutError("Timeout exceeded when calling GET /pricing-metrics.");
114
+ case "unknown":
115
+ throw new errors.LarkError({
116
+ message: _response.error.errorMessage,
117
+ rawResponse: _response.rawResponse,
118
+ });
119
+ }
120
+ });
121
+ }
58
122
  /**
59
123
  * @param {Lark.CreatePricingMetricRequest} request
60
124
  * @param {PricingMetrics.RequestOptions} requestOptions - Request-specific configuration.
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * limit: 1
8
+ * }
9
+ */
10
+ export interface ListPricingMetricsPricingMetricsGetRequest {
11
+ limit?: number;
12
+ }
@@ -1 +1,2 @@
1
+ export { type ListPricingMetricsPricingMetricsGetRequest } from "./ListPricingMetricsPricingMetricsGetRequest.js";
1
2
  export { type CreatePricingMetricRequest } from "./CreatePricingMetricRequest.js";
@@ -12,8 +12,8 @@ import * as Lark from "../../../../index.js";
12
12
  export interface CreateRateCardRequest {
13
13
  name: string;
14
14
  description?: string;
15
- usage_based_rates?: Lark.CreateSimpleUsageBasedRateInterface[];
16
- fixed_rates?: Lark.CreateFixedRateInterface[];
15
+ usage_based_rates?: Lark.CreateRateCardRequestUsageBasedRatesItem[];
16
+ fixed_rates?: Lark.CreateFixedRateRequest[];
17
17
  billing_interval: CreateRateCardRequest.BillingInterval;
18
18
  metadata?: Record<string, string>;
19
19
  }
@@ -1 +1,2 @@
1
+ export * from "./types/index.js";
1
2
  export * from "./client/index.js";
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types/index.js"), exports);
17
18
  __exportStar(require("./client/index.js"), exports);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Lark from "../../../index.js";
5
+ export type CreateRateCardRequestUsageBasedRatesItem = Lark.CreateRateCardRequestUsageBasedRatesItem.Simple;
6
+ export declare namespace CreateRateCardRequestUsageBasedRatesItem {
7
+ interface Simple extends Lark.CreateSimpleUsageBasedRateRequest {
8
+ usage_based_rate_type: "simple";
9
+ }
10
+ }
@@ -0,0 +1 @@
1
+ export * from "./CreateRateCardRequestUsageBasedRatesItem.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./CreateRateCardRequestUsageBasedRatesItem.js"), exports);
@@ -6,8 +6,12 @@
6
6
  * {}
7
7
  */
8
8
  export interface CreateSubjectRequest {
9
+ /** The ID of the subject in your system. If provided, you may use pass it to the API in place of the subject ID. Must be unique. */
9
10
  external_id?: string;
11
+ /** The name of the subject. Used for display in the dashboard. */
10
12
  name?: string;
13
+ /** The email of the subject. Must be a valid email address. */
11
14
  email?: string;
15
+ /** Additional metadata about the subject. You may use this to store any custom data about the subject. */
12
16
  metadata?: Record<string, string>;
13
17
  }
@@ -6,8 +6,10 @@
6
6
  * {}
7
7
  */
8
8
  export interface UpdateSubjectRequest {
9
- external_id?: string;
9
+ /** The name of the subject. Used for display in the dashboard. */
10
10
  name?: string;
11
+ /** The email of the subject. Must be a valid email address. */
11
12
  email?: string;
13
+ /** Additional metadata about the subject. You may use this to store any custom data about the subject. */
12
14
  metadata?: Record<string, string | undefined>;
13
15
  }
@@ -52,8 +52,8 @@ export declare class Subscriptions {
52
52
  *
53
53
  * @example
54
54
  * await client.subscriptions.createSubscription({
55
- * rate_card_id: "rate_card_id",
56
- * subject_id: "subject_id"
55
+ * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
56
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE"
57
57
  * })
58
58
  */
59
59
  createSubscription(request: Lark.CreateSubscriptionRequest, requestOptions?: Subscriptions.RequestOptions): core.HttpResponsePromise<Lark.SubscriptionResource>;
@@ -69,6 +69,32 @@ export declare class Subscriptions {
69
69
  */
70
70
  getSubscription(subscriptionId: string, requestOptions?: Subscriptions.RequestOptions): core.HttpResponsePromise<Lark.SubscriptionResource>;
71
71
  private __getSubscription;
72
+ /**
73
+ * @param {string} subscriptionId
74
+ * @param {Lark.CancelSubscriptionRequest} request
75
+ * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration.
76
+ *
77
+ * @throws {@link Lark.UnprocessableEntityError}
78
+ *
79
+ * @example
80
+ * await client.subscriptions.cancelSubscription("subscription_id")
81
+ */
82
+ cancelSubscription(subscriptionId: string, request?: Lark.CancelSubscriptionRequest, requestOptions?: Subscriptions.RequestOptions): core.HttpResponsePromise<Lark.SubscriptionResource>;
83
+ private __cancelSubscription;
84
+ /**
85
+ * @param {string} subscriptionId
86
+ * @param {Lark.ChangeSubscriptionRateCardRequest} request
87
+ * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration.
88
+ *
89
+ * @throws {@link Lark.UnprocessableEntityError}
90
+ *
91
+ * @example
92
+ * await client.subscriptions.changeSubscriptionRateCard("subscription_id", {
93
+ * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB"
94
+ * })
95
+ */
96
+ changeSubscriptionRateCard(subscriptionId: string, request: Lark.ChangeSubscriptionRateCardRequest, requestOptions?: Subscriptions.RequestOptions): core.HttpResponsePromise<Lark.SubscriptionResource>;
97
+ private __changeSubscriptionRateCard;
72
98
  protected _getCustomAuthorizationHeaders(): Promise<{
73
99
  "X-API-Key": string;
74
100
  }>;