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
|
@@ -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
|
}
|
|
@@ -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.js";
|
|
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.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
|
+
}
|
|
@@ -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.js";
|
|
1
2
|
export * from "./Amount.js";
|
|
2
3
|
export * from "./BillingStateResponse.js";
|
|
3
4
|
export * from "./CountAggregationPricingMetricInterface.js";
|
|
@@ -5,27 +6,30 @@ export * from "./CountAggregationPricingMetricResource.js";
|
|
|
5
6
|
export * from "./CreateCustomerPortalSessionResponse.js";
|
|
6
7
|
export * from "./Price.js";
|
|
7
8
|
export * from "./CreateFixedRateRequest.js";
|
|
8
|
-
export * from "./Aggregation.js";
|
|
9
|
-
export * from "./CreatePricingMetricResponse.js";
|
|
10
9
|
export * from "./CreateSimpleUsageBasedRateRequest.js";
|
|
11
10
|
export * from "./CreateSubjectResponse.js";
|
|
12
11
|
export * from "./CreateSubscriptionCheckoutSessionResponse.js";
|
|
13
|
-
export * from "./
|
|
12
|
+
export * from "./CustomAggregationPricingMetricInterface.js";
|
|
14
13
|
export * from "./FixedRateInterface.js";
|
|
15
14
|
export * from "./FlatPrice.js";
|
|
16
|
-
export * from "./GetPricingMetricResponse.js";
|
|
17
15
|
export * from "./HttpValidationError.js";
|
|
18
16
|
export * from "./InvoiceLineItemResource.js";
|
|
19
17
|
export * from "./InvoiceResource.js";
|
|
18
|
+
export * from "./LastAggregationPricingMetricInterface.js";
|
|
19
|
+
export * from "./LastAggregationPricingMetricResource.js";
|
|
20
20
|
export * from "./ListInvoicesResponse.js";
|
|
21
21
|
export * from "./ListPricingMetricsResponse.js";
|
|
22
22
|
export * from "./ListRateCardsResponse.js";
|
|
23
23
|
export * from "./ListSubjectsResponse.js";
|
|
24
24
|
export * from "./ListSubscriptionsResponse.js";
|
|
25
|
+
export * from "./MaxAggregationPricingMetricInterface.js";
|
|
26
|
+
export * from "./MaxAggregationPricingMetricResource.js";
|
|
25
27
|
export * from "./PackagePrice.js";
|
|
26
28
|
export * from "./Period.js";
|
|
27
29
|
export * from "./PeriodResource.js";
|
|
30
|
+
export * from "./Aggregation.js";
|
|
28
31
|
export * from "./PricingMetricResource.js";
|
|
32
|
+
export * from "./PricingMetricSummaryResource.js";
|
|
29
33
|
export * from "./RateCardResourceUsageBasedRatesItem.js";
|
|
30
34
|
export * from "./RateCardResource.js";
|
|
31
35
|
export * from "./SimpleUsageBasedRateInterface.js";
|
|
@@ -33,4 +37,5 @@ export * from "./SubjectResource.js";
|
|
|
33
37
|
export * from "./SubscriptionResource.js";
|
|
34
38
|
export * from "./SumAggregationPricingMetricInterface.js";
|
|
35
39
|
export * from "./SumAggregationPricingMetricResource.js";
|
|
40
|
+
export * from "./UsageDataForRate.js";
|
|
36
41
|
export * from "./ValidationError.js";
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ActiveSubscription.js"), exports);
|
|
17
18
|
__exportStar(require("./Amount.js"), exports);
|
|
18
19
|
__exportStar(require("./BillingStateResponse.js"), exports);
|
|
19
20
|
__exportStar(require("./CountAggregationPricingMetricInterface.js"), exports);
|
|
@@ -21,27 +22,30 @@ __exportStar(require("./CountAggregationPricingMetricResource.js"), exports);
|
|
|
21
22
|
__exportStar(require("./CreateCustomerPortalSessionResponse.js"), exports);
|
|
22
23
|
__exportStar(require("./Price.js"), exports);
|
|
23
24
|
__exportStar(require("./CreateFixedRateRequest.js"), exports);
|
|
24
|
-
__exportStar(require("./Aggregation.js"), exports);
|
|
25
|
-
__exportStar(require("./CreatePricingMetricResponse.js"), exports);
|
|
26
25
|
__exportStar(require("./CreateSimpleUsageBasedRateRequest.js"), exports);
|
|
27
26
|
__exportStar(require("./CreateSubjectResponse.js"), exports);
|
|
28
27
|
__exportStar(require("./CreateSubscriptionCheckoutSessionResponse.js"), exports);
|
|
29
|
-
__exportStar(require("./
|
|
28
|
+
__exportStar(require("./CustomAggregationPricingMetricInterface.js"), exports);
|
|
30
29
|
__exportStar(require("./FixedRateInterface.js"), exports);
|
|
31
30
|
__exportStar(require("./FlatPrice.js"), exports);
|
|
32
|
-
__exportStar(require("./GetPricingMetricResponse.js"), exports);
|
|
33
31
|
__exportStar(require("./HttpValidationError.js"), exports);
|
|
34
32
|
__exportStar(require("./InvoiceLineItemResource.js"), exports);
|
|
35
33
|
__exportStar(require("./InvoiceResource.js"), exports);
|
|
34
|
+
__exportStar(require("./LastAggregationPricingMetricInterface.js"), exports);
|
|
35
|
+
__exportStar(require("./LastAggregationPricingMetricResource.js"), exports);
|
|
36
36
|
__exportStar(require("./ListInvoicesResponse.js"), exports);
|
|
37
37
|
__exportStar(require("./ListPricingMetricsResponse.js"), exports);
|
|
38
38
|
__exportStar(require("./ListRateCardsResponse.js"), exports);
|
|
39
39
|
__exportStar(require("./ListSubjectsResponse.js"), exports);
|
|
40
40
|
__exportStar(require("./ListSubscriptionsResponse.js"), exports);
|
|
41
|
+
__exportStar(require("./MaxAggregationPricingMetricInterface.js"), exports);
|
|
42
|
+
__exportStar(require("./MaxAggregationPricingMetricResource.js"), exports);
|
|
41
43
|
__exportStar(require("./PackagePrice.js"), exports);
|
|
42
44
|
__exportStar(require("./Period.js"), exports);
|
|
43
45
|
__exportStar(require("./PeriodResource.js"), exports);
|
|
46
|
+
__exportStar(require("./Aggregation.js"), exports);
|
|
44
47
|
__exportStar(require("./PricingMetricResource.js"), exports);
|
|
48
|
+
__exportStar(require("./PricingMetricSummaryResource.js"), exports);
|
|
45
49
|
__exportStar(require("./RateCardResourceUsageBasedRatesItem.js"), exports);
|
|
46
50
|
__exportStar(require("./RateCardResource.js"), exports);
|
|
47
51
|
__exportStar(require("./SimpleUsageBasedRateInterface.js"), exports);
|
|
@@ -49,4 +53,5 @@ __exportStar(require("./SubjectResource.js"), exports);
|
|
|
49
53
|
__exportStar(require("./SubscriptionResource.js"), exports);
|
|
50
54
|
__exportStar(require("./SumAggregationPricingMetricInterface.js"), exports);
|
|
51
55
|
__exportStar(require("./SumAggregationPricingMetricResource.js"), exports);
|
|
56
|
+
__exportStar(require("./UsageDataForRate.js"), exports);
|
|
52
57
|
__exportStar(require("./ValidationError.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.
|
|
1
|
+
export declare const SDK_VERSION = "0.1.1";
|
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.
|
|
21
|
-
"User-Agent": "lark-billing/0.
|
|
20
|
+
"X-Fern-SDK-Version": "0.1.1",
|
|
21
|
+
"User-Agent": "lark-billing/0.1.1",
|
|
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) });
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* }
|
|
11
11
|
*/
|
|
12
12
|
export interface CreateSubscriptionCheckoutSessionRequest {
|
|
13
|
-
/** The ID of the subject to create the checkout for. */
|
|
13
|
+
/** The ID or external ID of the subject to create the checkout for. */
|
|
14
14
|
subject_id: string;
|
|
15
15
|
/** The ID of the rate card to subscribe to. */
|
|
16
16
|
rate_card_id: string;
|
|
@@ -50,15 +50,16 @@ export declare class PricingMetrics {
|
|
|
50
50
|
*
|
|
51
51
|
* @example
|
|
52
52
|
* await client.pricingMetrics.createPricingMetric({
|
|
53
|
-
* name: "
|
|
54
|
-
* event_name: "
|
|
53
|
+
* name: "Compute Hours",
|
|
54
|
+
* event_name: "job_completed",
|
|
55
55
|
* aggregation: {
|
|
56
|
-
* aggregation_type: "
|
|
56
|
+
* aggregation_type: "sum",
|
|
57
|
+
* value_field: "value_field"
|
|
57
58
|
* },
|
|
58
|
-
* unit: "
|
|
59
|
+
* unit: "hours"
|
|
59
60
|
* })
|
|
60
61
|
*/
|
|
61
|
-
createPricingMetric(request: Lark.CreatePricingMetricRequest, requestOptions?: PricingMetrics.RequestOptions): core.HttpResponsePromise<Lark.
|
|
62
|
+
createPricingMetric(request: Lark.CreatePricingMetricRequest, requestOptions?: PricingMetrics.RequestOptions): core.HttpResponsePromise<Lark.PricingMetricResource>;
|
|
62
63
|
private __createPricingMetric;
|
|
63
64
|
/**
|
|
64
65
|
* @param {string} pricingMetricId
|
|
@@ -69,8 +70,26 @@ export declare class PricingMetrics {
|
|
|
69
70
|
* @example
|
|
70
71
|
* await client.pricingMetrics.getPricingMetric("pricing_metric_id")
|
|
71
72
|
*/
|
|
72
|
-
getPricingMetric(pricingMetricId: string, requestOptions?: PricingMetrics.RequestOptions): core.HttpResponsePromise<Lark.
|
|
73
|
+
getPricingMetric(pricingMetricId: string, requestOptions?: PricingMetrics.RequestOptions): core.HttpResponsePromise<Lark.PricingMetricResource>;
|
|
73
74
|
private __getPricingMetric;
|
|
75
|
+
/**
|
|
76
|
+
* @param {string} pricingMetricId
|
|
77
|
+
* @param {Lark.CreatePricingMetricSummaryRequest} request
|
|
78
|
+
* @param {PricingMetrics.RequestOptions} requestOptions - Request-specific configuration.
|
|
79
|
+
*
|
|
80
|
+
* @throws {@link Lark.UnprocessableEntityError}
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* await client.pricingMetrics.createPricingMetricSummary("pricing_metric_id", {
|
|
84
|
+
* subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
|
|
85
|
+
* period: {
|
|
86
|
+
* start: "2025-10-01T00:00:00Z",
|
|
87
|
+
* end: "2025-11-01T00:00:00Z"
|
|
88
|
+
* }
|
|
89
|
+
* })
|
|
90
|
+
*/
|
|
91
|
+
createPricingMetricSummary(pricingMetricId: string, request: Lark.CreatePricingMetricSummaryRequest, requestOptions?: PricingMetrics.RequestOptions): core.HttpResponsePromise<Lark.PricingMetricSummaryResource>;
|
|
92
|
+
private __createPricingMetricSummary;
|
|
74
93
|
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
75
94
|
"X-API-Key": string;
|
|
76
95
|
}>;
|
|
@@ -91,12 +91,13 @@ export class PricingMetrics {
|
|
|
91
91
|
*
|
|
92
92
|
* @example
|
|
93
93
|
* await client.pricingMetrics.createPricingMetric({
|
|
94
|
-
* name: "
|
|
95
|
-
* event_name: "
|
|
94
|
+
* name: "Compute Hours",
|
|
95
|
+
* event_name: "job_completed",
|
|
96
96
|
* aggregation: {
|
|
97
|
-
* aggregation_type: "
|
|
97
|
+
* aggregation_type: "sum",
|
|
98
|
+
* value_field: "value_field"
|
|
98
99
|
* },
|
|
99
|
-
* unit: "
|
|
100
|
+
* unit: "hours"
|
|
100
101
|
* })
|
|
101
102
|
*/
|
|
102
103
|
createPricingMetric(request, requestOptions) {
|
|
@@ -207,6 +208,73 @@ export class PricingMetrics {
|
|
|
207
208
|
}
|
|
208
209
|
});
|
|
209
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* @param {string} pricingMetricId
|
|
213
|
+
* @param {Lark.CreatePricingMetricSummaryRequest} request
|
|
214
|
+
* @param {PricingMetrics.RequestOptions} requestOptions - Request-specific configuration.
|
|
215
|
+
*
|
|
216
|
+
* @throws {@link Lark.UnprocessableEntityError}
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* await client.pricingMetrics.createPricingMetricSummary("pricing_metric_id", {
|
|
220
|
+
* subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
|
|
221
|
+
* period: {
|
|
222
|
+
* start: "2025-10-01T00:00:00Z",
|
|
223
|
+
* end: "2025-11-01T00:00:00Z"
|
|
224
|
+
* }
|
|
225
|
+
* })
|
|
226
|
+
*/
|
|
227
|
+
createPricingMetricSummary(pricingMetricId, request, requestOptions) {
|
|
228
|
+
return core.HttpResponsePromise.fromPromise(this.__createPricingMetricSummary(pricingMetricId, request, requestOptions));
|
|
229
|
+
}
|
|
230
|
+
__createPricingMetricSummary(pricingMetricId, request, requestOptions) {
|
|
231
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
232
|
+
var _a, _b, _c;
|
|
233
|
+
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);
|
|
234
|
+
const _response = yield core.fetcher({
|
|
235
|
+
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, `pricing-metrics/${encodeURIComponent(pricingMetricId)}/summary`),
|
|
236
|
+
method: "POST",
|
|
237
|
+
headers: _headers,
|
|
238
|
+
contentType: "application/json",
|
|
239
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
240
|
+
requestType: "json",
|
|
241
|
+
body: request,
|
|
242
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
243
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
244
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
245
|
+
});
|
|
246
|
+
if (_response.ok) {
|
|
247
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
248
|
+
}
|
|
249
|
+
if (_response.error.reason === "status-code") {
|
|
250
|
+
switch (_response.error.statusCode) {
|
|
251
|
+
case 422:
|
|
252
|
+
throw new Lark.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
253
|
+
default:
|
|
254
|
+
throw new errors.LarkError({
|
|
255
|
+
statusCode: _response.error.statusCode,
|
|
256
|
+
body: _response.error.body,
|
|
257
|
+
rawResponse: _response.rawResponse,
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
switch (_response.error.reason) {
|
|
262
|
+
case "non-json":
|
|
263
|
+
throw new errors.LarkError({
|
|
264
|
+
statusCode: _response.error.statusCode,
|
|
265
|
+
body: _response.error.rawBody,
|
|
266
|
+
rawResponse: _response.rawResponse,
|
|
267
|
+
});
|
|
268
|
+
case "timeout":
|
|
269
|
+
throw new errors.LarkTimeoutError("Timeout exceeded when calling POST /pricing-metrics/{pricing_metric_id}/summary.");
|
|
270
|
+
case "unknown":
|
|
271
|
+
throw new errors.LarkError({
|
|
272
|
+
message: _response.error.errorMessage,
|
|
273
|
+
rawResponse: _response.rawResponse,
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
210
278
|
_getCustomAuthorizationHeaders() {
|
|
211
279
|
return __awaiter(this, void 0, void 0, function* () {
|
|
212
280
|
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
package/dist/esm/api/resources/pricingMetrics/client/requests/CreatePricingMetricRequest.d.mts
CHANGED
|
@@ -5,18 +5,22 @@ import * as Lark from "../../../../index.mjs";
|
|
|
5
5
|
/**
|
|
6
6
|
* @example
|
|
7
7
|
* {
|
|
8
|
-
* name: "
|
|
9
|
-
* event_name: "
|
|
8
|
+
* name: "Compute Hours",
|
|
9
|
+
* event_name: "job_completed",
|
|
10
10
|
* aggregation: {
|
|
11
|
-
* aggregation_type: "
|
|
11
|
+
* aggregation_type: "sum",
|
|
12
|
+
* value_field: "value_field"
|
|
12
13
|
* },
|
|
13
|
-
* unit: "
|
|
14
|
+
* unit: "hours"
|
|
14
15
|
* }
|
|
15
16
|
*/
|
|
16
17
|
export interface CreatePricingMetricRequest {
|
|
18
|
+
/** The name of the pricing metric. */
|
|
17
19
|
name: string;
|
|
20
|
+
/** The name of the event that the pricing metric is computed on. */
|
|
18
21
|
event_name: string;
|
|
22
|
+
/** The aggregation function used to compute the value of the pricing metric. */
|
|
19
23
|
aggregation: Lark.PricingMetricAggregation;
|
|
20
|
-
/** Unit of measurement for the pricing metric */
|
|
24
|
+
/** Unit of measurement for the pricing metric. */
|
|
21
25
|
unit: string;
|
|
22
26
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Lark from "../../../../index.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* @example
|
|
7
|
+
* {
|
|
8
|
+
* subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE",
|
|
9
|
+
* period: {
|
|
10
|
+
* start: "2025-10-01T00:00:00Z",
|
|
11
|
+
* end: "2025-11-01T00:00:00Z"
|
|
12
|
+
* }
|
|
13
|
+
* }
|
|
14
|
+
*/
|
|
15
|
+
export interface CreatePricingMetricSummaryRequest {
|
|
16
|
+
/** The ID or external ID of the subject that the summary should be computed for. */
|
|
17
|
+
subject_id: string;
|
|
18
|
+
/** The period that the summary should be computed over. */
|
|
19
|
+
period: Lark.Period;
|
|
20
|
+
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { type ListPricingMetricsPricingMetricsGetRequest } from "./ListPricingMetricsPricingMetricsGetRequest.mjs";
|
|
2
2
|
export { type CreatePricingMetricRequest } from "./CreatePricingMetricRequest.mjs";
|
|
3
|
+
export { type CreatePricingMetricSummaryRequest } from "./CreatePricingMetricSummaryRequest.mjs";
|
|
@@ -2,11 +2,23 @@
|
|
|
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 PricingMetricAggregation = Lark.PricingMetricAggregation.Count | Lark.PricingMetricAggregation.Custom | Lark.PricingMetricAggregation.Last | Lark.PricingMetricAggregation.Max | Lark.PricingMetricAggregation.Sum;
|
|
6
9
|
export declare namespace PricingMetricAggregation {
|
|
7
10
|
interface Count extends Lark.CountAggregationPricingMetricInterface {
|
|
8
11
|
aggregation_type: "count";
|
|
9
12
|
}
|
|
13
|
+
interface Custom extends Lark.CustomAggregationPricingMetricInterface {
|
|
14
|
+
aggregation_type: "custom";
|
|
15
|
+
}
|
|
16
|
+
interface Last extends Lark.LastAggregationPricingMetricInterface {
|
|
17
|
+
aggregation_type: "last";
|
|
18
|
+
}
|
|
19
|
+
interface Max extends Lark.MaxAggregationPricingMetricInterface {
|
|
20
|
+
aggregation_type: "max";
|
|
21
|
+
}
|
|
10
22
|
interface Sum extends Lark.SumAggregationPricingMetricInterface {
|
|
11
23
|
aggregation_type: "sum";
|
|
12
24
|
}
|
|
@@ -51,7 +51,33 @@ export declare class RateCards {
|
|
|
51
51
|
* @example
|
|
52
52
|
* await client.rateCards.createRateCard({
|
|
53
53
|
* name: "Pro Plan",
|
|
54
|
-
*
|
|
54
|
+
* description: "For production applications with moderate usage.",
|
|
55
|
+
* billing_interval: "monthly",
|
|
56
|
+
* fixed_rates: [{
|
|
57
|
+
* name: "Base Rate",
|
|
58
|
+
* price: {
|
|
59
|
+
* price_type: "flat",
|
|
60
|
+
* amount: {
|
|
61
|
+
* value: "2500",
|
|
62
|
+
* currency_code: "usd"
|
|
63
|
+
* }
|
|
64
|
+
* }
|
|
65
|
+
* }],
|
|
66
|
+
* usage_based_rates: [{
|
|
67
|
+
* usage_based_rate_type: "simple",
|
|
68
|
+
* name: "name",
|
|
69
|
+
* price: {
|
|
70
|
+
* price_type: "flat",
|
|
71
|
+
* amount: {
|
|
72
|
+
* value: "2500",
|
|
73
|
+
* currency_code: "usd"
|
|
74
|
+
* }
|
|
75
|
+
* },
|
|
76
|
+
* pricing_metric_id: "pricing_metric_id"
|
|
77
|
+
* }],
|
|
78
|
+
* metadata: {
|
|
79
|
+
* "key": "value"
|
|
80
|
+
* }
|
|
55
81
|
* })
|
|
56
82
|
*/
|
|
57
83
|
createRateCard(request: Lark.CreateRateCardRequest, requestOptions?: RateCards.RequestOptions): core.HttpResponsePromise<Lark.RateCardResource>;
|