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
@@ -80,7 +80,7 @@ class Subscriptions {
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)), "subscriptions"),
86
86
  method: "GET",
@@ -141,7 +141,7 @@ class Subscriptions {
141
141
  __createSubscription(request, requestOptions) {
142
142
  return __awaiter(this, void 0, void 0, function* () {
143
143
  var _a, _b;
144
- 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);
144
+ 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);
145
145
  const _response = yield core.fetcher({
146
146
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "subscriptions"),
147
147
  method: "POST",
@@ -201,7 +201,7 @@ class Subscriptions {
201
201
  __getSubscription(subscriptionId, requestOptions) {
202
202
  return __awaiter(this, void 0, void 0, function* () {
203
203
  var _a, _b;
204
- 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);
204
+ 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);
205
205
  const _response = yield core.fetcher({
206
206
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `subscriptions/${encodeURIComponent(subscriptionId)}`),
207
207
  method: "GET",
@@ -256,7 +256,7 @@ class Subscriptions {
256
256
  __cancelSubscription(subscriptionId, requestOptions) {
257
257
  return __awaiter(this, void 0, void 0, function* () {
258
258
  var _a, _b;
259
- 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);
259
+ 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);
260
260
  const _response = yield core.fetcher({
261
261
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `subscriptions/${encodeURIComponent(subscriptionId)}`),
262
262
  method: "DELETE",
@@ -306,7 +306,7 @@ class Subscriptions {
306
306
  __updateSubscription(subscriptionId, requestOptions) {
307
307
  return __awaiter(this, void 0, void 0, function* () {
308
308
  var _a, _b;
309
- 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);
309
+ 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);
310
310
  const _response = yield core.fetcher({
311
311
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `subscriptions/${encodeURIComponent(subscriptionId)}`),
312
312
  method: "PATCH",
@@ -343,5 +343,11 @@ class Subscriptions {
343
343
  }
344
344
  });
345
345
  }
346
+ _getCustomAuthorizationHeaders() {
347
+ return __awaiter(this, void 0, void 0, function* () {
348
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
349
+ return { "X-API-Key": apiKeyValue };
350
+ });
351
+ }
346
352
  }
347
353
  exports.Subscriptions = Subscriptions;
@@ -8,6 +8,7 @@ export declare namespace UsageEvents {
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
  }
@@ -46,4 +47,26 @@ export declare class UsageEvents {
46
47
  */
47
48
  createUsageEvent(request: Lark.CreateUsageEventRequest, requestOptions?: UsageEvents.RequestOptions): core.HttpResponsePromise<unknown>;
48
49
  private __createUsageEvent;
50
+ /**
51
+ * @param {Lark.CreateUsageEventSummaryRequest} request
52
+ * @param {UsageEvents.RequestOptions} requestOptions - Request-specific configuration.
53
+ *
54
+ * @throws {@link Lark.UnprocessableEntityError}
55
+ *
56
+ * @example
57
+ * await client.usageEvents.createUsageEventSummary({
58
+ * event_name: "event_name",
59
+ * subject_id: "subject_id",
60
+ * period: {
61
+ * start: "2024-01-15T09:30:00Z",
62
+ * end: "2024-01-15T09:30:00Z"
63
+ * },
64
+ * aggregation_type: "sum"
65
+ * })
66
+ */
67
+ createUsageEventSummary(request: Lark.CreateUsageEventSummaryRequest, requestOptions?: UsageEvents.RequestOptions): core.HttpResponsePromise<Lark.CreateUsageEventSummaryResponse>;
68
+ private __createUsageEventSummary;
69
+ protected _getCustomAuthorizationHeaders(): Promise<{
70
+ "X-API-Key": string | undefined;
71
+ }>;
49
72
  }
@@ -77,7 +77,7 @@ class UsageEvents {
77
77
  __createUsageEvent(request, requestOptions) {
78
78
  return __awaiter(this, void 0, void 0, function* () {
79
79
  var _a, _b;
80
- 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);
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
81
  const _response = yield core.fetcher({
82
82
  url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "usage-events"),
83
83
  method: "POST",
@@ -122,5 +122,79 @@ class UsageEvents {
122
122
  }
123
123
  });
124
124
  }
125
+ /**
126
+ * @param {Lark.CreateUsageEventSummaryRequest} request
127
+ * @param {UsageEvents.RequestOptions} requestOptions - Request-specific configuration.
128
+ *
129
+ * @throws {@link Lark.UnprocessableEntityError}
130
+ *
131
+ * @example
132
+ * await client.usageEvents.createUsageEventSummary({
133
+ * event_name: "event_name",
134
+ * subject_id: "subject_id",
135
+ * period: {
136
+ * start: "2024-01-15T09:30:00Z",
137
+ * end: "2024-01-15T09:30:00Z"
138
+ * },
139
+ * aggregation_type: "sum"
140
+ * })
141
+ */
142
+ createUsageEventSummary(request, requestOptions) {
143
+ return core.HttpResponsePromise.fromPromise(this.__createUsageEventSummary(request, requestOptions));
144
+ }
145
+ __createUsageEventSummary(request, requestOptions) {
146
+ return __awaiter(this, void 0, void 0, function* () {
147
+ var _a, _b;
148
+ 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);
149
+ const _response = yield core.fetcher({
150
+ url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "usage-events/summary"),
151
+ method: "POST",
152
+ headers: _headers,
153
+ contentType: "application/json",
154
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
155
+ requestType: "json",
156
+ body: request,
157
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
158
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
159
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
160
+ });
161
+ if (_response.ok) {
162
+ return { data: _response.body, rawResponse: _response.rawResponse };
163
+ }
164
+ if (_response.error.reason === "status-code") {
165
+ switch (_response.error.statusCode) {
166
+ case 422:
167
+ throw new Lark.UnprocessableEntityError(_response.error.body, _response.rawResponse);
168
+ default:
169
+ throw new errors.LarkError({
170
+ statusCode: _response.error.statusCode,
171
+ body: _response.error.body,
172
+ rawResponse: _response.rawResponse,
173
+ });
174
+ }
175
+ }
176
+ switch (_response.error.reason) {
177
+ case "non-json":
178
+ throw new errors.LarkError({
179
+ statusCode: _response.error.statusCode,
180
+ body: _response.error.rawBody,
181
+ rawResponse: _response.rawResponse,
182
+ });
183
+ case "timeout":
184
+ throw new errors.LarkTimeoutError("Timeout exceeded when calling POST /usage-events/summary.");
185
+ case "unknown":
186
+ throw new errors.LarkError({
187
+ message: _response.error.errorMessage,
188
+ rawResponse: _response.rawResponse,
189
+ });
190
+ }
191
+ });
192
+ }
193
+ _getCustomAuthorizationHeaders() {
194
+ return __awaiter(this, void 0, void 0, function* () {
195
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
196
+ return { "X-API-Key": apiKeyValue };
197
+ });
198
+ }
125
199
  }
126
200
  exports.UsageEvents = UsageEvents;
@@ -18,5 +18,5 @@ export interface CreateUsageEventRequest {
18
18
  event_name: string;
19
19
  subject_id: string;
20
20
  timestamp: string;
21
- data: Record<string, string>;
21
+ data: Record<string, unknown>;
22
22
  }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Lark from "../../../../index.js";
5
+ /**
6
+ * @example
7
+ * {
8
+ * event_name: "event_name",
9
+ * subject_id: "subject_id",
10
+ * period: {
11
+ * start: "2024-01-15T09:30:00Z",
12
+ * end: "2024-01-15T09:30:00Z"
13
+ * },
14
+ * aggregation_type: "sum"
15
+ * }
16
+ */
17
+ export interface CreateUsageEventSummaryRequest {
18
+ event_name: string;
19
+ subject_id: string;
20
+ period: Lark.Period;
21
+ aggregation_type: CreateUsageEventSummaryRequest.AggregationType;
22
+ }
23
+ export declare namespace CreateUsageEventSummaryRequest {
24
+ type AggregationType = "sum" | "count" | "max";
25
+ const AggregationType: {
26
+ readonly Sum: "sum";
27
+ readonly Count: "count";
28
+ readonly Max: "max";
29
+ };
30
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CreateUsageEventSummaryRequest = void 0;
7
+ var CreateUsageEventSummaryRequest;
8
+ (function (CreateUsageEventSummaryRequest) {
9
+ CreateUsageEventSummaryRequest.AggregationType = {
10
+ Sum: "sum",
11
+ Count: "count",
12
+ Max: "max",
13
+ };
14
+ })(CreateUsageEventSummaryRequest || (exports.CreateUsageEventSummaryRequest = CreateUsageEventSummaryRequest = {}));
@@ -1 +1,2 @@
1
1
  export { type CreateUsageEventRequest } from "./CreateUsageEventRequest.js";
2
+ export { type CreateUsageEventSummaryRequest } from "./CreateUsageEventSummaryRequest.js";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Lark from "../index.js";
5
+ export interface CompleteSubscriptionCheckoutResponse {
6
+ id: string;
7
+ amount: Lark.Amount;
8
+ }
@@ -3,6 +3,8 @@
3
3
  */
4
4
  import * as Lark from "../index.js";
5
5
  export interface CreateDimensionalUsageBasedRateInterface {
6
+ /** Code of this rate to be used for overrides and external reference. */
7
+ code: string;
6
8
  name: string;
7
9
  description?: string;
8
10
  included_units?: number;
@@ -7,5 +7,6 @@ export interface CreateFixedRateInterface {
7
7
  description?: string;
8
8
  price?: Lark.Price;
9
9
  credit_grants?: Lark.CreateCreditGrantInterface[];
10
+ /** Code of this rate to be used for setting quantity. */
10
11
  quantity_code?: string;
11
12
  }
@@ -6,5 +6,6 @@ export interface CreatePricingMetricInterface {
6
6
  name: string;
7
7
  event_name: string;
8
8
  aggregation: Lark.Aggregation;
9
+ /** Unit of the value computed by the pricing metric. */
9
10
  unit: string;
10
11
  }
@@ -3,6 +3,8 @@
3
3
  */
4
4
  import * as Lark from "../index.js";
5
5
  export interface CreateSimpleUsageBasedRateInterface {
6
+ /** Code of this rate to be used for overrides and external reference. */
7
+ code: string;
6
8
  name: string;
7
9
  description?: string;
8
10
  price?: Lark.Price;
@@ -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 interface CreateSubscriptionCheckoutSessionResponse {
6
+ id: string;
7
+ amount: Lark.Amount;
8
+ payment_intent_client_secret?: string;
9
+ setup_intent_client_secret?: string;
10
+ }
@@ -1,2 +1,5 @@
1
1
  "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -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 interface CreateUsageEventSummaryResponse {
6
+ event_name: string;
7
+ subject_id: string;
8
+ value?: number;
9
+ period: Lark.Period;
10
+ }
@@ -1,2 +1,5 @@
1
1
  "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,5 +2,6 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  export interface CustomAggregationPricingMetricInterface {
5
+ /** SQL to compute the pricing metric. */
5
6
  sql: string;
6
7
  }
@@ -3,6 +3,9 @@
3
3
  */
4
4
  import * as Lark from "../index.js";
5
5
  export interface DimensionalUsageBasedRateInterface {
6
+ id: string;
7
+ /** Code of this rate to be used for overrides and external reference. */
8
+ code: string;
6
9
  name: string;
7
10
  description: string;
8
11
  included_units: number;
@@ -3,9 +3,11 @@
3
3
  */
4
4
  import * as Lark from "../index.js";
5
5
  export interface FixedRateInterface {
6
+ id: string;
6
7
  name: string;
7
8
  description: string;
8
9
  price?: Lark.Price;
9
10
  credit_grants: Lark.CreditGrantInterface[];
11
+ /** Code of this rate to be used for setting quantity. */
10
12
  quantity_code?: string;
11
13
  }
@@ -2,5 +2,6 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  export interface LastAggregationPricingMetricInterface {
5
+ /** Field to get the last value of. */
5
6
  value_field: string;
6
7
  }
@@ -2,5 +2,6 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  export interface MaxAggregationPricingMetricInterface {
5
+ /** Field to get the max value of. */
5
6
  value_field: string;
6
7
  }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface Period {
5
+ inclusive_start?: boolean;
6
+ inclusive_end?: boolean;
7
+ start: string;
8
+ end: string;
9
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * This file was auto-generated by Fern from our API Definition.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -3,8 +3,10 @@
3
3
  */
4
4
  import * as Lark from "../index.js";
5
5
  export interface PricingMetricInterface {
6
+ id: string;
6
7
  name: string;
7
8
  event_name: string;
8
9
  aggregation: Lark.Aggregation;
10
+ /** Unit of the value computed by the pricing metric. */
9
11
  unit: string;
10
12
  }
@@ -3,6 +3,9 @@
3
3
  */
4
4
  import * as Lark from "../index.js";
5
5
  export interface SimpleUsageBasedRateInterface {
6
+ id: string;
7
+ /** Code of this rate to be used for overrides and external reference. */
8
+ code: string;
6
9
  name: string;
7
10
  description: string;
8
11
  price?: Lark.Price;
@@ -2,5 +2,6 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
  export interface SumAggregationPricingMetricInterface {
5
+ /** Field to sum over. */
5
6
  value_field: string;
6
7
  }
@@ -1,6 +1,7 @@
1
1
  export * from "./Amount.js";
2
2
  export * from "./CheckFeatureAccessRequest.js";
3
3
  export * from "./CheckFeatureAccessResponse.js";
4
+ export * from "./CompleteSubscriptionCheckoutResponse.js";
4
5
  export * from "./CountAggregationPricingMetricInterface.js";
5
6
  export * from "./CreateCreditGrantInterfaceExpiration.js";
6
7
  export * from "./CreateCreditGrantInterface.js";
@@ -13,13 +14,14 @@ export * from "./CreatePricingMatrixCellInterface.js";
13
14
  export * from "./CreatePricingMatrixInterface.js";
14
15
  export * from "./Aggregation.js";
15
16
  export * from "./CreatePricingMetricInterface.js";
16
- export * from "./CreateRateCardCheckoutResponse.js";
17
17
  export * from "./CreateRateCardResponseUsageBasedRatesItem.js";
18
18
  export * from "./CreateRateCardResponse.js";
19
19
  export * from "./CreateRateCardVersionResponseUsageBasedRatesItem.js";
20
20
  export * from "./CreateRateCardVersionResponse.js";
21
21
  export * from "./CreateSimpleUsageBasedRateInterface.js";
22
22
  export * from "./CreateSubjectResponse.js";
23
+ export * from "./CreateSubscriptionCheckoutSessionResponse.js";
24
+ export * from "./CreateUsageEventSummaryResponse.js";
23
25
  export * from "./CreditGrantDateTimeExpirationInterface.js";
24
26
  export * from "./CreditGrantDateTimeExpirationResource.js";
25
27
  export * from "./CreditGrantDurationExpirationInterface.js";
@@ -54,6 +56,7 @@ export * from "./ListSubjectsResponse.js";
54
56
  export * from "./ListSubscriptionsResponse.js";
55
57
  export * from "./MaxAggregationPricingMetricInterface.js";
56
58
  export * from "./PackagePrice.js";
59
+ export * from "./Period.js";
57
60
  export * from "./PricingMatrixCellInterface.js";
58
61
  export * from "./PricingMatrixInterface.js";
59
62
  export * from "./PricingMetricInterface.js";
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Amount.js"), exports);
18
18
  __exportStar(require("./CheckFeatureAccessRequest.js"), exports);
19
19
  __exportStar(require("./CheckFeatureAccessResponse.js"), exports);
20
+ __exportStar(require("./CompleteSubscriptionCheckoutResponse.js"), exports);
20
21
  __exportStar(require("./CountAggregationPricingMetricInterface.js"), exports);
21
22
  __exportStar(require("./CreateCreditGrantInterfaceExpiration.js"), exports);
22
23
  __exportStar(require("./CreateCreditGrantInterface.js"), exports);
@@ -29,13 +30,14 @@ __exportStar(require("./CreatePricingMatrixCellInterface.js"), exports);
29
30
  __exportStar(require("./CreatePricingMatrixInterface.js"), exports);
30
31
  __exportStar(require("./Aggregation.js"), exports);
31
32
  __exportStar(require("./CreatePricingMetricInterface.js"), exports);
32
- __exportStar(require("./CreateRateCardCheckoutResponse.js"), exports);
33
33
  __exportStar(require("./CreateRateCardResponseUsageBasedRatesItem.js"), exports);
34
34
  __exportStar(require("./CreateRateCardResponse.js"), exports);
35
35
  __exportStar(require("./CreateRateCardVersionResponseUsageBasedRatesItem.js"), exports);
36
36
  __exportStar(require("./CreateRateCardVersionResponse.js"), exports);
37
37
  __exportStar(require("./CreateSimpleUsageBasedRateInterface.js"), exports);
38
38
  __exportStar(require("./CreateSubjectResponse.js"), exports);
39
+ __exportStar(require("./CreateSubscriptionCheckoutSessionResponse.js"), exports);
40
+ __exportStar(require("./CreateUsageEventSummaryResponse.js"), exports);
39
41
  __exportStar(require("./CreditGrantDateTimeExpirationInterface.js"), exports);
40
42
  __exportStar(require("./CreditGrantDateTimeExpirationResource.js"), exports);
41
43
  __exportStar(require("./CreditGrantDurationExpirationInterface.js"), exports);
@@ -70,6 +72,7 @@ __exportStar(require("./ListSubjectsResponse.js"), exports);
70
72
  __exportStar(require("./ListSubscriptionsResponse.js"), exports);
71
73
  __exportStar(require("./MaxAggregationPricingMetricInterface.js"), exports);
72
74
  __exportStar(require("./PackagePrice.js"), exports);
75
+ __exportStar(require("./Period.js"), exports);
73
76
  __exportStar(require("./PricingMatrixCellInterface.js"), exports);
74
77
  __exportStar(require("./PricingMatrixInterface.js"), exports);
75
78
  __exportStar(require("./PricingMetricInterface.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.5";
1
+ export declare const SDK_VERSION = "0.0.6";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.0.5";
4
+ exports.SDK_VERSION = "0.0.6";
@@ -8,13 +8,12 @@ import { UsageEvents } from "./api/resources/usageEvents/client/Client.mjs";
8
8
  import { Subscriptions } from "./api/resources/subscriptions/client/Client.mjs";
9
9
  import { FeatureAccess } from "./api/resources/featureAccess/client/Client.mjs";
10
10
  import { Subjects } from "./api/resources/subjects/client/Client.mjs";
11
- import { PricingPlans } from "./api/resources/pricingPlans/client/Client.mjs";
12
- import { CreditPools } from "./api/resources/creditPools/client/Client.mjs";
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
  }
@@ -9,15 +9,13 @@ import { UsageEvents } from "./api/resources/usageEvents/client/Client.mjs";
9
9
  import { Subscriptions } from "./api/resources/subscriptions/client/Client.mjs";
10
10
  import { FeatureAccess } from "./api/resources/featureAccess/client/Client.mjs";
11
11
  import { Subjects } from "./api/resources/subjects/client/Client.mjs";
12
- import { PricingPlans } from "./api/resources/pricingPlans/client/Client.mjs";
13
- import { CreditPools } from "./api/resources/creditPools/client/Client.mjs";
14
12
  export class LarkClient {
15
13
  constructor(_options) {
16
14
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
17
15
  "X-Fern-Language": "JavaScript",
18
16
  "X-Fern-SDK-Name": "lark-billing",
19
- "X-Fern-SDK-Version": "0.0.5",
20
- "User-Agent": "lark-billing/0.0.5",
17
+ "X-Fern-SDK-Version": "0.0.6",
18
+ "User-Agent": "lark-billing/0.0.6",
21
19
  "X-Fern-Runtime": core.RUNTIME.type,
22
20
  "X-Fern-Runtime-Version": core.RUNTIME.version,
23
21
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -46,12 +44,4 @@ export class LarkClient {
46
44
  var _a;
47
45
  return ((_a = this._subjects) !== null && _a !== void 0 ? _a : (this._subjects = new Subjects(this._options)));
48
46
  }
49
- get pricingPlans() {
50
- var _a;
51
- return ((_a = this._pricingPlans) !== null && _a !== void 0 ? _a : (this._pricingPlans = new PricingPlans(this._options)));
52
- }
53
- get creditPools() {
54
- var _a;
55
- return ((_a = this._creditPools) !== null && _a !== void 0 ? _a : (this._creditPools = new CreditPools(this._options)));
56
- }
57
47
  }
@@ -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
  }