lark-billing 0.0.9 → 0.1.1
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/dist/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/checkout/client/requests/CreateSubscriptionCheckoutSessionRequest.d.ts +1 -1
- package/dist/cjs/api/resources/customerPortal/client/requests/CreateCustomerPortalSessionRequest.d.ts +1 -1
- package/dist/cjs/api/resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.d.ts +1 -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 +27 -1
- package/dist/cjs/api/resources/rateCards/client/Client.js +27 -1
- package/dist/cjs/api/resources/rateCards/client/requests/CreateRateCardRequest.d.ts +29 -1
- 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/requests/CreateSubscriptionRequest.d.ts +1 -1
- package/dist/cjs/api/resources/subscriptions/client/requests/ListSubscriptionsSubscriptionsGetRequest.d.ts +1 -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 +9 -6
- package/dist/cjs/api/resources/usageEvents/client/requests/index.d.ts +0 -1
- package/dist/cjs/api/types/ActiveSubscription.d.ts +7 -0
- package/dist/cjs/api/types/Aggregation.d.ts +10 -1
- package/dist/cjs/api/types/BillingStateResponse.d.ts +7 -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/CustomAggregationPricingMetricInterface.d.ts +10 -0
- package/dist/cjs/api/types/LastAggregationPricingMetricInterface.d.ts +10 -0
- package/dist/cjs/api/types/LastAggregationPricingMetricInterface.js +5 -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/SumAggregationPricingMetricInterface.d.ts +3 -0
- package/dist/cjs/api/types/SumAggregationPricingMetricResource.d.ts +1 -0
- package/dist/cjs/api/types/UsageDataForRate.d.ts +9 -0
- package/dist/cjs/api/types/UsageDataForRate.js +5 -0
- package/dist/cjs/api/types/index.d.ts +9 -4
- package/dist/cjs/api/types/index.js +9 -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/requests/CreateSubscriptionCheckoutSessionRequest.d.mts +1 -1
- package/dist/esm/api/resources/customerPortal/client/requests/CreateCustomerPortalSessionRequest.d.mts +1 -1
- package/dist/esm/api/resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.d.mts +1 -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 +27 -1
- package/dist/esm/api/resources/rateCards/client/Client.mjs +27 -1
- package/dist/esm/api/resources/rateCards/client/requests/CreateRateCardRequest.d.mts +29 -1
- 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/requests/CreateSubscriptionRequest.d.mts +1 -1
- package/dist/esm/api/resources/subscriptions/client/requests/ListSubscriptionsSubscriptionsGetRequest.d.mts +1 -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 +9 -6
- package/dist/esm/api/resources/usageEvents/client/requests/index.d.mts +0 -1
- package/dist/esm/api/types/ActiveSubscription.d.mts +7 -0
- package/dist/esm/api/types/Aggregation.d.mts +10 -1
- package/dist/esm/api/types/BillingStateResponse.d.mts +7 -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/CustomAggregationPricingMetricInterface.d.mts +10 -0
- package/dist/esm/api/types/LastAggregationPricingMetricInterface.d.mts +10 -0
- package/dist/esm/api/types/LastAggregationPricingMetricInterface.mjs +4 -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/SumAggregationPricingMetricInterface.d.mts +3 -0
- package/dist/esm/api/types/SumAggregationPricingMetricResource.d.mts +1 -0
- package/dist/esm/api/types/UsageDataForRate.d.mts +9 -0
- package/dist/esm/api/types/UsageDataForRate.mjs +4 -0
- package/dist/esm/api/types/index.d.mts +9 -4
- package/dist/esm/api/types/index.mjs +9 -4
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +114 -67
- 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 → ActiveSubscription.js} +0 -0
- /package/dist/cjs/api/types/{GetPricingMetricResponse.js → CustomAggregationPricingMetricInterface.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 → ActiveSubscription.mjs} +0 -0
- /package/dist/esm/api/types/{GetPricingMetricResponse.mjs → CustomAggregationPricingMetricInterface.mjs} +0 -0
|
@@ -92,7 +92,33 @@ export class RateCards {
|
|
|
92
92
|
* @example
|
|
93
93
|
* await client.rateCards.createRateCard({
|
|
94
94
|
* name: "Pro Plan",
|
|
95
|
-
*
|
|
95
|
+
* description: "For production applications with moderate usage.",
|
|
96
|
+
* billing_interval: "monthly",
|
|
97
|
+
* fixed_rates: [{
|
|
98
|
+
* name: "Base Rate",
|
|
99
|
+
* price: {
|
|
100
|
+
* price_type: "flat",
|
|
101
|
+
* amount: {
|
|
102
|
+
* value: "2500",
|
|
103
|
+
* currency_code: "usd"
|
|
104
|
+
* }
|
|
105
|
+
* }
|
|
106
|
+
* }],
|
|
107
|
+
* usage_based_rates: [{
|
|
108
|
+
* usage_based_rate_type: "simple",
|
|
109
|
+
* name: "name",
|
|
110
|
+
* price: {
|
|
111
|
+
* price_type: "flat",
|
|
112
|
+
* amount: {
|
|
113
|
+
* value: "2500",
|
|
114
|
+
* currency_code: "usd"
|
|
115
|
+
* }
|
|
116
|
+
* },
|
|
117
|
+
* pricing_metric_id: "pricing_metric_id"
|
|
118
|
+
* }],
|
|
119
|
+
* metadata: {
|
|
120
|
+
* "key": "value"
|
|
121
|
+
* }
|
|
96
122
|
* })
|
|
97
123
|
*/
|
|
98
124
|
createRateCard(request, requestOptions) {
|
|
@@ -6,7 +6,33 @@ import * as Lark from "../../../../index.mjs";
|
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
8
|
* name: "Pro Plan",
|
|
9
|
-
*
|
|
9
|
+
* description: "For production applications with moderate usage.",
|
|
10
|
+
* billing_interval: "monthly",
|
|
11
|
+
* fixed_rates: [{
|
|
12
|
+
* name: "Base Rate",
|
|
13
|
+
* price: {
|
|
14
|
+
* price_type: "flat",
|
|
15
|
+
* amount: {
|
|
16
|
+
* value: "2500",
|
|
17
|
+
* currency_code: "usd"
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
* }],
|
|
21
|
+
* usage_based_rates: [{
|
|
22
|
+
* usage_based_rate_type: "simple",
|
|
23
|
+
* name: "name",
|
|
24
|
+
* price: {
|
|
25
|
+
* price_type: "flat",
|
|
26
|
+
* amount: {
|
|
27
|
+
* value: "2500",
|
|
28
|
+
* currency_code: "usd"
|
|
29
|
+
* }
|
|
30
|
+
* },
|
|
31
|
+
* pricing_metric_id: "pricing_metric_id"
|
|
32
|
+
* }],
|
|
33
|
+
* metadata: {
|
|
34
|
+
* "key": "value"
|
|
35
|
+
* }
|
|
10
36
|
* }
|
|
11
37
|
*/
|
|
12
38
|
export interface CreateRateCardRequest {
|
|
@@ -16,7 +42,9 @@ export interface CreateRateCardRequest {
|
|
|
16
42
|
description?: string;
|
|
17
43
|
/** How often the customer will be billed for this rate card. */
|
|
18
44
|
billing_interval: CreateRateCardRequest.BillingInterval;
|
|
45
|
+
/** The fixed rates of the rate card. These are billed at the start of each billing cycle. */
|
|
19
46
|
fixed_rates?: Lark.CreateFixedRateRequest[];
|
|
47
|
+
/** The usage based rates of the rate card. These are billed at the end of each billing cycle. */
|
|
20
48
|
usage_based_rates?: Lark.CreateRateCardRequestUsageBasedRatesItem[];
|
|
21
49
|
metadata?: Record<string, string>;
|
|
22
50
|
}
|
|
@@ -50,7 +50,14 @@ export declare class Subjects {
|
|
|
50
50
|
* @throws {@link Lark.UnprocessableEntityError}
|
|
51
51
|
*
|
|
52
52
|
* @example
|
|
53
|
-
* await client.subjects.createSubject(
|
|
53
|
+
* await client.subjects.createSubject({
|
|
54
|
+
* external_id: "user_1234567890",
|
|
55
|
+
* name: "John Doe",
|
|
56
|
+
* email: "john.doe@example.com",
|
|
57
|
+
* metadata: {
|
|
58
|
+
* "key": "value"
|
|
59
|
+
* }
|
|
60
|
+
* })
|
|
54
61
|
*/
|
|
55
62
|
createSubject(request?: Lark.CreateSubjectRequest, requestOptions?: Subjects.RequestOptions): core.HttpResponsePromise<Lark.CreateSubjectResponse>;
|
|
56
63
|
private __createSubject;
|
|
@@ -94,7 +94,14 @@ export class Subjects {
|
|
|
94
94
|
* @throws {@link Lark.UnprocessableEntityError}
|
|
95
95
|
*
|
|
96
96
|
* @example
|
|
97
|
-
* await client.subjects.createSubject(
|
|
97
|
+
* await client.subjects.createSubject({
|
|
98
|
+
* external_id: "user_1234567890",
|
|
99
|
+
* name: "John Doe",
|
|
100
|
+
* email: "john.doe@example.com",
|
|
101
|
+
* metadata: {
|
|
102
|
+
* "key": "value"
|
|
103
|
+
* }
|
|
104
|
+
* })
|
|
98
105
|
*/
|
|
99
106
|
createSubject(request = {}, requestOptions) {
|
|
100
107
|
return core.HttpResponsePromise.fromPromise(this.__createSubject(request, requestOptions));
|
|
@@ -3,7 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
|
-
* {
|
|
6
|
+
* {
|
|
7
|
+
* external_id: "user_1234567890",
|
|
8
|
+
* name: "John Doe",
|
|
9
|
+
* email: "john.doe@example.com",
|
|
10
|
+
* metadata: {
|
|
11
|
+
* "key": "value"
|
|
12
|
+
* }
|
|
13
|
+
* }
|
|
7
14
|
*/
|
|
8
15
|
export interface CreateSubjectRequest {
|
|
9
16
|
/** The ID of the subject in your system. If provided, you may use pass it to the API in place of the subject ID. Must be unique. */
|
package/dist/esm/api/resources/subscriptions/client/requests/CreateSubscriptionRequest.d.mts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
export interface CreateSubscriptionRequest {
|
|
12
12
|
/** The ID of the rate card to use for the subscription. */
|
|
13
13
|
rate_card_id: string;
|
|
14
|
-
/** The ID of the subject to create the subscription for. */
|
|
14
|
+
/** The ID or external ID of the subject to create the subscription for. */
|
|
15
15
|
subject_id: string;
|
|
16
16
|
/** Additional metadata about the subscription. You may use this to store any custom data about the subscription. */
|
|
17
17
|
metadata?: Record<string, string>;
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export interface ListSubscriptionsSubscriptionsGetRequest {
|
|
13
13
|
limit?: number;
|
|
14
|
-
/** The ID of the subject to list subscriptions for. Cannot be used with rate_card_id. */
|
|
14
|
+
/** The ID or external ID of the subject to list subscriptions for. Cannot be used with rate_card_id. */
|
|
15
15
|
subject_id?: string;
|
|
16
16
|
/** The ID of the rate card to list subscriptions for. Cannot be used with subject_id. */
|
|
17
17
|
rate_card_id?: string;
|
|
@@ -37,35 +37,19 @@ export declare class UsageEvents {
|
|
|
37
37
|
*
|
|
38
38
|
* @example
|
|
39
39
|
* await client.usageEvents.createUsageEvent({
|
|
40
|
-
* idempotency_key: "
|
|
41
|
-
* event_name: "
|
|
42
|
-
* subject_id: "
|
|
40
|
+
* idempotency_key: "f283b3d1-41b2-43b1-9d00-dd7935cb6263",
|
|
41
|
+
* event_name: "compute_hours",
|
|
42
|
+
* subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
|
|
43
|
+
* timestamp: "2025-11-03T18:37:02Z",
|
|
43
44
|
* data: {
|
|
44
|
-
* "
|
|
45
|
+
* "compute_hours": 100,
|
|
46
|
+
* "instance_type": "t2.micro",
|
|
47
|
+
* "region": "us-east-1"
|
|
45
48
|
* }
|
|
46
49
|
* })
|
|
47
50
|
*/
|
|
48
51
|
createUsageEvent(request: Lark.CreateUsageEventRequest, requestOptions?: UsageEvents.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
49
52
|
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
53
|
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
70
54
|
"X-API-Key": string;
|
|
71
55
|
}>;
|
|
@@ -27,11 +27,14 @@ export class UsageEvents {
|
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
29
29
|
* await client.usageEvents.createUsageEvent({
|
|
30
|
-
* idempotency_key: "
|
|
31
|
-
* event_name: "
|
|
32
|
-
* subject_id: "
|
|
30
|
+
* idempotency_key: "f283b3d1-41b2-43b1-9d00-dd7935cb6263",
|
|
31
|
+
* event_name: "compute_hours",
|
|
32
|
+
* subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
|
|
33
|
+
* timestamp: "2025-11-03T18:37:02Z",
|
|
33
34
|
* data: {
|
|
34
|
-
* "
|
|
35
|
+
* "compute_hours": 100,
|
|
36
|
+
* "instance_type": "t2.micro",
|
|
37
|
+
* "region": "us-east-1"
|
|
35
38
|
* }
|
|
36
39
|
* })
|
|
37
40
|
*/
|
|
@@ -86,74 +89,6 @@ export class UsageEvents {
|
|
|
86
89
|
}
|
|
87
90
|
});
|
|
88
91
|
}
|
|
89
|
-
/**
|
|
90
|
-
* @param {Lark.CreateUsageEventSummaryRequest} request
|
|
91
|
-
* @param {UsageEvents.RequestOptions} requestOptions - Request-specific configuration.
|
|
92
|
-
*
|
|
93
|
-
* @throws {@link Lark.UnprocessableEntityError}
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* await client.usageEvents.createUsageEventSummary({
|
|
97
|
-
* event_name: "event_name",
|
|
98
|
-
* subject_id: "subject_id",
|
|
99
|
-
* period: {
|
|
100
|
-
* start: "2024-01-15T09:30:00Z",
|
|
101
|
-
* end: "2024-01-15T09:30:00Z"
|
|
102
|
-
* },
|
|
103
|
-
* aggregation_type: "sum"
|
|
104
|
-
* })
|
|
105
|
-
*/
|
|
106
|
-
createUsageEventSummary(request, requestOptions) {
|
|
107
|
-
return core.HttpResponsePromise.fromPromise(this.__createUsageEventSummary(request, requestOptions));
|
|
108
|
-
}
|
|
109
|
-
__createUsageEventSummary(request, requestOptions) {
|
|
110
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
-
var _a, _b, _c;
|
|
112
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
113
|
-
const _response = yield core.fetcher({
|
|
114
|
-
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"),
|
|
115
|
-
method: "POST",
|
|
116
|
-
headers: _headers,
|
|
117
|
-
contentType: "application/json",
|
|
118
|
-
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
119
|
-
requestType: "json",
|
|
120
|
-
body: request,
|
|
121
|
-
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
122
|
-
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
123
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
124
|
-
});
|
|
125
|
-
if (_response.ok) {
|
|
126
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
127
|
-
}
|
|
128
|
-
if (_response.error.reason === "status-code") {
|
|
129
|
-
switch (_response.error.statusCode) {
|
|
130
|
-
case 422:
|
|
131
|
-
throw new Lark.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
132
|
-
default:
|
|
133
|
-
throw new errors.LarkError({
|
|
134
|
-
statusCode: _response.error.statusCode,
|
|
135
|
-
body: _response.error.body,
|
|
136
|
-
rawResponse: _response.rawResponse,
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
switch (_response.error.reason) {
|
|
141
|
-
case "non-json":
|
|
142
|
-
throw new errors.LarkError({
|
|
143
|
-
statusCode: _response.error.statusCode,
|
|
144
|
-
body: _response.error.rawBody,
|
|
145
|
-
rawResponse: _response.rawResponse,
|
|
146
|
-
});
|
|
147
|
-
case "timeout":
|
|
148
|
-
throw new errors.LarkTimeoutError("Timeout exceeded when calling POST /usage-events/summary.");
|
|
149
|
-
case "unknown":
|
|
150
|
-
throw new errors.LarkError({
|
|
151
|
-
message: _response.error.errorMessage,
|
|
152
|
-
rawResponse: _response.rawResponse,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
92
|
_getCustomAuthorizationHeaders() {
|
|
158
93
|
return __awaiter(this, void 0, void 0, function* () {
|
|
159
94
|
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @example
|
|
6
6
|
* {
|
|
7
|
-
* idempotency_key: "
|
|
8
|
-
* event_name: "
|
|
9
|
-
* subject_id: "
|
|
7
|
+
* idempotency_key: "f283b3d1-41b2-43b1-9d00-dd7935cb6263",
|
|
8
|
+
* event_name: "compute_hours",
|
|
9
|
+
* subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
|
|
10
|
+
* timestamp: "2025-11-03T18:37:02Z",
|
|
10
11
|
* data: {
|
|
11
|
-
* "
|
|
12
|
+
* "compute_hours": 100,
|
|
13
|
+
* "instance_type": "t2.micro",
|
|
14
|
+
* "region": "us-east-1"
|
|
12
15
|
* }
|
|
13
16
|
* }
|
|
14
17
|
*/
|
|
@@ -17,7 +20,7 @@ export interface CreateUsageEventRequest {
|
|
|
17
20
|
idempotency_key: string;
|
|
18
21
|
/** The name of the event. This is used by pricing metrics to aggregate usage events. */
|
|
19
22
|
event_name: string;
|
|
20
|
-
/** The ID of the subject that the usage event is for. */
|
|
23
|
+
/** The ID or external ID of the subject that the usage event is for. */
|
|
21
24
|
subject_id: string;
|
|
22
25
|
/** The timestamp of the usage event. It is highly recommended to provide a timestamp. If not provided, the current timestamp will be used. */
|
|
23
26
|
timestamp?: string;
|
|
@@ -26,6 +29,6 @@ export interface CreateUsageEventRequest {
|
|
|
26
29
|
}
|
|
27
30
|
export declare namespace CreateUsageEventRequest {
|
|
28
31
|
namespace Data {
|
|
29
|
-
type Value = string | number
|
|
32
|
+
type Value = string | number;
|
|
30
33
|
}
|
|
31
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.mjs";
|
|
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
|
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This file was auto-generated by Fern from our API Definition.
|
|
3
3
|
*/
|
|
4
|
+
import * as Lark from "../index.mjs";
|
|
4
5
|
export interface BillingStateResponse {
|
|
6
|
+
/** Whether the subject has an active subscription. */
|
|
5
7
|
has_active_subscription: boolean;
|
|
8
|
+
/** Whether the subject has exceeded the included usage (if any) on a usage-based rate they are subscribed to. */
|
|
6
9
|
has_overage_for_usage: boolean;
|
|
10
|
+
/** List of active subscriptions the subject is subscribed to. */
|
|
11
|
+
active_subscriptions: Lark.ActiveSubscription[];
|
|
12
|
+
/** The usage data for the usage-based rates the subject is subscribed to. */
|
|
13
|
+
usage_data: Lark.UsageDataForRate[];
|
|
7
14
|
}
|
|
@@ -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
|
+
}
|
|
@@ -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.mjs";
|
|
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.mjs";
|
|
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
|
+
}
|
|
@@ -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;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./ActiveSubscription.mjs";
|
|
1
2
|
export * from "./Amount.mjs";
|
|
2
3
|
export * from "./BillingStateResponse.mjs";
|
|
3
4
|
export * from "./CountAggregationPricingMetricInterface.mjs";
|
|
@@ -5,27 +6,30 @@ export * from "./CountAggregationPricingMetricResource.mjs";
|
|
|
5
6
|
export * from "./CreateCustomerPortalSessionResponse.mjs";
|
|
6
7
|
export * from "./Price.mjs";
|
|
7
8
|
export * from "./CreateFixedRateRequest.mjs";
|
|
8
|
-
export * from "./Aggregation.mjs";
|
|
9
|
-
export * from "./CreatePricingMetricResponse.mjs";
|
|
10
9
|
export * from "./CreateSimpleUsageBasedRateRequest.mjs";
|
|
11
10
|
export * from "./CreateSubjectResponse.mjs";
|
|
12
11
|
export * from "./CreateSubscriptionCheckoutSessionResponse.mjs";
|
|
13
|
-
export * from "./
|
|
12
|
+
export * from "./CustomAggregationPricingMetricInterface.mjs";
|
|
14
13
|
export * from "./FixedRateInterface.mjs";
|
|
15
14
|
export * from "./FlatPrice.mjs";
|
|
16
|
-
export * from "./GetPricingMetricResponse.mjs";
|
|
17
15
|
export * from "./HttpValidationError.mjs";
|
|
18
16
|
export * from "./InvoiceLineItemResource.mjs";
|
|
19
17
|
export * from "./InvoiceResource.mjs";
|
|
18
|
+
export * from "./LastAggregationPricingMetricInterface.mjs";
|
|
19
|
+
export * from "./LastAggregationPricingMetricResource.mjs";
|
|
20
20
|
export * from "./ListInvoicesResponse.mjs";
|
|
21
21
|
export * from "./ListPricingMetricsResponse.mjs";
|
|
22
22
|
export * from "./ListRateCardsResponse.mjs";
|
|
23
23
|
export * from "./ListSubjectsResponse.mjs";
|
|
24
24
|
export * from "./ListSubscriptionsResponse.mjs";
|
|
25
|
+
export * from "./MaxAggregationPricingMetricInterface.mjs";
|
|
26
|
+
export * from "./MaxAggregationPricingMetricResource.mjs";
|
|
25
27
|
export * from "./PackagePrice.mjs";
|
|
26
28
|
export * from "./Period.mjs";
|
|
27
29
|
export * from "./PeriodResource.mjs";
|
|
30
|
+
export * from "./Aggregation.mjs";
|
|
28
31
|
export * from "./PricingMetricResource.mjs";
|
|
32
|
+
export * from "./PricingMetricSummaryResource.mjs";
|
|
29
33
|
export * from "./RateCardResourceUsageBasedRatesItem.mjs";
|
|
30
34
|
export * from "./RateCardResource.mjs";
|
|
31
35
|
export * from "./SimpleUsageBasedRateInterface.mjs";
|
|
@@ -33,4 +37,5 @@ export * from "./SubjectResource.mjs";
|
|
|
33
37
|
export * from "./SubscriptionResource.mjs";
|
|
34
38
|
export * from "./SumAggregationPricingMetricInterface.mjs";
|
|
35
39
|
export * from "./SumAggregationPricingMetricResource.mjs";
|
|
40
|
+
export * from "./UsageDataForRate.mjs";
|
|
36
41
|
export * from "./ValidationError.mjs";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./ActiveSubscription.mjs";
|
|
1
2
|
export * from "./Amount.mjs";
|
|
2
3
|
export * from "./BillingStateResponse.mjs";
|
|
3
4
|
export * from "./CountAggregationPricingMetricInterface.mjs";
|
|
@@ -5,27 +6,30 @@ export * from "./CountAggregationPricingMetricResource.mjs";
|
|
|
5
6
|
export * from "./CreateCustomerPortalSessionResponse.mjs";
|
|
6
7
|
export * from "./Price.mjs";
|
|
7
8
|
export * from "./CreateFixedRateRequest.mjs";
|
|
8
|
-
export * from "./Aggregation.mjs";
|
|
9
|
-
export * from "./CreatePricingMetricResponse.mjs";
|
|
10
9
|
export * from "./CreateSimpleUsageBasedRateRequest.mjs";
|
|
11
10
|
export * from "./CreateSubjectResponse.mjs";
|
|
12
11
|
export * from "./CreateSubscriptionCheckoutSessionResponse.mjs";
|
|
13
|
-
export * from "./
|
|
12
|
+
export * from "./CustomAggregationPricingMetricInterface.mjs";
|
|
14
13
|
export * from "./FixedRateInterface.mjs";
|
|
15
14
|
export * from "./FlatPrice.mjs";
|
|
16
|
-
export * from "./GetPricingMetricResponse.mjs";
|
|
17
15
|
export * from "./HttpValidationError.mjs";
|
|
18
16
|
export * from "./InvoiceLineItemResource.mjs";
|
|
19
17
|
export * from "./InvoiceResource.mjs";
|
|
18
|
+
export * from "./LastAggregationPricingMetricInterface.mjs";
|
|
19
|
+
export * from "./LastAggregationPricingMetricResource.mjs";
|
|
20
20
|
export * from "./ListInvoicesResponse.mjs";
|
|
21
21
|
export * from "./ListPricingMetricsResponse.mjs";
|
|
22
22
|
export * from "./ListRateCardsResponse.mjs";
|
|
23
23
|
export * from "./ListSubjectsResponse.mjs";
|
|
24
24
|
export * from "./ListSubscriptionsResponse.mjs";
|
|
25
|
+
export * from "./MaxAggregationPricingMetricInterface.mjs";
|
|
26
|
+
export * from "./MaxAggregationPricingMetricResource.mjs";
|
|
25
27
|
export * from "./PackagePrice.mjs";
|
|
26
28
|
export * from "./Period.mjs";
|
|
27
29
|
export * from "./PeriodResource.mjs";
|
|
30
|
+
export * from "./Aggregation.mjs";
|
|
28
31
|
export * from "./PricingMetricResource.mjs";
|
|
32
|
+
export * from "./PricingMetricSummaryResource.mjs";
|
|
29
33
|
export * from "./RateCardResourceUsageBasedRatesItem.mjs";
|
|
30
34
|
export * from "./RateCardResource.mjs";
|
|
31
35
|
export * from "./SimpleUsageBasedRateInterface.mjs";
|
|
@@ -33,4 +37,5 @@ export * from "./SubjectResource.mjs";
|
|
|
33
37
|
export * from "./SubscriptionResource.mjs";
|
|
34
38
|
export * from "./SumAggregationPricingMetricInterface.mjs";
|
|
35
39
|
export * from "./SumAggregationPricingMetricResource.mjs";
|
|
40
|
+
export * from "./UsageDataForRate.mjs";
|
|
36
41
|
export * from "./ValidationError.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.
|
|
1
|
+
export declare const SDK_VERSION = "0.1.1";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.
|
|
1
|
+
export const SDK_VERSION = "0.1.1";
|