@flexprice/sdk 2.1.24 → 2.1.25
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/docs/sdk/models/create-entitlement-request.md +22 -21
- package/docs/sdk/models/create-entity-integration-mapping-request.md +1 -1
- package/docs/sdk/models/entitlement-grant-allocation-behavior.md +17 -0
- package/docs/sdk/models/entitlement-grant-duration-unit.md +1 -1
- package/docs/sdk/models/entitlement-response.md +34 -33
- package/docs/sdk/models/integration-entity-type.md +2 -2
- package/docs/sdk/models/invoice-sync-settings.md +4 -3
- package/docs/sdk/models/link-integration-mapping-request.md +1 -1
- package/docs/sdk/models/service-period-custom-fields.md +16 -0
- package/docs/sdk/models/subscription-change-v2-request.md +1 -0
- package/docs/sdk/models/subscription-change-v2-response.md +14 -11
- package/docs/sdk/models/update-entitlement-request.md +1 -0
- package/docs/sdks/costs/README.md +0 -72
- package/docs/sdks/integrations/README.md +4 -4
- package/docs/sdks/subscriptions/README.md +6 -0
- package/esm/funcs/subscriptions-execute-subscription-plan-change-v2.d.ts +6 -0
- package/esm/funcs/subscriptions-execute-subscription-plan-change-v2.d.ts.map +1 -1
- package/esm/funcs/subscriptions-execute-subscription-plan-change-v2.js +6 -0
- package/esm/funcs/subscriptions-execute-subscription-plan-change-v2.js.map +1 -1
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/sdk/costs.d.ts +0 -7
- package/esm/sdk/costs.d.ts.map +1 -1
- package/esm/sdk/costs.js +0 -10
- package/esm/sdk/costs.js.map +1 -1
- package/esm/sdk/models/create-entitlement-request.d.ts +3 -0
- package/esm/sdk/models/create-entitlement-request.d.ts.map +1 -1
- package/esm/sdk/models/create-entitlement-request.js +3 -0
- package/esm/sdk/models/create-entitlement-request.js.map +1 -1
- package/esm/sdk/models/entitlement-grant-allocation-behavior.d.ts +12 -0
- package/esm/sdk/models/entitlement-grant-allocation-behavior.d.ts.map +1 -0
- package/esm/sdk/models/entitlement-grant-allocation-behavior.js +13 -0
- package/esm/sdk/models/entitlement-grant-allocation-behavior.js.map +1 -0
- package/esm/sdk/models/entitlement-grant-duration-unit.d.ts +1 -0
- package/esm/sdk/models/entitlement-grant-duration-unit.d.ts.map +1 -1
- package/esm/sdk/models/entitlement-grant-duration-unit.js +1 -0
- package/esm/sdk/models/entitlement-grant-duration-unit.js.map +1 -1
- package/esm/sdk/models/entitlement-response.d.ts +2 -0
- package/esm/sdk/models/entitlement-response.d.ts.map +1 -1
- package/esm/sdk/models/entitlement-response.js +3 -0
- package/esm/sdk/models/entitlement-response.js.map +1 -1
- package/esm/sdk/models/index.d.ts +2 -0
- package/esm/sdk/models/index.d.ts.map +1 -1
- package/esm/sdk/models/index.js +2 -0
- package/esm/sdk/models/index.js.map +1 -1
- package/esm/sdk/models/integration-entity-type.d.ts +1 -0
- package/esm/sdk/models/integration-entity-type.d.ts.map +1 -1
- package/esm/sdk/models/integration-entity-type.js +1 -0
- package/esm/sdk/models/integration-entity-type.js.map +1 -1
- package/esm/sdk/models/invoice-sync-settings.d.ts +2 -0
- package/esm/sdk/models/invoice-sync-settings.d.ts.map +1 -1
- package/esm/sdk/models/invoice-sync-settings.js +3 -0
- package/esm/sdk/models/invoice-sync-settings.js.map +1 -1
- package/esm/sdk/models/service-period-custom-fields.d.ts +11 -0
- package/esm/sdk/models/service-period-custom-fields.d.ts.map +1 -0
- package/esm/sdk/models/service-period-custom-fields.js +21 -0
- package/esm/sdk/models/service-period-custom-fields.js.map +1 -0
- package/esm/sdk/models/subscription-change-v2-request.d.ts +3 -0
- package/esm/sdk/models/subscription-change-v2-request.d.ts.map +1 -1
- package/esm/sdk/models/subscription-change-v2-request.js +3 -0
- package/esm/sdk/models/subscription-change-v2-request.js.map +1 -1
- package/esm/sdk/models/subscription-change-v2-response.d.ts +9 -0
- package/esm/sdk/models/subscription-change-v2-response.d.ts.map +1 -1
- package/esm/sdk/models/subscription-change-v2-response.js +6 -0
- package/esm/sdk/models/subscription-change-v2-response.js.map +1 -1
- package/esm/sdk/models/update-entitlement-request.d.ts +3 -0
- package/esm/sdk/models/update-entitlement-request.d.ts.map +1 -1
- package/esm/sdk/models/update-entitlement-request.js +3 -0
- package/esm/sdk/models/update-entitlement-request.js.map +1 -1
- package/esm/sdk/subscriptions.d.ts +6 -0
- package/esm/sdk/subscriptions.d.ts.map +1 -1
- package/esm/sdk/subscriptions.js +6 -0
- package/esm/sdk/subscriptions.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/subscriptions-execute-subscription-plan-change-v2.ts +6 -0
- package/src/lib/config.ts +2 -2
- package/src/sdk/costs.ts +0 -18
- package/src/sdk/models/create-entitlement-request.ts +10 -0
- package/src/sdk/models/entitlement-grant-allocation-behavior.ts +26 -0
- package/src/sdk/models/entitlement-grant-duration-unit.ts +1 -0
- package/src/sdk/models/entitlement-response.ts +9 -0
- package/src/sdk/models/index.ts +2 -0
- package/src/sdk/models/integration-entity-type.ts +1 -0
- package/src/sdk/models/invoice-sync-settings.ts +9 -0
- package/src/sdk/models/service-period-custom-fields.ts +42 -0
- package/src/sdk/models/subscription-change-v2-request.ts +5 -0
- package/src/sdk/models/subscription-change-v2-response.ts +15 -0
- package/src/sdk/models/update-entitlement-request.ts +10 -0
- package/src/sdk/subscriptions.ts +6 -0
- package/esm/funcs/costs-get-detailed-cost-analytics-v2.d.ts +0 -17
- package/esm/funcs/costs-get-detailed-cost-analytics-v2.d.ts.map +0 -1
- package/esm/funcs/costs-get-detailed-cost-analytics-v2.js +0 -83
- package/esm/funcs/costs-get-detailed-cost-analytics-v2.js.map +0 -1
- package/src/funcs/costs-get-detailed-cost-analytics-v2.ts +0 -172
|
@@ -32,7 +32,16 @@ export type SubscriptionChangeV2Response = {
|
|
|
32
32
|
effectiveAt?: Date | undefined;
|
|
33
33
|
entityChanges?: Array<EntityChangeResult> | undefined;
|
|
34
34
|
fromPlan?: PlanSummary | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* IsScheduled is true when the change was deferred to the period end instead
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* of being applied immediately.
|
|
40
|
+
*/
|
|
41
|
+
isScheduled?: boolean | undefined;
|
|
35
42
|
metadata?: { [k: string]: string } | undefined;
|
|
43
|
+
scheduleId?: string | undefined;
|
|
44
|
+
scheduledAt?: Date | undefined;
|
|
36
45
|
subscription?: SubscriptionResponse | undefined;
|
|
37
46
|
toPlan?: PlanSummary | undefined;
|
|
38
47
|
warnings?: Array<string> | undefined;
|
|
@@ -49,7 +58,10 @@ export const SubscriptionChangeV2Response$inboundSchema: z.ZodMiniType<
|
|
|
49
58
|
effective_at: types.optional(types.date()),
|
|
50
59
|
entity_changes: types.optional(z.array(EntityChangeResult$inboundSchema)),
|
|
51
60
|
from_plan: types.optional(PlanSummary$inboundSchema),
|
|
61
|
+
is_scheduled: types.optional(types.boolean()),
|
|
52
62
|
metadata: types.optional(z.record(z.string(), types.string())),
|
|
63
|
+
schedule_id: types.optional(types.string()),
|
|
64
|
+
scheduled_at: types.optional(types.date()),
|
|
53
65
|
subscription: types.optional(SubscriptionResponse$inboundSchema),
|
|
54
66
|
to_plan: types.optional(PlanSummary$inboundSchema),
|
|
55
67
|
warnings: types.optional(z.array(types.string())),
|
|
@@ -61,6 +73,9 @@ export const SubscriptionChangeV2Response$inboundSchema: z.ZodMiniType<
|
|
|
61
73
|
"effective_at": "effectiveAt",
|
|
62
74
|
"entity_changes": "entityChanges",
|
|
63
75
|
"from_plan": "fromPlan",
|
|
76
|
+
"is_scheduled": "isScheduled",
|
|
77
|
+
"schedule_id": "scheduleId",
|
|
78
|
+
"scheduled_at": "scheduledAt",
|
|
64
79
|
"to_plan": "toPlan",
|
|
65
80
|
});
|
|
66
81
|
}),
|
|
@@ -8,6 +8,10 @@ import {
|
|
|
8
8
|
EntitlementAggregationMode,
|
|
9
9
|
EntitlementAggregationMode$outboundSchema,
|
|
10
10
|
} from "./entitlement-aggregation-mode.js";
|
|
11
|
+
import {
|
|
12
|
+
EntitlementGrantAllocationBehavior,
|
|
13
|
+
EntitlementGrantAllocationBehavior$outboundSchema,
|
|
14
|
+
} from "./entitlement-grant-allocation-behavior.js";
|
|
11
15
|
import {
|
|
12
16
|
EntitlementGrantDurationUnit,
|
|
13
17
|
EntitlementGrantDurationUnit$outboundSchema,
|
|
@@ -31,6 +35,7 @@ export type UpdateEntitlementRequest = {
|
|
|
31
35
|
*/
|
|
32
36
|
clearGrantConfig?: boolean | undefined;
|
|
33
37
|
configValue?: { [k: string]: any } | undefined;
|
|
38
|
+
grantAllocationBehavior?: EntitlementGrantAllocationBehavior | undefined;
|
|
34
39
|
grantDurationUnit?: EntitlementGrantDurationUnit | undefined;
|
|
35
40
|
grantDurationValue?: number | undefined;
|
|
36
41
|
grantMeasure?: EntitlementGrantMeasure | undefined;
|
|
@@ -47,6 +52,7 @@ export type UpdateEntitlementRequest$Outbound = {
|
|
|
47
52
|
aggregation_mode?: string | undefined;
|
|
48
53
|
clear_grant_config?: boolean | undefined;
|
|
49
54
|
config_value?: { [k: string]: any } | undefined;
|
|
55
|
+
grant_allocation_behavior?: string | undefined;
|
|
50
56
|
grant_duration_unit?: string | undefined;
|
|
51
57
|
grant_duration_value?: number | undefined;
|
|
52
58
|
grant_measure?: string | undefined;
|
|
@@ -67,6 +73,9 @@ export const UpdateEntitlementRequest$outboundSchema: z.ZodMiniType<
|
|
|
67
73
|
aggregationMode: z.optional(EntitlementAggregationMode$outboundSchema),
|
|
68
74
|
clearGrantConfig: z.optional(z.boolean()),
|
|
69
75
|
configValue: z.optional(z.record(z.string(), z.any())),
|
|
76
|
+
grantAllocationBehavior: z.optional(
|
|
77
|
+
EntitlementGrantAllocationBehavior$outboundSchema,
|
|
78
|
+
),
|
|
70
79
|
grantDurationUnit: z.optional(EntitlementGrantDurationUnit$outboundSchema),
|
|
71
80
|
grantDurationValue: z.optional(z.int()),
|
|
72
81
|
grantMeasure: z.optional(EntitlementGrantMeasure$outboundSchema),
|
|
@@ -82,6 +91,7 @@ export const UpdateEntitlementRequest$outboundSchema: z.ZodMiniType<
|
|
|
82
91
|
aggregationMode: "aggregation_mode",
|
|
83
92
|
clearGrantConfig: "clear_grant_config",
|
|
84
93
|
configValue: "config_value",
|
|
94
|
+
grantAllocationBehavior: "grant_allocation_behavior",
|
|
85
95
|
grantDurationUnit: "grant_duration_unit",
|
|
86
96
|
grantDurationValue: "grant_duration_value",
|
|
87
97
|
grantMeasure: "grant_measure",
|
package/src/sdk/subscriptions.ts
CHANGED
|
@@ -314,6 +314,12 @@ export class Subscriptions extends ClientSDK {
|
|
|
314
314
|
*
|
|
315
315
|
* @remarks
|
|
316
316
|
* Change a subscription's plan in place. Subscription id, billing anchor and period bounds are preserved; line items are sliced and settled in one transaction.
|
|
317
|
+
*
|
|
318
|
+
* change_at controls timing. Omitted or 'immediate' applies the change now. 'end_of_period' records a pending schedule that executes at the subscription's current period end: the response returns is_scheduled, schedule_id and scheduled_at instead of a completed change, and nothing is swapped or billed until the boundary.
|
|
319
|
+
*
|
|
320
|
+
* scheduled_at is resolved from the subscription's current period end at request time. If that period end is already in the past (a backdated start date, a resumed pause, or worker downtime can all leave a subscription behind), the change is due immediately and fires on the next billing scan rather than a period away — inspect scheduled_at to see this.
|
|
321
|
+
*
|
|
322
|
+
* Only one plan change may be pending per subscription; request a second one and this returns 400. Cancel the existing schedule via POST /subscriptions/schedules/{schedule_id}/cancel first. Pending schedules are listable via GET /subscriptions/{id}/schedules.
|
|
317
323
|
*/
|
|
318
324
|
async executeSubscriptionPlanChangeV2(
|
|
319
325
|
id: string,
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { FlexpriceCore } from "../core.js";
|
|
2
|
-
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
-
import { FlexPriceError } from "../sdk/models/flex-price-error.js";
|
|
4
|
-
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../sdk/models/http-client-errors.js";
|
|
5
|
-
import * as models from "../sdk/models/index.js";
|
|
6
|
-
import { ResponseValidationError } from "../sdk/models/response-validation-error.js";
|
|
7
|
-
import { SDKValidationError } from "../sdk/models/sdk-validation-error.js";
|
|
8
|
-
import { APIPromise } from "../types/async.js";
|
|
9
|
-
import { Result } from "../types/fp.js";
|
|
10
|
-
/**
|
|
11
|
-
* Get combined revenue and cost analytics (V2)
|
|
12
|
-
*
|
|
13
|
-
* @remarks
|
|
14
|
-
* Use when you need the same revenue/cost/ROI analytics but computed from the costsheet usage-tracking pipeline (e.g. for consistency with usage-based cost data).
|
|
15
|
-
*/
|
|
16
|
-
export declare function costsGetDetailedCostAnalyticsV2(client: FlexpriceCore, request: models.GetCostAnalyticsRequest, options?: RequestOptions): APIPromise<Result<models.GetDetailedCostAnalyticsResponse, models.ErrorsErrorResponse | FlexPriceError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
17
|
-
//# sourceMappingURL=costs-get-detailed-cost-analytics-v2.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"costs-get-detailed-cost-analytics-v2.d.ts","sourceRoot":"","sources":["../../src/funcs/costs-get-detailed-cost-analytics-v2.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAM3C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAW,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,MAAM,CAAC,uBAAuB,EACvC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CACX,MAAM,CACJ,MAAM,CAAC,gCAAgC,EACrC,MAAM,CAAC,mBAAmB,GAC1B,cAAc,GACd,uBAAuB,GACvB,eAAe,GACf,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,qBAAqB,GACrB,kBAAkB,CACrB,CACF,CAMA"}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
import * as z from "zod/v4-mini";
|
|
5
|
-
import { encodeJSON } from "../lib/encodings.js";
|
|
6
|
-
import { matchStatusCode } from "../lib/http.js";
|
|
7
|
-
import * as M from "../lib/matchers.js";
|
|
8
|
-
import { compactMap } from "../lib/primitives.js";
|
|
9
|
-
import { safeParse } from "../lib/schemas.js";
|
|
10
|
-
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
-
import { pathToFunc } from "../lib/url.js";
|
|
12
|
-
import * as models from "../sdk/models/index.js";
|
|
13
|
-
import { APIPromise } from "../types/async.js";
|
|
14
|
-
/**
|
|
15
|
-
* Get combined revenue and cost analytics (V2)
|
|
16
|
-
*
|
|
17
|
-
* @remarks
|
|
18
|
-
* Use when you need the same revenue/cost/ROI analytics but computed from the costsheet usage-tracking pipeline (e.g. for consistency with usage-based cost data).
|
|
19
|
-
*/
|
|
20
|
-
export function costsGetDetailedCostAnalyticsV2(client, request, options) {
|
|
21
|
-
return new APIPromise($do(client, request, options));
|
|
22
|
-
}
|
|
23
|
-
async function $do(client, request, options) {
|
|
24
|
-
const parsed = safeParse(request, (value) => z.parse(models.GetCostAnalyticsRequest$outboundSchema, value), "Input validation failed");
|
|
25
|
-
if (!parsed.ok) {
|
|
26
|
-
return [parsed, { status: "invalid" }];
|
|
27
|
-
}
|
|
28
|
-
const payload = parsed.value;
|
|
29
|
-
const body = encodeJSON("body", payload, { explode: true });
|
|
30
|
-
const path = pathToFunc("/costs/analytics-v2")();
|
|
31
|
-
const headers = new Headers(compactMap({
|
|
32
|
-
"Content-Type": "application/json",
|
|
33
|
-
Accept: "application/json",
|
|
34
|
-
}));
|
|
35
|
-
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
36
|
-
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
37
|
-
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
38
|
-
const context = {
|
|
39
|
-
options: client._options,
|
|
40
|
-
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
41
|
-
operationID: "getDetailedCostAnalyticsV2",
|
|
42
|
-
oAuth2Scopes: null,
|
|
43
|
-
resolvedSecurity: requestSecurity,
|
|
44
|
-
securitySource: client._options.apiKeyAuth,
|
|
45
|
-
retryConfig: options?.retries
|
|
46
|
-
|| client._options.retryConfig
|
|
47
|
-
|| { strategy: "none" },
|
|
48
|
-
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
49
|
-
};
|
|
50
|
-
const requestRes = client._createRequest(context, {
|
|
51
|
-
security: requestSecurity,
|
|
52
|
-
method: "POST",
|
|
53
|
-
baseURL: options?.serverURL,
|
|
54
|
-
path: path,
|
|
55
|
-
headers: headers,
|
|
56
|
-
body: body,
|
|
57
|
-
userAgent: client._options.userAgent,
|
|
58
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
59
|
-
}, options);
|
|
60
|
-
if (!requestRes.ok) {
|
|
61
|
-
return [requestRes, { status: "invalid" }];
|
|
62
|
-
}
|
|
63
|
-
const req = requestRes.value;
|
|
64
|
-
const doResult = await client._do(req, {
|
|
65
|
-
context,
|
|
66
|
-
isErrorStatusCode: (statusCode) => matchStatusCode({ status: statusCode }, ["4XX", "5XX"]),
|
|
67
|
-
retryConfig: context.retryConfig,
|
|
68
|
-
retryCodes: context.retryCodes,
|
|
69
|
-
});
|
|
70
|
-
if (!doResult.ok) {
|
|
71
|
-
return [doResult, { status: "request-error", request: req }];
|
|
72
|
-
}
|
|
73
|
-
const response = doResult.value;
|
|
74
|
-
const responseFields = {
|
|
75
|
-
HttpMeta: { Response: response, Request: req },
|
|
76
|
-
};
|
|
77
|
-
const [result] = await M.match(M.json(200, models.GetDetailedCostAnalyticsResponse$inboundSchema), M.jsonErr(400, models.ErrorsErrorResponse$inboundSchema), M.jsonErr(500, models.ErrorsErrorResponse$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
78
|
-
if (!result.ok) {
|
|
79
|
-
return [result, { status: "complete", request: req, response }];
|
|
80
|
-
}
|
|
81
|
-
return [result, { status: "complete", request: req, response }];
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=costs-get-detailed-cost-analytics-v2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"costs-get-detailed-cost-analytics-v2.js","sourceRoot":"","sources":["../../src/funcs/costs-get-detailed-cost-analytics-v2.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,CAAC,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAS3C,OAA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1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4-mini";
|
|
6
|
-
import { FlexpriceCore } from "../core.js";
|
|
7
|
-
import { encodeJSON } from "../lib/encodings.js";
|
|
8
|
-
import { matchStatusCode } from "../lib/http.js";
|
|
9
|
-
import * as M from "../lib/matchers.js";
|
|
10
|
-
import { compactMap } from "../lib/primitives.js";
|
|
11
|
-
import { safeParse } from "../lib/schemas.js";
|
|
12
|
-
import { RequestOptions } from "../lib/sdks.js";
|
|
13
|
-
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
14
|
-
import { pathToFunc } from "../lib/url.js";
|
|
15
|
-
import { FlexPriceError } from "../sdk/models/flex-price-error.js";
|
|
16
|
-
import {
|
|
17
|
-
ConnectionError,
|
|
18
|
-
InvalidRequestError,
|
|
19
|
-
RequestAbortedError,
|
|
20
|
-
RequestTimeoutError,
|
|
21
|
-
UnexpectedClientError,
|
|
22
|
-
} from "../sdk/models/http-client-errors.js";
|
|
23
|
-
import * as models from "../sdk/models/index.js";
|
|
24
|
-
import { ResponseValidationError } from "../sdk/models/response-validation-error.js";
|
|
25
|
-
import { SDKValidationError } from "../sdk/models/sdk-validation-error.js";
|
|
26
|
-
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
-
import { Result } from "../types/fp.js";
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Get combined revenue and cost analytics (V2)
|
|
31
|
-
*
|
|
32
|
-
* @remarks
|
|
33
|
-
* Use when you need the same revenue/cost/ROI analytics but computed from the costsheet usage-tracking pipeline (e.g. for consistency with usage-based cost data).
|
|
34
|
-
*/
|
|
35
|
-
export function costsGetDetailedCostAnalyticsV2(
|
|
36
|
-
client: FlexpriceCore,
|
|
37
|
-
request: models.GetCostAnalyticsRequest,
|
|
38
|
-
options?: RequestOptions,
|
|
39
|
-
): APIPromise<
|
|
40
|
-
Result<
|
|
41
|
-
models.GetDetailedCostAnalyticsResponse,
|
|
42
|
-
| models.ErrorsErrorResponse
|
|
43
|
-
| FlexPriceError
|
|
44
|
-
| ResponseValidationError
|
|
45
|
-
| ConnectionError
|
|
46
|
-
| RequestAbortedError
|
|
47
|
-
| RequestTimeoutError
|
|
48
|
-
| InvalidRequestError
|
|
49
|
-
| UnexpectedClientError
|
|
50
|
-
| SDKValidationError
|
|
51
|
-
>
|
|
52
|
-
> {
|
|
53
|
-
return new APIPromise($do(
|
|
54
|
-
client,
|
|
55
|
-
request,
|
|
56
|
-
options,
|
|
57
|
-
));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async function $do(
|
|
61
|
-
client: FlexpriceCore,
|
|
62
|
-
request: models.GetCostAnalyticsRequest,
|
|
63
|
-
options?: RequestOptions,
|
|
64
|
-
): Promise<
|
|
65
|
-
[
|
|
66
|
-
Result<
|
|
67
|
-
models.GetDetailedCostAnalyticsResponse,
|
|
68
|
-
| models.ErrorsErrorResponse
|
|
69
|
-
| FlexPriceError
|
|
70
|
-
| ResponseValidationError
|
|
71
|
-
| ConnectionError
|
|
72
|
-
| RequestAbortedError
|
|
73
|
-
| RequestTimeoutError
|
|
74
|
-
| InvalidRequestError
|
|
75
|
-
| UnexpectedClientError
|
|
76
|
-
| SDKValidationError
|
|
77
|
-
>,
|
|
78
|
-
APICall,
|
|
79
|
-
]
|
|
80
|
-
> {
|
|
81
|
-
const parsed = safeParse(
|
|
82
|
-
request,
|
|
83
|
-
(value) => z.parse(models.GetCostAnalyticsRequest$outboundSchema, value),
|
|
84
|
-
"Input validation failed",
|
|
85
|
-
);
|
|
86
|
-
if (!parsed.ok) {
|
|
87
|
-
return [parsed, { status: "invalid" }];
|
|
88
|
-
}
|
|
89
|
-
const payload = parsed.value;
|
|
90
|
-
const body = encodeJSON("body", payload, { explode: true });
|
|
91
|
-
|
|
92
|
-
const path = pathToFunc("/costs/analytics-v2")();
|
|
93
|
-
|
|
94
|
-
const headers = new Headers(compactMap({
|
|
95
|
-
"Content-Type": "application/json",
|
|
96
|
-
Accept: "application/json",
|
|
97
|
-
}));
|
|
98
|
-
|
|
99
|
-
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
100
|
-
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
101
|
-
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
102
|
-
|
|
103
|
-
const context = {
|
|
104
|
-
options: client._options,
|
|
105
|
-
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
106
|
-
operationID: "getDetailedCostAnalyticsV2",
|
|
107
|
-
oAuth2Scopes: null,
|
|
108
|
-
|
|
109
|
-
resolvedSecurity: requestSecurity,
|
|
110
|
-
|
|
111
|
-
securitySource: client._options.apiKeyAuth,
|
|
112
|
-
retryConfig: options?.retries
|
|
113
|
-
|| client._options.retryConfig
|
|
114
|
-
|| { strategy: "none" },
|
|
115
|
-
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const requestRes = client._createRequest(context, {
|
|
119
|
-
security: requestSecurity,
|
|
120
|
-
method: "POST",
|
|
121
|
-
baseURL: options?.serverURL,
|
|
122
|
-
path: path,
|
|
123
|
-
headers: headers,
|
|
124
|
-
body: body,
|
|
125
|
-
userAgent: client._options.userAgent,
|
|
126
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
127
|
-
}, options);
|
|
128
|
-
if (!requestRes.ok) {
|
|
129
|
-
return [requestRes, { status: "invalid" }];
|
|
130
|
-
}
|
|
131
|
-
const req = requestRes.value;
|
|
132
|
-
|
|
133
|
-
const doResult = await client._do(req, {
|
|
134
|
-
context,
|
|
135
|
-
isErrorStatusCode: (statusCode: number) =>
|
|
136
|
-
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
137
|
-
retryConfig: context.retryConfig,
|
|
138
|
-
retryCodes: context.retryCodes,
|
|
139
|
-
});
|
|
140
|
-
if (!doResult.ok) {
|
|
141
|
-
return [doResult, { status: "request-error", request: req }];
|
|
142
|
-
}
|
|
143
|
-
const response = doResult.value;
|
|
144
|
-
|
|
145
|
-
const responseFields = {
|
|
146
|
-
HttpMeta: { Response: response, Request: req },
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
const [result] = await M.match<
|
|
150
|
-
models.GetDetailedCostAnalyticsResponse,
|
|
151
|
-
| models.ErrorsErrorResponse
|
|
152
|
-
| FlexPriceError
|
|
153
|
-
| ResponseValidationError
|
|
154
|
-
| ConnectionError
|
|
155
|
-
| RequestAbortedError
|
|
156
|
-
| RequestTimeoutError
|
|
157
|
-
| InvalidRequestError
|
|
158
|
-
| UnexpectedClientError
|
|
159
|
-
| SDKValidationError
|
|
160
|
-
>(
|
|
161
|
-
M.json(200, models.GetDetailedCostAnalyticsResponse$inboundSchema),
|
|
162
|
-
M.jsonErr(400, models.ErrorsErrorResponse$inboundSchema),
|
|
163
|
-
M.jsonErr(500, models.ErrorsErrorResponse$inboundSchema),
|
|
164
|
-
M.fail("4XX"),
|
|
165
|
-
M.fail("5XX"),
|
|
166
|
-
)(response, req, { extraFields: responseFields });
|
|
167
|
-
if (!result.ok) {
|
|
168
|
-
return [result, { status: "complete", request: req, response }];
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return [result, { status: "complete", request: req, response }];
|
|
172
|
-
}
|