lark-billing 0.0.5 → 0.0.6

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 (123) hide show
  1. package/README.md +10 -10
  2. package/dist/cjs/Client.d.ts +1 -6
  3. package/dist/cjs/Client.js +2 -12
  4. package/dist/cjs/api/resources/checkout/client/Client.d.ts +19 -4
  5. package/dist/cjs/api/resources/checkout/client/Client.js +78 -9
  6. package/dist/cjs/api/resources/checkout/client/requests/{CreateRateCardCheckoutRequest.d.ts → CreateSubscriptionCheckoutSessionRequest.d.ts} +1 -1
  7. package/dist/cjs/api/resources/checkout/client/requests/index.d.ts +1 -1
  8. package/dist/cjs/api/resources/featureAccess/client/Client.d.ts +4 -0
  9. package/dist/cjs/api/resources/featureAccess/client/Client.js +7 -1
  10. package/dist/cjs/api/resources/index.d.ts +0 -2
  11. package/dist/cjs/api/resources/index.js +1 -3
  12. package/dist/cjs/api/resources/rateCards/client/Client.d.ts +8 -0
  13. package/dist/cjs/api/resources/rateCards/client/Client.js +16 -6
  14. package/dist/cjs/api/resources/rateCards/client/requests/CreateRateCardRequest.d.ts +1 -0
  15. package/dist/cjs/api/resources/rateCards/client/requests/CreateRateCardVersionRequest.d.ts +3 -0
  16. package/dist/cjs/api/resources/subjects/client/Client.d.ts +4 -0
  17. package/dist/cjs/api/resources/subjects/client/Client.js +11 -5
  18. package/dist/cjs/api/resources/subscriptions/client/Client.d.ts +4 -0
  19. package/dist/cjs/api/resources/subscriptions/client/Client.js +11 -5
  20. package/dist/cjs/api/resources/usageEvents/client/Client.d.ts +23 -0
  21. package/dist/cjs/api/resources/usageEvents/client/Client.js +75 -1
  22. package/dist/cjs/api/resources/usageEvents/client/requests/CreateUsageEventRequest.d.ts +1 -1
  23. package/dist/cjs/api/resources/usageEvents/client/requests/CreateUsageEventSummaryRequest.d.ts +30 -0
  24. package/dist/cjs/api/resources/usageEvents/client/requests/CreateUsageEventSummaryRequest.js +14 -0
  25. package/dist/cjs/api/resources/usageEvents/client/requests/index.d.ts +1 -0
  26. package/dist/cjs/api/types/CompleteSubscriptionCheckoutResponse.d.ts +8 -0
  27. package/dist/cjs/api/types/CreateDimensionalUsageBasedRateInterface.d.ts +2 -0
  28. package/dist/cjs/api/types/CreateFixedRateInterface.d.ts +1 -0
  29. package/dist/cjs/api/types/CreatePricingMetricInterface.d.ts +1 -0
  30. package/dist/cjs/api/types/CreateSimpleUsageBasedRateInterface.d.ts +2 -0
  31. package/dist/cjs/api/types/CreateSubscriptionCheckoutSessionResponse.d.ts +10 -0
  32. package/dist/cjs/api/{resources/creditPools/client/index.js → types/CreateSubscriptionCheckoutSessionResponse.js} +3 -0
  33. package/dist/cjs/api/types/CreateUsageEventSummaryResponse.d.ts +10 -0
  34. package/dist/cjs/api/{resources/pricingPlans/client/index.js → types/CreateUsageEventSummaryResponse.js} +3 -0
  35. package/dist/cjs/api/types/CustomAggregationPricingMetricInterface.d.ts +1 -0
  36. package/dist/cjs/api/types/DimensionalUsageBasedRateInterface.d.ts +3 -0
  37. package/dist/cjs/api/types/FixedRateInterface.d.ts +2 -0
  38. package/dist/cjs/api/types/LastAggregationPricingMetricInterface.d.ts +1 -0
  39. package/dist/cjs/api/types/MaxAggregationPricingMetricInterface.d.ts +1 -0
  40. package/dist/cjs/api/types/Period.d.ts +9 -0
  41. package/dist/cjs/api/types/Period.js +5 -0
  42. package/dist/cjs/api/types/PricingMetricInterface.d.ts +2 -0
  43. package/dist/cjs/api/types/SimpleUsageBasedRateInterface.d.ts +3 -0
  44. package/dist/cjs/api/types/SumAggregationPricingMetricInterface.d.ts +1 -0
  45. package/dist/cjs/api/types/index.d.ts +4 -1
  46. package/dist/cjs/api/types/index.js +4 -1
  47. package/dist/cjs/version.d.ts +1 -1
  48. package/dist/cjs/version.js +1 -1
  49. package/dist/esm/Client.d.mts +1 -6
  50. package/dist/esm/Client.mjs +2 -12
  51. package/dist/esm/api/resources/checkout/client/Client.d.mts +19 -4
  52. package/dist/esm/api/resources/checkout/client/Client.mjs +79 -10
  53. package/dist/esm/api/resources/checkout/client/requests/{CreateRateCardCheckoutRequest.d.mts → CreateSubscriptionCheckoutSessionRequest.d.mts} +1 -1
  54. package/dist/esm/api/resources/checkout/client/requests/index.d.mts +1 -1
  55. package/dist/esm/api/resources/featureAccess/client/Client.d.mts +4 -0
  56. package/dist/esm/api/resources/featureAccess/client/Client.mjs +8 -2
  57. package/dist/esm/api/resources/index.d.mts +0 -2
  58. package/dist/esm/api/resources/index.mjs +0 -2
  59. package/dist/esm/api/resources/rateCards/client/Client.d.mts +8 -0
  60. package/dist/esm/api/resources/rateCards/client/Client.mjs +17 -7
  61. package/dist/esm/api/resources/rateCards/client/requests/CreateRateCardRequest.d.mts +1 -0
  62. package/dist/esm/api/resources/rateCards/client/requests/CreateRateCardVersionRequest.d.mts +3 -0
  63. package/dist/esm/api/resources/subjects/client/Client.d.mts +4 -0
  64. package/dist/esm/api/resources/subjects/client/Client.mjs +12 -6
  65. package/dist/esm/api/resources/subscriptions/client/Client.d.mts +4 -0
  66. package/dist/esm/api/resources/subscriptions/client/Client.mjs +12 -6
  67. package/dist/esm/api/resources/usageEvents/client/Client.d.mts +23 -0
  68. package/dist/esm/api/resources/usageEvents/client/Client.mjs +76 -2
  69. package/dist/esm/api/resources/usageEvents/client/requests/CreateUsageEventRequest.d.mts +1 -1
  70. package/dist/esm/api/resources/usageEvents/client/requests/CreateUsageEventSummaryRequest.d.mts +30 -0
  71. package/dist/esm/api/resources/usageEvents/client/requests/CreateUsageEventSummaryRequest.mjs +11 -0
  72. package/dist/esm/api/resources/usageEvents/client/requests/index.d.mts +1 -0
  73. package/dist/esm/api/types/CompleteSubscriptionCheckoutResponse.d.mts +8 -0
  74. package/dist/esm/api/types/CreateDimensionalUsageBasedRateInterface.d.mts +2 -0
  75. package/dist/esm/api/types/CreateFixedRateInterface.d.mts +1 -0
  76. package/dist/esm/api/types/CreatePricingMetricInterface.d.mts +1 -0
  77. package/dist/esm/api/types/CreateSimpleUsageBasedRateInterface.d.mts +2 -0
  78. package/dist/esm/api/types/CreateSubscriptionCheckoutSessionResponse.d.mts +10 -0
  79. package/dist/{cjs/api/types/CreateRateCardCheckoutResponse.d.ts → esm/api/types/CreateSubscriptionCheckoutSessionResponse.mjs} +1 -3
  80. package/dist/esm/api/types/CreateUsageEventSummaryResponse.d.mts +10 -0
  81. package/dist/esm/api/types/{CreateRateCardCheckoutResponse.d.mts → CreateUsageEventSummaryResponse.mjs} +1 -3
  82. package/dist/esm/api/types/CustomAggregationPricingMetricInterface.d.mts +1 -0
  83. package/dist/esm/api/types/DimensionalUsageBasedRateInterface.d.mts +3 -0
  84. package/dist/esm/api/types/FixedRateInterface.d.mts +2 -0
  85. package/dist/esm/api/types/LastAggregationPricingMetricInterface.d.mts +1 -0
  86. package/dist/esm/api/types/MaxAggregationPricingMetricInterface.d.mts +1 -0
  87. package/dist/esm/api/types/Period.d.mts +9 -0
  88. package/dist/esm/api/types/Period.mjs +4 -0
  89. package/dist/esm/api/types/PricingMetricInterface.d.mts +2 -0
  90. package/dist/esm/api/types/SimpleUsageBasedRateInterface.d.mts +3 -0
  91. package/dist/esm/api/types/SumAggregationPricingMetricInterface.d.mts +1 -0
  92. package/dist/esm/api/types/index.d.mts +4 -1
  93. package/dist/esm/api/types/index.mjs +4 -1
  94. package/dist/esm/version.d.mts +1 -1
  95. package/dist/esm/version.mjs +1 -1
  96. package/package.json +1 -1
  97. package/reference.md +111 -351
  98. package/dist/cjs/api/resources/creditPools/client/Client.d.ts +0 -53
  99. package/dist/cjs/api/resources/creditPools/client/Client.js +0 -204
  100. package/dist/cjs/api/resources/creditPools/client/index.d.ts +0 -1
  101. package/dist/cjs/api/resources/creditPools/index.d.ts +0 -1
  102. package/dist/cjs/api/resources/creditPools/index.js +0 -17
  103. package/dist/cjs/api/resources/pricingPlans/client/Client.d.ts +0 -72
  104. package/dist/cjs/api/resources/pricingPlans/client/Client.js +0 -305
  105. package/dist/cjs/api/resources/pricingPlans/client/index.d.ts +0 -1
  106. package/dist/cjs/api/resources/pricingPlans/index.d.ts +0 -1
  107. package/dist/cjs/api/resources/pricingPlans/index.js +0 -17
  108. package/dist/esm/api/resources/creditPools/client/Client.d.mts +0 -53
  109. package/dist/esm/api/resources/creditPools/client/Client.mjs +0 -167
  110. package/dist/esm/api/resources/creditPools/client/index.d.mts +0 -1
  111. package/dist/esm/api/resources/creditPools/client/index.mjs +0 -1
  112. package/dist/esm/api/resources/creditPools/index.d.mts +0 -1
  113. package/dist/esm/api/resources/creditPools/index.mjs +0 -1
  114. package/dist/esm/api/resources/pricingPlans/client/Client.d.mts +0 -72
  115. package/dist/esm/api/resources/pricingPlans/client/Client.mjs +0 -268
  116. package/dist/esm/api/resources/pricingPlans/client/index.d.mts +0 -1
  117. package/dist/esm/api/resources/pricingPlans/client/index.mjs +0 -1
  118. package/dist/esm/api/resources/pricingPlans/index.d.mts +0 -1
  119. package/dist/esm/api/resources/pricingPlans/index.mjs +0 -1
  120. /package/dist/cjs/api/resources/checkout/client/requests/{CreateRateCardCheckoutRequest.js → CreateSubscriptionCheckoutSessionRequest.js} +0 -0
  121. /package/dist/cjs/api/types/{CreateRateCardCheckoutResponse.js → CompleteSubscriptionCheckoutResponse.js} +0 -0
  122. /package/dist/esm/api/resources/checkout/client/requests/{CreateRateCardCheckoutRequest.mjs → CreateSubscriptionCheckoutSessionRequest.mjs} +0 -0
  123. /package/dist/esm/api/types/{CreateRateCardCheckoutResponse.mjs → CompleteSubscriptionCheckoutResponse.mjs} +0 -0
package/README.md CHANGED
@@ -22,8 +22,8 @@ Instantiate and use the client with the following:
22
22
  ```typescript
23
23
  import { LarkClient } from "lark-billing";
24
24
 
25
- const client = new LarkClient({ environment: "YOUR_BASE_URL" });
26
- await client.checkout.createRateCardCheckoutSession({
25
+ const client = new LarkClient({ environment: "YOUR_BASE_URL", apiKey: "YOUR_API_KEY" });
26
+ await client.checkout.createSubscriptionCheckoutSession({
27
27
  subject_id: "subject_id",
28
28
  rate_card_id: "rate_card_id",
29
29
  });
@@ -37,7 +37,7 @@ following namespace:
37
37
  ```typescript
38
38
  import { Lark } from "lark-billing";
39
39
 
40
- const request: Lark.CreateRateCardCheckoutRequest = {
40
+ const request: Lark.CreateSubscriptionCheckoutSessionRequest = {
41
41
  ...
42
42
  };
43
43
  ```
@@ -51,7 +51,7 @@ will be thrown.
51
51
  import { LarkError } from "lark-billing";
52
52
 
53
53
  try {
54
- await client.checkout.createRateCardCheckoutSession(...);
54
+ await client.checkout.createSubscriptionCheckoutSession(...);
55
55
  } catch (err) {
56
56
  if (err instanceof LarkError) {
57
57
  console.log(err.statusCode);
@@ -69,7 +69,7 @@ try {
69
69
  If you would like to send additional headers as part of the request, use the `headers` request option.
70
70
 
71
71
  ```typescript
72
- const response = await client.checkout.createRateCardCheckoutSession(..., {
72
+ const response = await client.checkout.createSubscriptionCheckoutSession(..., {
73
73
  headers: {
74
74
  'X-Custom-Header': 'custom value'
75
75
  }
@@ -81,7 +81,7 @@ const response = await client.checkout.createRateCardCheckoutSession(..., {
81
81
  If you would like to send additional query string parameters as part of the request, use the `queryParams` request option.
82
82
 
83
83
  ```typescript
84
- const response = await client.checkout.createRateCardCheckoutSession(..., {
84
+ const response = await client.checkout.createSubscriptionCheckoutSession(..., {
85
85
  queryParams: {
86
86
  'customQueryParamKey': 'custom query param value'
87
87
  }
@@ -103,7 +103,7 @@ A request is deemed retryable when any of the following HTTP status codes is ret
103
103
  Use the `maxRetries` request option to configure this behavior.
104
104
 
105
105
  ```typescript
106
- const response = await client.checkout.createRateCardCheckoutSession(..., {
106
+ const response = await client.checkout.createSubscriptionCheckoutSession(..., {
107
107
  maxRetries: 0 // override maxRetries at the request level
108
108
  });
109
109
  ```
@@ -113,7 +113,7 @@ const response = await client.checkout.createRateCardCheckoutSession(..., {
113
113
  The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
114
114
 
115
115
  ```typescript
116
- const response = await client.checkout.createRateCardCheckoutSession(..., {
116
+ const response = await client.checkout.createSubscriptionCheckoutSession(..., {
117
117
  timeoutInSeconds: 30 // override timeout to 30s
118
118
  });
119
119
  ```
@@ -124,7 +124,7 @@ The SDK allows users to abort requests at any point by passing in an abort signa
124
124
 
125
125
  ```typescript
126
126
  const controller = new AbortController();
127
- const response = await client.checkout.createRateCardCheckoutSession(..., {
127
+ const response = await client.checkout.createSubscriptionCheckoutSession(..., {
128
128
  abortSignal: controller.signal
129
129
  });
130
130
  controller.abort(); // aborts the request
@@ -136,7 +136,7 @@ The SDK provides access to raw response data, including headers, through the `.w
136
136
  The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
137
137
 
138
138
  ```typescript
139
- const { data, rawResponse } = await client.checkout.createRateCardCheckoutSession(...).withRawResponse();
139
+ const { data, rawResponse } = await client.checkout.createSubscriptionCheckoutSession(...).withRawResponse();
140
140
 
141
141
  console.log(data);
142
142
  console.log(rawResponse.headers['X-My-Header']);
@@ -8,13 +8,12 @@ import { UsageEvents } from "./api/resources/usageEvents/client/Client.js";
8
8
  import { Subscriptions } from "./api/resources/subscriptions/client/Client.js";
9
9
  import { FeatureAccess } from "./api/resources/featureAccess/client/Client.js";
10
10
  import { Subjects } from "./api/resources/subjects/client/Client.js";
11
- import { PricingPlans } from "./api/resources/pricingPlans/client/Client.js";
12
- import { CreditPools } from "./api/resources/creditPools/client/Client.js";
13
11
  export declare namespace LarkClient {
14
12
  interface Options {
15
13
  environment: core.Supplier<string>;
16
14
  /** Specify a custom URL to connect the client to. */
17
15
  baseUrl?: core.Supplier<string>;
16
+ apiKey?: core.Supplier<string | undefined>;
18
17
  /** Additional headers to include in requests. */
19
18
  headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
20
19
  }
@@ -39,8 +38,6 @@ export declare class LarkClient {
39
38
  protected _subscriptions: Subscriptions | undefined;
40
39
  protected _featureAccess: FeatureAccess | undefined;
41
40
  protected _subjects: Subjects | undefined;
42
- protected _pricingPlans: PricingPlans | undefined;
43
- protected _creditPools: CreditPools | undefined;
44
41
  constructor(_options: LarkClient.Options);
45
42
  get checkout(): Checkout;
46
43
  get rateCards(): RateCards;
@@ -48,6 +45,4 @@ export declare class LarkClient {
48
45
  get subscriptions(): Subscriptions;
49
46
  get featureAccess(): FeatureAccess;
50
47
  get subjects(): Subjects;
51
- get pricingPlans(): PricingPlans;
52
- get creditPools(): CreditPools;
53
48
  }
@@ -45,15 +45,13 @@ const Client_js_3 = require("./api/resources/usageEvents/client/Client.js");
45
45
  const Client_js_4 = require("./api/resources/subscriptions/client/Client.js");
46
46
  const Client_js_5 = require("./api/resources/featureAccess/client/Client.js");
47
47
  const Client_js_6 = require("./api/resources/subjects/client/Client.js");
48
- const Client_js_7 = require("./api/resources/pricingPlans/client/Client.js");
49
- const Client_js_8 = require("./api/resources/creditPools/client/Client.js");
50
48
  class LarkClient {
51
49
  constructor(_options) {
52
50
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
53
51
  "X-Fern-Language": "JavaScript",
54
52
  "X-Fern-SDK-Name": "lark-billing",
55
- "X-Fern-SDK-Version": "0.0.5",
56
- "User-Agent": "lark-billing/0.0.5",
53
+ "X-Fern-SDK-Version": "0.0.6",
54
+ "User-Agent": "lark-billing/0.0.6",
57
55
  "X-Fern-Runtime": core.RUNTIME.type,
58
56
  "X-Fern-Runtime-Version": core.RUNTIME.version,
59
57
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -82,13 +80,5 @@ class LarkClient {
82
80
  var _a;
83
81
  return ((_a = this._subjects) !== null && _a !== void 0 ? _a : (this._subjects = new Client_js_6.Subjects(this._options)));
84
82
  }
85
- get pricingPlans() {
86
- var _a;
87
- return ((_a = this._pricingPlans) !== null && _a !== void 0 ? _a : (this._pricingPlans = new Client_js_7.PricingPlans(this._options)));
88
- }
89
- get creditPools() {
90
- var _a;
91
- return ((_a = this._creditPools) !== null && _a !== void 0 ? _a : (this._creditPools = new Client_js_8.CreditPools(this._options)));
92
- }
93
83
  }
94
84
  exports.LarkClient = LarkClient;
@@ -8,6 +8,7 @@ export declare namespace Checkout {
8
8
  environment: core.Supplier<string>;
9
9
  /** Specify a custom URL to connect the client to. */
10
10
  baseUrl?: core.Supplier<string>;
11
+ apiKey?: core.Supplier<string | undefined>;
11
12
  /** Additional headers to include in requests. */
12
13
  headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
13
14
  }
@@ -28,17 +29,31 @@ export declare class Checkout {
28
29
  protected readonly _options: Checkout.Options;
29
30
  constructor(_options: Checkout.Options);
30
31
  /**
31
- * @param {Lark.CreateRateCardCheckoutRequest} request
32
+ * @param {Lark.CreateSubscriptionCheckoutSessionRequest} request
32
33
  * @param {Checkout.RequestOptions} requestOptions - Request-specific configuration.
33
34
  *
34
35
  * @throws {@link Lark.UnprocessableEntityError}
35
36
  *
36
37
  * @example
37
- * await client.checkout.createRateCardCheckoutSession({
38
+ * await client.checkout.createSubscriptionCheckoutSession({
38
39
  * subject_id: "subject_id",
39
40
  * rate_card_id: "rate_card_id"
40
41
  * })
41
42
  */
42
- createRateCardCheckoutSession(request: Lark.CreateRateCardCheckoutRequest, requestOptions?: Checkout.RequestOptions): core.HttpResponsePromise<Lark.CreateRateCardCheckoutResponse>;
43
- private __createRateCardCheckoutSession;
43
+ createSubscriptionCheckoutSession(request: Lark.CreateSubscriptionCheckoutSessionRequest, requestOptions?: Checkout.RequestOptions): core.HttpResponsePromise<Lark.CreateSubscriptionCheckoutSessionResponse>;
44
+ private __createSubscriptionCheckoutSession;
45
+ /**
46
+ * @param {string} checkoutId
47
+ * @param {Checkout.RequestOptions} requestOptions - Request-specific configuration.
48
+ *
49
+ * @throws {@link Lark.UnprocessableEntityError}
50
+ *
51
+ * @example
52
+ * await client.checkout.completeSubscriptionCheckout("checkout_id")
53
+ */
54
+ completeSubscriptionCheckout(checkoutId: string, requestOptions?: Checkout.RequestOptions): core.HttpResponsePromise<Lark.CompleteSubscriptionCheckoutResponse>;
55
+ private __completeSubscriptionCheckout;
56
+ protected _getCustomAuthorizationHeaders(): Promise<{
57
+ "X-API-Key": string | undefined;
58
+ }>;
44
59
  }
@@ -55,26 +55,26 @@ class Checkout {
55
55
  this._options = _options;
56
56
  }
57
57
  /**
58
- * @param {Lark.CreateRateCardCheckoutRequest} request
58
+ * @param {Lark.CreateSubscriptionCheckoutSessionRequest} request
59
59
  * @param {Checkout.RequestOptions} requestOptions - Request-specific configuration.
60
60
  *
61
61
  * @throws {@link Lark.UnprocessableEntityError}
62
62
  *
63
63
  * @example
64
- * await client.checkout.createRateCardCheckoutSession({
64
+ * await client.checkout.createSubscriptionCheckoutSession({
65
65
  * subject_id: "subject_id",
66
66
  * rate_card_id: "rate_card_id"
67
67
  * })
68
68
  */
69
- createRateCardCheckoutSession(request, requestOptions) {
70
- return core.HttpResponsePromise.fromPromise(this.__createRateCardCheckoutSession(request, requestOptions));
69
+ createSubscriptionCheckoutSession(request, requestOptions) {
70
+ return core.HttpResponsePromise.fromPromise(this.__createSubscriptionCheckoutSession(request, requestOptions));
71
71
  }
72
- __createRateCardCheckoutSession(request, requestOptions) {
72
+ __createSubscriptionCheckoutSession(request, requestOptions) {
73
73
  return __awaiter(this, void 0, void 0, function* () {
74
74
  var _a, _b;
75
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
75
+ 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);
76
76
  const _response = yield core.fetcher({
77
- url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "checkout/rate-card"),
77
+ url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "checkout"),
78
78
  method: "POST",
79
79
  headers: _headers,
80
80
  contentType: "application/json",
@@ -86,7 +86,10 @@ class Checkout {
86
86
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
87
87
  });
88
88
  if (_response.ok) {
89
- return { data: _response.body, rawResponse: _response.rawResponse };
89
+ return {
90
+ data: _response.body,
91
+ rawResponse: _response.rawResponse,
92
+ };
90
93
  }
91
94
  if (_response.error.reason === "status-code") {
92
95
  switch (_response.error.statusCode) {
@@ -108,7 +111,7 @@ class Checkout {
108
111
  rawResponse: _response.rawResponse,
109
112
  });
110
113
  case "timeout":
111
- throw new errors.LarkTimeoutError("Timeout exceeded when calling POST /checkout/rate-card.");
114
+ throw new errors.LarkTimeoutError("Timeout exceeded when calling POST /checkout.");
112
115
  case "unknown":
113
116
  throw new errors.LarkError({
114
117
  message: _response.error.errorMessage,
@@ -117,5 +120,71 @@ class Checkout {
117
120
  }
118
121
  });
119
122
  }
123
+ /**
124
+ * @param {string} checkoutId
125
+ * @param {Checkout.RequestOptions} requestOptions - Request-specific configuration.
126
+ *
127
+ * @throws {@link Lark.UnprocessableEntityError}
128
+ *
129
+ * @example
130
+ * await client.checkout.completeSubscriptionCheckout("checkout_id")
131
+ */
132
+ completeSubscriptionCheckout(checkoutId, requestOptions) {
133
+ return core.HttpResponsePromise.fromPromise(this.__completeSubscriptionCheckout(checkoutId, requestOptions));
134
+ }
135
+ __completeSubscriptionCheckout(checkoutId, requestOptions) {
136
+ return __awaiter(this, void 0, void 0, function* () {
137
+ var _a, _b;
138
+ 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);
139
+ const _response = yield core.fetcher({
140
+ url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `checkout/${encodeURIComponent(checkoutId)}/complete`),
141
+ method: "POST",
142
+ headers: _headers,
143
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
144
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
145
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
146
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
147
+ });
148
+ if (_response.ok) {
149
+ return {
150
+ data: _response.body,
151
+ rawResponse: _response.rawResponse,
152
+ };
153
+ }
154
+ if (_response.error.reason === "status-code") {
155
+ switch (_response.error.statusCode) {
156
+ case 422:
157
+ throw new Lark.UnprocessableEntityError(_response.error.body, _response.rawResponse);
158
+ default:
159
+ throw new errors.LarkError({
160
+ statusCode: _response.error.statusCode,
161
+ body: _response.error.body,
162
+ rawResponse: _response.rawResponse,
163
+ });
164
+ }
165
+ }
166
+ switch (_response.error.reason) {
167
+ case "non-json":
168
+ throw new errors.LarkError({
169
+ statusCode: _response.error.statusCode,
170
+ body: _response.error.rawBody,
171
+ rawResponse: _response.rawResponse,
172
+ });
173
+ case "timeout":
174
+ throw new errors.LarkTimeoutError("Timeout exceeded when calling POST /checkout/{checkout_id}/complete.");
175
+ case "unknown":
176
+ throw new errors.LarkError({
177
+ message: _response.error.errorMessage,
178
+ rawResponse: _response.rawResponse,
179
+ });
180
+ }
181
+ });
182
+ }
183
+ _getCustomAuthorizationHeaders() {
184
+ return __awaiter(this, void 0, void 0, function* () {
185
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
186
+ return { "X-API-Key": apiKeyValue };
187
+ });
188
+ }
120
189
  }
121
190
  exports.Checkout = Checkout;
@@ -8,7 +8,7 @@
8
8
  * rate_card_id: "rate_card_id"
9
9
  * }
10
10
  */
11
- export interface CreateRateCardCheckoutRequest {
11
+ export interface CreateSubscriptionCheckoutSessionRequest {
12
12
  subject_id: string;
13
13
  rate_card_id: string;
14
14
  rate_card_overrides?: Record<string, string>;
@@ -1 +1 @@
1
- export { type CreateRateCardCheckoutRequest } from "./CreateRateCardCheckoutRequest.js";
1
+ export { type CreateSubscriptionCheckoutSessionRequest } from "./CreateSubscriptionCheckoutSessionRequest.js";
@@ -8,6 +8,7 @@ export declare namespace FeatureAccess {
8
8
  environment: core.Supplier<string>;
9
9
  /** Specify a custom URL to connect the client to. */
10
10
  baseUrl?: core.Supplier<string>;
11
+ apiKey?: core.Supplier<string | undefined>;
11
12
  /** Additional headers to include in requests. */
12
13
  headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
13
14
  }
@@ -37,4 +38,7 @@ export declare class FeatureAccess {
37
38
  */
38
39
  getFeatureAccess(requestOptions?: FeatureAccess.RequestOptions): core.HttpResponsePromise<Lark.CheckFeatureAccessResponse>;
39
40
  private __getFeatureAccess;
41
+ protected _getCustomAuthorizationHeaders(): Promise<{
42
+ "X-API-Key": string | undefined;
43
+ }>;
40
44
  }
@@ -68,7 +68,7 @@ class FeatureAccess {
68
68
  __getFeatureAccess(requestOptions) {
69
69
  return __awaiter(this, void 0, void 0, function* () {
70
70
  var _a, _b;
71
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
71
+ 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);
72
72
  const _response = yield core.fetcher({
73
73
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "feature-access"),
74
74
  method: "GET",
@@ -110,5 +110,11 @@ class FeatureAccess {
110
110
  }
111
111
  });
112
112
  }
113
+ _getCustomAuthorizationHeaders() {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
116
+ return { "X-API-Key": apiKeyValue };
117
+ });
118
+ }
113
119
  }
114
120
  exports.FeatureAccess = FeatureAccess;
@@ -5,8 +5,6 @@ export * as usageEvents from "./usageEvents/index.js";
5
5
  export * as subscriptions from "./subscriptions/index.js";
6
6
  export * as featureAccess from "./featureAccess/index.js";
7
7
  export * as subjects from "./subjects/index.js";
8
- export * as pricingPlans from "./pricingPlans/index.js";
9
- export * as creditPools from "./creditPools/index.js";
10
8
  export * from "./checkout/client/requests/index.js";
11
9
  export * from "./rateCards/client/requests/index.js";
12
10
  export * from "./usageEvents/client/requests/index.js";
@@ -36,7 +36,7 @@ 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.creditPools = exports.pricingPlans = exports.subjects = exports.featureAccess = exports.subscriptions = exports.usageEvents = exports.checkout = exports.rateCards = void 0;
39
+ exports.subjects = exports.featureAccess = exports.subscriptions = exports.usageEvents = exports.checkout = exports.rateCards = void 0;
40
40
  exports.rateCards = __importStar(require("./rateCards/index.js"));
41
41
  __exportStar(require("./rateCards/types/index.js"), exports);
42
42
  exports.checkout = __importStar(require("./checkout/index.js"));
@@ -44,8 +44,6 @@ exports.usageEvents = __importStar(require("./usageEvents/index.js"));
44
44
  exports.subscriptions = __importStar(require("./subscriptions/index.js"));
45
45
  exports.featureAccess = __importStar(require("./featureAccess/index.js"));
46
46
  exports.subjects = __importStar(require("./subjects/index.js"));
47
- exports.pricingPlans = __importStar(require("./pricingPlans/index.js"));
48
- exports.creditPools = __importStar(require("./creditPools/index.js"));
49
47
  __exportStar(require("./checkout/client/requests/index.js"), exports);
50
48
  __exportStar(require("./rateCards/client/requests/index.js"), exports);
51
49
  __exportStar(require("./usageEvents/client/requests/index.js"), exports);
@@ -8,6 +8,7 @@ export declare namespace RateCards {
8
8
  environment: core.Supplier<string>;
9
9
  /** Specify a custom URL to connect the client to. */
10
10
  baseUrl?: core.Supplier<string>;
11
+ apiKey?: core.Supplier<string | undefined>;
11
12
  /** Additional headers to include in requests. */
12
13
  headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
13
14
  }
@@ -53,6 +54,7 @@ export declare class RateCards {
53
54
  * description: "description",
54
55
  * usage_based_rates: [{
55
56
  * usage_based_rate_type: "dimensional",
57
+ * code: "code",
56
58
  * name: "name",
57
59
  * pricing_metric: {
58
60
  * name: "name",
@@ -129,10 +131,13 @@ export declare class RateCards {
129
131
  * description: "description",
130
132
  * usage_based_rates: [{
131
133
  * usage_based_rate_type: "dimensional",
134
+ * id: "id",
135
+ * code: "code",
132
136
  * name: "name",
133
137
  * description: "description",
134
138
  * included_units: 1,
135
139
  * pricing_metric: {
140
+ * id: "id",
136
141
  * name: "name",
137
142
  * event_name: "event_name",
138
143
  * aggregation: {
@@ -165,4 +170,7 @@ export declare class RateCards {
165
170
  */
166
171
  createRateCardVersion(rateCardId: string, request: Lark.CreateRateCardVersionRequest, requestOptions?: RateCards.RequestOptions): core.HttpResponsePromise<Lark.CreateRateCardVersionResponse>;
167
172
  private __createRateCardVersion;
173
+ protected _getCustomAuthorizationHeaders(): Promise<{
174
+ "X-API-Key": string | undefined;
175
+ }>;
168
176
  }
@@ -80,7 +80,7 @@ class RateCards {
80
80
  if (offset != null) {
81
81
  _queryParams["offset"] = offset.toString();
82
82
  }
83
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
83
+ 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);
84
84
  const _response = yield core.fetcher({
85
85
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "rate-cards"),
86
86
  method: "GET",
@@ -134,6 +134,7 @@ class RateCards {
134
134
  * description: "description",
135
135
  * usage_based_rates: [{
136
136
  * usage_based_rate_type: "dimensional",
137
+ * code: "code",
137
138
  * name: "name",
138
139
  * pricing_metric: {
139
140
  * name: "name",
@@ -172,7 +173,7 @@ class RateCards {
172
173
  __createRateCard(request, requestOptions) {
173
174
  return __awaiter(this, void 0, void 0, function* () {
174
175
  var _a, _b;
175
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
176
+ 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);
176
177
  const _response = yield core.fetcher({
177
178
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "rate-cards"),
178
179
  method: "POST",
@@ -232,7 +233,7 @@ class RateCards {
232
233
  __getRateCard(rateCardId, requestOptions) {
233
234
  return __awaiter(this, void 0, void 0, function* () {
234
235
  var _a, _b;
235
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
236
+ 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);
236
237
  const _response = yield core.fetcher({
237
238
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `rate-cards/${encodeURIComponent(rateCardId)}`),
238
239
  method: "GET",
@@ -287,7 +288,7 @@ class RateCards {
287
288
  __deleteRateCard(rateCardId, requestOptions) {
288
289
  return __awaiter(this, void 0, void 0, function* () {
289
290
  var _a, _b;
290
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
291
+ 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);
291
292
  const _response = yield core.fetcher({
292
293
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `rate-cards/${encodeURIComponent(rateCardId)}`),
293
294
  method: "DELETE",
@@ -337,7 +338,7 @@ class RateCards {
337
338
  __updateRateCard(rateCardId, requestOptions) {
338
339
  return __awaiter(this, void 0, void 0, function* () {
339
340
  var _a, _b;
340
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
341
+ 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);
341
342
  const _response = yield core.fetcher({
342
343
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `rate-cards/${encodeURIComponent(rateCardId)}`),
343
344
  method: "PATCH",
@@ -387,10 +388,13 @@ class RateCards {
387
388
  * description: "description",
388
389
  * usage_based_rates: [{
389
390
  * usage_based_rate_type: "dimensional",
391
+ * id: "id",
392
+ * code: "code",
390
393
  * name: "name",
391
394
  * description: "description",
392
395
  * included_units: 1,
393
396
  * pricing_metric: {
397
+ * id: "id",
394
398
  * name: "name",
395
399
  * event_name: "event_name",
396
400
  * aggregation: {
@@ -427,7 +431,7 @@ class RateCards {
427
431
  __createRateCardVersion(rateCardId, request, requestOptions) {
428
432
  return __awaiter(this, void 0, void 0, function* () {
429
433
  var _a, _b;
430
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
434
+ 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);
431
435
  const _response = yield core.fetcher({
432
436
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `rate-cards/${encodeURIComponent(rateCardId)}/versions`),
433
437
  method: "POST",
@@ -472,5 +476,11 @@ class RateCards {
472
476
  }
473
477
  });
474
478
  }
479
+ _getCustomAuthorizationHeaders() {
480
+ return __awaiter(this, void 0, void 0, function* () {
481
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
482
+ return { "X-API-Key": apiKeyValue };
483
+ });
484
+ }
475
485
  }
476
486
  exports.RateCards = RateCards;
@@ -9,6 +9,7 @@ import * as Lark from "../../../../index.js";
9
9
  * description: "description",
10
10
  * usage_based_rates: [{
11
11
  * usage_based_rate_type: "dimensional",
12
+ * code: "code",
12
13
  * name: "name",
13
14
  * pricing_metric: {
14
15
  * name: "name",
@@ -9,10 +9,13 @@ import * as Lark from "../../../../index.js";
9
9
  * description: "description",
10
10
  * usage_based_rates: [{
11
11
  * usage_based_rate_type: "dimensional",
12
+ * id: "id",
13
+ * code: "code",
12
14
  * name: "name",
13
15
  * description: "description",
14
16
  * included_units: 1,
15
17
  * pricing_metric: {
18
+ * id: "id",
16
19
  * name: "name",
17
20
  * event_name: "event_name",
18
21
  * aggregation: {
@@ -8,6 +8,7 @@ export declare namespace Subjects {
8
8
  environment: core.Supplier<string>;
9
9
  /** Specify a custom URL to connect the client to. */
10
10
  baseUrl?: core.Supplier<string>;
11
+ apiKey?: core.Supplier<string | undefined>;
11
12
  /** Additional headers to include in requests. */
12
13
  headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
13
14
  }
@@ -86,4 +87,7 @@ export declare class Subjects {
86
87
  */
87
88
  deleteSubject(subjectId: string, requestOptions?: Subjects.RequestOptions): core.HttpResponsePromise<unknown>;
88
89
  private __deleteSubject;
90
+ protected _getCustomAuthorizationHeaders(): Promise<{
91
+ "X-API-Key": string | undefined;
92
+ }>;
89
93
  }
@@ -80,7 +80,7 @@ class Subjects {
80
80
  if (offset != null) {
81
81
  _queryParams["offset"] = offset.toString();
82
82
  }
83
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
83
+ 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);
84
84
  const _response = yield core.fetcher({
85
85
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "subjects"),
86
86
  method: "GET",
@@ -137,7 +137,7 @@ class Subjects {
137
137
  __createSubject() {
138
138
  return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
139
139
  var _a, _b;
140
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
140
+ 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);
141
141
  const _response = yield core.fetcher({
142
142
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "subjects"),
143
143
  method: "POST",
@@ -197,7 +197,7 @@ class Subjects {
197
197
  __getSubject(subjectId, requestOptions) {
198
198
  return __awaiter(this, void 0, void 0, function* () {
199
199
  var _a, _b;
200
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
200
+ 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);
201
201
  const _response = yield core.fetcher({
202
202
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `subjects/${encodeURIComponent(subjectId)}`),
203
203
  method: "GET",
@@ -255,7 +255,7 @@ class Subjects {
255
255
  __updateSubject(subjectId_1) {
256
256
  return __awaiter(this, arguments, void 0, function* (subjectId, request = {}, requestOptions) {
257
257
  var _a, _b;
258
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
258
+ 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);
259
259
  const _response = yield core.fetcher({
260
260
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `subjects/${encodeURIComponent(subjectId)}`),
261
261
  method: "PUT",
@@ -315,7 +315,7 @@ class Subjects {
315
315
  __deleteSubject(subjectId, requestOptions) {
316
316
  return __awaiter(this, void 0, void 0, function* () {
317
317
  var _a, _b;
318
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
318
+ 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);
319
319
  const _response = yield core.fetcher({
320
320
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `subjects/${encodeURIComponent(subjectId)}`),
321
321
  method: "DELETE",
@@ -357,5 +357,11 @@ class Subjects {
357
357
  }
358
358
  });
359
359
  }
360
+ _getCustomAuthorizationHeaders() {
361
+ return __awaiter(this, void 0, void 0, function* () {
362
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
363
+ return { "X-API-Key": apiKeyValue };
364
+ });
365
+ }
360
366
  }
361
367
  exports.Subjects = Subjects;
@@ -8,6 +8,7 @@ export declare namespace Subscriptions {
8
8
  environment: core.Supplier<string>;
9
9
  /** Specify a custom URL to connect the client to. */
10
10
  baseUrl?: core.Supplier<string>;
11
+ apiKey?: core.Supplier<string | undefined>;
11
12
  /** Additional headers to include in requests. */
12
13
  headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
13
14
  }
@@ -85,4 +86,7 @@ export declare class Subscriptions {
85
86
  */
86
87
  updateSubscription(subscriptionId: string, requestOptions?: Subscriptions.RequestOptions): core.HttpResponsePromise<void>;
87
88
  private __updateSubscription;
89
+ protected _getCustomAuthorizationHeaders(): Promise<{
90
+ "X-API-Key": string | undefined;
91
+ }>;
88
92
  }