lark-billing 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cjs/Client.d.ts +3 -0
- package/dist/cjs/Client.js +7 -2
- package/dist/cjs/api/resources/checkout/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/checkout/client/Client.js +1 -1
- package/dist/cjs/api/resources/checkout/client/requests/CreateSubscriptionCheckoutSessionRequest.d.ts +5 -2
- package/dist/cjs/api/resources/index.d.ts +4 -1
- package/dist/cjs/api/resources/index.js +5 -2
- package/dist/cjs/api/resources/invoices/client/Client.d.ts +50 -0
- package/dist/cjs/api/resources/invoices/client/Client.js +135 -0
- package/dist/cjs/api/resources/invoices/client/index.d.ts +2 -0
- package/dist/cjs/api/resources/invoices/client/index.js +17 -0
- package/dist/cjs/api/resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.d.ts +17 -0
- package/dist/cjs/api/resources/invoices/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/invoices/client/requests/index.js +2 -0
- package/dist/cjs/api/resources/invoices/index.d.ts +1 -0
- package/dist/cjs/api/resources/invoices/index.js +17 -0
- package/dist/cjs/api/resources/pricingMetrics/client/Client.d.ts +13 -0
- package/dist/cjs/api/resources/pricingMetrics/client/Client.js +64 -0
- package/dist/cjs/api/resources/pricingMetrics/client/requests/ListPricingMetricsPricingMetricsGetRequest.d.ts +12 -0
- package/dist/cjs/api/resources/pricingMetrics/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/rateCards/client/requests/CreateRateCardRequest.d.ts +2 -2
- package/dist/cjs/api/resources/rateCards/index.d.ts +1 -0
- package/dist/cjs/api/resources/rateCards/index.js +1 -0
- package/dist/cjs/api/resources/rateCards/types/CreateRateCardRequestUsageBasedRatesItem.d.ts +10 -0
- package/dist/cjs/api/resources/rateCards/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/rateCards/types/index.js +17 -0
- package/dist/cjs/api/resources/subjects/client/requests/CreateSubjectRequest.d.ts +4 -0
- package/dist/cjs/api/resources/subjects/client/requests/UpdateSubjectRequest.d.ts +3 -1
- package/dist/cjs/api/resources/subscriptions/client/Client.d.ts +28 -2
- package/dist/cjs/api/resources/subscriptions/client/Client.js +126 -2
- package/dist/cjs/api/resources/subscriptions/client/requests/CancelSubscriptionRequest.d.ts +13 -0
- package/dist/cjs/api/resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.d.ts +12 -0
- package/dist/cjs/api/resources/subscriptions/client/requests/CreateSubscriptionRequest.d.ts +6 -3
- package/dist/cjs/api/resources/subscriptions/client/requests/index.d.ts +2 -0
- package/dist/cjs/api/types/Aggregation.d.ts +1 -10
- package/dist/cjs/api/types/{CreateFixedRateInterface.d.ts → CreateFixedRateRequest.d.ts} +1 -1
- package/dist/cjs/api/types/CreateFixedRateRequest.js +5 -0
- package/dist/cjs/api/types/{CreateSimpleUsageBasedRateInterface.d.ts → CreateSimpleUsageBasedRateRequest.d.ts} +2 -2
- package/dist/cjs/api/types/CreateSimpleUsageBasedRateRequest.js +5 -0
- package/dist/cjs/api/types/CreateSubjectResponse.d.ts +6 -0
- package/dist/cjs/api/types/InvoiceLineItemResource.d.ts +10 -0
- package/dist/cjs/api/types/InvoiceLineItemResource.js +5 -0
- package/dist/cjs/api/types/InvoiceResource.d.ts +25 -0
- package/dist/cjs/api/types/InvoiceResource.js +16 -0
- package/dist/cjs/api/types/ListInvoicesResponse.d.ts +8 -0
- package/dist/cjs/api/types/ListInvoicesResponse.js +5 -0
- package/dist/cjs/api/types/ListPricingMetricsResponse.d.ts +8 -0
- package/dist/cjs/api/types/ListPricingMetricsResponse.js +5 -0
- package/dist/cjs/api/types/PeriodResource.d.ts +9 -0
- package/dist/cjs/api/types/PeriodResource.js +5 -0
- package/dist/cjs/api/types/PricingMetricResource.d.ts +11 -0
- package/dist/cjs/api/types/PricingMetricResource.js +5 -0
- package/dist/cjs/api/types/SimpleUsageBasedRateInterface.d.ts +0 -2
- package/dist/cjs/api/types/SubjectResource.d.ts +6 -0
- package/dist/cjs/api/types/SubscriptionResource.d.ts +6 -2
- package/dist/cjs/api/types/SubscriptionResource.js +1 -0
- package/dist/cjs/api/types/index.d.ts +8 -5
- package/dist/cjs/api/types/index.js +8 -5
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +3 -0
- package/dist/esm/Client.mjs +7 -2
- package/dist/esm/api/resources/checkout/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/checkout/client/Client.mjs +1 -1
- package/dist/esm/api/resources/checkout/client/requests/CreateSubscriptionCheckoutSessionRequest.d.mts +5 -2
- package/dist/esm/api/resources/index.d.mts +4 -1
- package/dist/esm/api/resources/index.mjs +4 -1
- package/dist/esm/api/resources/invoices/client/Client.d.mts +50 -0
- package/dist/esm/api/resources/invoices/client/Client.mjs +98 -0
- package/dist/esm/api/resources/invoices/client/index.d.mts +2 -0
- package/dist/esm/api/resources/invoices/client/index.mjs +1 -0
- package/dist/esm/api/resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.d.mts +17 -0
- package/dist/esm/api/resources/invoices/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/invoices/client/requests/index.mjs +1 -0
- package/dist/esm/api/resources/invoices/index.d.mts +1 -0
- package/dist/esm/api/resources/invoices/index.mjs +1 -0
- package/dist/esm/api/resources/pricingMetrics/client/Client.d.mts +13 -0
- package/dist/esm/api/resources/pricingMetrics/client/Client.mjs +64 -0
- package/dist/esm/api/resources/pricingMetrics/client/requests/ListPricingMetricsPricingMetricsGetRequest.d.mts +12 -0
- package/dist/esm/api/resources/pricingMetrics/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/rateCards/client/requests/CreateRateCardRequest.d.mts +2 -2
- package/dist/esm/api/resources/rateCards/index.d.mts +1 -0
- package/dist/esm/api/resources/rateCards/index.mjs +1 -0
- package/dist/esm/api/resources/rateCards/types/CreateRateCardRequestUsageBasedRatesItem.d.mts +10 -0
- package/dist/esm/api/resources/rateCards/types/index.d.mts +1 -0
- package/dist/esm/api/resources/rateCards/types/index.mjs +1 -0
- package/dist/esm/api/resources/subjects/client/requests/CreateSubjectRequest.d.mts +4 -0
- package/dist/esm/api/resources/subjects/client/requests/UpdateSubjectRequest.d.mts +3 -1
- package/dist/esm/api/resources/subscriptions/client/Client.d.mts +28 -2
- package/dist/esm/api/resources/subscriptions/client/Client.mjs +126 -2
- package/dist/esm/api/resources/subscriptions/client/requests/CancelSubscriptionRequest.d.mts +13 -0
- package/dist/esm/api/resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.d.mts +12 -0
- package/dist/esm/api/resources/subscriptions/client/requests/CreateSubscriptionRequest.d.mts +6 -3
- package/dist/esm/api/resources/subscriptions/client/requests/index.d.mts +2 -0
- package/dist/esm/api/types/Aggregation.d.mts +1 -10
- package/dist/esm/api/types/{CreateFixedRateInterface.d.mts → CreateFixedRateRequest.d.mts} +1 -1
- package/dist/esm/api/types/CreateFixedRateRequest.mjs +4 -0
- package/dist/esm/api/types/{CreateSimpleUsageBasedRateInterface.d.mts → CreateSimpleUsageBasedRateRequest.d.mts} +2 -2
- package/dist/esm/api/types/CreateSimpleUsageBasedRateRequest.mjs +4 -0
- package/dist/esm/api/types/CreateSubjectResponse.d.mts +6 -0
- package/dist/esm/api/types/InvoiceLineItemResource.d.mts +10 -0
- package/dist/esm/api/types/InvoiceLineItemResource.mjs +4 -0
- package/dist/esm/api/types/InvoiceResource.d.mts +25 -0
- package/dist/esm/api/types/InvoiceResource.mjs +13 -0
- package/dist/esm/api/types/ListInvoicesResponse.d.mts +8 -0
- package/dist/esm/api/types/ListInvoicesResponse.mjs +4 -0
- package/dist/esm/api/types/ListPricingMetricsResponse.d.mts +8 -0
- package/dist/esm/api/types/ListPricingMetricsResponse.mjs +4 -0
- package/dist/esm/api/types/PeriodResource.d.mts +9 -0
- package/dist/esm/api/types/PeriodResource.mjs +4 -0
- package/dist/esm/api/types/PricingMetricResource.d.mts +11 -0
- package/dist/esm/api/types/PricingMetricResource.mjs +4 -0
- package/dist/esm/api/types/SimpleUsageBasedRateInterface.d.mts +0 -2
- package/dist/esm/api/types/SubjectResource.d.mts +6 -0
- package/dist/esm/api/types/SubscriptionResource.d.mts +6 -2
- package/dist/esm/api/types/SubscriptionResource.mjs +1 -0
- package/dist/esm/api/types/index.d.mts +8 -5
- package/dist/esm/api/types/index.mjs +8 -5
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +221 -3
- package/dist/cjs/api/types/CustomPricingMetricResource.d.ts +0 -6
- package/dist/cjs/api/types/LastAggregationPricingMetricResource.d.ts +0 -6
- package/dist/cjs/api/types/MaxAggregationPricingMetricResource.d.ts +0 -6
- package/dist/esm/api/types/CustomPricingMetricResource.d.mts +0 -6
- package/dist/esm/api/types/LastAggregationPricingMetricResource.d.mts +0 -6
- package/dist/esm/api/types/MaxAggregationPricingMetricResource.d.mts +0 -6
- /package/dist/cjs/api/{types/CreateFixedRateInterface.js → resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.js} +0 -0
- /package/dist/cjs/api/{types/CreateSimpleUsageBasedRateInterface.js → resources/pricingMetrics/client/requests/ListPricingMetricsPricingMetricsGetRequest.js} +0 -0
- /package/dist/cjs/api/{types/CustomPricingMetricResource.js → resources/rateCards/types/CreateRateCardRequestUsageBasedRatesItem.js} +0 -0
- /package/dist/cjs/api/{types/LastAggregationPricingMetricResource.js → resources/subscriptions/client/requests/CancelSubscriptionRequest.js} +0 -0
- /package/dist/cjs/api/{types/MaxAggregationPricingMetricResource.js → resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.js} +0 -0
- /package/dist/esm/api/{types/CreateFixedRateInterface.mjs → resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.mjs} +0 -0
- /package/dist/esm/api/{types/CreateSimpleUsageBasedRateInterface.mjs → resources/pricingMetrics/client/requests/ListPricingMetricsPricingMetricsGetRequest.mjs} +0 -0
- /package/dist/esm/api/{types/CustomPricingMetricResource.mjs → resources/rateCards/types/CreateRateCardRequestUsageBasedRatesItem.mjs} +0 -0
- /package/dist/esm/api/{types/LastAggregationPricingMetricResource.mjs → resources/subscriptions/client/requests/CancelSubscriptionRequest.mjs} +0 -0
- /package/dist/esm/api/{types/MaxAggregationPricingMetricResource.mjs → resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.mjs} +0 -0
|
@@ -135,8 +135,8 @@ class Subscriptions {
|
|
|
135
135
|
*
|
|
136
136
|
* @example
|
|
137
137
|
* await client.subscriptions.createSubscription({
|
|
138
|
-
* rate_card_id: "
|
|
139
|
-
* subject_id: "
|
|
138
|
+
* rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
|
|
139
|
+
* subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE"
|
|
140
140
|
* })
|
|
141
141
|
*/
|
|
142
142
|
createSubscription(request, requestOptions) {
|
|
@@ -247,6 +247,130 @@ class Subscriptions {
|
|
|
247
247
|
}
|
|
248
248
|
});
|
|
249
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* @param {string} subscriptionId
|
|
252
|
+
* @param {Lark.CancelSubscriptionRequest} request
|
|
253
|
+
* @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration.
|
|
254
|
+
*
|
|
255
|
+
* @throws {@link Lark.UnprocessableEntityError}
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* await client.subscriptions.cancelSubscription("subscription_id")
|
|
259
|
+
*/
|
|
260
|
+
cancelSubscription(subscriptionId, request = {}, requestOptions) {
|
|
261
|
+
return core.HttpResponsePromise.fromPromise(this.__cancelSubscription(subscriptionId, request, requestOptions));
|
|
262
|
+
}
|
|
263
|
+
__cancelSubscription(subscriptionId_1) {
|
|
264
|
+
return __awaiter(this, arguments, void 0, function* (subscriptionId, request = {}, requestOptions) {
|
|
265
|
+
var _a, _b, _c;
|
|
266
|
+
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);
|
|
267
|
+
const _response = yield core.fetcher({
|
|
268
|
+
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, `subscriptions/${encodeURIComponent(subscriptionId)}/cancel`),
|
|
269
|
+
method: "POST",
|
|
270
|
+
headers: _headers,
|
|
271
|
+
contentType: "application/json",
|
|
272
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
273
|
+
requestType: "json",
|
|
274
|
+
body: request,
|
|
275
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
276
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
277
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
278
|
+
});
|
|
279
|
+
if (_response.ok) {
|
|
280
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
281
|
+
}
|
|
282
|
+
if (_response.error.reason === "status-code") {
|
|
283
|
+
switch (_response.error.statusCode) {
|
|
284
|
+
case 422:
|
|
285
|
+
throw new Lark.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
286
|
+
default:
|
|
287
|
+
throw new errors.LarkError({
|
|
288
|
+
statusCode: _response.error.statusCode,
|
|
289
|
+
body: _response.error.body,
|
|
290
|
+
rawResponse: _response.rawResponse,
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
switch (_response.error.reason) {
|
|
295
|
+
case "non-json":
|
|
296
|
+
throw new errors.LarkError({
|
|
297
|
+
statusCode: _response.error.statusCode,
|
|
298
|
+
body: _response.error.rawBody,
|
|
299
|
+
rawResponse: _response.rawResponse,
|
|
300
|
+
});
|
|
301
|
+
case "timeout":
|
|
302
|
+
throw new errors.LarkTimeoutError("Timeout exceeded when calling POST /subscriptions/{subscription_id}/cancel.");
|
|
303
|
+
case "unknown":
|
|
304
|
+
throw new errors.LarkError({
|
|
305
|
+
message: _response.error.errorMessage,
|
|
306
|
+
rawResponse: _response.rawResponse,
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* @param {string} subscriptionId
|
|
313
|
+
* @param {Lark.ChangeSubscriptionRateCardRequest} request
|
|
314
|
+
* @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration.
|
|
315
|
+
*
|
|
316
|
+
* @throws {@link Lark.UnprocessableEntityError}
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* await client.subscriptions.changeSubscriptionRateCard("subscription_id", {
|
|
320
|
+
* rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB"
|
|
321
|
+
* })
|
|
322
|
+
*/
|
|
323
|
+
changeSubscriptionRateCard(subscriptionId, request, requestOptions) {
|
|
324
|
+
return core.HttpResponsePromise.fromPromise(this.__changeSubscriptionRateCard(subscriptionId, request, requestOptions));
|
|
325
|
+
}
|
|
326
|
+
__changeSubscriptionRateCard(subscriptionId, request, requestOptions) {
|
|
327
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
328
|
+
var _a, _b, _c;
|
|
329
|
+
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);
|
|
330
|
+
const _response = yield core.fetcher({
|
|
331
|
+
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, `subscriptions/${encodeURIComponent(subscriptionId)}/change-rate-card`),
|
|
332
|
+
method: "POST",
|
|
333
|
+
headers: _headers,
|
|
334
|
+
contentType: "application/json",
|
|
335
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
336
|
+
requestType: "json",
|
|
337
|
+
body: request,
|
|
338
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
339
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
340
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
341
|
+
});
|
|
342
|
+
if (_response.ok) {
|
|
343
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
344
|
+
}
|
|
345
|
+
if (_response.error.reason === "status-code") {
|
|
346
|
+
switch (_response.error.statusCode) {
|
|
347
|
+
case 422:
|
|
348
|
+
throw new Lark.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
349
|
+
default:
|
|
350
|
+
throw new errors.LarkError({
|
|
351
|
+
statusCode: _response.error.statusCode,
|
|
352
|
+
body: _response.error.body,
|
|
353
|
+
rawResponse: _response.rawResponse,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
switch (_response.error.reason) {
|
|
358
|
+
case "non-json":
|
|
359
|
+
throw new errors.LarkError({
|
|
360
|
+
statusCode: _response.error.statusCode,
|
|
361
|
+
body: _response.error.rawBody,
|
|
362
|
+
rawResponse: _response.rawResponse,
|
|
363
|
+
});
|
|
364
|
+
case "timeout":
|
|
365
|
+
throw new errors.LarkTimeoutError("Timeout exceeded when calling POST /subscriptions/{subscription_id}/change-rate-card.");
|
|
366
|
+
case "unknown":
|
|
367
|
+
throw new errors.LarkError({
|
|
368
|
+
message: _response.error.errorMessage,
|
|
369
|
+
rawResponse: _response.rawResponse,
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
}
|
|
250
374
|
_getCustomAuthorizationHeaders() {
|
|
251
375
|
return __awaiter(this, void 0, void 0, function* () {
|
|
252
376
|
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {}
|
|
7
|
+
*/
|
|
8
|
+
export interface CancelSubscriptionRequest {
|
|
9
|
+
/** The reason for cancelling the subscription. */
|
|
10
|
+
reason?: string;
|
|
11
|
+
/** Whether to cancel the subscription at end of cycle. */
|
|
12
|
+
cancel_at_end_of_cycle?: boolean;
|
|
13
|
+
}
|
|
@@ -4,12 +4,15 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
6
|
* {
|
|
7
|
-
* rate_card_id: "
|
|
8
|
-
* subject_id: "
|
|
7
|
+
* rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
|
|
8
|
+
* subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE"
|
|
9
9
|
* }
|
|
10
10
|
*/
|
|
11
11
|
export interface CreateSubscriptionRequest {
|
|
12
|
+
/** The ID of the rate card to use for the subscription. */
|
|
12
13
|
rate_card_id: string;
|
|
14
|
+
/** The ID of the subject to create the subscription for. */
|
|
13
15
|
subject_id: string;
|
|
14
|
-
metadata
|
|
16
|
+
/** Additional metadata about the subscription. You may use this to store any custom data about the subscription. */
|
|
17
|
+
metadata?: Record<string, string>;
|
|
15
18
|
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { type ListSubscriptionsSubscriptionsGetRequest } from "./ListSubscriptionsSubscriptionsGetRequest.js";
|
|
2
2
|
export { type CreateSubscriptionRequest } from "./CreateSubscriptionRequest.js";
|
|
3
|
+
export { type CancelSubscriptionRequest } from "./CancelSubscriptionRequest.js";
|
|
4
|
+
export { type ChangeSubscriptionRateCardRequest } from "./ChangeSubscriptionRateCardRequest.js";
|
|
@@ -2,20 +2,11 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
import * as Lark from "../index.js";
|
|
5
|
-
export type Aggregation = Lark.Aggregation.Count | Lark.Aggregation.
|
|
5
|
+
export type Aggregation = Lark.Aggregation.Count | Lark.Aggregation.Sum;
|
|
6
6
|
export declare namespace Aggregation {
|
|
7
7
|
interface Count extends Lark.CountAggregationPricingMetricResource {
|
|
8
8
|
aggregation_type: "count";
|
|
9
9
|
}
|
|
10
|
-
interface Custom extends Lark.CustomPricingMetricResource {
|
|
11
|
-
aggregation_type: "custom";
|
|
12
|
-
}
|
|
13
|
-
interface Last extends Lark.LastAggregationPricingMetricResource {
|
|
14
|
-
aggregation_type: "last";
|
|
15
|
-
}
|
|
16
|
-
interface Max extends Lark.MaxAggregationPricingMetricResource {
|
|
17
|
-
aggregation_type: "max";
|
|
18
|
-
}
|
|
19
10
|
interface Sum extends Lark.SumAggregationPricingMetricResource {
|
|
20
11
|
aggregation_type: "sum";
|
|
21
12
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
import * as Lark from "../index.js";
|
|
5
|
-
export interface
|
|
6
|
-
usage_based_rate_type?: "simple";
|
|
5
|
+
export interface CreateSimpleUsageBasedRateRequest {
|
|
7
6
|
name?: string;
|
|
8
7
|
description?: string;
|
|
9
8
|
price: Lark.Price;
|
|
10
9
|
included_units?: number;
|
|
10
|
+
/** The ID of the pricing metric to use for this rate. */
|
|
11
11
|
pricing_metric_id: string;
|
|
12
12
|
}
|
|
@@ -2,10 +2,16 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
export interface CreateSubjectResponse {
|
|
5
|
+
/** The ID of the subject. */
|
|
5
6
|
id: string;
|
|
7
|
+
/** The ID of the subject in your system. You may pass it to the API in place of the subject ID. */
|
|
6
8
|
external_id?: string;
|
|
9
|
+
/** The name of the subject. Used for display in the dashboard. */
|
|
7
10
|
name?: string;
|
|
11
|
+
/** The email of the subject. */
|
|
8
12
|
email?: string;
|
|
13
|
+
/** Additional metadata about the subject. You may use this to store any custom data about the subject. */
|
|
9
14
|
metadata: Record<string, string>;
|
|
15
|
+
/** The date and time the subject was created. */
|
|
10
16
|
created_at: string;
|
|
11
17
|
}
|
|
@@ -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 InvoiceLineItemResource {
|
|
6
|
+
amount: Lark.Amount;
|
|
7
|
+
description: string;
|
|
8
|
+
quantity: number;
|
|
9
|
+
price_in_unit_amount: Lark.Amount;
|
|
10
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Lark from "../index.js";
|
|
5
|
+
export interface InvoiceResource {
|
|
6
|
+
id: string;
|
|
7
|
+
merchant_id: string;
|
|
8
|
+
bill_id?: string;
|
|
9
|
+
total_amount: Lark.Amount;
|
|
10
|
+
subject_id: string;
|
|
11
|
+
created_at: string;
|
|
12
|
+
status: InvoiceResource.Status;
|
|
13
|
+
hosted_url?: string;
|
|
14
|
+
line_items: Lark.InvoiceLineItemResource[];
|
|
15
|
+
}
|
|
16
|
+
export declare namespace InvoiceResource {
|
|
17
|
+
type Status = "draft" | "open" | "paid" | "uncollectible" | "void";
|
|
18
|
+
const Status: {
|
|
19
|
+
readonly Draft: "draft";
|
|
20
|
+
readonly Open: "open";
|
|
21
|
+
readonly Paid: "paid";
|
|
22
|
+
readonly Uncollectible: "uncollectible";
|
|
23
|
+
readonly Void: "void";
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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.InvoiceResource = void 0;
|
|
7
|
+
var InvoiceResource;
|
|
8
|
+
(function (InvoiceResource) {
|
|
9
|
+
InvoiceResource.Status = {
|
|
10
|
+
Draft: "draft",
|
|
11
|
+
Open: "open",
|
|
12
|
+
Paid: "paid",
|
|
13
|
+
Uncollectible: "uncollectible",
|
|
14
|
+
Void: "void",
|
|
15
|
+
};
|
|
16
|
+
})(InvoiceResource || (exports.InvoiceResource = InvoiceResource = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Lark from "../index.js";
|
|
5
|
+
export interface PricingMetricResource {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
event_name: string;
|
|
9
|
+
aggregation: Lark.Aggregation;
|
|
10
|
+
unit: string;
|
|
11
|
+
}
|
|
@@ -2,10 +2,16 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
export interface SubjectResource {
|
|
5
|
+
/** The ID of the subject. */
|
|
5
6
|
id: string;
|
|
7
|
+
/** The ID of the subject in your system. You may pass it to the API in place of the subject ID. */
|
|
6
8
|
external_id?: string;
|
|
9
|
+
/** The name of the subject. Used for display in the dashboard. */
|
|
7
10
|
name?: string;
|
|
11
|
+
/** The email of the subject. */
|
|
8
12
|
email?: string;
|
|
13
|
+
/** Additional metadata about the subject. You may use this to store any custom data about the subject. */
|
|
9
14
|
metadata: Record<string, string>;
|
|
15
|
+
/** The date and time the subject was created. */
|
|
10
16
|
created_at: string;
|
|
11
17
|
}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
+
import * as Lark from "../index.js";
|
|
4
5
|
export interface SubscriptionResource {
|
|
5
6
|
id: string;
|
|
6
7
|
subject_id: string;
|
|
7
8
|
rate_card_id: string;
|
|
8
9
|
effective_at: string;
|
|
9
10
|
cycles_next_at?: string;
|
|
10
|
-
|
|
11
|
+
current_period?: Lark.PeriodResource;
|
|
12
|
+
metadata: Record<string, string>;
|
|
11
13
|
status: SubscriptionResource.Status;
|
|
14
|
+
cancels_at_end_of_cycle: boolean;
|
|
12
15
|
}
|
|
13
16
|
export declare namespace SubscriptionResource {
|
|
14
|
-
type Status = "active" | "cancelled";
|
|
17
|
+
type Status = "active" | "cancelled" | "paused";
|
|
15
18
|
const Status: {
|
|
16
19
|
readonly Active: "active";
|
|
17
20
|
readonly Cancelled: "cancelled";
|
|
21
|
+
readonly Paused: "paused";
|
|
18
22
|
};
|
|
19
23
|
}
|
|
@@ -4,25 +4,28 @@ export * from "./CountAggregationPricingMetricInterface.js";
|
|
|
4
4
|
export * from "./CountAggregationPricingMetricResource.js";
|
|
5
5
|
export * from "./CreateCustomerPortalSessionResponse.js";
|
|
6
6
|
export * from "./Price.js";
|
|
7
|
-
export * from "./
|
|
7
|
+
export * from "./CreateFixedRateRequest.js";
|
|
8
8
|
export * from "./Aggregation.js";
|
|
9
9
|
export * from "./CreatePricingMetricResponse.js";
|
|
10
|
-
export * from "./
|
|
10
|
+
export * from "./CreateSimpleUsageBasedRateRequest.js";
|
|
11
11
|
export * from "./CreateSubjectResponse.js";
|
|
12
12
|
export * from "./CreateSubscriptionCheckoutSessionResponse.js";
|
|
13
13
|
export * from "./CreateUsageEventSummaryResponse.js";
|
|
14
|
-
export * from "./CustomPricingMetricResource.js";
|
|
15
14
|
export * from "./FixedRateInterface.js";
|
|
16
15
|
export * from "./FlatPrice.js";
|
|
17
16
|
export * from "./GetPricingMetricResponse.js";
|
|
18
17
|
export * from "./HttpValidationError.js";
|
|
19
|
-
export * from "./
|
|
18
|
+
export * from "./InvoiceLineItemResource.js";
|
|
19
|
+
export * from "./InvoiceResource.js";
|
|
20
|
+
export * from "./ListInvoicesResponse.js";
|
|
21
|
+
export * from "./ListPricingMetricsResponse.js";
|
|
20
22
|
export * from "./ListRateCardsResponse.js";
|
|
21
23
|
export * from "./ListSubjectsResponse.js";
|
|
22
24
|
export * from "./ListSubscriptionsResponse.js";
|
|
23
|
-
export * from "./MaxAggregationPricingMetricResource.js";
|
|
24
25
|
export * from "./PackagePrice.js";
|
|
25
26
|
export * from "./Period.js";
|
|
27
|
+
export * from "./PeriodResource.js";
|
|
28
|
+
export * from "./PricingMetricResource.js";
|
|
26
29
|
export * from "./RateCardResourceUsageBasedRatesItem.js";
|
|
27
30
|
export * from "./RateCardResource.js";
|
|
28
31
|
export * from "./SimpleUsageBasedRateInterface.js";
|
|
@@ -20,25 +20,28 @@ __exportStar(require("./CountAggregationPricingMetricInterface.js"), exports);
|
|
|
20
20
|
__exportStar(require("./CountAggregationPricingMetricResource.js"), exports);
|
|
21
21
|
__exportStar(require("./CreateCustomerPortalSessionResponse.js"), exports);
|
|
22
22
|
__exportStar(require("./Price.js"), exports);
|
|
23
|
-
__exportStar(require("./
|
|
23
|
+
__exportStar(require("./CreateFixedRateRequest.js"), exports);
|
|
24
24
|
__exportStar(require("./Aggregation.js"), exports);
|
|
25
25
|
__exportStar(require("./CreatePricingMetricResponse.js"), exports);
|
|
26
|
-
__exportStar(require("./
|
|
26
|
+
__exportStar(require("./CreateSimpleUsageBasedRateRequest.js"), exports);
|
|
27
27
|
__exportStar(require("./CreateSubjectResponse.js"), exports);
|
|
28
28
|
__exportStar(require("./CreateSubscriptionCheckoutSessionResponse.js"), exports);
|
|
29
29
|
__exportStar(require("./CreateUsageEventSummaryResponse.js"), exports);
|
|
30
|
-
__exportStar(require("./CustomPricingMetricResource.js"), exports);
|
|
31
30
|
__exportStar(require("./FixedRateInterface.js"), exports);
|
|
32
31
|
__exportStar(require("./FlatPrice.js"), exports);
|
|
33
32
|
__exportStar(require("./GetPricingMetricResponse.js"), exports);
|
|
34
33
|
__exportStar(require("./HttpValidationError.js"), exports);
|
|
35
|
-
__exportStar(require("./
|
|
34
|
+
__exportStar(require("./InvoiceLineItemResource.js"), exports);
|
|
35
|
+
__exportStar(require("./InvoiceResource.js"), exports);
|
|
36
|
+
__exportStar(require("./ListInvoicesResponse.js"), exports);
|
|
37
|
+
__exportStar(require("./ListPricingMetricsResponse.js"), exports);
|
|
36
38
|
__exportStar(require("./ListRateCardsResponse.js"), exports);
|
|
37
39
|
__exportStar(require("./ListSubjectsResponse.js"), exports);
|
|
38
40
|
__exportStar(require("./ListSubscriptionsResponse.js"), exports);
|
|
39
|
-
__exportStar(require("./MaxAggregationPricingMetricResource.js"), exports);
|
|
40
41
|
__exportStar(require("./PackagePrice.js"), exports);
|
|
41
42
|
__exportStar(require("./Period.js"), exports);
|
|
43
|
+
__exportStar(require("./PeriodResource.js"), exports);
|
|
44
|
+
__exportStar(require("./PricingMetricResource.js"), exports);
|
|
42
45
|
__exportStar(require("./RateCardResourceUsageBasedRatesItem.js"), exports);
|
|
43
46
|
__exportStar(require("./RateCardResource.js"), exports);
|
|
44
47
|
__exportStar(require("./SimpleUsageBasedRateInterface.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.0.
|
|
1
|
+
export declare const SDK_VERSION = "0.0.8";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.d.mts
CHANGED
|
@@ -11,6 +11,7 @@ import { Subscriptions } from "./api/resources/subscriptions/client/Client.mjs";
|
|
|
11
11
|
import { Subjects } from "./api/resources/subjects/client/Client.mjs";
|
|
12
12
|
import { PricingMetrics } from "./api/resources/pricingMetrics/client/Client.mjs";
|
|
13
13
|
import { CustomerAccess } from "./api/resources/customerAccess/client/Client.mjs";
|
|
14
|
+
import { Invoices } from "./api/resources/invoices/client/Client.mjs";
|
|
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
|
}
|
package/dist/esm/Client.mjs
CHANGED
|
@@ -11,13 +11,14 @@ import { Subscriptions } from "./api/resources/subscriptions/client/Client.mjs";
|
|
|
11
11
|
import { Subjects } from "./api/resources/subjects/client/Client.mjs";
|
|
12
12
|
import { PricingMetrics } from "./api/resources/pricingMetrics/client/Client.mjs";
|
|
13
13
|
import { CustomerAccess } from "./api/resources/customerAccess/client/Client.mjs";
|
|
14
|
+
import { Invoices } from "./api/resources/invoices/client/Client.mjs";
|
|
14
15
|
export class LarkClient {
|
|
15
16
|
constructor(_options) {
|
|
16
17
|
this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
|
|
17
18
|
"X-Fern-Language": "JavaScript",
|
|
18
19
|
"X-Fern-SDK-Name": "lark-billing",
|
|
19
|
-
"X-Fern-SDK-Version": "0.0.
|
|
20
|
-
"User-Agent": "lark-billing/0.0.
|
|
20
|
+
"X-Fern-SDK-Version": "0.0.8",
|
|
21
|
+
"User-Agent": "lark-billing/0.0.8",
|
|
21
22
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
22
23
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
23
24
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -54,4 +55,8 @@ export class LarkClient {
|
|
|
54
55
|
var _a;
|
|
55
56
|
return ((_a = this._customerAccess) !== null && _a !== void 0 ? _a : (this._customerAccess = new CustomerAccess(this._options)));
|
|
56
57
|
}
|
|
58
|
+
get invoices() {
|
|
59
|
+
var _a;
|
|
60
|
+
return ((_a = this._invoices) !== null && _a !== void 0 ? _a : (this._invoices = new Invoices(this._options)));
|
|
61
|
+
}
|
|
57
62
|
}
|
|
@@ -39,7 +39,7 @@ export declare class Checkout {
|
|
|
39
39
|
* await client.checkout.createSubscriptionCheckoutSession({
|
|
40
40
|
* subject_id: "subject_id",
|
|
41
41
|
* rate_card_id: "rate_card_id",
|
|
42
|
-
*
|
|
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>;
|
|
@@ -29,7 +29,7 @@ export class Checkout {
|
|
|
29
29
|
* await client.checkout.createSubscriptionCheckoutSession({
|
|
30
30
|
* subject_id: "subject_id",
|
|
31
31
|
* rate_card_id: "rate_card_id",
|
|
32
|
-
*
|
|
32
|
+
* success_callback_url: "https://example.com/callback"
|
|
33
33
|
* })
|
|
34
34
|
*/
|
|
35
35
|
createSubscriptionCheckoutSession(request, requestOptions) {
|
|
@@ -6,11 +6,14 @@
|
|
|
6
6
|
* {
|
|
7
7
|
* subject_id: "subject_id",
|
|
8
8
|
* rate_card_id: "rate_card_id",
|
|
9
|
-
*
|
|
9
|
+
* success_callback_url: "https://example.com/callback"
|
|
10
10
|
* }
|
|
11
11
|
*/
|
|
12
12
|
export interface CreateSubscriptionCheckoutSessionRequest {
|
|
13
13
|
subject_id: string;
|
|
14
14
|
rate_card_id: string;
|
|
15
|
-
|
|
15
|
+
/** The URL to redirect to after the checkout is successful. */
|
|
16
|
+
success_callback_url: string;
|
|
17
|
+
/** The URL to redirect to after the checkout is cancelled. */
|
|
18
|
+
cancel_url?: string;
|
|
16
19
|
}
|