lark-billing 0.0.7 → 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 (163) hide show
  1. package/README.md +3 -3
  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 +3 -3
  5. package/dist/cjs/api/resources/checkout/client/Client.js +3 -3
  6. package/dist/cjs/api/resources/checkout/client/requests/CreateSubscriptionCheckoutSessionRequest.d.ts +9 -4
  7. package/dist/cjs/api/resources/customerPortal/client/Client.d.ts +1 -1
  8. package/dist/cjs/api/resources/customerPortal/client/Client.js +1 -1
  9. package/dist/cjs/api/resources/customerPortal/client/requests/CreateCustomerPortalSessionRequest.d.ts +2 -1
  10. package/dist/cjs/api/resources/index.d.ts +4 -1
  11. package/dist/cjs/api/resources/index.js +5 -2
  12. package/dist/cjs/api/resources/invoices/client/Client.d.ts +50 -0
  13. package/dist/cjs/api/resources/invoices/client/Client.js +135 -0
  14. package/dist/cjs/api/resources/invoices/client/index.d.ts +2 -0
  15. package/dist/cjs/api/resources/invoices/client/index.js +17 -0
  16. package/dist/cjs/api/resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.d.ts +17 -0
  17. package/dist/cjs/api/resources/invoices/client/requests/index.d.ts +1 -0
  18. package/dist/cjs/api/resources/invoices/client/requests/index.js +2 -0
  19. package/dist/cjs/api/resources/invoices/index.d.ts +1 -0
  20. package/dist/cjs/api/resources/invoices/index.js +17 -0
  21. package/dist/cjs/api/resources/pricingMetrics/client/Client.d.ts +13 -0
  22. package/dist/cjs/api/resources/pricingMetrics/client/Client.js +64 -0
  23. package/dist/cjs/api/resources/pricingMetrics/client/requests/ListPricingMetricsPricingMetricsGetRequest.d.ts +12 -0
  24. package/dist/cjs/api/resources/pricingMetrics/client/requests/index.d.ts +1 -0
  25. package/dist/cjs/api/resources/rateCards/client/Client.d.ts +1 -1
  26. package/dist/cjs/api/resources/rateCards/client/Client.js +1 -1
  27. package/dist/cjs/api/resources/rateCards/client/requests/CreateRateCardRequest.d.ts +9 -3
  28. package/dist/cjs/api/resources/rateCards/index.d.ts +1 -0
  29. package/dist/cjs/api/resources/rateCards/index.js +1 -0
  30. package/dist/cjs/api/resources/rateCards/types/CreateRateCardRequestUsageBasedRatesItem.d.ts +10 -0
  31. package/dist/cjs/api/resources/rateCards/types/index.d.ts +1 -0
  32. package/dist/cjs/api/resources/rateCards/types/index.js +17 -0
  33. package/dist/cjs/api/resources/subjects/client/requests/CreateSubjectRequest.d.ts +4 -0
  34. package/dist/cjs/api/resources/subjects/client/requests/UpdateSubjectRequest.d.ts +3 -1
  35. package/dist/cjs/api/resources/subscriptions/client/Client.d.ts +28 -2
  36. package/dist/cjs/api/resources/subscriptions/client/Client.js +126 -2
  37. package/dist/cjs/api/resources/subscriptions/client/requests/CancelSubscriptionRequest.d.ts +13 -0
  38. package/dist/cjs/api/resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.d.ts +13 -0
  39. package/dist/cjs/api/resources/subscriptions/client/requests/CreateSubscriptionRequest.d.ts +6 -3
  40. package/dist/cjs/api/resources/subscriptions/client/requests/index.d.ts +2 -0
  41. package/dist/cjs/api/resources/usageEvents/client/requests/CreateUsageEventRequest.d.ts +11 -1
  42. package/dist/cjs/api/types/Aggregation.d.ts +1 -10
  43. package/dist/cjs/api/types/Amount.d.ts +1 -0
  44. package/dist/cjs/api/types/CreateCustomerPortalSessionResponse.d.ts +2 -0
  45. package/dist/cjs/api/types/CreateFixedRateRequest.d.ts +11 -0
  46. package/dist/cjs/api/types/CreateFixedRateRequest.js +5 -0
  47. package/dist/cjs/api/types/CreateSimpleUsageBasedRateRequest.d.ts +15 -0
  48. package/dist/cjs/api/types/CreateSimpleUsageBasedRateRequest.js +5 -0
  49. package/dist/cjs/api/types/CreateSubjectResponse.d.ts +6 -0
  50. package/dist/cjs/api/types/CreateSubscriptionCheckoutSessionResponse.d.ts +3 -0
  51. package/dist/cjs/api/types/FixedRateInterface.d.ts +1 -1
  52. package/dist/cjs/api/types/InvoiceLineItemResource.d.ts +10 -0
  53. package/dist/cjs/api/types/InvoiceLineItemResource.js +5 -0
  54. package/dist/cjs/api/types/InvoiceResource.d.ts +33 -0
  55. package/dist/cjs/api/types/InvoiceResource.js +16 -0
  56. package/dist/cjs/api/types/{CreateFixedRateInterface.d.ts → ListInvoicesResponse.d.ts} +3 -4
  57. package/dist/cjs/api/types/ListInvoicesResponse.js +5 -0
  58. package/dist/cjs/api/types/ListPricingMetricsResponse.d.ts +8 -0
  59. package/dist/cjs/api/types/ListPricingMetricsResponse.js +5 -0
  60. package/dist/cjs/api/types/PeriodResource.d.ts +9 -0
  61. package/dist/cjs/api/types/PeriodResource.js +5 -0
  62. package/dist/cjs/api/types/PricingMetricResource.d.ts +11 -0
  63. package/dist/cjs/api/types/PricingMetricResource.js +5 -0
  64. package/dist/cjs/api/types/RateCardResource.d.ts +8 -1
  65. package/dist/cjs/api/types/SimpleUsageBasedRateInterface.d.ts +1 -3
  66. package/dist/cjs/api/types/SubjectResource.d.ts +6 -0
  67. package/dist/cjs/api/types/SubscriptionResource.d.ts +17 -2
  68. package/dist/cjs/api/types/SubscriptionResource.js +1 -0
  69. package/dist/cjs/api/types/index.d.ts +8 -5
  70. package/dist/cjs/api/types/index.js +8 -5
  71. package/dist/cjs/version.d.ts +1 -1
  72. package/dist/cjs/version.js +1 -1
  73. package/dist/esm/Client.d.mts +3 -0
  74. package/dist/esm/Client.mjs +7 -2
  75. package/dist/esm/api/resources/checkout/client/Client.d.mts +3 -3
  76. package/dist/esm/api/resources/checkout/client/Client.mjs +3 -3
  77. package/dist/esm/api/resources/checkout/client/requests/CreateSubscriptionCheckoutSessionRequest.d.mts +9 -4
  78. package/dist/esm/api/resources/customerPortal/client/Client.d.mts +1 -1
  79. package/dist/esm/api/resources/customerPortal/client/Client.mjs +1 -1
  80. package/dist/esm/api/resources/customerPortal/client/requests/CreateCustomerPortalSessionRequest.d.mts +2 -1
  81. package/dist/esm/api/resources/index.d.mts +4 -1
  82. package/dist/esm/api/resources/index.mjs +4 -1
  83. package/dist/esm/api/resources/invoices/client/Client.d.mts +50 -0
  84. package/dist/esm/api/resources/invoices/client/Client.mjs +98 -0
  85. package/dist/esm/api/resources/invoices/client/index.d.mts +2 -0
  86. package/dist/esm/api/resources/invoices/client/index.mjs +1 -0
  87. package/dist/esm/api/resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.d.mts +17 -0
  88. package/dist/esm/api/resources/invoices/client/requests/index.d.mts +1 -0
  89. package/dist/esm/api/resources/invoices/client/requests/index.mjs +1 -0
  90. package/dist/esm/api/resources/invoices/index.d.mts +1 -0
  91. package/dist/esm/api/resources/invoices/index.mjs +1 -0
  92. package/dist/esm/api/resources/pricingMetrics/client/Client.d.mts +13 -0
  93. package/dist/esm/api/resources/pricingMetrics/client/Client.mjs +64 -0
  94. package/dist/esm/api/resources/pricingMetrics/client/requests/ListPricingMetricsPricingMetricsGetRequest.d.mts +12 -0
  95. package/dist/esm/api/resources/pricingMetrics/client/requests/index.d.mts +1 -0
  96. package/dist/esm/api/resources/rateCards/client/Client.d.mts +1 -1
  97. package/dist/esm/api/resources/rateCards/client/Client.mjs +1 -1
  98. package/dist/esm/api/resources/rateCards/client/requests/CreateRateCardRequest.d.mts +9 -3
  99. package/dist/esm/api/resources/rateCards/index.d.mts +1 -0
  100. package/dist/esm/api/resources/rateCards/index.mjs +1 -0
  101. package/dist/esm/api/resources/rateCards/types/CreateRateCardRequestUsageBasedRatesItem.d.mts +10 -0
  102. package/dist/esm/api/resources/rateCards/types/index.d.mts +1 -0
  103. package/dist/esm/api/resources/rateCards/types/index.mjs +1 -0
  104. package/dist/esm/api/resources/subjects/client/requests/CreateSubjectRequest.d.mts +4 -0
  105. package/dist/esm/api/resources/subjects/client/requests/UpdateSubjectRequest.d.mts +3 -1
  106. package/dist/esm/api/resources/subscriptions/client/Client.d.mts +28 -2
  107. package/dist/esm/api/resources/subscriptions/client/Client.mjs +126 -2
  108. package/dist/esm/api/resources/subscriptions/client/requests/CancelSubscriptionRequest.d.mts +13 -0
  109. package/dist/esm/api/resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.d.mts +13 -0
  110. package/dist/esm/api/resources/subscriptions/client/requests/CreateSubscriptionRequest.d.mts +6 -3
  111. package/dist/esm/api/resources/subscriptions/client/requests/index.d.mts +2 -0
  112. package/dist/esm/api/resources/usageEvents/client/requests/CreateUsageEventRequest.d.mts +11 -1
  113. package/dist/esm/api/types/Aggregation.d.mts +1 -10
  114. package/dist/esm/api/types/Amount.d.mts +1 -0
  115. package/dist/esm/api/types/CreateCustomerPortalSessionResponse.d.mts +2 -0
  116. package/dist/esm/api/types/CreateFixedRateRequest.d.mts +11 -0
  117. package/dist/esm/api/types/CreateFixedRateRequest.mjs +4 -0
  118. package/dist/esm/api/types/CreateSimpleUsageBasedRateRequest.d.mts +15 -0
  119. package/dist/esm/api/types/CreateSimpleUsageBasedRateRequest.mjs +4 -0
  120. package/dist/esm/api/types/CreateSubjectResponse.d.mts +6 -0
  121. package/dist/esm/api/types/CreateSubscriptionCheckoutSessionResponse.d.mts +3 -0
  122. package/dist/esm/api/types/FixedRateInterface.d.mts +1 -1
  123. package/dist/esm/api/types/InvoiceLineItemResource.d.mts +10 -0
  124. package/dist/esm/api/types/InvoiceLineItemResource.mjs +4 -0
  125. package/dist/esm/api/types/InvoiceResource.d.mts +33 -0
  126. package/dist/esm/api/types/InvoiceResource.mjs +13 -0
  127. package/dist/esm/api/types/{CreateFixedRateInterface.d.mts → ListInvoicesResponse.d.mts} +3 -4
  128. package/dist/esm/api/types/ListInvoicesResponse.mjs +4 -0
  129. package/dist/esm/api/types/ListPricingMetricsResponse.d.mts +8 -0
  130. package/dist/esm/api/types/ListPricingMetricsResponse.mjs +4 -0
  131. package/dist/esm/api/types/PeriodResource.d.mts +9 -0
  132. package/dist/esm/api/types/PeriodResource.mjs +4 -0
  133. package/dist/esm/api/types/PricingMetricResource.d.mts +11 -0
  134. package/dist/esm/api/types/PricingMetricResource.mjs +4 -0
  135. package/dist/esm/api/types/RateCardResource.d.mts +8 -1
  136. package/dist/esm/api/types/SimpleUsageBasedRateInterface.d.mts +1 -3
  137. package/dist/esm/api/types/SubjectResource.d.mts +6 -0
  138. package/dist/esm/api/types/SubscriptionResource.d.mts +17 -2
  139. package/dist/esm/api/types/SubscriptionResource.mjs +1 -0
  140. package/dist/esm/api/types/index.d.mts +8 -5
  141. package/dist/esm/api/types/index.mjs +8 -5
  142. package/dist/esm/version.d.mts +1 -1
  143. package/dist/esm/version.mjs +1 -1
  144. package/package.json +1 -1
  145. package/reference.md +225 -7
  146. package/dist/cjs/api/types/CreateSimpleUsageBasedRateInterface.d.ts +0 -12
  147. package/dist/cjs/api/types/CustomPricingMetricResource.d.ts +0 -6
  148. package/dist/cjs/api/types/LastAggregationPricingMetricResource.d.ts +0 -6
  149. package/dist/cjs/api/types/MaxAggregationPricingMetricResource.d.ts +0 -6
  150. package/dist/esm/api/types/CreateSimpleUsageBasedRateInterface.d.mts +0 -12
  151. package/dist/esm/api/types/CustomPricingMetricResource.d.mts +0 -6
  152. package/dist/esm/api/types/LastAggregationPricingMetricResource.d.mts +0 -6
  153. package/dist/esm/api/types/MaxAggregationPricingMetricResource.d.mts +0 -6
  154. /package/dist/cjs/api/{types/CreateFixedRateInterface.js → resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.js} +0 -0
  155. /package/dist/cjs/api/{types/CreateSimpleUsageBasedRateInterface.js → resources/pricingMetrics/client/requests/ListPricingMetricsPricingMetricsGetRequest.js} +0 -0
  156. /package/dist/cjs/api/{types/CustomPricingMetricResource.js → resources/rateCards/types/CreateRateCardRequestUsageBasedRatesItem.js} +0 -0
  157. /package/dist/cjs/api/{types/LastAggregationPricingMetricResource.js → resources/subscriptions/client/requests/CancelSubscriptionRequest.js} +0 -0
  158. /package/dist/cjs/api/{types/MaxAggregationPricingMetricResource.js → resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.js} +0 -0
  159. /package/dist/esm/api/{types/CreateFixedRateInterface.mjs → resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.mjs} +0 -0
  160. /package/dist/esm/api/{types/CreateSimpleUsageBasedRateInterface.mjs → resources/pricingMetrics/client/requests/ListPricingMetricsPricingMetricsGetRequest.mjs} +0 -0
  161. /package/dist/esm/api/{types/CustomPricingMetricResource.mjs → resources/rateCards/types/CreateRateCardRequestUsageBasedRatesItem.mjs} +0 -0
  162. /package/dist/esm/api/{types/LastAggregationPricingMetricResource.mjs → resources/subscriptions/client/requests/CancelSubscriptionRequest.mjs} +0 -0
  163. /package/dist/esm/api/{types/MaxAggregationPricingMetricResource.mjs → resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.mjs} +0 -0
package/README.md CHANGED
@@ -24,9 +24,9 @@ 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",
29
- callback_url: "callback_url",
27
+ subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
28
+ rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
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.9",
57
+ "User-Agent": "lark-billing/0.0.9",
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;
@@ -37,9 +37,9 @@ 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",
42
- * callback_url: "callback_url"
40
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
41
+ * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
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>;
@@ -63,9 +63,9 @@ 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",
68
- * callback_url: "callback_url"
66
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
67
+ * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
68
+ * success_callback_url: "https://example.com/callback"
69
69
  * })
70
70
  */
71
71
  createSubscriptionCheckoutSession(request, requestOptions) {
@@ -4,13 +4,18 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * subject_id: "subject_id",
8
- * rate_card_id: "rate_card_id",
9
- * callback_url: "callback_url"
7
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
8
+ * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
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
- callback_url: 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;
16
21
  }
@@ -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
  }
@@ -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";
@@ -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.CreateSimpleUsageBasedRateInterface[];
16
- fixed_rates?: Lark.CreateFixedRateInterface[];
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";
@@ -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";