@paygentic/sdk 0.8.0 → 0.8.2
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 +5 -3
- package/dist/commonjs/funcs/billableMetricsListEvents.js +1 -0
- package/dist/commonjs/funcs/billableMetricsListEvents.js.map +1 -1
- package/dist/commonjs/funcs/billableMetricsMeter.js +2 -0
- package/dist/commonjs/funcs/billableMetricsMeter.js.map +1 -1
- package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.d.ts +19 -0
- package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.d.ts.map +1 -0
- package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.js +125 -0
- package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/eventresponse.d.ts +7 -0
- package/dist/commonjs/models/eventresponse.d.ts.map +1 -1
- package/dist/commonjs/models/eventresponse.js +1 -0
- package/dist/commonjs/models/eventresponse.js.map +1 -1
- package/dist/commonjs/models/index.d.ts +6 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +6 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/invoice.d.ts +4 -4
- package/dist/commonjs/models/invoice.d.ts.map +1 -1
- package/dist/commonjs/models/invoice.js +7 -6
- package/dist/commonjs/models/invoice.js.map +1 -1
- package/dist/commonjs/models/meterevent.d.ts +4 -0
- package/dist/commonjs/models/meterevent.d.ts.map +1 -1
- package/dist/commonjs/models/meterevent.js +1 -0
- package/dist/commonjs/models/meterevent.js.map +1 -1
- package/dist/commonjs/models/operations/advancetestclock.d.ts +12 -12
- package/dist/commonjs/models/operations/advancetestclock.d.ts.map +1 -1
- package/dist/commonjs/models/operations/advancetestclock.js +13 -13
- package/dist/commonjs/models/operations/advancetestclock.js.map +1 -1
- package/dist/commonjs/models/operations/createplan.d.ts +8 -2
- package/dist/commonjs/models/operations/createplan.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createplan.js +4 -1
- package/dist/commonjs/models/operations/createplan.js.map +1 -1
- package/dist/commonjs/models/operations/getbillablemetricmeter.d.ts +11 -1
- package/dist/commonjs/models/operations/getbillablemetricmeter.d.ts.map +1 -1
- package/dist/commonjs/models/operations/getbillablemetricmeter.js +2 -0
- package/dist/commonjs/models/operations/getbillablemetricmeter.js.map +1 -1
- package/dist/commonjs/models/operations/index.d.ts +1 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +1 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/ingestevent.d.ts +71 -3
- package/dist/commonjs/models/operations/ingestevent.d.ts.map +1 -1
- package/dist/commonjs/models/operations/ingestevent.js +28 -2
- package/dist/commonjs/models/operations/ingestevent.js.map +1 -1
- package/dist/commonjs/models/operations/listbillablemetricevents.d.ts +5 -0
- package/dist/commonjs/models/operations/listbillablemetricevents.d.ts.map +1 -1
- package/dist/commonjs/models/operations/listbillablemetricevents.js +1 -0
- package/dist/commonjs/models/operations/listbillablemetricevents.js.map +1 -1
- package/dist/commonjs/models/operations/reconcilesubscriptionfeatures.d.ts +30 -0
- package/dist/commonjs/models/operations/reconcilesubscriptionfeatures.d.ts.map +1 -0
- package/dist/commonjs/models/operations/reconcilesubscriptionfeatures.js +63 -0
- package/dist/commonjs/models/operations/reconcilesubscriptionfeatures.js.map +1 -0
- package/dist/commonjs/models/operations/updateplan.d.ts +6 -0
- package/dist/commonjs/models/operations/updateplan.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updateplan.js +3 -0
- package/dist/commonjs/models/operations/updateplan.js.map +1 -1
- package/dist/commonjs/models/plan.d.ts +5 -0
- package/dist/commonjs/models/plan.d.ts.map +1 -1
- package/dist/commonjs/models/plan.js +2 -0
- package/dist/commonjs/models/plan.js.map +1 -1
- package/dist/commonjs/models/plancreditallocation.d.ts +30 -0
- package/dist/commonjs/models/plancreditallocation.d.ts.map +1 -0
- package/dist/commonjs/models/plancreditallocation.js +62 -0
- package/dist/commonjs/models/plancreditallocation.js.map +1 -0
- package/dist/commonjs/models/reconciledfeatureadded.d.ts +15 -0
- package/dist/commonjs/models/reconciledfeatureadded.d.ts.map +1 -0
- package/dist/commonjs/models/reconciledfeatureadded.js +52 -0
- package/dist/commonjs/models/reconciledfeatureadded.js.map +1 -0
- package/dist/commonjs/models/reconciledfeaturefailed.d.ts +29 -0
- package/dist/commonjs/models/reconciledfeaturefailed.d.ts.map +1 -0
- package/dist/commonjs/models/reconciledfeaturefailed.js +62 -0
- package/dist/commonjs/models/reconciledfeaturefailed.js.map +1 -0
- package/dist/commonjs/models/reconciledfeatureremoved.d.ts +11 -0
- package/dist/commonjs/models/reconciledfeatureremoved.d.ts.map +1 -0
- package/dist/commonjs/models/reconciledfeatureremoved.js +51 -0
- package/dist/commonjs/models/reconciledfeatureremoved.js.map +1 -0
- package/dist/commonjs/models/reconciledfeatureskipped.d.ts +11 -0
- package/dist/commonjs/models/reconciledfeatureskipped.d.ts.map +1 -0
- package/dist/commonjs/models/reconciledfeatureskipped.js +51 -0
- package/dist/commonjs/models/reconciledfeatureskipped.js.map +1 -0
- package/dist/commonjs/models/subscriptionreconciliation.d.ts +62 -0
- package/dist/commonjs/models/subscriptionreconciliation.d.ts.map +1 -0
- package/dist/commonjs/models/subscriptionreconciliation.js +83 -0
- package/dist/commonjs/models/subscriptionreconciliation.js.map +1 -0
- package/dist/commonjs/models/usageresponse.d.ts +10 -2
- package/dist/commonjs/models/usageresponse.d.ts.map +1 -1
- package/dist/commonjs/models/usageresponse.js +2 -0
- package/dist/commonjs/models/usageresponse.js.map +1 -1
- package/dist/commonjs/sdk/subscriptions.d.ts +7 -0
- package/dist/commonjs/sdk/subscriptions.d.ts.map +1 -1
- package/dist/commonjs/sdk/subscriptions.js +10 -0
- package/dist/commonjs/sdk/subscriptions.js.map +1 -1
- package/dist/esm/funcs/billableMetricsListEvents.js +1 -0
- package/dist/esm/funcs/billableMetricsListEvents.js.map +1 -1
- package/dist/esm/funcs/billableMetricsMeter.js +2 -0
- package/dist/esm/funcs/billableMetricsMeter.js.map +1 -1
- package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.d.ts +19 -0
- package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.d.ts.map +1 -0
- package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.js +89 -0
- package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/eventresponse.d.ts +7 -0
- package/dist/esm/models/eventresponse.d.ts.map +1 -1
- package/dist/esm/models/eventresponse.js +1 -0
- package/dist/esm/models/eventresponse.js.map +1 -1
- package/dist/esm/models/index.d.ts +6 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +6 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/invoice.d.ts +4 -4
- package/dist/esm/models/invoice.d.ts.map +1 -1
- package/dist/esm/models/invoice.js +5 -4
- package/dist/esm/models/invoice.js.map +1 -1
- package/dist/esm/models/meterevent.d.ts +4 -0
- package/dist/esm/models/meterevent.d.ts.map +1 -1
- package/dist/esm/models/meterevent.js +1 -0
- package/dist/esm/models/meterevent.js.map +1 -1
- package/dist/esm/models/operations/advancetestclock.d.ts +12 -12
- package/dist/esm/models/operations/advancetestclock.d.ts.map +1 -1
- package/dist/esm/models/operations/advancetestclock.js +10 -10
- package/dist/esm/models/operations/advancetestclock.js.map +1 -1
- package/dist/esm/models/operations/createplan.d.ts +8 -2
- package/dist/esm/models/operations/createplan.d.ts.map +1 -1
- package/dist/esm/models/operations/createplan.js +4 -1
- package/dist/esm/models/operations/createplan.js.map +1 -1
- package/dist/esm/models/operations/getbillablemetricmeter.d.ts +11 -1
- package/dist/esm/models/operations/getbillablemetricmeter.d.ts.map +1 -1
- package/dist/esm/models/operations/getbillablemetricmeter.js +2 -0
- package/dist/esm/models/operations/getbillablemetricmeter.js.map +1 -1
- package/dist/esm/models/operations/index.d.ts +1 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +1 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/ingestevent.d.ts +71 -3
- package/dist/esm/models/operations/ingestevent.d.ts.map +1 -1
- package/dist/esm/models/operations/ingestevent.js +25 -1
- package/dist/esm/models/operations/ingestevent.js.map +1 -1
- package/dist/esm/models/operations/listbillablemetricevents.d.ts +5 -0
- package/dist/esm/models/operations/listbillablemetricevents.d.ts.map +1 -1
- package/dist/esm/models/operations/listbillablemetricevents.js +1 -0
- package/dist/esm/models/operations/listbillablemetricevents.js.map +1 -1
- package/dist/esm/models/operations/reconcilesubscriptionfeatures.d.ts +30 -0
- package/dist/esm/models/operations/reconcilesubscriptionfeatures.d.ts.map +1 -0
- package/dist/esm/models/operations/reconcilesubscriptionfeatures.js +25 -0
- package/dist/esm/models/operations/reconcilesubscriptionfeatures.js.map +1 -0
- package/dist/esm/models/operations/updateplan.d.ts +6 -0
- package/dist/esm/models/operations/updateplan.d.ts.map +1 -1
- package/dist/esm/models/operations/updateplan.js +3 -0
- package/dist/esm/models/operations/updateplan.js.map +1 -1
- package/dist/esm/models/plan.d.ts +5 -0
- package/dist/esm/models/plan.d.ts.map +1 -1
- package/dist/esm/models/plan.js +2 -0
- package/dist/esm/models/plan.js.map +1 -1
- package/dist/esm/models/plancreditallocation.d.ts +30 -0
- package/dist/esm/models/plancreditallocation.d.ts.map +1 -0
- package/dist/esm/models/plancreditallocation.js +24 -0
- package/dist/esm/models/plancreditallocation.js.map +1 -0
- package/dist/esm/models/reconciledfeatureadded.d.ts +15 -0
- package/dist/esm/models/reconciledfeatureadded.d.ts.map +1 -0
- package/dist/esm/models/reconciledfeatureadded.js +15 -0
- package/dist/esm/models/reconciledfeatureadded.js.map +1 -0
- package/dist/esm/models/reconciledfeaturefailed.d.ts +29 -0
- package/dist/esm/models/reconciledfeaturefailed.d.ts.map +1 -0
- package/dist/esm/models/reconciledfeaturefailed.js +25 -0
- package/dist/esm/models/reconciledfeaturefailed.js.map +1 -0
- package/dist/esm/models/reconciledfeatureremoved.d.ts +11 -0
- package/dist/esm/models/reconciledfeatureremoved.d.ts.map +1 -0
- package/dist/esm/models/reconciledfeatureremoved.js +14 -0
- package/dist/esm/models/reconciledfeatureremoved.js.map +1 -0
- package/dist/esm/models/reconciledfeatureskipped.d.ts +11 -0
- package/dist/esm/models/reconciledfeatureskipped.d.ts.map +1 -0
- package/dist/esm/models/reconciledfeatureskipped.js +14 -0
- package/dist/esm/models/reconciledfeatureskipped.js.map +1 -0
- package/dist/esm/models/subscriptionreconciliation.d.ts +62 -0
- package/dist/esm/models/subscriptionreconciliation.d.ts.map +1 -0
- package/dist/esm/models/subscriptionreconciliation.js +44 -0
- package/dist/esm/models/subscriptionreconciliation.js.map +1 -0
- package/dist/esm/models/usageresponse.d.ts +10 -2
- package/dist/esm/models/usageresponse.d.ts.map +1 -1
- package/dist/esm/models/usageresponse.js +2 -0
- package/dist/esm/models/usageresponse.js.map +1 -1
- package/dist/esm/sdk/subscriptions.d.ts +7 -0
- package/dist/esm/sdk/subscriptions.d.ts.map +1 -1
- package/dist/esm/sdk/subscriptions.js +10 -0
- package/dist/esm/sdk/subscriptions.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/billableMetricsListEvents.ts +1 -0
- package/src/funcs/billableMetricsMeter.ts +2 -0
- package/src/funcs/subscriptionsReconcileSubscriptionFeatures.ts +184 -0
- package/src/lib/config.ts +2 -2
- package/src/models/eventresponse.ts +8 -0
- package/src/models/index.ts +6 -0
- package/src/models/invoice.ts +10 -9
- package/src/models/meterevent.ts +5 -0
- package/src/models/operations/advancetestclock.ts +39 -23
- package/src/models/operations/createplan.ts +11 -3
- package/src/models/operations/getbillablemetricmeter.ts +13 -1
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/ingestevent.ts +116 -6
- package/src/models/operations/listbillablemetricevents.ts +6 -0
- package/src/models/operations/reconcilesubscriptionfeatures.ts +78 -0
- package/src/models/operations/updateplan.ts +8 -0
- package/src/models/plan.ts +9 -0
- package/src/models/plancreditallocation.ts +68 -0
- package/src/models/reconciledfeatureadded.ts +38 -0
- package/src/models/reconciledfeaturefailed.ts +55 -0
- package/src/models/reconciledfeatureremoved.ts +33 -0
- package/src/models/reconciledfeatureskipped.ts +33 -0
- package/src/models/subscriptionreconciliation.ts +144 -0
- package/src/models/usageresponse.ts +12 -2
- package/src/sdk/subscriptions.ts +18 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type ReconciledFeatureAdded = {
|
|
11
|
+
featureId: string;
|
|
12
|
+
featureKey: string;
|
|
13
|
+
/**
|
|
14
|
+
* False when this feature's price never produces a recurring line item (an instant price, a credit-denominated price, or an already-elapsed one-time charge) — the feature is entitled but not billed by this reconciliation.
|
|
15
|
+
*/
|
|
16
|
+
billed: boolean;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const ReconciledFeatureAdded$inboundSchema: z.ZodType<
|
|
21
|
+
ReconciledFeatureAdded,
|
|
22
|
+
z.ZodTypeDef,
|
|
23
|
+
unknown
|
|
24
|
+
> = z.object({
|
|
25
|
+
featureId: z.string(),
|
|
26
|
+
featureKey: z.string(),
|
|
27
|
+
billed: z.boolean(),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export function reconciledFeatureAddedFromJSON(
|
|
31
|
+
jsonString: string,
|
|
32
|
+
): SafeParseResult<ReconciledFeatureAdded, SDKValidationError> {
|
|
33
|
+
return safeParse(
|
|
34
|
+
jsonString,
|
|
35
|
+
(x) => ReconciledFeatureAdded$inboundSchema.parse(JSON.parse(x)),
|
|
36
|
+
`Failed to parse 'ReconciledFeatureAdded' from JSON`,
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Coded failure reason. `grant_mint_failed` means the entitlement was created but its initial metered grant could not be minted; re-running this reconciliation retries the mint.
|
|
13
|
+
*/
|
|
14
|
+
export const Reason = {
|
|
15
|
+
EntitlementFailed: "entitlement_failed",
|
|
16
|
+
GrantMintFailed: "grant_mint_failed",
|
|
17
|
+
} as const;
|
|
18
|
+
/**
|
|
19
|
+
* Coded failure reason. `grant_mint_failed` means the entitlement was created but its initial metered grant could not be minted; re-running this reconciliation retries the mint.
|
|
20
|
+
*/
|
|
21
|
+
export type Reason = ClosedEnum<typeof Reason>;
|
|
22
|
+
|
|
23
|
+
export type ReconciledFeatureFailed = {
|
|
24
|
+
featureId: string;
|
|
25
|
+
featureKey: string;
|
|
26
|
+
/**
|
|
27
|
+
* Coded failure reason. `grant_mint_failed` means the entitlement was created but its initial metered grant could not be minted; re-running this reconciliation retries the mint.
|
|
28
|
+
*/
|
|
29
|
+
reason: Reason;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** @internal */
|
|
33
|
+
export const Reason$inboundSchema: z.ZodNativeEnum<typeof Reason> = z
|
|
34
|
+
.nativeEnum(Reason);
|
|
35
|
+
|
|
36
|
+
/** @internal */
|
|
37
|
+
export const ReconciledFeatureFailed$inboundSchema: z.ZodType<
|
|
38
|
+
ReconciledFeatureFailed,
|
|
39
|
+
z.ZodTypeDef,
|
|
40
|
+
unknown
|
|
41
|
+
> = z.object({
|
|
42
|
+
featureId: z.string(),
|
|
43
|
+
featureKey: z.string(),
|
|
44
|
+
reason: Reason$inboundSchema,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export function reconciledFeatureFailedFromJSON(
|
|
48
|
+
jsonString: string,
|
|
49
|
+
): SafeParseResult<ReconciledFeatureFailed, SDKValidationError> {
|
|
50
|
+
return safeParse(
|
|
51
|
+
jsonString,
|
|
52
|
+
(x) => ReconciledFeatureFailed$inboundSchema.parse(JSON.parse(x)),
|
|
53
|
+
`Failed to parse 'ReconciledFeatureFailed' from JSON`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type ReconciledFeatureRemoved = {
|
|
11
|
+
featureId: string;
|
|
12
|
+
featureKey: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
export const ReconciledFeatureRemoved$inboundSchema: z.ZodType<
|
|
17
|
+
ReconciledFeatureRemoved,
|
|
18
|
+
z.ZodTypeDef,
|
|
19
|
+
unknown
|
|
20
|
+
> = z.object({
|
|
21
|
+
featureId: z.string(),
|
|
22
|
+
featureKey: z.string(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export function reconciledFeatureRemovedFromJSON(
|
|
26
|
+
jsonString: string,
|
|
27
|
+
): SafeParseResult<ReconciledFeatureRemoved, SDKValidationError> {
|
|
28
|
+
return safeParse(
|
|
29
|
+
jsonString,
|
|
30
|
+
(x) => ReconciledFeatureRemoved$inboundSchema.parse(JSON.parse(x)),
|
|
31
|
+
`Failed to parse 'ReconciledFeatureRemoved' from JSON`,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type ReconciledFeatureSkipped = {
|
|
11
|
+
featureId: string;
|
|
12
|
+
featureKey: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
export const ReconciledFeatureSkipped$inboundSchema: z.ZodType<
|
|
17
|
+
ReconciledFeatureSkipped,
|
|
18
|
+
z.ZodTypeDef,
|
|
19
|
+
unknown
|
|
20
|
+
> = z.object({
|
|
21
|
+
featureId: z.string(),
|
|
22
|
+
featureKey: z.string(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export function reconciledFeatureSkippedFromJSON(
|
|
26
|
+
jsonString: string,
|
|
27
|
+
): SafeParseResult<ReconciledFeatureSkipped, SDKValidationError> {
|
|
28
|
+
return safeParse(
|
|
29
|
+
jsonString,
|
|
30
|
+
(x) => ReconciledFeatureSkipped$inboundSchema.parse(JSON.parse(x)),
|
|
31
|
+
`Failed to parse 'ReconciledFeatureSkipped' from JSON`,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
ReconciledFeatureAdded,
|
|
12
|
+
ReconciledFeatureAdded$inboundSchema,
|
|
13
|
+
} from "./reconciledfeatureadded.js";
|
|
14
|
+
import {
|
|
15
|
+
ReconciledFeatureFailed,
|
|
16
|
+
ReconciledFeatureFailed$inboundSchema,
|
|
17
|
+
} from "./reconciledfeaturefailed.js";
|
|
18
|
+
import {
|
|
19
|
+
ReconciledFeatureRemoved,
|
|
20
|
+
ReconciledFeatureRemoved$inboundSchema,
|
|
21
|
+
} from "./reconciledfeatureremoved.js";
|
|
22
|
+
import {
|
|
23
|
+
ReconciledFeatureSkipped,
|
|
24
|
+
ReconciledFeatureSkipped$inboundSchema,
|
|
25
|
+
} from "./reconciledfeatureskipped.js";
|
|
26
|
+
|
|
27
|
+
export const SubscriptionReconciliationObject = {
|
|
28
|
+
SubscriptionReconciliation: "subscriptionReconciliation",
|
|
29
|
+
} as const;
|
|
30
|
+
export type SubscriptionReconciliationObject = ClosedEnum<
|
|
31
|
+
typeof SubscriptionReconciliationObject
|
|
32
|
+
>;
|
|
33
|
+
|
|
34
|
+
export type Features = {
|
|
35
|
+
added: Array<ReconciledFeatureAdded>;
|
|
36
|
+
/**
|
|
37
|
+
* Features the subscription already had an active entitlement for — left unchanged.
|
|
38
|
+
*/
|
|
39
|
+
skipped: Array<ReconciledFeatureSkipped>;
|
|
40
|
+
/**
|
|
41
|
+
* Features no longer on the plan: their entitlement was canceled and grants voided so the subscription matches the plan's current features.
|
|
42
|
+
*/
|
|
43
|
+
removed: Array<ReconciledFeatureRemoved>;
|
|
44
|
+
/**
|
|
45
|
+
* Features that could not be fully provisioned. Never billed by this call.
|
|
46
|
+
*/
|
|
47
|
+
failed: Array<ReconciledFeatureFailed>;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type SubscriptionReconciliationLineItems = {
|
|
51
|
+
/**
|
|
52
|
+
* Number of features newly billed on the subscription by this reconciliation. A dry-run preview returns the same count as the applied run.
|
|
53
|
+
*/
|
|
54
|
+
created: number;
|
|
55
|
+
/**
|
|
56
|
+
* Number of features whose billing was removed from the subscription's upcoming (not-yet-invoiced) invoice because their price is no longer on the plan.
|
|
57
|
+
*/
|
|
58
|
+
removed: number;
|
|
59
|
+
/**
|
|
60
|
+
* True when entitlements were provisioned successfully but the line-item synchronization step failed. Safe to retry.
|
|
61
|
+
*/
|
|
62
|
+
syncFailed?: boolean | undefined;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export type SubscriptionReconciliation = {
|
|
66
|
+
object: SubscriptionReconciliationObject;
|
|
67
|
+
/**
|
|
68
|
+
* True when this reconciliation was a preview — no entitlement, grant, or line item was created.
|
|
69
|
+
*/
|
|
70
|
+
dryRun: boolean;
|
|
71
|
+
features: Features;
|
|
72
|
+
lineItems: SubscriptionReconciliationLineItems;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/** @internal */
|
|
76
|
+
export const SubscriptionReconciliationObject$inboundSchema: z.ZodNativeEnum<
|
|
77
|
+
typeof SubscriptionReconciliationObject
|
|
78
|
+
> = z.nativeEnum(SubscriptionReconciliationObject);
|
|
79
|
+
|
|
80
|
+
/** @internal */
|
|
81
|
+
export const Features$inboundSchema: z.ZodType<
|
|
82
|
+
Features,
|
|
83
|
+
z.ZodTypeDef,
|
|
84
|
+
unknown
|
|
85
|
+
> = z.object({
|
|
86
|
+
added: z.array(ReconciledFeatureAdded$inboundSchema),
|
|
87
|
+
skipped: z.array(ReconciledFeatureSkipped$inboundSchema),
|
|
88
|
+
removed: z.array(ReconciledFeatureRemoved$inboundSchema),
|
|
89
|
+
failed: z.array(ReconciledFeatureFailed$inboundSchema),
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export function featuresFromJSON(
|
|
93
|
+
jsonString: string,
|
|
94
|
+
): SafeParseResult<Features, SDKValidationError> {
|
|
95
|
+
return safeParse(
|
|
96
|
+
jsonString,
|
|
97
|
+
(x) => Features$inboundSchema.parse(JSON.parse(x)),
|
|
98
|
+
`Failed to parse 'Features' from JSON`,
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** @internal */
|
|
103
|
+
export const SubscriptionReconciliationLineItems$inboundSchema: z.ZodType<
|
|
104
|
+
SubscriptionReconciliationLineItems,
|
|
105
|
+
z.ZodTypeDef,
|
|
106
|
+
unknown
|
|
107
|
+
> = z.object({
|
|
108
|
+
created: z.number().int(),
|
|
109
|
+
removed: z.number().int(),
|
|
110
|
+
syncFailed: z.boolean().optional(),
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
export function subscriptionReconciliationLineItemsFromJSON(
|
|
114
|
+
jsonString: string,
|
|
115
|
+
): SafeParseResult<SubscriptionReconciliationLineItems, SDKValidationError> {
|
|
116
|
+
return safeParse(
|
|
117
|
+
jsonString,
|
|
118
|
+
(x) =>
|
|
119
|
+
SubscriptionReconciliationLineItems$inboundSchema.parse(JSON.parse(x)),
|
|
120
|
+
`Failed to parse 'SubscriptionReconciliationLineItems' from JSON`,
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** @internal */
|
|
125
|
+
export const SubscriptionReconciliation$inboundSchema: z.ZodType<
|
|
126
|
+
SubscriptionReconciliation,
|
|
127
|
+
z.ZodTypeDef,
|
|
128
|
+
unknown
|
|
129
|
+
> = z.object({
|
|
130
|
+
object: SubscriptionReconciliationObject$inboundSchema,
|
|
131
|
+
dryRun: z.boolean(),
|
|
132
|
+
features: z.lazy(() => Features$inboundSchema),
|
|
133
|
+
lineItems: z.lazy(() => SubscriptionReconciliationLineItems$inboundSchema),
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
export function subscriptionReconciliationFromJSON(
|
|
137
|
+
jsonString: string,
|
|
138
|
+
): SafeParseResult<SubscriptionReconciliation, SDKValidationError> {
|
|
139
|
+
return safeParse(
|
|
140
|
+
jsonString,
|
|
141
|
+
(x) => SubscriptionReconciliation$inboundSchema.parse(JSON.parse(x)),
|
|
142
|
+
`Failed to parse 'SubscriptionReconciliation' from JSON`,
|
|
143
|
+
);
|
|
144
|
+
}
|
|
@@ -22,6 +22,10 @@ export type WindowedValue = {
|
|
|
22
22
|
export type GroupedValue = {
|
|
23
23
|
groupBy: { [k: string]: string };
|
|
24
24
|
value: number;
|
|
25
|
+
/**
|
|
26
|
+
* Number of raw events in this group
|
|
27
|
+
*/
|
|
28
|
+
eventCount?: number | undefined;
|
|
25
29
|
};
|
|
26
30
|
|
|
27
31
|
export type UsageResponse = {
|
|
@@ -35,13 +39,17 @@ export type UsageResponse = {
|
|
|
35
39
|
*/
|
|
36
40
|
totalValue: number;
|
|
37
41
|
/**
|
|
38
|
-
* Time-bucketed values. Only present when windowSize is specified.
|
|
42
|
+
* Time-bucketed values. Only present when windowSize is specified. When both windowSize and groupBy are set, windowedValues[i] is index-aligned with groupedValues[i] (same window and group).
|
|
39
43
|
*/
|
|
40
44
|
windowedValues?: Array<WindowedValue> | undefined;
|
|
41
45
|
/**
|
|
42
|
-
* Dimension-grouped values. Only present when groupBy is specified.
|
|
46
|
+
* Dimension-grouped values. Only present when groupBy is specified. When both windowSize and groupBy are set, groupedValues[i] is index-aligned with windowedValues[i] (same window and group).
|
|
43
47
|
*/
|
|
44
48
|
groupedValues?: Array<GroupedValue> | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Total distinct groups before groupLimit/groupOffset truncation. Only present when groupLimit is specified; use it to drive pagination totals.
|
|
51
|
+
*/
|
|
52
|
+
groupCount?: number | undefined;
|
|
45
53
|
};
|
|
46
54
|
|
|
47
55
|
/** @internal */
|
|
@@ -80,6 +88,7 @@ export const GroupedValue$inboundSchema: z.ZodType<
|
|
|
80
88
|
> = z.object({
|
|
81
89
|
groupBy: z.record(z.string()),
|
|
82
90
|
value: z.number(),
|
|
91
|
+
eventCount: z.number().int().optional(),
|
|
83
92
|
});
|
|
84
93
|
|
|
85
94
|
export function groupedValueFromJSON(
|
|
@@ -103,6 +112,7 @@ export const UsageResponse$inboundSchema: z.ZodType<
|
|
|
103
112
|
totalValue: z.number(),
|
|
104
113
|
windowedValues: z.array(z.lazy(() => WindowedValue$inboundSchema)).optional(),
|
|
105
114
|
groupedValues: z.array(z.lazy(() => GroupedValue$inboundSchema)).optional(),
|
|
115
|
+
groupCount: z.number().int().optional(),
|
|
106
116
|
});
|
|
107
117
|
|
|
108
118
|
export function usageResponseFromJSON(
|
package/src/sdk/subscriptions.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { subscriptionsCreate } from "../funcs/subscriptionsCreate.js";
|
|
|
6
6
|
import { subscriptionsGeneratePortalLink } from "../funcs/subscriptionsGeneratePortalLink.js";
|
|
7
7
|
import { subscriptionsGet } from "../funcs/subscriptionsGet.js";
|
|
8
8
|
import { subscriptionsList } from "../funcs/subscriptionsList.js";
|
|
9
|
+
import { subscriptionsReconcileSubscriptionFeatures } from "../funcs/subscriptionsReconcileSubscriptionFeatures.js";
|
|
9
10
|
import { subscriptionsTerminate } from "../funcs/subscriptionsTerminate.js";
|
|
10
11
|
import { subscriptionsUpdateSubscription } from "../funcs/subscriptionsUpdateSubscription.js";
|
|
11
12
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
@@ -106,4 +107,21 @@ export class Subscriptions extends ClientSDK {
|
|
|
106
107
|
options,
|
|
107
108
|
));
|
|
108
109
|
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Reconcile Features
|
|
113
|
+
*
|
|
114
|
+
* @remarks
|
|
115
|
+
* Creates a reconciliation that converges a subscription's feature entitlements to its current plan. Provisions a missing entitlement (and, for metered features, its initial grant) for every plan feature the subscription does not already have; cancels the entitlement and voids the grants of any feature no longer on the plan; then synchronizes the corresponding prices' billing. An already-present feature is left unchanged. Restricted to active subscriptions billed on their plan's line-item schedule.
|
|
116
|
+
*/
|
|
117
|
+
async reconcileSubscriptionFeatures(
|
|
118
|
+
request: operations.ReconcileSubscriptionFeaturesRequest,
|
|
119
|
+
options?: RequestOptions,
|
|
120
|
+
): Promise<models.SubscriptionReconciliation> {
|
|
121
|
+
return unwrapAsync(subscriptionsReconcileSubscriptionFeatures(
|
|
122
|
+
this,
|
|
123
|
+
request,
|
|
124
|
+
options,
|
|
125
|
+
));
|
|
126
|
+
}
|
|
109
127
|
}
|