lark-billing 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/dist/cjs/Client.d.ts +1 -6
- package/dist/cjs/Client.js +2 -12
- package/dist/cjs/api/resources/checkout/client/Client.d.ts +19 -4
- package/dist/cjs/api/resources/checkout/client/Client.js +78 -9
- package/dist/cjs/api/resources/checkout/client/requests/{CreateRateCardCheckoutRequest.d.ts → CreateSubscriptionCheckoutSessionRequest.d.ts} +1 -1
- package/dist/cjs/api/resources/checkout/client/requests/index.d.ts +1 -1
- package/dist/cjs/api/resources/featureAccess/client/Client.d.ts +4 -0
- package/dist/cjs/api/resources/featureAccess/client/Client.js +7 -1
- package/dist/cjs/api/resources/index.d.ts +0 -2
- package/dist/cjs/api/resources/index.js +1 -3
- package/dist/cjs/api/resources/rateCards/client/Client.d.ts +8 -0
- package/dist/cjs/api/resources/rateCards/client/Client.js +16 -6
- package/dist/cjs/api/resources/rateCards/client/requests/CreateRateCardRequest.d.ts +1 -0
- package/dist/cjs/api/resources/rateCards/client/requests/CreateRateCardVersionRequest.d.ts +3 -0
- package/dist/cjs/api/resources/subjects/client/Client.d.ts +4 -0
- package/dist/cjs/api/resources/subjects/client/Client.js +11 -5
- package/dist/cjs/api/resources/subscriptions/client/Client.d.ts +4 -0
- package/dist/cjs/api/resources/subscriptions/client/Client.js +11 -5
- package/dist/cjs/api/resources/usageEvents/client/Client.d.ts +23 -0
- package/dist/cjs/api/resources/usageEvents/client/Client.js +75 -1
- package/dist/cjs/api/resources/usageEvents/client/requests/CreateUsageEventRequest.d.ts +1 -1
- package/dist/cjs/api/resources/usageEvents/client/requests/CreateUsageEventSummaryRequest.d.ts +30 -0
- package/dist/cjs/api/resources/usageEvents/client/requests/CreateUsageEventSummaryRequest.js +14 -0
- package/dist/cjs/api/resources/usageEvents/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/types/CompleteSubscriptionCheckoutResponse.d.ts +8 -0
- package/dist/cjs/api/types/CreateDimensionalUsageBasedRateInterface.d.ts +2 -0
- package/dist/cjs/api/types/CreateFixedRateInterface.d.ts +1 -0
- package/dist/cjs/api/types/CreatePricingMetricInterface.d.ts +1 -0
- package/dist/cjs/api/types/CreateSimpleUsageBasedRateInterface.d.ts +2 -0
- package/dist/cjs/api/types/CreateSubscriptionCheckoutSessionResponse.d.ts +10 -0
- package/dist/cjs/api/{resources/creditPools/client/index.js → types/CreateSubscriptionCheckoutSessionResponse.js} +3 -0
- package/dist/cjs/api/types/CreateUsageEventSummaryResponse.d.ts +10 -0
- package/dist/cjs/api/{resources/pricingPlans/client/index.js → types/CreateUsageEventSummaryResponse.js} +3 -0
- package/dist/cjs/api/types/CustomAggregationPricingMetricInterface.d.ts +1 -0
- package/dist/cjs/api/types/DimensionalUsageBasedRateInterface.d.ts +3 -0
- package/dist/cjs/api/types/FixedRateInterface.d.ts +2 -0
- package/dist/cjs/api/types/LastAggregationPricingMetricInterface.d.ts +1 -0
- package/dist/cjs/api/types/MaxAggregationPricingMetricInterface.d.ts +1 -0
- package/dist/cjs/api/types/Period.d.ts +9 -0
- package/dist/cjs/api/types/Period.js +5 -0
- package/dist/cjs/api/types/PricingMetricInterface.d.ts +2 -0
- package/dist/cjs/api/types/SimpleUsageBasedRateInterface.d.ts +3 -0
- package/dist/cjs/api/types/SumAggregationPricingMetricInterface.d.ts +1 -0
- package/dist/cjs/api/types/index.d.ts +4 -1
- package/dist/cjs/api/types/index.js +4 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.d.mts +1 -6
- package/dist/esm/Client.mjs +2 -12
- package/dist/esm/api/resources/checkout/client/Client.d.mts +19 -4
- package/dist/esm/api/resources/checkout/client/Client.mjs +79 -10
- package/dist/esm/api/resources/checkout/client/requests/{CreateRateCardCheckoutRequest.d.mts → CreateSubscriptionCheckoutSessionRequest.d.mts} +1 -1
- package/dist/esm/api/resources/checkout/client/requests/index.d.mts +1 -1
- package/dist/esm/api/resources/featureAccess/client/Client.d.mts +4 -0
- package/dist/esm/api/resources/featureAccess/client/Client.mjs +8 -2
- package/dist/esm/api/resources/index.d.mts +0 -2
- package/dist/esm/api/resources/index.mjs +0 -2
- package/dist/esm/api/resources/rateCards/client/Client.d.mts +8 -0
- package/dist/esm/api/resources/rateCards/client/Client.mjs +17 -7
- package/dist/esm/api/resources/rateCards/client/requests/CreateRateCardRequest.d.mts +1 -0
- package/dist/esm/api/resources/rateCards/client/requests/CreateRateCardVersionRequest.d.mts +3 -0
- package/dist/esm/api/resources/subjects/client/Client.d.mts +4 -0
- package/dist/esm/api/resources/subjects/client/Client.mjs +12 -6
- package/dist/esm/api/resources/subscriptions/client/Client.d.mts +4 -0
- package/dist/esm/api/resources/subscriptions/client/Client.mjs +12 -6
- package/dist/esm/api/resources/usageEvents/client/Client.d.mts +23 -0
- package/dist/esm/api/resources/usageEvents/client/Client.mjs +76 -2
- package/dist/esm/api/resources/usageEvents/client/requests/CreateUsageEventRequest.d.mts +1 -1
- package/dist/esm/api/resources/usageEvents/client/requests/CreateUsageEventSummaryRequest.d.mts +30 -0
- package/dist/esm/api/resources/usageEvents/client/requests/CreateUsageEventSummaryRequest.mjs +11 -0
- package/dist/esm/api/resources/usageEvents/client/requests/index.d.mts +1 -0
- package/dist/esm/api/types/CompleteSubscriptionCheckoutResponse.d.mts +8 -0
- package/dist/esm/api/types/CreateDimensionalUsageBasedRateInterface.d.mts +2 -0
- package/dist/esm/api/types/CreateFixedRateInterface.d.mts +1 -0
- package/dist/esm/api/types/CreatePricingMetricInterface.d.mts +1 -0
- package/dist/esm/api/types/CreateSimpleUsageBasedRateInterface.d.mts +2 -0
- package/dist/esm/api/types/CreateSubscriptionCheckoutSessionResponse.d.mts +10 -0
- package/dist/{cjs/api/types/CreateRateCardCheckoutResponse.d.ts → esm/api/types/CreateSubscriptionCheckoutSessionResponse.mjs} +1 -3
- package/dist/esm/api/types/CreateUsageEventSummaryResponse.d.mts +10 -0
- package/dist/esm/api/types/{CreateRateCardCheckoutResponse.d.mts → CreateUsageEventSummaryResponse.mjs} +1 -3
- package/dist/esm/api/types/CustomAggregationPricingMetricInterface.d.mts +1 -0
- package/dist/esm/api/types/DimensionalUsageBasedRateInterface.d.mts +3 -0
- package/dist/esm/api/types/FixedRateInterface.d.mts +2 -0
- package/dist/esm/api/types/LastAggregationPricingMetricInterface.d.mts +1 -0
- package/dist/esm/api/types/MaxAggregationPricingMetricInterface.d.mts +1 -0
- package/dist/esm/api/types/Period.d.mts +9 -0
- package/dist/esm/api/types/Period.mjs +4 -0
- package/dist/esm/api/types/PricingMetricInterface.d.mts +2 -0
- package/dist/esm/api/types/SimpleUsageBasedRateInterface.d.mts +3 -0
- package/dist/esm/api/types/SumAggregationPricingMetricInterface.d.mts +1 -0
- package/dist/esm/api/types/index.d.mts +4 -1
- package/dist/esm/api/types/index.mjs +4 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +111 -351
- package/dist/cjs/api/resources/creditPools/client/Client.d.ts +0 -53
- package/dist/cjs/api/resources/creditPools/client/Client.js +0 -204
- package/dist/cjs/api/resources/creditPools/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/creditPools/index.d.ts +0 -1
- package/dist/cjs/api/resources/creditPools/index.js +0 -17
- package/dist/cjs/api/resources/pricingPlans/client/Client.d.ts +0 -72
- package/dist/cjs/api/resources/pricingPlans/client/Client.js +0 -305
- package/dist/cjs/api/resources/pricingPlans/client/index.d.ts +0 -1
- package/dist/cjs/api/resources/pricingPlans/index.d.ts +0 -1
- package/dist/cjs/api/resources/pricingPlans/index.js +0 -17
- package/dist/esm/api/resources/creditPools/client/Client.d.mts +0 -53
- package/dist/esm/api/resources/creditPools/client/Client.mjs +0 -167
- package/dist/esm/api/resources/creditPools/client/index.d.mts +0 -1
- package/dist/esm/api/resources/creditPools/client/index.mjs +0 -1
- package/dist/esm/api/resources/creditPools/index.d.mts +0 -1
- package/dist/esm/api/resources/creditPools/index.mjs +0 -1
- package/dist/esm/api/resources/pricingPlans/client/Client.d.mts +0 -72
- package/dist/esm/api/resources/pricingPlans/client/Client.mjs +0 -268
- package/dist/esm/api/resources/pricingPlans/client/index.d.mts +0 -1
- package/dist/esm/api/resources/pricingPlans/client/index.mjs +0 -1
- package/dist/esm/api/resources/pricingPlans/index.d.mts +0 -1
- package/dist/esm/api/resources/pricingPlans/index.mjs +0 -1
- /package/dist/cjs/api/resources/checkout/client/requests/{CreateRateCardCheckoutRequest.js → CreateSubscriptionCheckoutSessionRequest.js} +0 -0
- /package/dist/cjs/api/types/{CreateRateCardCheckoutResponse.js → CompleteSubscriptionCheckoutResponse.js} +0 -0
- /package/dist/esm/api/resources/checkout/client/requests/{CreateRateCardCheckoutRequest.mjs → CreateSubscriptionCheckoutSessionRequest.mjs} +0 -0
- /package/dist/esm/api/types/{CreateRateCardCheckoutResponse.mjs → CompleteSubscriptionCheckoutResponse.mjs} +0 -0
|
@@ -12,33 +12,33 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
};
|
|
13
13
|
import * as core from "../../../../core/index.mjs";
|
|
14
14
|
import * as Lark from "../../../index.mjs";
|
|
15
|
-
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
15
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
16
16
|
import * as errors from "../../../../errors/index.mjs";
|
|
17
17
|
export class Checkout {
|
|
18
18
|
constructor(_options) {
|
|
19
19
|
this._options = _options;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* @param {Lark.
|
|
22
|
+
* @param {Lark.CreateSubscriptionCheckoutSessionRequest} request
|
|
23
23
|
* @param {Checkout.RequestOptions} requestOptions - Request-specific configuration.
|
|
24
24
|
*
|
|
25
25
|
* @throws {@link Lark.UnprocessableEntityError}
|
|
26
26
|
*
|
|
27
27
|
* @example
|
|
28
|
-
* await client.checkout.
|
|
28
|
+
* await client.checkout.createSubscriptionCheckoutSession({
|
|
29
29
|
* subject_id: "subject_id",
|
|
30
30
|
* rate_card_id: "rate_card_id"
|
|
31
31
|
* })
|
|
32
32
|
*/
|
|
33
|
-
|
|
34
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
33
|
+
createSubscriptionCheckoutSession(request, requestOptions) {
|
|
34
|
+
return core.HttpResponsePromise.fromPromise(this.__createSubscriptionCheckoutSession(request, requestOptions));
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
__createSubscriptionCheckoutSession(request, requestOptions) {
|
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
38
|
var _a, _b;
|
|
39
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
39
|
+
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);
|
|
40
40
|
const _response = yield core.fetcher({
|
|
41
|
-
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "checkout
|
|
41
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "checkout"),
|
|
42
42
|
method: "POST",
|
|
43
43
|
headers: _headers,
|
|
44
44
|
contentType: "application/json",
|
|
@@ -50,7 +50,10 @@ export class Checkout {
|
|
|
50
50
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
51
51
|
});
|
|
52
52
|
if (_response.ok) {
|
|
53
|
-
return {
|
|
53
|
+
return {
|
|
54
|
+
data: _response.body,
|
|
55
|
+
rawResponse: _response.rawResponse,
|
|
56
|
+
};
|
|
54
57
|
}
|
|
55
58
|
if (_response.error.reason === "status-code") {
|
|
56
59
|
switch (_response.error.statusCode) {
|
|
@@ -72,7 +75,7 @@ export class Checkout {
|
|
|
72
75
|
rawResponse: _response.rawResponse,
|
|
73
76
|
});
|
|
74
77
|
case "timeout":
|
|
75
|
-
throw new errors.LarkTimeoutError("Timeout exceeded when calling POST /checkout
|
|
78
|
+
throw new errors.LarkTimeoutError("Timeout exceeded when calling POST /checkout.");
|
|
76
79
|
case "unknown":
|
|
77
80
|
throw new errors.LarkError({
|
|
78
81
|
message: _response.error.errorMessage,
|
|
@@ -81,4 +84,70 @@ export class Checkout {
|
|
|
81
84
|
}
|
|
82
85
|
});
|
|
83
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* @param {string} checkoutId
|
|
89
|
+
* @param {Checkout.RequestOptions} requestOptions - Request-specific configuration.
|
|
90
|
+
*
|
|
91
|
+
* @throws {@link Lark.UnprocessableEntityError}
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* await client.checkout.completeSubscriptionCheckout("checkout_id")
|
|
95
|
+
*/
|
|
96
|
+
completeSubscriptionCheckout(checkoutId, requestOptions) {
|
|
97
|
+
return core.HttpResponsePromise.fromPromise(this.__completeSubscriptionCheckout(checkoutId, requestOptions));
|
|
98
|
+
}
|
|
99
|
+
__completeSubscriptionCheckout(checkoutId, requestOptions) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
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);
|
|
103
|
+
const _response = yield core.fetcher({
|
|
104
|
+
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `checkout/${encodeURIComponent(checkoutId)}/complete`),
|
|
105
|
+
method: "POST",
|
|
106
|
+
headers: _headers,
|
|
107
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
108
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
109
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
110
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
111
|
+
});
|
|
112
|
+
if (_response.ok) {
|
|
113
|
+
return {
|
|
114
|
+
data: _response.body,
|
|
115
|
+
rawResponse: _response.rawResponse,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
if (_response.error.reason === "status-code") {
|
|
119
|
+
switch (_response.error.statusCode) {
|
|
120
|
+
case 422:
|
|
121
|
+
throw new Lark.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
122
|
+
default:
|
|
123
|
+
throw new errors.LarkError({
|
|
124
|
+
statusCode: _response.error.statusCode,
|
|
125
|
+
body: _response.error.body,
|
|
126
|
+
rawResponse: _response.rawResponse,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
switch (_response.error.reason) {
|
|
131
|
+
case "non-json":
|
|
132
|
+
throw new errors.LarkError({
|
|
133
|
+
statusCode: _response.error.statusCode,
|
|
134
|
+
body: _response.error.rawBody,
|
|
135
|
+
rawResponse: _response.rawResponse,
|
|
136
|
+
});
|
|
137
|
+
case "timeout":
|
|
138
|
+
throw new errors.LarkTimeoutError("Timeout exceeded when calling POST /checkout/{checkout_id}/complete.");
|
|
139
|
+
case "unknown":
|
|
140
|
+
throw new errors.LarkError({
|
|
141
|
+
message: _response.error.errorMessage,
|
|
142
|
+
rawResponse: _response.rawResponse,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
_getCustomAuthorizationHeaders() {
|
|
148
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
150
|
+
return { "X-API-Key": apiKeyValue };
|
|
151
|
+
});
|
|
152
|
+
}
|
|
84
153
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { type
|
|
1
|
+
export { type CreateSubscriptionCheckoutSessionRequest } from "./CreateSubscriptionCheckoutSessionRequest.mjs";
|
|
@@ -8,6 +8,7 @@ export declare namespace FeatureAccess {
|
|
|
8
8
|
environment: core.Supplier<string>;
|
|
9
9
|
/** Specify a custom URL to connect the client to. */
|
|
10
10
|
baseUrl?: core.Supplier<string>;
|
|
11
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
11
12
|
/** Additional headers to include in requests. */
|
|
12
13
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
13
14
|
}
|
|
@@ -37,4 +38,7 @@ export declare class FeatureAccess {
|
|
|
37
38
|
*/
|
|
38
39
|
getFeatureAccess(requestOptions?: FeatureAccess.RequestOptions): core.HttpResponsePromise<Lark.CheckFeatureAccessResponse>;
|
|
39
40
|
private __getFeatureAccess;
|
|
41
|
+
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
42
|
+
"X-API-Key": string | undefined;
|
|
43
|
+
}>;
|
|
40
44
|
}
|
|
@@ -12,7 +12,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
};
|
|
13
13
|
import * as core from "../../../../core/index.mjs";
|
|
14
14
|
import * as Lark from "../../../index.mjs";
|
|
15
|
-
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
15
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
16
16
|
import * as errors from "../../../../errors/index.mjs";
|
|
17
17
|
export class FeatureAccess {
|
|
18
18
|
constructor(_options) {
|
|
@@ -32,7 +32,7 @@ export class FeatureAccess {
|
|
|
32
32
|
__getFeatureAccess(requestOptions) {
|
|
33
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
34
|
var _a, _b;
|
|
35
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
35
|
+
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);
|
|
36
36
|
const _response = yield core.fetcher({
|
|
37
37
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "feature-access"),
|
|
38
38
|
method: "GET",
|
|
@@ -74,4 +74,10 @@ export class FeatureAccess {
|
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
+
_getCustomAuthorizationHeaders() {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
80
|
+
return { "X-API-Key": apiKeyValue };
|
|
81
|
+
});
|
|
82
|
+
}
|
|
77
83
|
}
|
|
@@ -5,8 +5,6 @@ export * as usageEvents from "./usageEvents/index.mjs";
|
|
|
5
5
|
export * as subscriptions from "./subscriptions/index.mjs";
|
|
6
6
|
export * as featureAccess from "./featureAccess/index.mjs";
|
|
7
7
|
export * as subjects from "./subjects/index.mjs";
|
|
8
|
-
export * as pricingPlans from "./pricingPlans/index.mjs";
|
|
9
|
-
export * as creditPools from "./creditPools/index.mjs";
|
|
10
8
|
export * from "./checkout/client/requests/index.mjs";
|
|
11
9
|
export * from "./rateCards/client/requests/index.mjs";
|
|
12
10
|
export * from "./usageEvents/client/requests/index.mjs";
|
|
@@ -5,8 +5,6 @@ export * as usageEvents from "./usageEvents/index.mjs";
|
|
|
5
5
|
export * as subscriptions from "./subscriptions/index.mjs";
|
|
6
6
|
export * as featureAccess from "./featureAccess/index.mjs";
|
|
7
7
|
export * as subjects from "./subjects/index.mjs";
|
|
8
|
-
export * as pricingPlans from "./pricingPlans/index.mjs";
|
|
9
|
-
export * as creditPools from "./creditPools/index.mjs";
|
|
10
8
|
export * from "./checkout/client/requests/index.mjs";
|
|
11
9
|
export * from "./rateCards/client/requests/index.mjs";
|
|
12
10
|
export * from "./usageEvents/client/requests/index.mjs";
|
|
@@ -8,6 +8,7 @@ export declare namespace RateCards {
|
|
|
8
8
|
environment: core.Supplier<string>;
|
|
9
9
|
/** Specify a custom URL to connect the client to. */
|
|
10
10
|
baseUrl?: core.Supplier<string>;
|
|
11
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
11
12
|
/** Additional headers to include in requests. */
|
|
12
13
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
13
14
|
}
|
|
@@ -53,6 +54,7 @@ export declare class RateCards {
|
|
|
53
54
|
* description: "description",
|
|
54
55
|
* usage_based_rates: [{
|
|
55
56
|
* usage_based_rate_type: "dimensional",
|
|
57
|
+
* code: "code",
|
|
56
58
|
* name: "name",
|
|
57
59
|
* pricing_metric: {
|
|
58
60
|
* name: "name",
|
|
@@ -129,10 +131,13 @@ export declare class RateCards {
|
|
|
129
131
|
* description: "description",
|
|
130
132
|
* usage_based_rates: [{
|
|
131
133
|
* usage_based_rate_type: "dimensional",
|
|
134
|
+
* id: "id",
|
|
135
|
+
* code: "code",
|
|
132
136
|
* name: "name",
|
|
133
137
|
* description: "description",
|
|
134
138
|
* included_units: 1,
|
|
135
139
|
* pricing_metric: {
|
|
140
|
+
* id: "id",
|
|
136
141
|
* name: "name",
|
|
137
142
|
* event_name: "event_name",
|
|
138
143
|
* aggregation: {
|
|
@@ -165,4 +170,7 @@ export declare class RateCards {
|
|
|
165
170
|
*/
|
|
166
171
|
createRateCardVersion(rateCardId: string, request: Lark.CreateRateCardVersionRequest, requestOptions?: RateCards.RequestOptions): core.HttpResponsePromise<Lark.CreateRateCardVersionResponse>;
|
|
167
172
|
private __createRateCardVersion;
|
|
173
|
+
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
174
|
+
"X-API-Key": string | undefined;
|
|
175
|
+
}>;
|
|
168
176
|
}
|
|
@@ -12,7 +12,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
};
|
|
13
13
|
import * as core from "../../../../core/index.mjs";
|
|
14
14
|
import * as Lark from "../../../index.mjs";
|
|
15
|
-
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
15
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
16
16
|
import * as errors from "../../../../errors/index.mjs";
|
|
17
17
|
export class RateCards {
|
|
18
18
|
constructor(_options) {
|
|
@@ -44,7 +44,7 @@ export class RateCards {
|
|
|
44
44
|
if (offset != null) {
|
|
45
45
|
_queryParams["offset"] = offset.toString();
|
|
46
46
|
}
|
|
47
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
47
|
+
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);
|
|
48
48
|
const _response = yield core.fetcher({
|
|
49
49
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "rate-cards"),
|
|
50
50
|
method: "GET",
|
|
@@ -98,6 +98,7 @@ export class RateCards {
|
|
|
98
98
|
* description: "description",
|
|
99
99
|
* usage_based_rates: [{
|
|
100
100
|
* usage_based_rate_type: "dimensional",
|
|
101
|
+
* code: "code",
|
|
101
102
|
* name: "name",
|
|
102
103
|
* pricing_metric: {
|
|
103
104
|
* name: "name",
|
|
@@ -136,7 +137,7 @@ export class RateCards {
|
|
|
136
137
|
__createRateCard(request, requestOptions) {
|
|
137
138
|
return __awaiter(this, void 0, void 0, function* () {
|
|
138
139
|
var _a, _b;
|
|
139
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
140
|
+
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);
|
|
140
141
|
const _response = yield core.fetcher({
|
|
141
142
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "rate-cards"),
|
|
142
143
|
method: "POST",
|
|
@@ -196,7 +197,7 @@ export class RateCards {
|
|
|
196
197
|
__getRateCard(rateCardId, requestOptions) {
|
|
197
198
|
return __awaiter(this, void 0, void 0, function* () {
|
|
198
199
|
var _a, _b;
|
|
199
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
200
|
+
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);
|
|
200
201
|
const _response = yield core.fetcher({
|
|
201
202
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `rate-cards/${encodeURIComponent(rateCardId)}`),
|
|
202
203
|
method: "GET",
|
|
@@ -251,7 +252,7 @@ export class RateCards {
|
|
|
251
252
|
__deleteRateCard(rateCardId, requestOptions) {
|
|
252
253
|
return __awaiter(this, void 0, void 0, function* () {
|
|
253
254
|
var _a, _b;
|
|
254
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
255
|
+
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);
|
|
255
256
|
const _response = yield core.fetcher({
|
|
256
257
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `rate-cards/${encodeURIComponent(rateCardId)}`),
|
|
257
258
|
method: "DELETE",
|
|
@@ -301,7 +302,7 @@ export class RateCards {
|
|
|
301
302
|
__updateRateCard(rateCardId, requestOptions) {
|
|
302
303
|
return __awaiter(this, void 0, void 0, function* () {
|
|
303
304
|
var _a, _b;
|
|
304
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
305
|
+
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);
|
|
305
306
|
const _response = yield core.fetcher({
|
|
306
307
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `rate-cards/${encodeURIComponent(rateCardId)}`),
|
|
307
308
|
method: "PATCH",
|
|
@@ -351,10 +352,13 @@ export class RateCards {
|
|
|
351
352
|
* description: "description",
|
|
352
353
|
* usage_based_rates: [{
|
|
353
354
|
* usage_based_rate_type: "dimensional",
|
|
355
|
+
* id: "id",
|
|
356
|
+
* code: "code",
|
|
354
357
|
* name: "name",
|
|
355
358
|
* description: "description",
|
|
356
359
|
* included_units: 1,
|
|
357
360
|
* pricing_metric: {
|
|
361
|
+
* id: "id",
|
|
358
362
|
* name: "name",
|
|
359
363
|
* event_name: "event_name",
|
|
360
364
|
* aggregation: {
|
|
@@ -391,7 +395,7 @@ export class RateCards {
|
|
|
391
395
|
__createRateCardVersion(rateCardId, request, requestOptions) {
|
|
392
396
|
return __awaiter(this, void 0, void 0, function* () {
|
|
393
397
|
var _a, _b;
|
|
394
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
398
|
+
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);
|
|
395
399
|
const _response = yield core.fetcher({
|
|
396
400
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `rate-cards/${encodeURIComponent(rateCardId)}/versions`),
|
|
397
401
|
method: "POST",
|
|
@@ -436,4 +440,10 @@ export class RateCards {
|
|
|
436
440
|
}
|
|
437
441
|
});
|
|
438
442
|
}
|
|
443
|
+
_getCustomAuthorizationHeaders() {
|
|
444
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
445
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
446
|
+
return { "X-API-Key": apiKeyValue };
|
|
447
|
+
});
|
|
448
|
+
}
|
|
439
449
|
}
|
|
@@ -9,10 +9,13 @@ import * as Lark from "../../../../index.mjs";
|
|
|
9
9
|
* description: "description",
|
|
10
10
|
* usage_based_rates: [{
|
|
11
11
|
* usage_based_rate_type: "dimensional",
|
|
12
|
+
* id: "id",
|
|
13
|
+
* code: "code",
|
|
12
14
|
* name: "name",
|
|
13
15
|
* description: "description",
|
|
14
16
|
* included_units: 1,
|
|
15
17
|
* pricing_metric: {
|
|
18
|
+
* id: "id",
|
|
16
19
|
* name: "name",
|
|
17
20
|
* event_name: "event_name",
|
|
18
21
|
* aggregation: {
|
|
@@ -8,6 +8,7 @@ export declare namespace Subjects {
|
|
|
8
8
|
environment: core.Supplier<string>;
|
|
9
9
|
/** Specify a custom URL to connect the client to. */
|
|
10
10
|
baseUrl?: core.Supplier<string>;
|
|
11
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
11
12
|
/** Additional headers to include in requests. */
|
|
12
13
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
13
14
|
}
|
|
@@ -86,4 +87,7 @@ export declare class Subjects {
|
|
|
86
87
|
*/
|
|
87
88
|
deleteSubject(subjectId: string, requestOptions?: Subjects.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
88
89
|
private __deleteSubject;
|
|
90
|
+
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
91
|
+
"X-API-Key": string | undefined;
|
|
92
|
+
}>;
|
|
89
93
|
}
|
|
@@ -12,7 +12,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
};
|
|
13
13
|
import * as core from "../../../../core/index.mjs";
|
|
14
14
|
import * as Lark from "../../../index.mjs";
|
|
15
|
-
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
15
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
16
16
|
import * as errors from "../../../../errors/index.mjs";
|
|
17
17
|
export class Subjects {
|
|
18
18
|
constructor(_options) {
|
|
@@ -44,7 +44,7 @@ export class Subjects {
|
|
|
44
44
|
if (offset != null) {
|
|
45
45
|
_queryParams["offset"] = offset.toString();
|
|
46
46
|
}
|
|
47
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
47
|
+
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);
|
|
48
48
|
const _response = yield core.fetcher({
|
|
49
49
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "subjects"),
|
|
50
50
|
method: "GET",
|
|
@@ -101,7 +101,7 @@ export class Subjects {
|
|
|
101
101
|
__createSubject() {
|
|
102
102
|
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
103
103
|
var _a, _b;
|
|
104
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
104
|
+
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);
|
|
105
105
|
const _response = yield core.fetcher({
|
|
106
106
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "subjects"),
|
|
107
107
|
method: "POST",
|
|
@@ -161,7 +161,7 @@ export class Subjects {
|
|
|
161
161
|
__getSubject(subjectId, requestOptions) {
|
|
162
162
|
return __awaiter(this, void 0, void 0, function* () {
|
|
163
163
|
var _a, _b;
|
|
164
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
164
|
+
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);
|
|
165
165
|
const _response = yield core.fetcher({
|
|
166
166
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `subjects/${encodeURIComponent(subjectId)}`),
|
|
167
167
|
method: "GET",
|
|
@@ -219,7 +219,7 @@ export class Subjects {
|
|
|
219
219
|
__updateSubject(subjectId_1) {
|
|
220
220
|
return __awaiter(this, arguments, void 0, function* (subjectId, request = {}, requestOptions) {
|
|
221
221
|
var _a, _b;
|
|
222
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
222
|
+
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);
|
|
223
223
|
const _response = yield core.fetcher({
|
|
224
224
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `subjects/${encodeURIComponent(subjectId)}`),
|
|
225
225
|
method: "PUT",
|
|
@@ -279,7 +279,7 @@ export class Subjects {
|
|
|
279
279
|
__deleteSubject(subjectId, requestOptions) {
|
|
280
280
|
return __awaiter(this, void 0, void 0, function* () {
|
|
281
281
|
var _a, _b;
|
|
282
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
282
|
+
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);
|
|
283
283
|
const _response = yield core.fetcher({
|
|
284
284
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `subjects/${encodeURIComponent(subjectId)}`),
|
|
285
285
|
method: "DELETE",
|
|
@@ -321,4 +321,10 @@ export class Subjects {
|
|
|
321
321
|
}
|
|
322
322
|
});
|
|
323
323
|
}
|
|
324
|
+
_getCustomAuthorizationHeaders() {
|
|
325
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
326
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
327
|
+
return { "X-API-Key": apiKeyValue };
|
|
328
|
+
});
|
|
329
|
+
}
|
|
324
330
|
}
|
|
@@ -8,6 +8,7 @@ export declare namespace Subscriptions {
|
|
|
8
8
|
environment: core.Supplier<string>;
|
|
9
9
|
/** Specify a custom URL to connect the client to. */
|
|
10
10
|
baseUrl?: core.Supplier<string>;
|
|
11
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
11
12
|
/** Additional headers to include in requests. */
|
|
12
13
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
13
14
|
}
|
|
@@ -85,4 +86,7 @@ export declare class Subscriptions {
|
|
|
85
86
|
*/
|
|
86
87
|
updateSubscription(subscriptionId: string, requestOptions?: Subscriptions.RequestOptions): core.HttpResponsePromise<void>;
|
|
87
88
|
private __updateSubscription;
|
|
89
|
+
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
90
|
+
"X-API-Key": string | undefined;
|
|
91
|
+
}>;
|
|
88
92
|
}
|
|
@@ -12,7 +12,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
12
12
|
};
|
|
13
13
|
import * as core from "../../../../core/index.mjs";
|
|
14
14
|
import * as Lark from "../../../index.mjs";
|
|
15
|
-
import { mergeHeaders } from "../../../../core/headers.mjs";
|
|
15
|
+
import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
|
|
16
16
|
import * as errors from "../../../../errors/index.mjs";
|
|
17
17
|
export class Subscriptions {
|
|
18
18
|
constructor(_options) {
|
|
@@ -44,7 +44,7 @@ export class Subscriptions {
|
|
|
44
44
|
if (offset != null) {
|
|
45
45
|
_queryParams["offset"] = offset.toString();
|
|
46
46
|
}
|
|
47
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
47
|
+
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);
|
|
48
48
|
const _response = yield core.fetcher({
|
|
49
49
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "subscriptions"),
|
|
50
50
|
method: "GET",
|
|
@@ -105,7 +105,7 @@ export class Subscriptions {
|
|
|
105
105
|
__createSubscription(request, requestOptions) {
|
|
106
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
107
107
|
var _a, _b;
|
|
108
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
108
|
+
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);
|
|
109
109
|
const _response = yield core.fetcher({
|
|
110
110
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), "subscriptions"),
|
|
111
111
|
method: "POST",
|
|
@@ -165,7 +165,7 @@ export class Subscriptions {
|
|
|
165
165
|
__getSubscription(subscriptionId, requestOptions) {
|
|
166
166
|
return __awaiter(this, void 0, void 0, function* () {
|
|
167
167
|
var _a, _b;
|
|
168
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
168
|
+
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);
|
|
169
169
|
const _response = yield core.fetcher({
|
|
170
170
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `subscriptions/${encodeURIComponent(subscriptionId)}`),
|
|
171
171
|
method: "GET",
|
|
@@ -220,7 +220,7 @@ export class Subscriptions {
|
|
|
220
220
|
__cancelSubscription(subscriptionId, requestOptions) {
|
|
221
221
|
return __awaiter(this, void 0, void 0, function* () {
|
|
222
222
|
var _a, _b;
|
|
223
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
223
|
+
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);
|
|
224
224
|
const _response = yield core.fetcher({
|
|
225
225
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `subscriptions/${encodeURIComponent(subscriptionId)}`),
|
|
226
226
|
method: "DELETE",
|
|
@@ -270,7 +270,7 @@ export class Subscriptions {
|
|
|
270
270
|
__updateSubscription(subscriptionId, requestOptions) {
|
|
271
271
|
return __awaiter(this, void 0, void 0, function* () {
|
|
272
272
|
var _a, _b;
|
|
273
|
-
let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
273
|
+
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);
|
|
274
274
|
const _response = yield core.fetcher({
|
|
275
275
|
url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment)), `subscriptions/${encodeURIComponent(subscriptionId)}`),
|
|
276
276
|
method: "PATCH",
|
|
@@ -307,4 +307,10 @@ export class Subscriptions {
|
|
|
307
307
|
}
|
|
308
308
|
});
|
|
309
309
|
}
|
|
310
|
+
_getCustomAuthorizationHeaders() {
|
|
311
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
312
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
313
|
+
return { "X-API-Key": apiKeyValue };
|
|
314
|
+
});
|
|
315
|
+
}
|
|
310
316
|
}
|
|
@@ -8,6 +8,7 @@ export declare namespace UsageEvents {
|
|
|
8
8
|
environment: core.Supplier<string>;
|
|
9
9
|
/** Specify a custom URL to connect the client to. */
|
|
10
10
|
baseUrl?: core.Supplier<string>;
|
|
11
|
+
apiKey?: core.Supplier<string | undefined>;
|
|
11
12
|
/** Additional headers to include in requests. */
|
|
12
13
|
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
13
14
|
}
|
|
@@ -46,4 +47,26 @@ export declare class UsageEvents {
|
|
|
46
47
|
*/
|
|
47
48
|
createUsageEvent(request: Lark.CreateUsageEventRequest, requestOptions?: UsageEvents.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
48
49
|
private __createUsageEvent;
|
|
50
|
+
/**
|
|
51
|
+
* @param {Lark.CreateUsageEventSummaryRequest} request
|
|
52
|
+
* @param {UsageEvents.RequestOptions} requestOptions - Request-specific configuration.
|
|
53
|
+
*
|
|
54
|
+
* @throws {@link Lark.UnprocessableEntityError}
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* await client.usageEvents.createUsageEventSummary({
|
|
58
|
+
* event_name: "event_name",
|
|
59
|
+
* subject_id: "subject_id",
|
|
60
|
+
* period: {
|
|
61
|
+
* start: "2024-01-15T09:30:00Z",
|
|
62
|
+
* end: "2024-01-15T09:30:00Z"
|
|
63
|
+
* },
|
|
64
|
+
* aggregation_type: "sum"
|
|
65
|
+
* })
|
|
66
|
+
*/
|
|
67
|
+
createUsageEventSummary(request: Lark.CreateUsageEventSummaryRequest, requestOptions?: UsageEvents.RequestOptions): core.HttpResponsePromise<Lark.CreateUsageEventSummaryResponse>;
|
|
68
|
+
private __createUsageEventSummary;
|
|
69
|
+
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
70
|
+
"X-API-Key": string | undefined;
|
|
71
|
+
}>;
|
|
49
72
|
}
|