@paygentic/sdk 0.7.9 → 0.7.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/funcs/entitlementsIssue.d.ts +1 -1
- package/dist/commonjs/funcs/entitlementsIssue.d.ts.map +1 -1
- package/dist/commonjs/funcs/entitlementsIssue.js +1 -1
- package/dist/commonjs/funcs/entitlementsIssue.js.map +1 -1
- package/dist/commonjs/funcs/entitlementsList.d.ts +4 -0
- package/dist/commonjs/funcs/entitlementsList.d.ts.map +1 -1
- package/dist/commonjs/funcs/entitlementsList.js +4 -0
- package/dist/commonjs/funcs/entitlementsList.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/lib/config.js.map +1 -1
- package/dist/commonjs/models/booleanentitlementdetail.d.ts +16 -19
- package/dist/commonjs/models/booleanentitlementdetail.d.ts.map +1 -1
- package/dist/commonjs/models/booleanentitlementdetail.js +8 -15
- package/dist/commonjs/models/booleanentitlementdetail.js.map +1 -1
- package/dist/commonjs/models/booleanentitlementlistitem.d.ts +66 -0
- package/dist/commonjs/models/booleanentitlementlistitem.d.ts.map +1 -0
- package/dist/commonjs/models/{entitlement.js → booleanentitlementlistitem.js} +16 -27
- package/dist/commonjs/models/booleanentitlementlistitem.js.map +1 -0
- package/dist/commonjs/models/entitlementlistitem.d.ts +14 -0
- package/dist/commonjs/models/entitlementlistitem.d.ts.map +1 -0
- package/dist/commonjs/models/entitlementlistitem.js +55 -0
- package/dist/commonjs/models/entitlementlistitem.js.map +1 -0
- package/dist/commonjs/models/entitlementstatus.d.ts +17 -0
- package/dist/commonjs/models/entitlementstatus.d.ts.map +1 -0
- package/dist/commonjs/models/entitlementstatus.js +51 -0
- package/dist/commonjs/models/entitlementstatus.js.map +1 -0
- package/dist/commonjs/models/index.d.ts +5 -2
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +5 -2
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/invoice.d.ts +4 -0
- package/dist/commonjs/models/invoice.d.ts.map +1 -1
- package/dist/commonjs/models/invoice.js +1 -0
- package/dist/commonjs/models/invoice.js.map +1 -1
- package/dist/commonjs/models/meteredentitlementdetail.d.ts +20 -23
- package/dist/commonjs/models/meteredentitlementdetail.d.ts.map +1 -1
- package/dist/commonjs/models/meteredentitlementdetail.js +10 -17
- package/dist/commonjs/models/meteredentitlementdetail.js.map +1 -1
- package/dist/commonjs/models/meteredentitlementlistitem.d.ts +90 -0
- package/dist/commonjs/models/meteredentitlementlistitem.d.ts.map +1 -0
- package/dist/commonjs/models/{entitlementaccessresult.js → meteredentitlementlistitem.js} +23 -37
- package/dist/commonjs/models/meteredentitlementlistitem.js.map +1 -0
- package/dist/commonjs/models/operations/listentitlements.d.ts +2 -2
- package/dist/commonjs/models/operations/listentitlements.d.ts.map +1 -1
- package/dist/commonjs/models/operations/listentitlements.js +1 -1
- package/dist/commonjs/models/operations/listentitlements.js.map +1 -1
- package/dist/commonjs/models/operations/updatesubscription.d.ts +3 -0
- package/dist/commonjs/models/operations/updatesubscription.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updatesubscription.js.map +1 -1
- package/dist/commonjs/models/staticentitlementdetail.d.ts +12 -21
- package/dist/commonjs/models/staticentitlementdetail.d.ts.map +1 -1
- package/dist/commonjs/models/staticentitlementdetail.js +8 -16
- package/dist/commonjs/models/staticentitlementdetail.js.map +1 -1
- package/dist/commonjs/models/staticentitlementlistitem.d.ts +66 -0
- package/dist/commonjs/models/staticentitlementlistitem.d.ts.map +1 -0
- package/dist/commonjs/models/staticentitlementlistitem.js +63 -0
- package/dist/commonjs/models/staticentitlementlistitem.js.map +1 -0
- package/dist/commonjs/models/user.d.ts +1 -0
- package/dist/commonjs/models/user.d.ts.map +1 -1
- package/dist/commonjs/models/user.js +1 -0
- package/dist/commonjs/models/user.js.map +1 -1
- package/dist/commonjs/sdk/entitlements.d.ts +5 -1
- package/dist/commonjs/sdk/entitlements.d.ts.map +1 -1
- package/dist/commonjs/sdk/entitlements.js +4 -0
- package/dist/commonjs/sdk/entitlements.js.map +1 -1
- package/dist/esm/funcs/entitlementsIssue.d.ts +1 -1
- package/dist/esm/funcs/entitlementsIssue.d.ts.map +1 -1
- package/dist/esm/funcs/entitlementsIssue.js +1 -1
- package/dist/esm/funcs/entitlementsIssue.js.map +1 -1
- package/dist/esm/funcs/entitlementsList.d.ts +4 -0
- package/dist/esm/funcs/entitlementsList.d.ts.map +1 -1
- package/dist/esm/funcs/entitlementsList.js +4 -0
- package/dist/esm/funcs/entitlementsList.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/lib/config.js.map +1 -1
- package/dist/esm/models/booleanentitlementdetail.d.ts +16 -19
- package/dist/esm/models/booleanentitlementdetail.d.ts.map +1 -1
- package/dist/esm/models/booleanentitlementdetail.js +7 -14
- package/dist/esm/models/booleanentitlementdetail.js.map +1 -1
- package/dist/esm/models/booleanentitlementlistitem.d.ts +66 -0
- package/dist/esm/models/booleanentitlementlistitem.d.ts.map +1 -0
- package/dist/esm/models/booleanentitlementlistitem.js +26 -0
- package/dist/esm/models/booleanentitlementlistitem.js.map +1 -0
- package/dist/esm/models/entitlementlistitem.d.ts +14 -0
- package/dist/esm/models/entitlementlistitem.d.ts.map +1 -0
- package/dist/esm/models/entitlementlistitem.js +18 -0
- package/dist/esm/models/entitlementlistitem.js.map +1 -0
- package/dist/esm/models/entitlementstatus.d.ts +17 -0
- package/dist/esm/models/entitlementstatus.d.ts.map +1 -0
- package/dist/esm/models/entitlementstatus.js +15 -0
- package/dist/esm/models/entitlementstatus.js.map +1 -0
- package/dist/esm/models/index.d.ts +5 -2
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +5 -2
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/invoice.d.ts +4 -0
- package/dist/esm/models/invoice.d.ts.map +1 -1
- package/dist/esm/models/invoice.js +1 -0
- package/dist/esm/models/invoice.js.map +1 -1
- package/dist/esm/models/meteredentitlementdetail.d.ts +20 -23
- package/dist/esm/models/meteredentitlementdetail.d.ts.map +1 -1
- package/dist/esm/models/meteredentitlementdetail.js +9 -16
- package/dist/esm/models/meteredentitlementdetail.js.map +1 -1
- package/dist/esm/models/meteredentitlementlistitem.d.ts +90 -0
- package/dist/esm/models/meteredentitlementlistitem.d.ts.map +1 -0
- package/dist/esm/models/meteredentitlementlistitem.js +32 -0
- package/dist/esm/models/meteredentitlementlistitem.js.map +1 -0
- package/dist/esm/models/operations/listentitlements.d.ts +2 -2
- package/dist/esm/models/operations/listentitlements.d.ts.map +1 -1
- package/dist/esm/models/operations/listentitlements.js +1 -1
- package/dist/esm/models/operations/listentitlements.js.map +1 -1
- package/dist/esm/models/operations/updatesubscription.d.ts +3 -0
- package/dist/esm/models/operations/updatesubscription.d.ts.map +1 -1
- package/dist/esm/models/operations/updatesubscription.js.map +1 -1
- package/dist/esm/models/staticentitlementdetail.d.ts +12 -21
- package/dist/esm/models/staticentitlementdetail.d.ts.map +1 -1
- package/dist/esm/models/staticentitlementdetail.js +7 -15
- package/dist/esm/models/staticentitlementdetail.js.map +1 -1
- package/dist/esm/models/staticentitlementlistitem.d.ts +66 -0
- package/dist/esm/models/staticentitlementlistitem.d.ts.map +1 -0
- package/dist/esm/models/staticentitlementlistitem.js +26 -0
- package/dist/esm/models/staticentitlementlistitem.js.map +1 -0
- package/dist/esm/models/user.d.ts +1 -0
- package/dist/esm/models/user.d.ts.map +1 -1
- package/dist/esm/models/user.js +1 -0
- package/dist/esm/models/user.js.map +1 -1
- package/dist/esm/sdk/entitlements.d.ts +5 -1
- package/dist/esm/sdk/entitlements.d.ts.map +1 -1
- package/dist/esm/sdk/entitlements.js +4 -0
- package/dist/esm/sdk/entitlements.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/entitlementsIssue.ts +4 -4
- package/src/funcs/entitlementsList.ts +4 -0
- package/src/lib/config.ts +2 -2
- package/src/models/booleanentitlementdetail.ts +22 -28
- package/src/models/booleanentitlementlistitem.ts +100 -0
- package/src/models/entitlementlistitem.ts +49 -0
- package/src/models/entitlementstatus.ts +24 -0
- package/src/models/index.ts +5 -2
- package/src/models/invoice.ts +5 -0
- package/src/models/meteredentitlementdetail.ts +28 -34
- package/src/models/meteredentitlementlistitem.ts +134 -0
- package/src/models/operations/listentitlements.ts +3 -3
- package/src/models/operations/updatesubscription.ts +3 -0
- package/src/models/staticentitlementdetail.ts +19 -30
- package/src/models/staticentitlementlistitem.ts +100 -0
- package/src/models/user.ts +1 -0
- package/src/sdk/entitlements.ts +5 -1
- package/dist/commonjs/models/entitlement.d.ts +0 -71
- package/dist/commonjs/models/entitlement.d.ts.map +0 -1
- package/dist/commonjs/models/entitlement.js.map +0 -1
- package/dist/commonjs/models/entitlementaccessresult.d.ts +0 -99
- package/dist/commonjs/models/entitlementaccessresult.d.ts.map +0 -1
- package/dist/commonjs/models/entitlementaccessresult.js.map +0 -1
- package/dist/esm/models/entitlement.d.ts +0 -71
- package/dist/esm/models/entitlement.d.ts.map +0 -1
- package/dist/esm/models/entitlement.js +0 -37
- package/dist/esm/models/entitlement.js.map +0 -1
- package/dist/esm/models/entitlementaccessresult.d.ts +0 -99
- package/dist/esm/models/entitlementaccessresult.d.ts.map +0 -1
- package/dist/esm/models/entitlementaccessresult.js +0 -46
- package/dist/esm/models/entitlementaccessresult.js.map +0 -1
- package/src/models/entitlement.ts +0 -107
- package/src/models/entitlementaccessresult.ts +0 -147
|
@@ -6,6 +6,10 @@ import * as z from "zod/v3";
|
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
7
|
import { ClosedEnum } from "../types/enums.js";
|
|
8
8
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
|
+
import {
|
|
10
|
+
EntitlementStatus,
|
|
11
|
+
EntitlementStatus$inboundSchema,
|
|
12
|
+
} from "./entitlementstatus.js";
|
|
9
13
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
14
|
|
|
11
15
|
export const BooleanEntitlementDetailObject = {
|
|
@@ -15,21 +19,6 @@ export type BooleanEntitlementDetailObject = ClosedEnum<
|
|
|
15
19
|
typeof BooleanEntitlementDetailObject
|
|
16
20
|
>;
|
|
17
21
|
|
|
18
|
-
/**
|
|
19
|
-
* Current status of the entitlement.
|
|
20
|
-
*/
|
|
21
|
-
export const BooleanEntitlementDetailStatus = {
|
|
22
|
-
Active: "active",
|
|
23
|
-
Canceled: "canceled",
|
|
24
|
-
Expired: "expired",
|
|
25
|
-
} as const;
|
|
26
|
-
/**
|
|
27
|
-
* Current status of the entitlement.
|
|
28
|
-
*/
|
|
29
|
-
export type BooleanEntitlementDetailStatus = ClosedEnum<
|
|
30
|
-
typeof BooleanEntitlementDetailStatus
|
|
31
|
-
>;
|
|
32
|
-
|
|
33
22
|
/**
|
|
34
23
|
* Common fields shared by all entitlement types.
|
|
35
24
|
*/
|
|
@@ -52,14 +41,18 @@ export type BooleanEntitlementDetail = {
|
|
|
52
41
|
*/
|
|
53
42
|
featureKey: string;
|
|
54
43
|
featureType: "boolean";
|
|
44
|
+
/**
|
|
45
|
+
* Unique identifier for a product
|
|
46
|
+
*/
|
|
47
|
+
productId: string;
|
|
55
48
|
/**
|
|
56
49
|
* The subscription this entitlement is associated with, if any.
|
|
57
50
|
*/
|
|
58
|
-
subscriptionId
|
|
51
|
+
subscriptionId: string | null;
|
|
59
52
|
/**
|
|
60
53
|
* Current status of the entitlement.
|
|
61
54
|
*/
|
|
62
|
-
status:
|
|
55
|
+
status: EntitlementStatus;
|
|
63
56
|
/**
|
|
64
57
|
* When the entitlement becomes active.
|
|
65
58
|
*/
|
|
@@ -67,7 +60,7 @@ export type BooleanEntitlementDetail = {
|
|
|
67
60
|
/**
|
|
68
61
|
* When the entitlement expires. Null means no expiration.
|
|
69
62
|
*/
|
|
70
|
-
activeTo
|
|
63
|
+
activeTo: Date | null;
|
|
71
64
|
/**
|
|
72
65
|
* Whether the customer currently has active access to this entitlement.
|
|
73
66
|
*/
|
|
@@ -75,7 +68,11 @@ export type BooleanEntitlementDetail = {
|
|
|
75
68
|
/**
|
|
76
69
|
* Additional metadata for the entitlement.
|
|
77
70
|
*/
|
|
78
|
-
metadata
|
|
71
|
+
metadata: { [k: string]: string };
|
|
72
|
+
/**
|
|
73
|
+
* Always `null` for boolean entitlements. Surfaced on every entitlement so clients can read `config` without first switching on `featureType`.
|
|
74
|
+
*/
|
|
75
|
+
config: { [k: string]: any } | null;
|
|
79
76
|
};
|
|
80
77
|
|
|
81
78
|
/** @internal */
|
|
@@ -83,11 +80,6 @@ export const BooleanEntitlementDetailObject$inboundSchema: z.ZodNativeEnum<
|
|
|
83
80
|
typeof BooleanEntitlementDetailObject
|
|
84
81
|
> = z.nativeEnum(BooleanEntitlementDetailObject);
|
|
85
82
|
|
|
86
|
-
/** @internal */
|
|
87
|
-
export const BooleanEntitlementDetailStatus$inboundSchema: z.ZodNativeEnum<
|
|
88
|
-
typeof BooleanEntitlementDetailStatus
|
|
89
|
-
> = z.nativeEnum(BooleanEntitlementDetailStatus);
|
|
90
|
-
|
|
91
83
|
/** @internal */
|
|
92
84
|
export const BooleanEntitlementDetail$inboundSchema: z.ZodType<
|
|
93
85
|
BooleanEntitlementDetail,
|
|
@@ -100,14 +92,16 @@ export const BooleanEntitlementDetail$inboundSchema: z.ZodType<
|
|
|
100
92
|
featureId: z.string(),
|
|
101
93
|
featureKey: z.string(),
|
|
102
94
|
featureType: z.literal("boolean"),
|
|
103
|
-
|
|
104
|
-
|
|
95
|
+
productId: z.string(),
|
|
96
|
+
subscriptionId: z.nullable(z.string()),
|
|
97
|
+
status: EntitlementStatus$inboundSchema,
|
|
105
98
|
activeFrom: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
106
99
|
activeTo: z.nullable(
|
|
107
100
|
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
108
|
-
)
|
|
101
|
+
),
|
|
109
102
|
hasAccess: z.boolean(),
|
|
110
|
-
metadata: z.record(z.string())
|
|
103
|
+
metadata: z.record(z.string()),
|
|
104
|
+
config: z.nullable(z.record(z.any())),
|
|
111
105
|
});
|
|
112
106
|
|
|
113
107
|
export function booleanEntitlementDetailFromJSON(
|
|
@@ -0,0 +1,100 @@
|
|
|
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 {
|
|
9
|
+
EntitlementStatus,
|
|
10
|
+
EntitlementStatus$inboundSchema,
|
|
11
|
+
} from "./entitlementstatus.js";
|
|
12
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Common fields shared by all entitlement list items. List items use `entitlementId` (not `id`) to preserve the original public field name on `/v1/entitlements`. The get-by-id endpoint returns the same object with a top-level `id` and `object: "entitlement"` instead.
|
|
16
|
+
*/
|
|
17
|
+
export type BooleanEntitlementListItem = {
|
|
18
|
+
/**
|
|
19
|
+
* Unique identifier for the entitlement.
|
|
20
|
+
*/
|
|
21
|
+
entitlementId: string;
|
|
22
|
+
/**
|
|
23
|
+
* Unique identifier for a customer
|
|
24
|
+
*/
|
|
25
|
+
customerId: string;
|
|
26
|
+
/**
|
|
27
|
+
* The feature this entitlement grants access to.
|
|
28
|
+
*/
|
|
29
|
+
featureId: string;
|
|
30
|
+
/**
|
|
31
|
+
* The unique key identifying the feature.
|
|
32
|
+
*/
|
|
33
|
+
featureKey: string;
|
|
34
|
+
featureType: "boolean";
|
|
35
|
+
/**
|
|
36
|
+
* Unique identifier for a product
|
|
37
|
+
*/
|
|
38
|
+
productId: string;
|
|
39
|
+
/**
|
|
40
|
+
* The subscription this entitlement is associated with, if any.
|
|
41
|
+
*/
|
|
42
|
+
subscriptionId: string | null;
|
|
43
|
+
/**
|
|
44
|
+
* Current status of the entitlement.
|
|
45
|
+
*/
|
|
46
|
+
status: EntitlementStatus;
|
|
47
|
+
/**
|
|
48
|
+
* When the entitlement becomes active.
|
|
49
|
+
*/
|
|
50
|
+
activeFrom: Date;
|
|
51
|
+
/**
|
|
52
|
+
* When the entitlement expires. Null means no expiration.
|
|
53
|
+
*/
|
|
54
|
+
activeTo: Date | null;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the customer currently has active access to this entitlement.
|
|
57
|
+
*/
|
|
58
|
+
hasAccess: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Additional metadata for the entitlement.
|
|
61
|
+
*/
|
|
62
|
+
metadata: { [k: string]: string };
|
|
63
|
+
/**
|
|
64
|
+
* Always `null` for boolean entitlements. Surfaced on every list item so clients can read `item.config` without first switching on `featureType`.
|
|
65
|
+
*/
|
|
66
|
+
config: { [k: string]: any } | null;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/** @internal */
|
|
70
|
+
export const BooleanEntitlementListItem$inboundSchema: z.ZodType<
|
|
71
|
+
BooleanEntitlementListItem,
|
|
72
|
+
z.ZodTypeDef,
|
|
73
|
+
unknown
|
|
74
|
+
> = z.object({
|
|
75
|
+
entitlementId: z.string(),
|
|
76
|
+
customerId: z.string(),
|
|
77
|
+
featureId: z.string(),
|
|
78
|
+
featureKey: z.string(),
|
|
79
|
+
featureType: z.literal("boolean"),
|
|
80
|
+
productId: z.string(),
|
|
81
|
+
subscriptionId: z.nullable(z.string()),
|
|
82
|
+
status: EntitlementStatus$inboundSchema,
|
|
83
|
+
activeFrom: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
84
|
+
activeTo: z.nullable(
|
|
85
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
86
|
+
),
|
|
87
|
+
hasAccess: z.boolean(),
|
|
88
|
+
metadata: z.record(z.string()),
|
|
89
|
+
config: z.nullable(z.record(z.any())),
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export function booleanEntitlementListItemFromJSON(
|
|
93
|
+
jsonString: string,
|
|
94
|
+
): SafeParseResult<BooleanEntitlementListItem, SDKValidationError> {
|
|
95
|
+
return safeParse(
|
|
96
|
+
jsonString,
|
|
97
|
+
(x) => BooleanEntitlementListItem$inboundSchema.parse(JSON.parse(x)),
|
|
98
|
+
`Failed to parse 'BooleanEntitlementListItem' from JSON`,
|
|
99
|
+
);
|
|
100
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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 {
|
|
9
|
+
BooleanEntitlementListItem,
|
|
10
|
+
BooleanEntitlementListItem$inboundSchema,
|
|
11
|
+
} from "./booleanentitlementlistitem.js";
|
|
12
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
13
|
+
import {
|
|
14
|
+
MeteredEntitlementListItem,
|
|
15
|
+
MeteredEntitlementListItem$inboundSchema,
|
|
16
|
+
} from "./meteredentitlementlistitem.js";
|
|
17
|
+
import {
|
|
18
|
+
StaticEntitlementListItem,
|
|
19
|
+
StaticEntitlementListItem$inboundSchema,
|
|
20
|
+
} from "./staticentitlementlistitem.js";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* An entitlement as returned by the list endpoint. The shape varies by featureType. Uses `entitlementId` (not `id`) for backwards compatibility with the original list contract.
|
|
24
|
+
*/
|
|
25
|
+
export type EntitlementListItem =
|
|
26
|
+
| BooleanEntitlementListItem
|
|
27
|
+
| StaticEntitlementListItem
|
|
28
|
+
| MeteredEntitlementListItem;
|
|
29
|
+
|
|
30
|
+
/** @internal */
|
|
31
|
+
export const EntitlementListItem$inboundSchema: z.ZodType<
|
|
32
|
+
EntitlementListItem,
|
|
33
|
+
z.ZodTypeDef,
|
|
34
|
+
unknown
|
|
35
|
+
> = z.union([
|
|
36
|
+
BooleanEntitlementListItem$inboundSchema,
|
|
37
|
+
StaticEntitlementListItem$inboundSchema,
|
|
38
|
+
MeteredEntitlementListItem$inboundSchema,
|
|
39
|
+
]);
|
|
40
|
+
|
|
41
|
+
export function entitlementListItemFromJSON(
|
|
42
|
+
jsonString: string,
|
|
43
|
+
): SafeParseResult<EntitlementListItem, SDKValidationError> {
|
|
44
|
+
return safeParse(
|
|
45
|
+
jsonString,
|
|
46
|
+
(x) => EntitlementListItem$inboundSchema.parse(JSON.parse(x)),
|
|
47
|
+
`Failed to parse 'EntitlementListItem' from JSON`,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Current status of the entitlement.
|
|
10
|
+
*/
|
|
11
|
+
export const EntitlementStatus = {
|
|
12
|
+
Active: "active",
|
|
13
|
+
Canceled: "canceled",
|
|
14
|
+
Expired: "expired",
|
|
15
|
+
} as const;
|
|
16
|
+
/**
|
|
17
|
+
* Current status of the entitlement.
|
|
18
|
+
*/
|
|
19
|
+
export type EntitlementStatus = ClosedEnum<typeof EntitlementStatus>;
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const EntitlementStatus$inboundSchema: z.ZodNativeEnum<
|
|
23
|
+
typeof EntitlementStatus
|
|
24
|
+
> = z.nativeEnum(EntitlementStatus);
|
package/src/models/index.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
export * from "./address.js";
|
|
6
6
|
export * from "./billablemetric.js";
|
|
7
7
|
export * from "./booleanentitlementdetail.js";
|
|
8
|
+
export * from "./booleanentitlementlistitem.js";
|
|
8
9
|
export * from "./cost.js";
|
|
9
10
|
export * from "./costreportgroup.js";
|
|
10
11
|
export * from "./costreportresponse.js";
|
|
@@ -15,9 +16,9 @@ export * from "./createmanuallineitemrequest.js";
|
|
|
15
16
|
export * from "./createrulerequest.js";
|
|
16
17
|
export * from "./currencybreakdownentry.js";
|
|
17
18
|
export * from "./customer.js";
|
|
18
|
-
export * from "./entitlement.js";
|
|
19
|
-
export * from "./entitlementaccessresult.js";
|
|
20
19
|
export * from "./entitlementdetail.js";
|
|
20
|
+
export * from "./entitlementlistitem.js";
|
|
21
|
+
export * from "./entitlementstatus.js";
|
|
21
22
|
export * from "./entitlementtemplate.js";
|
|
22
23
|
export * from "./eventresponse.js";
|
|
23
24
|
export * from "./feature.js";
|
|
@@ -36,6 +37,7 @@ export * from "./lineitem.js";
|
|
|
36
37
|
export * from "./lineitemsresponse.js";
|
|
37
38
|
export * from "./lineitemssummary.js";
|
|
38
39
|
export * from "./meteredentitlementdetail.js";
|
|
40
|
+
export * from "./meteredentitlementlistitem.js";
|
|
39
41
|
export * from "./meterevent.js";
|
|
40
42
|
export * from "./metereventlist.js";
|
|
41
43
|
export * from "./offsetpagination.js";
|
|
@@ -64,6 +66,7 @@ export * from "./source.js";
|
|
|
64
66
|
export * from "./sourceevent.js";
|
|
65
67
|
export * from "./sourcerule.js";
|
|
66
68
|
export * from "./staticentitlementdetail.js";
|
|
69
|
+
export * from "./staticentitlementlistitem.js";
|
|
67
70
|
export * from "./subscription.js";
|
|
68
71
|
export * from "./subscriptionmetadata.js";
|
|
69
72
|
export * from "./subscriptionportal.js";
|
package/src/models/invoice.ts
CHANGED
|
@@ -129,6 +129,10 @@ export type Invoice = {
|
|
|
129
129
|
* ISO 4217 currency code (e.g., USD, EUR)
|
|
130
130
|
*/
|
|
131
131
|
currency: string;
|
|
132
|
+
/**
|
|
133
|
+
* Machine-readable reason code for the most recent failure (e.g. CALCULATION_FAILED). Present only when status is FAILED or PAYMENT_FAILED.
|
|
134
|
+
*/
|
|
135
|
+
failureReason?: string | undefined;
|
|
132
136
|
/**
|
|
133
137
|
* The end of the grace period for accepting usage events
|
|
134
138
|
*/
|
|
@@ -297,6 +301,7 @@ export const Invoice$inboundSchema: z.ZodType<Invoice, z.ZodTypeDef, unknown> =
|
|
|
297
301
|
new Date(v)
|
|
298
302
|
),
|
|
299
303
|
currency: z.string(),
|
|
304
|
+
failureReason: z.string().optional(),
|
|
300
305
|
gracePeriodEnd: z.string().datetime({ offset: true }).transform(v =>
|
|
301
306
|
new Date(v)
|
|
302
307
|
),
|
|
@@ -6,6 +6,10 @@ import * as z from "zod/v3";
|
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
7
|
import { ClosedEnum } from "../types/enums.js";
|
|
8
8
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
|
+
import {
|
|
10
|
+
EntitlementStatus,
|
|
11
|
+
EntitlementStatus$inboundSchema,
|
|
12
|
+
} from "./entitlementstatus.js";
|
|
9
13
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
14
|
|
|
11
15
|
export const MeteredEntitlementDetailObject = {
|
|
@@ -15,21 +19,6 @@ export type MeteredEntitlementDetailObject = ClosedEnum<
|
|
|
15
19
|
typeof MeteredEntitlementDetailObject
|
|
16
20
|
>;
|
|
17
21
|
|
|
18
|
-
/**
|
|
19
|
-
* Current status of the entitlement.
|
|
20
|
-
*/
|
|
21
|
-
export const MeteredEntitlementDetailStatus = {
|
|
22
|
-
Active: "active",
|
|
23
|
-
Canceled: "canceled",
|
|
24
|
-
Expired: "expired",
|
|
25
|
-
} as const;
|
|
26
|
-
/**
|
|
27
|
-
* Current status of the entitlement.
|
|
28
|
-
*/
|
|
29
|
-
export type MeteredEntitlementDetailStatus = ClosedEnum<
|
|
30
|
-
typeof MeteredEntitlementDetailStatus
|
|
31
|
-
>;
|
|
32
|
-
|
|
33
22
|
/**
|
|
34
23
|
* Common fields shared by all entitlement types.
|
|
35
24
|
*/
|
|
@@ -52,14 +41,18 @@ export type MeteredEntitlementDetail = {
|
|
|
52
41
|
*/
|
|
53
42
|
featureKey: string;
|
|
54
43
|
featureType: "metered";
|
|
44
|
+
/**
|
|
45
|
+
* Unique identifier for a product
|
|
46
|
+
*/
|
|
47
|
+
productId: string;
|
|
55
48
|
/**
|
|
56
49
|
* The subscription this entitlement is associated with, if any.
|
|
57
50
|
*/
|
|
58
|
-
subscriptionId
|
|
51
|
+
subscriptionId: string | null;
|
|
59
52
|
/**
|
|
60
53
|
* Current status of the entitlement.
|
|
61
54
|
*/
|
|
62
|
-
status:
|
|
55
|
+
status: EntitlementStatus;
|
|
63
56
|
/**
|
|
64
57
|
* When the entitlement becomes active.
|
|
65
58
|
*/
|
|
@@ -67,7 +60,7 @@ export type MeteredEntitlementDetail = {
|
|
|
67
60
|
/**
|
|
68
61
|
* When the entitlement expires. Null means no expiration.
|
|
69
62
|
*/
|
|
70
|
-
activeTo
|
|
63
|
+
activeTo: Date | null;
|
|
71
64
|
/**
|
|
72
65
|
* Whether the customer currently has active access to this entitlement.
|
|
73
66
|
*/
|
|
@@ -75,7 +68,11 @@ export type MeteredEntitlementDetail = {
|
|
|
75
68
|
/**
|
|
76
69
|
* Additional metadata for the entitlement.
|
|
77
70
|
*/
|
|
78
|
-
metadata
|
|
71
|
+
metadata: { [k: string]: string };
|
|
72
|
+
/**
|
|
73
|
+
* Always `null` for metered entitlements. Surfaced on every entitlement so clients can read `config` without first switching on `featureType`.
|
|
74
|
+
*/
|
|
75
|
+
config: { [k: string]: any } | null;
|
|
79
76
|
/**
|
|
80
77
|
* When false (hard limit), access is blocked when balance is exhausted and overage is not charged on invoices. When true (soft limit), access continues past the grant and overage is charged at the per-unit rate.
|
|
81
78
|
*/
|
|
@@ -93,13 +90,13 @@ export type MeteredEntitlementDetail = {
|
|
|
93
90
|
*/
|
|
94
91
|
overage: number;
|
|
95
92
|
/**
|
|
96
|
-
* Start of the current usage period.
|
|
93
|
+
* Start of the current usage period. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead describes the pre-activation `[subscription start, activation)` window and may be `null` when there is no associated subscription.
|
|
97
94
|
*/
|
|
98
|
-
currentPeriodStart
|
|
95
|
+
currentPeriodStart: Date | null;
|
|
99
96
|
/**
|
|
100
|
-
* End of the current usage period.
|
|
97
|
+
* End of the current usage period. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead holds `activeFrom` — the end of the pre-activation `[subscription start, activation)` window.
|
|
101
98
|
*/
|
|
102
|
-
currentPeriodEnd
|
|
99
|
+
currentPeriodEnd: Date | null;
|
|
103
100
|
};
|
|
104
101
|
|
|
105
102
|
/** @internal */
|
|
@@ -107,11 +104,6 @@ export const MeteredEntitlementDetailObject$inboundSchema: z.ZodNativeEnum<
|
|
|
107
104
|
typeof MeteredEntitlementDetailObject
|
|
108
105
|
> = z.nativeEnum(MeteredEntitlementDetailObject);
|
|
109
106
|
|
|
110
|
-
/** @internal */
|
|
111
|
-
export const MeteredEntitlementDetailStatus$inboundSchema: z.ZodNativeEnum<
|
|
112
|
-
typeof MeteredEntitlementDetailStatus
|
|
113
|
-
> = z.nativeEnum(MeteredEntitlementDetailStatus);
|
|
114
|
-
|
|
115
107
|
/** @internal */
|
|
116
108
|
export const MeteredEntitlementDetail$inboundSchema: z.ZodType<
|
|
117
109
|
MeteredEntitlementDetail,
|
|
@@ -124,24 +116,26 @@ export const MeteredEntitlementDetail$inboundSchema: z.ZodType<
|
|
|
124
116
|
featureId: z.string(),
|
|
125
117
|
featureKey: z.string(),
|
|
126
118
|
featureType: z.literal("metered"),
|
|
127
|
-
|
|
128
|
-
|
|
119
|
+
productId: z.string(),
|
|
120
|
+
subscriptionId: z.nullable(z.string()),
|
|
121
|
+
status: EntitlementStatus$inboundSchema,
|
|
129
122
|
activeFrom: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
130
123
|
activeTo: z.nullable(
|
|
131
124
|
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
132
|
-
)
|
|
125
|
+
),
|
|
133
126
|
hasAccess: z.boolean(),
|
|
134
|
-
metadata: z.record(z.string())
|
|
127
|
+
metadata: z.record(z.string()),
|
|
128
|
+
config: z.nullable(z.record(z.any())),
|
|
135
129
|
isSoftLimit: z.boolean(),
|
|
136
130
|
balance: z.number(),
|
|
137
131
|
usageInPeriod: z.number(),
|
|
138
132
|
overage: z.number(),
|
|
139
133
|
currentPeriodStart: z.nullable(
|
|
140
134
|
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
141
|
-
)
|
|
135
|
+
),
|
|
142
136
|
currentPeriodEnd: z.nullable(
|
|
143
137
|
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
144
|
-
)
|
|
138
|
+
),
|
|
145
139
|
});
|
|
146
140
|
|
|
147
141
|
export function meteredEntitlementDetailFromJSON(
|
|
@@ -0,0 +1,134 @@
|
|
|
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 {
|
|
9
|
+
EntitlementStatus,
|
|
10
|
+
EntitlementStatus$inboundSchema,
|
|
11
|
+
} from "./entitlementstatus.js";
|
|
12
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Common fields shared by all entitlement list items. List items use `entitlementId` (not `id`) to preserve the original public field name on `/v1/entitlements`. The get-by-id endpoint returns the same object with a top-level `id` and `object: "entitlement"` instead.
|
|
16
|
+
*/
|
|
17
|
+
export type MeteredEntitlementListItem = {
|
|
18
|
+
/**
|
|
19
|
+
* Unique identifier for the entitlement.
|
|
20
|
+
*/
|
|
21
|
+
entitlementId: string;
|
|
22
|
+
/**
|
|
23
|
+
* Unique identifier for a customer
|
|
24
|
+
*/
|
|
25
|
+
customerId: string;
|
|
26
|
+
/**
|
|
27
|
+
* The feature this entitlement grants access to.
|
|
28
|
+
*/
|
|
29
|
+
featureId: string;
|
|
30
|
+
/**
|
|
31
|
+
* The unique key identifying the feature.
|
|
32
|
+
*/
|
|
33
|
+
featureKey: string;
|
|
34
|
+
featureType: "metered";
|
|
35
|
+
/**
|
|
36
|
+
* Unique identifier for a product
|
|
37
|
+
*/
|
|
38
|
+
productId: string;
|
|
39
|
+
/**
|
|
40
|
+
* The subscription this entitlement is associated with, if any.
|
|
41
|
+
*/
|
|
42
|
+
subscriptionId: string | null;
|
|
43
|
+
/**
|
|
44
|
+
* Current status of the entitlement.
|
|
45
|
+
*/
|
|
46
|
+
status: EntitlementStatus;
|
|
47
|
+
/**
|
|
48
|
+
* When the entitlement becomes active.
|
|
49
|
+
*/
|
|
50
|
+
activeFrom: Date;
|
|
51
|
+
/**
|
|
52
|
+
* When the entitlement expires. Null means no expiration.
|
|
53
|
+
*/
|
|
54
|
+
activeTo: Date | null;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the customer currently has active access to this entitlement.
|
|
57
|
+
*/
|
|
58
|
+
hasAccess: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Additional metadata for the entitlement.
|
|
61
|
+
*/
|
|
62
|
+
metadata: { [k: string]: string };
|
|
63
|
+
/**
|
|
64
|
+
* Always `null` for metered entitlements. Surfaced on every list item so clients can read `item.config` without first switching on `featureType`.
|
|
65
|
+
*/
|
|
66
|
+
config: { [k: string]: any } | null;
|
|
67
|
+
/**
|
|
68
|
+
* When false (hard limit), access is blocked when balance is exhausted and overage is not charged on invoices. When true (soft limit), access continues past the grant and overage is charged at the per-unit rate.
|
|
69
|
+
*/
|
|
70
|
+
isSoftLimit: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Remaining grant balance for the current period.
|
|
73
|
+
*/
|
|
74
|
+
balance: number;
|
|
75
|
+
/**
|
|
76
|
+
* Total usage consumed in the current billing period.
|
|
77
|
+
*/
|
|
78
|
+
usageInPeriod: number;
|
|
79
|
+
/**
|
|
80
|
+
* Amount of usage exceeding the granted balance.
|
|
81
|
+
*/
|
|
82
|
+
overage: number;
|
|
83
|
+
/**
|
|
84
|
+
* Start of the current usage period. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead describes the pre-activation `[subscription start, activation)` window and may be `null` when there is no associated subscription.
|
|
85
|
+
*/
|
|
86
|
+
currentPeriodStart: Date | null;
|
|
87
|
+
/**
|
|
88
|
+
* End of the current usage period. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead holds `activeFrom` — the end of the pre-activation `[subscription start, activation)` window.
|
|
89
|
+
*/
|
|
90
|
+
currentPeriodEnd: Date | null;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/** @internal */
|
|
94
|
+
export const MeteredEntitlementListItem$inboundSchema: z.ZodType<
|
|
95
|
+
MeteredEntitlementListItem,
|
|
96
|
+
z.ZodTypeDef,
|
|
97
|
+
unknown
|
|
98
|
+
> = z.object({
|
|
99
|
+
entitlementId: z.string(),
|
|
100
|
+
customerId: z.string(),
|
|
101
|
+
featureId: z.string(),
|
|
102
|
+
featureKey: z.string(),
|
|
103
|
+
featureType: z.literal("metered"),
|
|
104
|
+
productId: z.string(),
|
|
105
|
+
subscriptionId: z.nullable(z.string()),
|
|
106
|
+
status: EntitlementStatus$inboundSchema,
|
|
107
|
+
activeFrom: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
108
|
+
activeTo: z.nullable(
|
|
109
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
110
|
+
),
|
|
111
|
+
hasAccess: z.boolean(),
|
|
112
|
+
metadata: z.record(z.string()),
|
|
113
|
+
config: z.nullable(z.record(z.any())),
|
|
114
|
+
isSoftLimit: z.boolean(),
|
|
115
|
+
balance: z.number(),
|
|
116
|
+
usageInPeriod: z.number(),
|
|
117
|
+
overage: z.number(),
|
|
118
|
+
currentPeriodStart: z.nullable(
|
|
119
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
120
|
+
),
|
|
121
|
+
currentPeriodEnd: z.nullable(
|
|
122
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
123
|
+
),
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
export function meteredEntitlementListItemFromJSON(
|
|
127
|
+
jsonString: string,
|
|
128
|
+
): SafeParseResult<MeteredEntitlementListItem, SDKValidationError> {
|
|
129
|
+
return safeParse(
|
|
130
|
+
jsonString,
|
|
131
|
+
(x) => MeteredEntitlementListItem$inboundSchema.parse(JSON.parse(x)),
|
|
132
|
+
`Failed to parse 'MeteredEntitlementListItem' from JSON`,
|
|
133
|
+
);
|
|
134
|
+
}
|
|
@@ -51,9 +51,9 @@ export type ListEntitlementsObject = ClosedEnum<typeof ListEntitlementsObject>;
|
|
|
51
51
|
export type ListEntitlementsResponse = {
|
|
52
52
|
object: ListEntitlementsObject;
|
|
53
53
|
/**
|
|
54
|
-
* Array of entitlement
|
|
54
|
+
* Array of entitlement list items. The shape of each item varies by featureType.
|
|
55
55
|
*/
|
|
56
|
-
data: Array<models.
|
|
56
|
+
data: Array<models.EntitlementListItem>;
|
|
57
57
|
/**
|
|
58
58
|
* Offset-based pagination response.
|
|
59
59
|
*/
|
|
@@ -106,7 +106,7 @@ export const ListEntitlementsResponse$inboundSchema: z.ZodType<
|
|
|
106
106
|
unknown
|
|
107
107
|
> = z.object({
|
|
108
108
|
object: ListEntitlementsObject$inboundSchema.default("list"),
|
|
109
|
-
data: z.array(models.
|
|
109
|
+
data: z.array(models.EntitlementListItem$inboundSchema),
|
|
110
110
|
pagination: models.OffsetPagination$inboundSchema,
|
|
111
111
|
});
|
|
112
112
|
|
|
@@ -17,6 +17,9 @@ export type UpdateSubscriptionStatus = ClosedEnum<
|
|
|
17
17
|
export type UpdateSubscriptionRequestBody = {
|
|
18
18
|
endingAt?: Date | undefined;
|
|
19
19
|
status?: UpdateSubscriptionStatus | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Effective termination timestamp. Capped at the current effective time (future values are clamped). Must be strictly after the subscription's start date — values at or before startedAt are rejected with 400.
|
|
22
|
+
*/
|
|
20
23
|
terminatedAt?: Date | undefined;
|
|
21
24
|
/**
|
|
22
25
|
* Identifier of entity that cancelled the subscription. Sample values: 'cust_abc123' for customer-initiated cancellation, 'org_xyz789' for merchant-initiated cancellation
|