lark-billing 0.0.8 → 0.1.0
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 +2 -2
- package/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/checkout/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/checkout/client/Client.js +2 -2
- package/dist/cjs/api/resources/checkout/client/requests/CreateSubscriptionCheckoutSessionRequest.d.ts +4 -2
- package/dist/cjs/api/resources/customerPortal/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/customerPortal/client/Client.js +1 -1
- package/dist/cjs/api/resources/customerPortal/client/requests/CreateCustomerPortalSessionRequest.d.ts +2 -1
- package/dist/cjs/api/resources/pricingMetrics/client/Client.d.ts +25 -6
- package/dist/cjs/api/resources/pricingMetrics/client/Client.js +72 -4
- package/dist/cjs/api/resources/pricingMetrics/client/requests/CreatePricingMetricRequest.d.ts +9 -5
- package/dist/cjs/api/resources/pricingMetrics/client/requests/CreatePricingMetricSummaryRequest.d.ts +20 -0
- package/dist/cjs/api/resources/pricingMetrics/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/pricingMetrics/types/PricingMetricAggregation.d.ts +13 -1
- package/dist/cjs/api/resources/rateCards/client/Client.d.ts +28 -2
- package/dist/cjs/api/resources/rateCards/client/Client.js +28 -2
- package/dist/cjs/api/resources/rateCards/client/requests/CreateRateCardRequest.d.ts +38 -4
- package/dist/cjs/api/resources/subjects/client/Client.d.ts +8 -1
- package/dist/cjs/api/resources/subjects/client/Client.js +8 -1
- package/dist/cjs/api/resources/subjects/client/requests/CreateSubjectRequest.d.ts +8 -1
- package/dist/cjs/api/resources/subscriptions/client/Client.d.ts +1 -1
- package/dist/cjs/api/resources/subscriptions/client/Client.js +1 -1
- package/dist/cjs/api/resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.d.ts +2 -1
- package/dist/cjs/api/resources/usageEvents/client/Client.d.ts +7 -23
- package/dist/cjs/api/resources/usageEvents/client/Client.js +7 -72
- package/dist/cjs/api/resources/usageEvents/client/requests/CreateUsageEventRequest.d.ts +18 -5
- package/dist/cjs/api/resources/usageEvents/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/types/Aggregation.d.ts +10 -1
- package/dist/cjs/api/types/Amount.d.ts +1 -0
- package/dist/cjs/api/types/BillingStateResponse.d.ts +2 -0
- package/dist/cjs/api/types/CountAggregationPricingMetricInterface.d.ts +3 -0
- package/dist/cjs/api/types/CreateCustomerPortalSessionResponse.d.ts +2 -0
- package/dist/cjs/api/types/CreateFixedRateRequest.d.ts +3 -1
- package/dist/cjs/api/types/CreateSimpleUsageBasedRateRequest.d.ts +4 -1
- package/dist/cjs/api/types/CreateSubscriptionCheckoutSessionResponse.d.ts +3 -0
- package/dist/cjs/api/types/CustomAggregationPricingMetricInterface.d.ts +10 -0
- package/dist/cjs/api/types/FixedRateInterface.d.ts +1 -1
- package/dist/cjs/api/types/InvoiceResource.d.ts +10 -2
- package/dist/cjs/api/types/LastAggregationPricingMetricInterface.d.ts +10 -0
- package/dist/cjs/api/types/LastAggregationPricingMetricResource.d.ts +7 -0
- package/dist/cjs/api/types/LastAggregationPricingMetricResource.js +5 -0
- package/dist/cjs/api/types/MaxAggregationPricingMetricInterface.d.ts +10 -0
- package/dist/cjs/api/types/MaxAggregationPricingMetricInterface.js +5 -0
- package/dist/cjs/api/types/MaxAggregationPricingMetricResource.d.ts +7 -0
- package/dist/cjs/api/types/MaxAggregationPricingMetricResource.js +5 -0
- package/dist/cjs/api/types/PricingMetricResource.d.ts +5 -0
- package/dist/cjs/api/types/PricingMetricSummaryResource.d.ts +16 -0
- package/dist/cjs/api/types/PricingMetricSummaryResource.js +5 -0
- package/dist/cjs/api/types/RateCardResource.d.ts +8 -1
- package/dist/cjs/api/types/SimpleUsageBasedRateInterface.d.ts +1 -1
- package/dist/cjs/api/types/SubscriptionResource.d.ts +11 -0
- package/dist/cjs/api/types/SumAggregationPricingMetricInterface.d.ts +3 -0
- package/dist/cjs/api/types/SumAggregationPricingMetricResource.d.ts +1 -0
- package/dist/cjs/api/types/index.d.ts +7 -4
- package/dist/cjs/api/types/index.js +7 -4
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/checkout/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/checkout/client/Client.mjs +2 -2
- package/dist/esm/api/resources/checkout/client/requests/CreateSubscriptionCheckoutSessionRequest.d.mts +4 -2
- package/dist/esm/api/resources/customerPortal/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/customerPortal/client/Client.mjs +1 -1
- package/dist/esm/api/resources/customerPortal/client/requests/CreateCustomerPortalSessionRequest.d.mts +2 -1
- package/dist/esm/api/resources/pricingMetrics/client/Client.d.mts +25 -6
- package/dist/esm/api/resources/pricingMetrics/client/Client.mjs +72 -4
- package/dist/esm/api/resources/pricingMetrics/client/requests/CreatePricingMetricRequest.d.mts +9 -5
- package/dist/esm/api/resources/pricingMetrics/client/requests/CreatePricingMetricSummaryRequest.d.mts +20 -0
- package/dist/esm/api/resources/pricingMetrics/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/pricingMetrics/types/PricingMetricAggregation.d.mts +13 -1
- package/dist/esm/api/resources/rateCards/client/Client.d.mts +28 -2
- package/dist/esm/api/resources/rateCards/client/Client.mjs +28 -2
- package/dist/esm/api/resources/rateCards/client/requests/CreateRateCardRequest.d.mts +38 -4
- package/dist/esm/api/resources/subjects/client/Client.d.mts +8 -1
- package/dist/esm/api/resources/subjects/client/Client.mjs +8 -1
- package/dist/esm/api/resources/subjects/client/requests/CreateSubjectRequest.d.mts +8 -1
- package/dist/esm/api/resources/subscriptions/client/Client.d.mts +1 -1
- package/dist/esm/api/resources/subscriptions/client/Client.mjs +1 -1
- package/dist/esm/api/resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.d.mts +2 -1
- package/dist/esm/api/resources/usageEvents/client/Client.d.mts +7 -23
- package/dist/esm/api/resources/usageEvents/client/Client.mjs +7 -72
- package/dist/esm/api/resources/usageEvents/client/requests/CreateUsageEventRequest.d.mts +18 -5
- package/dist/esm/api/resources/usageEvents/client/requests/index.d.mts +0 -1
- package/dist/esm/api/types/Aggregation.d.mts +10 -1
- package/dist/esm/api/types/Amount.d.mts +1 -0
- package/dist/esm/api/types/BillingStateResponse.d.mts +2 -0
- package/dist/esm/api/types/CountAggregationPricingMetricInterface.d.mts +3 -0
- package/dist/esm/api/types/CreateCustomerPortalSessionResponse.d.mts +2 -0
- package/dist/esm/api/types/CreateFixedRateRequest.d.mts +3 -1
- package/dist/esm/api/types/CreateSimpleUsageBasedRateRequest.d.mts +4 -1
- package/dist/esm/api/types/CreateSubscriptionCheckoutSessionResponse.d.mts +3 -0
- package/dist/esm/api/types/CustomAggregationPricingMetricInterface.d.mts +10 -0
- package/dist/esm/api/types/FixedRateInterface.d.mts +1 -1
- package/dist/esm/api/types/InvoiceResource.d.mts +10 -2
- package/dist/esm/api/types/LastAggregationPricingMetricInterface.d.mts +10 -0
- package/dist/esm/api/types/LastAggregationPricingMetricResource.d.mts +7 -0
- package/dist/esm/api/types/LastAggregationPricingMetricResource.mjs +4 -0
- package/dist/esm/api/types/MaxAggregationPricingMetricInterface.d.mts +10 -0
- package/dist/esm/api/types/MaxAggregationPricingMetricInterface.mjs +4 -0
- package/dist/esm/api/types/MaxAggregationPricingMetricResource.d.mts +7 -0
- package/dist/esm/api/types/MaxAggregationPricingMetricResource.mjs +4 -0
- package/dist/esm/api/types/PricingMetricResource.d.mts +5 -0
- package/dist/esm/api/types/PricingMetricSummaryResource.d.mts +16 -0
- package/dist/esm/api/types/PricingMetricSummaryResource.mjs +4 -0
- package/dist/esm/api/types/RateCardResource.d.mts +8 -1
- package/dist/esm/api/types/SimpleUsageBasedRateInterface.d.mts +1 -1
- package/dist/esm/api/types/SubscriptionResource.d.mts +11 -0
- package/dist/esm/api/types/SumAggregationPricingMetricInterface.d.mts +3 -0
- package/dist/esm/api/types/SumAggregationPricingMetricResource.d.mts +1 -0
- package/dist/esm/api/types/index.d.mts +7 -4
- package/dist/esm/api/types/index.mjs +7 -4
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +119 -72
- package/dist/cjs/api/resources/usageEvents/client/requests/CreateUsageEventSummaryRequest.d.ts +0 -30
- package/dist/cjs/api/resources/usageEvents/client/requests/CreateUsageEventSummaryRequest.js +0 -14
- package/dist/cjs/api/types/CreatePricingMetricResponse.d.ts +0 -11
- package/dist/cjs/api/types/CreateUsageEventSummaryResponse.d.ts +0 -10
- package/dist/cjs/api/types/GetPricingMetricResponse.d.ts +0 -11
- package/dist/esm/api/resources/usageEvents/client/requests/CreateUsageEventSummaryRequest.d.mts +0 -30
- package/dist/esm/api/resources/usageEvents/client/requests/CreateUsageEventSummaryRequest.mjs +0 -11
- package/dist/esm/api/types/CreatePricingMetricResponse.d.mts +0 -11
- package/dist/esm/api/types/CreateUsageEventSummaryResponse.d.mts +0 -10
- package/dist/esm/api/types/GetPricingMetricResponse.d.mts +0 -11
- /package/dist/cjs/api/{types/CreatePricingMetricResponse.js → resources/pricingMetrics/client/requests/CreatePricingMetricSummaryRequest.js} +0 -0
- /package/dist/cjs/api/types/{CreateUsageEventSummaryResponse.js → CustomAggregationPricingMetricInterface.js} +0 -0
- /package/dist/cjs/api/types/{GetPricingMetricResponse.js → LastAggregationPricingMetricInterface.js} +0 -0
- /package/dist/esm/api/{types/CreatePricingMetricResponse.mjs → resources/pricingMetrics/client/requests/CreatePricingMetricSummaryRequest.mjs} +0 -0
- /package/dist/esm/api/types/{CreateUsageEventSummaryResponse.mjs → CustomAggregationPricingMetricInterface.mjs} +0 -0
- /package/dist/esm/api/types/{GetPricingMetricResponse.mjs → LastAggregationPricingMetricInterface.mjs} +0 -0
|
@@ -63,11 +63,14 @@ class UsageEvents {
|
|
|
63
63
|
*
|
|
64
64
|
* @example
|
|
65
65
|
* await client.usageEvents.createUsageEvent({
|
|
66
|
-
* idempotency_key: "
|
|
67
|
-
* event_name: "
|
|
68
|
-
* subject_id: "
|
|
66
|
+
* idempotency_key: "6b4ef298-4566-427d-b2ca-cd8fbe38ec60",
|
|
67
|
+
* event_name: "compute_hours",
|
|
68
|
+
* subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
|
|
69
|
+
* timestamp: "2025-10-31T20:29:47Z",
|
|
69
70
|
* data: {
|
|
70
|
-
* "
|
|
71
|
+
* "compute_hours": 100,
|
|
72
|
+
* "instance_type": "t2.micro",
|
|
73
|
+
* "region": "us-east-1"
|
|
71
74
|
* }
|
|
72
75
|
* })
|
|
73
76
|
*/
|
|
@@ -122,74 +125,6 @@ class UsageEvents {
|
|
|
122
125
|
}
|
|
123
126
|
});
|
|
124
127
|
}
|
|
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, _c;
|
|
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((_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, "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
128
|
_getCustomAuthorizationHeaders() {
|
|
194
129
|
return __awaiter(this, void 0, void 0, function* () {
|
|
195
130
|
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
@@ -4,18 +4,31 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
6
|
* {
|
|
7
|
-
* idempotency_key: "
|
|
8
|
-
* event_name: "
|
|
9
|
-
* subject_id: "
|
|
7
|
+
* idempotency_key: "6b4ef298-4566-427d-b2ca-cd8fbe38ec60",
|
|
8
|
+
* event_name: "compute_hours",
|
|
9
|
+
* subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
|
|
10
|
+
* timestamp: "2025-10-31T20:29:47Z",
|
|
10
11
|
* data: {
|
|
11
|
-
* "
|
|
12
|
+
* "compute_hours": 100,
|
|
13
|
+
* "instance_type": "t2.micro",
|
|
14
|
+
* "region": "us-east-1"
|
|
12
15
|
* }
|
|
13
16
|
* }
|
|
14
17
|
*/
|
|
15
18
|
export interface CreateUsageEventRequest {
|
|
19
|
+
/** The idempotency key for the usage event. This ensures that the same event is not processed multiple times. */
|
|
16
20
|
idempotency_key: string;
|
|
21
|
+
/** The name of the event. This is used by pricing metrics to aggregate usage events. */
|
|
17
22
|
event_name: string;
|
|
23
|
+
/** The ID of the subject that the usage event is for. */
|
|
18
24
|
subject_id: string;
|
|
25
|
+
/** The timestamp of the usage event. It is highly recommended to provide a timestamp. If not provided, the current timestamp will be used. */
|
|
19
26
|
timestamp?: string;
|
|
20
|
-
data
|
|
27
|
+
/** The data of the usage event. This should contain any data that is needed to aggregate the usage event. */
|
|
28
|
+
data: Record<string, CreateUsageEventRequest.Data.Value>;
|
|
29
|
+
}
|
|
30
|
+
export declare namespace CreateUsageEventRequest {
|
|
31
|
+
namespace Data {
|
|
32
|
+
type Value = string | number;
|
|
33
|
+
}
|
|
21
34
|
}
|
|
@@ -2,11 +2,20 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
import * as Lark from "../index.js";
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The aggregation function used to compute the value of the pricing metric.
|
|
7
|
+
*/
|
|
8
|
+
export type Aggregation = Lark.Aggregation.Count | Lark.Aggregation.Last | Lark.Aggregation.Max | Lark.Aggregation.Sum;
|
|
6
9
|
export declare namespace Aggregation {
|
|
7
10
|
interface Count extends Lark.CountAggregationPricingMetricResource {
|
|
8
11
|
aggregation_type: "count";
|
|
9
12
|
}
|
|
13
|
+
interface Last extends Lark.LastAggregationPricingMetricResource {
|
|
14
|
+
aggregation_type: "last";
|
|
15
|
+
}
|
|
16
|
+
interface Max extends Lark.MaxAggregationPricingMetricResource {
|
|
17
|
+
aggregation_type: "max";
|
|
18
|
+
}
|
|
10
19
|
interface Sum extends Lark.SumAggregationPricingMetricResource {
|
|
11
20
|
aggregation_type: "sum";
|
|
12
21
|
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
export interface BillingStateResponse {
|
|
5
|
+
/** Whether the subject has an active subscription. */
|
|
5
6
|
has_active_subscription: boolean;
|
|
7
|
+
/** Whether the subject has exceeded the included usage (if any) on a usage-based rate they are subscribed to. */
|
|
6
8
|
has_overage_for_usage: boolean;
|
|
7
9
|
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
4
|
export interface CreateCustomerPortalSessionResponse {
|
|
5
|
+
/** The ID of the subject for the customer portal session. */
|
|
5
6
|
subject_id: string;
|
|
7
|
+
/** The URL to redirect to the customer portal session. */
|
|
6
8
|
url: string;
|
|
7
9
|
}
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Lark from "../index.js";
|
|
5
5
|
export interface CreateFixedRateRequest {
|
|
6
|
-
name
|
|
6
|
+
/** The name of the rate displayed to the customer. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** The description of the rate displayed to the customer. */
|
|
7
9
|
description?: string;
|
|
8
10
|
price: Lark.Price;
|
|
9
11
|
}
|
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Lark from "../index.js";
|
|
5
5
|
export interface CreateSimpleUsageBasedRateRequest {
|
|
6
|
-
name
|
|
6
|
+
/** The name of the rate displayed to the customer. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** The description of the rate displayed to the customer. */
|
|
7
9
|
description?: string;
|
|
8
10
|
price: Lark.Price;
|
|
11
|
+
/** The number of units included in the rate before the price is applied. */
|
|
9
12
|
included_units?: number;
|
|
10
13
|
/** The ID of the pricing metric to use for this rate. */
|
|
11
14
|
pricing_metric_id: string;
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Lark from "../index.js";
|
|
5
5
|
export interface CreateSubscriptionCheckoutSessionResponse {
|
|
6
|
+
/** The ID of the checkout session. */
|
|
6
7
|
id: string;
|
|
8
|
+
/** The amount of the checkout session. */
|
|
7
9
|
amount: Lark.Amount;
|
|
10
|
+
/** The URL to redirect to the checkout session. */
|
|
8
11
|
url: string;
|
|
9
12
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Custom aggregation for use cases not supported by the other aggregation types. Please email team@uselark.ai to enable this feature.
|
|
6
|
+
*/
|
|
7
|
+
export interface CustomAggregationPricingMetricInterface {
|
|
8
|
+
/** Custom expression to compute the pricing metric. Please email team@uselark.ai to enable this feature. */
|
|
9
|
+
custom_expression: string;
|
|
10
|
+
}
|
|
@@ -3,17 +3,25 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Lark from "../index.js";
|
|
5
5
|
export interface InvoiceResource {
|
|
6
|
+
/** The ID of the invoice. */
|
|
6
7
|
id: string;
|
|
7
|
-
|
|
8
|
-
bill_id?: string;
|
|
8
|
+
/** The total amount of the invoice. */
|
|
9
9
|
total_amount: Lark.Amount;
|
|
10
|
+
/** The ID of the subject for the invoice. */
|
|
10
11
|
subject_id: string;
|
|
12
|
+
/** The date and time the invoice was created. */
|
|
11
13
|
created_at: string;
|
|
14
|
+
/** The status of the invoice. */
|
|
12
15
|
status: InvoiceResource.Status;
|
|
16
|
+
/** The URL of the hosted invoice. */
|
|
13
17
|
hosted_url?: string;
|
|
18
|
+
/** The line items of the invoice. */
|
|
14
19
|
line_items: Lark.InvoiceLineItemResource[];
|
|
15
20
|
}
|
|
16
21
|
export declare namespace InvoiceResource {
|
|
22
|
+
/**
|
|
23
|
+
* The status of the invoice.
|
|
24
|
+
*/
|
|
17
25
|
type Status = "draft" | "open" | "paid" | "uncollectible" | "void";
|
|
18
26
|
const Status: {
|
|
19
27
|
readonly Draft: "draft";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Computes the last value of the `value_field` over all usage events with the specified `event_name`.
|
|
6
|
+
*/
|
|
7
|
+
export interface LastAggregationPricingMetricInterface {
|
|
8
|
+
/** Field to get the last value of. */
|
|
9
|
+
value_field: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Computes the max value of the `value_field` over all usage events with the specified `event_name`.
|
|
6
|
+
*/
|
|
7
|
+
export interface MaxAggregationPricingMetricInterface {
|
|
8
|
+
/** Field to get the max value of. */
|
|
9
|
+
value_field: string;
|
|
10
|
+
}
|
|
@@ -3,9 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Lark from "../index.js";
|
|
5
5
|
export interface PricingMetricResource {
|
|
6
|
+
/** The ID of the pricing metric. */
|
|
6
7
|
id: string;
|
|
8
|
+
/** The name of the pricing metric. */
|
|
7
9
|
name: string;
|
|
10
|
+
/** The event name that the pricing metric is computed on. */
|
|
8
11
|
event_name: string;
|
|
12
|
+
/** The aggregation function used to compute the value of the pricing metric. */
|
|
9
13
|
aggregation: Lark.Aggregation;
|
|
14
|
+
/** The unit of the value computed by the pricing metric. */
|
|
10
15
|
unit: string;
|
|
11
16
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Lark from "../index.js";
|
|
5
|
+
export interface PricingMetricSummaryResource {
|
|
6
|
+
/** The ID of the pricing metric summary. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** The ID of the pricing metric that the summary is for. */
|
|
9
|
+
pricing_metric_id: string;
|
|
10
|
+
/** The ID of the subject that the summary is for. */
|
|
11
|
+
subject_id: string;
|
|
12
|
+
/** The period that the summary is computed over. */
|
|
13
|
+
period: Lark.Period;
|
|
14
|
+
/** The computed value of the pricing metric for the period. If the pricing metric does not have any usage events for the period, this will be `null`. */
|
|
15
|
+
value?: string;
|
|
16
|
+
}
|
|
@@ -3,13 +3,20 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Lark from "../index.js";
|
|
5
5
|
export interface RateCardResource {
|
|
6
|
+
/** The ID of the rate card. */
|
|
6
7
|
id: string;
|
|
8
|
+
/** The name of the rate card. */
|
|
7
9
|
name: string;
|
|
8
|
-
description
|
|
10
|
+
/** The description of the rate card. */
|
|
11
|
+
description?: string;
|
|
12
|
+
/** The usage based rates of the rate card. */
|
|
9
13
|
usage_based_rates: Lark.RateCardResourceUsageBasedRatesItem[];
|
|
14
|
+
/** The fixed rates of the rate card. */
|
|
10
15
|
fixed_rates: Lark.FixedRateInterface[];
|
|
11
16
|
billing_interval: RateCardResource.BillingInterval;
|
|
17
|
+
/** The date and time the rate card was created. */
|
|
12
18
|
created_at: string;
|
|
19
|
+
/** The date and time the rate card was last updated. */
|
|
13
20
|
updated_at: string;
|
|
14
21
|
metadata: Record<string, string>;
|
|
15
22
|
}
|
|
@@ -3,17 +3,28 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as Lark from "../index.js";
|
|
5
5
|
export interface SubscriptionResource {
|
|
6
|
+
/** The ID of the subscription. */
|
|
6
7
|
id: string;
|
|
8
|
+
/** The ID of the subject that the subscription is for. */
|
|
7
9
|
subject_id: string;
|
|
10
|
+
/** The ID of the rate card of the subscription. */
|
|
8
11
|
rate_card_id: string;
|
|
12
|
+
/** The date and time the subscription became effective. */
|
|
9
13
|
effective_at: string;
|
|
14
|
+
/** The date and time the next cycle of the subscription will start. */
|
|
10
15
|
cycles_next_at?: string;
|
|
16
|
+
/** The current period of the subscription if it is active. */
|
|
11
17
|
current_period?: Lark.PeriodResource;
|
|
12
18
|
metadata: Record<string, string>;
|
|
19
|
+
/** The status of the subscription. */
|
|
13
20
|
status: SubscriptionResource.Status;
|
|
21
|
+
/** Whether the subscription will be cancelled at the end of the current cycle. */
|
|
14
22
|
cancels_at_end_of_cycle: boolean;
|
|
15
23
|
}
|
|
16
24
|
export declare namespace SubscriptionResource {
|
|
25
|
+
/**
|
|
26
|
+
* The status of the subscription.
|
|
27
|
+
*/
|
|
17
28
|
type Status = "active" | "cancelled" | "paused";
|
|
18
29
|
const Status: {
|
|
19
30
|
readonly Active: "active";
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* Computes the sum of the `value_field` over all usage events with the specified `event_name`.
|
|
6
|
+
*/
|
|
4
7
|
export interface SumAggregationPricingMetricInterface {
|
|
5
8
|
/** Field to sum over. */
|
|
6
9
|
value_field: string;
|
|
@@ -5,27 +5,30 @@ export * from "./CountAggregationPricingMetricResource.js";
|
|
|
5
5
|
export * from "./CreateCustomerPortalSessionResponse.js";
|
|
6
6
|
export * from "./Price.js";
|
|
7
7
|
export * from "./CreateFixedRateRequest.js";
|
|
8
|
-
export * from "./Aggregation.js";
|
|
9
|
-
export * from "./CreatePricingMetricResponse.js";
|
|
10
8
|
export * from "./CreateSimpleUsageBasedRateRequest.js";
|
|
11
9
|
export * from "./CreateSubjectResponse.js";
|
|
12
10
|
export * from "./CreateSubscriptionCheckoutSessionResponse.js";
|
|
13
|
-
export * from "./
|
|
11
|
+
export * from "./CustomAggregationPricingMetricInterface.js";
|
|
14
12
|
export * from "./FixedRateInterface.js";
|
|
15
13
|
export * from "./FlatPrice.js";
|
|
16
|
-
export * from "./GetPricingMetricResponse.js";
|
|
17
14
|
export * from "./HttpValidationError.js";
|
|
18
15
|
export * from "./InvoiceLineItemResource.js";
|
|
19
16
|
export * from "./InvoiceResource.js";
|
|
17
|
+
export * from "./LastAggregationPricingMetricInterface.js";
|
|
18
|
+
export * from "./LastAggregationPricingMetricResource.js";
|
|
20
19
|
export * from "./ListInvoicesResponse.js";
|
|
21
20
|
export * from "./ListPricingMetricsResponse.js";
|
|
22
21
|
export * from "./ListRateCardsResponse.js";
|
|
23
22
|
export * from "./ListSubjectsResponse.js";
|
|
24
23
|
export * from "./ListSubscriptionsResponse.js";
|
|
24
|
+
export * from "./MaxAggregationPricingMetricInterface.js";
|
|
25
|
+
export * from "./MaxAggregationPricingMetricResource.js";
|
|
25
26
|
export * from "./PackagePrice.js";
|
|
26
27
|
export * from "./Period.js";
|
|
27
28
|
export * from "./PeriodResource.js";
|
|
29
|
+
export * from "./Aggregation.js";
|
|
28
30
|
export * from "./PricingMetricResource.js";
|
|
31
|
+
export * from "./PricingMetricSummaryResource.js";
|
|
29
32
|
export * from "./RateCardResourceUsageBasedRatesItem.js";
|
|
30
33
|
export * from "./RateCardResource.js";
|
|
31
34
|
export * from "./SimpleUsageBasedRateInterface.js";
|
|
@@ -21,27 +21,30 @@ __exportStar(require("./CountAggregationPricingMetricResource.js"), exports);
|
|
|
21
21
|
__exportStar(require("./CreateCustomerPortalSessionResponse.js"), exports);
|
|
22
22
|
__exportStar(require("./Price.js"), exports);
|
|
23
23
|
__exportStar(require("./CreateFixedRateRequest.js"), exports);
|
|
24
|
-
__exportStar(require("./Aggregation.js"), exports);
|
|
25
|
-
__exportStar(require("./CreatePricingMetricResponse.js"), exports);
|
|
26
24
|
__exportStar(require("./CreateSimpleUsageBasedRateRequest.js"), exports);
|
|
27
25
|
__exportStar(require("./CreateSubjectResponse.js"), exports);
|
|
28
26
|
__exportStar(require("./CreateSubscriptionCheckoutSessionResponse.js"), exports);
|
|
29
|
-
__exportStar(require("./
|
|
27
|
+
__exportStar(require("./CustomAggregationPricingMetricInterface.js"), exports);
|
|
30
28
|
__exportStar(require("./FixedRateInterface.js"), exports);
|
|
31
29
|
__exportStar(require("./FlatPrice.js"), exports);
|
|
32
|
-
__exportStar(require("./GetPricingMetricResponse.js"), exports);
|
|
33
30
|
__exportStar(require("./HttpValidationError.js"), exports);
|
|
34
31
|
__exportStar(require("./InvoiceLineItemResource.js"), exports);
|
|
35
32
|
__exportStar(require("./InvoiceResource.js"), exports);
|
|
33
|
+
__exportStar(require("./LastAggregationPricingMetricInterface.js"), exports);
|
|
34
|
+
__exportStar(require("./LastAggregationPricingMetricResource.js"), exports);
|
|
36
35
|
__exportStar(require("./ListInvoicesResponse.js"), exports);
|
|
37
36
|
__exportStar(require("./ListPricingMetricsResponse.js"), exports);
|
|
38
37
|
__exportStar(require("./ListRateCardsResponse.js"), exports);
|
|
39
38
|
__exportStar(require("./ListSubjectsResponse.js"), exports);
|
|
40
39
|
__exportStar(require("./ListSubscriptionsResponse.js"), exports);
|
|
40
|
+
__exportStar(require("./MaxAggregationPricingMetricInterface.js"), exports);
|
|
41
|
+
__exportStar(require("./MaxAggregationPricingMetricResource.js"), exports);
|
|
41
42
|
__exportStar(require("./PackagePrice.js"), exports);
|
|
42
43
|
__exportStar(require("./Period.js"), exports);
|
|
43
44
|
__exportStar(require("./PeriodResource.js"), exports);
|
|
45
|
+
__exportStar(require("./Aggregation.js"), exports);
|
|
44
46
|
__exportStar(require("./PricingMetricResource.js"), exports);
|
|
47
|
+
__exportStar(require("./PricingMetricSummaryResource.js"), exports);
|
|
45
48
|
__exportStar(require("./RateCardResourceUsageBasedRatesItem.js"), exports);
|
|
46
49
|
__exportStar(require("./RateCardResource.js"), exports);
|
|
47
50
|
__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.1.0";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.mjs
CHANGED
|
@@ -17,8 +17,8 @@ export class LarkClient {
|
|
|
17
17
|
this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
|
|
18
18
|
"X-Fern-Language": "JavaScript",
|
|
19
19
|
"X-Fern-SDK-Name": "lark-billing",
|
|
20
|
-
"X-Fern-SDK-Version": "0.0
|
|
21
|
-
"User-Agent": "lark-billing/0.0
|
|
20
|
+
"X-Fern-SDK-Version": "0.1.0",
|
|
21
|
+
"User-Agent": "lark-billing/0.1.0",
|
|
22
22
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
23
23
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
24
24
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -37,8 +37,8 @@ export declare class Checkout {
|
|
|
37
37
|
*
|
|
38
38
|
* @example
|
|
39
39
|
* await client.checkout.createSubscriptionCheckoutSession({
|
|
40
|
-
* subject_id: "
|
|
41
|
-
* rate_card_id: "
|
|
40
|
+
* subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
|
|
41
|
+
* rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
|
|
42
42
|
* success_callback_url: "https://example.com/callback"
|
|
43
43
|
* })
|
|
44
44
|
*/
|
|
@@ -27,8 +27,8 @@ export class Checkout {
|
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
29
29
|
* await client.checkout.createSubscriptionCheckoutSession({
|
|
30
|
-
* subject_id: "
|
|
31
|
-
* rate_card_id: "
|
|
30
|
+
* subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
|
|
31
|
+
* rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
|
|
32
32
|
* success_callback_url: "https://example.com/callback"
|
|
33
33
|
* })
|
|
34
34
|
*/
|
|
@@ -4,13 +4,15 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
6
|
* {
|
|
7
|
-
* subject_id: "
|
|
8
|
-
* rate_card_id: "
|
|
7
|
+
* subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
|
|
8
|
+
* rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
|
|
9
9
|
* success_callback_url: "https://example.com/callback"
|
|
10
10
|
* }
|
|
11
11
|
*/
|
|
12
12
|
export interface CreateSubscriptionCheckoutSessionRequest {
|
|
13
|
+
/** The ID of the subject to create the checkout for. */
|
|
13
14
|
subject_id: string;
|
|
15
|
+
/** The ID of the rate card to subscribe to. */
|
|
14
16
|
rate_card_id: string;
|
|
15
17
|
/** The URL to redirect to after the checkout is successful. */
|
|
16
18
|
success_callback_url: string;
|
|
@@ -37,7 +37,7 @@ export declare class CustomerPortal {
|
|
|
37
37
|
*
|
|
38
38
|
* @example
|
|
39
39
|
* await client.customerPortal.createCustomerPortalSession({
|
|
40
|
-
* subject_id: "
|
|
40
|
+
* subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE"
|
|
41
41
|
* })
|
|
42
42
|
*/
|
|
43
43
|
createCustomerPortalSession(request: Lark.CreateCustomerPortalSessionRequest, requestOptions?: CustomerPortal.RequestOptions): core.HttpResponsePromise<Lark.CreateCustomerPortalSessionResponse>;
|
|
@@ -27,7 +27,7 @@ export class CustomerPortal {
|
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
29
29
|
* await client.customerPortal.createCustomerPortalSession({
|
|
30
|
-
* subject_id: "
|
|
30
|
+
* subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE"
|
|
31
31
|
* })
|
|
32
32
|
*/
|
|
33
33
|
createCustomerPortalSession(request, requestOptions) {
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
6
|
* {
|
|
7
|
-
* subject_id: "
|
|
7
|
+
* subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE"
|
|
8
8
|
* }
|
|
9
9
|
*/
|
|
10
10
|
export interface CreateCustomerPortalSessionRequest {
|
|
11
|
+
/** The ID of the subject to create the customer portal session for. */
|
|
11
12
|
subject_id: string;
|
|
12
13
|
}
|