@paygentic/sdk 0.7.5 → 0.7.7
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/subscriptionsUpdateSubscription.d.ts +16 -0
- package/dist/commonjs/funcs/subscriptionsUpdateSubscription.d.ts.map +1 -0
- package/dist/commonjs/funcs/subscriptionsUpdateSubscription.js +122 -0
- package/dist/commonjs/funcs/subscriptionsUpdateSubscription.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/creategrantrequest.d.ts +2 -2
- package/dist/commonjs/models/feeprice.d.ts +5 -1
- package/dist/commonjs/models/feeprice.d.ts.map +1 -1
- package/dist/commonjs/models/feeprice.js +1 -0
- package/dist/commonjs/models/feeprice.js.map +1 -1
- package/dist/commonjs/models/lineitem.d.ts +1 -1
- package/dist/commonjs/models/operations/createprice.d.ts +5 -0
- package/dist/commonjs/models/operations/createprice.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createprice.js +1 -0
- package/dist/commonjs/models/operations/createprice.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/updateprice.d.ts +5 -0
- package/dist/commonjs/models/operations/updateprice.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updateprice.js +1 -0
- package/dist/commonjs/models/operations/updateprice.js.map +1 -1
- package/dist/commonjs/models/operations/updatesubscription.d.ts +71 -0
- package/dist/commonjs/models/operations/updatesubscription.d.ts.map +1 -0
- package/dist/commonjs/models/operations/updatesubscription.js +78 -0
- package/dist/commonjs/models/operations/updatesubscription.js.map +1 -0
- package/dist/commonjs/models/price.d.ts +4 -0
- package/dist/commonjs/models/price.d.ts.map +1 -1
- package/dist/commonjs/models/price.js +1 -0
- package/dist/commonjs/models/price.js.map +1 -1
- package/dist/commonjs/models/pricepropertiesunion.d.ts +1 -1
- package/dist/commonjs/models/purchasegrantrequest.d.ts +2 -2
- package/dist/commonjs/models/schemasprice.d.ts +4 -0
- package/dist/commonjs/models/schemasprice.d.ts.map +1 -1
- package/dist/commonjs/models/schemasprice.js +1 -0
- package/dist/commonjs/models/schemasprice.js.map +1 -1
- package/dist/commonjs/sdk/subscriptions.d.ts +4 -0
- package/dist/commonjs/sdk/subscriptions.d.ts.map +1 -1
- package/dist/commonjs/sdk/subscriptions.js +7 -0
- package/dist/commonjs/sdk/subscriptions.js.map +1 -1
- package/dist/esm/funcs/subscriptionsUpdateSubscription.d.ts +16 -0
- package/dist/esm/funcs/subscriptionsUpdateSubscription.d.ts.map +1 -0
- package/dist/esm/funcs/subscriptionsUpdateSubscription.js +86 -0
- package/dist/esm/funcs/subscriptionsUpdateSubscription.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/creategrantrequest.d.ts +2 -2
- package/dist/esm/models/feeprice.d.ts +5 -1
- package/dist/esm/models/feeprice.d.ts.map +1 -1
- package/dist/esm/models/feeprice.js +1 -0
- package/dist/esm/models/feeprice.js.map +1 -1
- package/dist/esm/models/lineitem.d.ts +1 -1
- package/dist/esm/models/operations/createprice.d.ts +5 -0
- package/dist/esm/models/operations/createprice.d.ts.map +1 -1
- package/dist/esm/models/operations/createprice.js +1 -0
- package/dist/esm/models/operations/createprice.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/updateprice.d.ts +5 -0
- package/dist/esm/models/operations/updateprice.d.ts.map +1 -1
- package/dist/esm/models/operations/updateprice.js +1 -0
- package/dist/esm/models/operations/updateprice.js.map +1 -1
- package/dist/esm/models/operations/updatesubscription.d.ts +71 -0
- package/dist/esm/models/operations/updatesubscription.d.ts.map +1 -0
- package/dist/esm/models/operations/updatesubscription.js +40 -0
- package/dist/esm/models/operations/updatesubscription.js.map +1 -0
- package/dist/esm/models/price.d.ts +4 -0
- package/dist/esm/models/price.d.ts.map +1 -1
- package/dist/esm/models/price.js +1 -0
- package/dist/esm/models/price.js.map +1 -1
- package/dist/esm/models/pricepropertiesunion.d.ts +1 -1
- package/dist/esm/models/purchasegrantrequest.d.ts +2 -2
- package/dist/esm/models/schemasprice.d.ts +4 -0
- package/dist/esm/models/schemasprice.d.ts.map +1 -1
- package/dist/esm/models/schemasprice.js +1 -0
- package/dist/esm/models/schemasprice.js.map +1 -1
- package/dist/esm/sdk/subscriptions.d.ts +4 -0
- package/dist/esm/sdk/subscriptions.d.ts.map +1 -1
- package/dist/esm/sdk/subscriptions.js +7 -0
- package/dist/esm/sdk/subscriptions.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/subscriptionsUpdateSubscription.ts +178 -0
- package/src/lib/config.ts +2 -2
- package/src/models/creategrantrequest.ts +2 -2
- package/src/models/feeprice.ts +6 -1
- package/src/models/lineitem.ts +1 -1
- package/src/models/operations/createprice.ts +6 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/updateprice.ts +6 -0
- package/src/models/operations/updatesubscription.ts +129 -0
- package/src/models/price.ts +5 -0
- package/src/models/pricepropertiesunion.ts +1 -1
- package/src/models/purchasegrantrequest.ts +2 -2
- package/src/models/schemasprice.ts +5 -0
- package/src/sdk/subscriptions.ts +15 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
|
+
|
|
9
|
+
export const UpdateSubscriptionStatus = {
|
|
10
|
+
Active: "active",
|
|
11
|
+
Terminated: "terminated",
|
|
12
|
+
} as const;
|
|
13
|
+
export type UpdateSubscriptionStatus = ClosedEnum<
|
|
14
|
+
typeof UpdateSubscriptionStatus
|
|
15
|
+
>;
|
|
16
|
+
|
|
17
|
+
export type UpdateSubscriptionRequestBody = {
|
|
18
|
+
endingAt?: Date | undefined;
|
|
19
|
+
status?: UpdateSubscriptionStatus | undefined;
|
|
20
|
+
terminatedAt?: Date | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Identifier of entity that cancelled the subscription. Sample values: 'cust_abc123' for customer-initiated cancellation, 'org_xyz789' for merchant-initiated cancellation
|
|
23
|
+
*/
|
|
24
|
+
terminatedBy?: string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Explanation for subscription cancellation. Sample values: 'Customer requested cancellation', 'Payment failure', 'Service migration', 'Contract expiration'
|
|
27
|
+
*/
|
|
28
|
+
terminationReason?: string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Enable or disable automatic charging of invoices using stored payment methods.
|
|
31
|
+
*/
|
|
32
|
+
autoCharge?: boolean | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* When true, forces tax rate to 0%.
|
|
35
|
+
*/
|
|
36
|
+
taxExempt?: boolean | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Minimum wallet balance requirement in decimal dollars (e.g., '100.00'). Can be set to '0' to disable. Maximum allowed is $5,000. Contact support for higher limits. Note: If the calculated charge amount at renewal is below payment processor minimums (typically $1.00), it will be automatically adjusted upward to meet the minimum requirement. Changes apply at next renewal.
|
|
39
|
+
*/
|
|
40
|
+
minimumAccountBalance?: string | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Override plan setting for renewal reminder emails. Set to true to enable, false to disable, or null to use plan default.
|
|
43
|
+
*/
|
|
44
|
+
renewalReminderEnabled?: boolean | null | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Override plan setting for number of days before renewal to send the reminder. Set to null to use plan default.
|
|
47
|
+
*/
|
|
48
|
+
renewalReminderDays?: number | null | undefined;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type UpdateSubscriptionRequest = {
|
|
52
|
+
id: string;
|
|
53
|
+
requestBody: UpdateSubscriptionRequestBody;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** @internal */
|
|
57
|
+
export const UpdateSubscriptionStatus$outboundSchema: z.ZodNativeEnum<
|
|
58
|
+
typeof UpdateSubscriptionStatus
|
|
59
|
+
> = z.nativeEnum(UpdateSubscriptionStatus);
|
|
60
|
+
|
|
61
|
+
/** @internal */
|
|
62
|
+
export type UpdateSubscriptionRequestBody$Outbound = {
|
|
63
|
+
endingAt?: string | undefined;
|
|
64
|
+
status?: string | undefined;
|
|
65
|
+
terminatedAt?: string | undefined;
|
|
66
|
+
terminatedBy?: string | undefined;
|
|
67
|
+
terminationReason?: string | undefined;
|
|
68
|
+
autoCharge?: boolean | undefined;
|
|
69
|
+
taxExempt?: boolean | undefined;
|
|
70
|
+
minimumAccountBalance?: string | undefined;
|
|
71
|
+
renewalReminderEnabled?: boolean | null | undefined;
|
|
72
|
+
renewalReminderDays?: number | null | undefined;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/** @internal */
|
|
76
|
+
export const UpdateSubscriptionRequestBody$outboundSchema: z.ZodType<
|
|
77
|
+
UpdateSubscriptionRequestBody$Outbound,
|
|
78
|
+
z.ZodTypeDef,
|
|
79
|
+
UpdateSubscriptionRequestBody
|
|
80
|
+
> = z.object({
|
|
81
|
+
endingAt: z.date().transform(v => v.toISOString()).optional(),
|
|
82
|
+
status: UpdateSubscriptionStatus$outboundSchema.optional(),
|
|
83
|
+
terminatedAt: z.date().transform(v => v.toISOString()).optional(),
|
|
84
|
+
terminatedBy: z.string().optional(),
|
|
85
|
+
terminationReason: z.string().optional(),
|
|
86
|
+
autoCharge: z.boolean().optional(),
|
|
87
|
+
taxExempt: z.boolean().optional(),
|
|
88
|
+
minimumAccountBalance: z.string().optional(),
|
|
89
|
+
renewalReminderEnabled: z.nullable(z.boolean()).optional(),
|
|
90
|
+
renewalReminderDays: z.nullable(z.number().int()).optional(),
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export function updateSubscriptionRequestBodyToJSON(
|
|
94
|
+
updateSubscriptionRequestBody: UpdateSubscriptionRequestBody,
|
|
95
|
+
): string {
|
|
96
|
+
return JSON.stringify(
|
|
97
|
+
UpdateSubscriptionRequestBody$outboundSchema.parse(
|
|
98
|
+
updateSubscriptionRequestBody,
|
|
99
|
+
),
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** @internal */
|
|
104
|
+
export type UpdateSubscriptionRequest$Outbound = {
|
|
105
|
+
id: string;
|
|
106
|
+
RequestBody: UpdateSubscriptionRequestBody$Outbound;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/** @internal */
|
|
110
|
+
export const UpdateSubscriptionRequest$outboundSchema: z.ZodType<
|
|
111
|
+
UpdateSubscriptionRequest$Outbound,
|
|
112
|
+
z.ZodTypeDef,
|
|
113
|
+
UpdateSubscriptionRequest
|
|
114
|
+
> = z.object({
|
|
115
|
+
id: z.string(),
|
|
116
|
+
requestBody: z.lazy(() => UpdateSubscriptionRequestBody$outboundSchema),
|
|
117
|
+
}).transform((v) => {
|
|
118
|
+
return remap$(v, {
|
|
119
|
+
requestBody: "RequestBody",
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
export function updateSubscriptionRequestToJSON(
|
|
124
|
+
updateSubscriptionRequest: UpdateSubscriptionRequest,
|
|
125
|
+
): string {
|
|
126
|
+
return JSON.stringify(
|
|
127
|
+
UpdateSubscriptionRequest$outboundSchema.parse(updateSubscriptionRequest),
|
|
128
|
+
);
|
|
129
|
+
}
|
package/src/models/price.ts
CHANGED
|
@@ -61,6 +61,10 @@ export type Price = {
|
|
|
61
61
|
* When true, grants applied to a subscription will discount usage charged by this price. Only supported for standard metered prices.
|
|
62
62
|
*/
|
|
63
63
|
grantDiscountEnabled: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Quantity used when generating invoice line items for this price. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
|
|
66
|
+
*/
|
|
67
|
+
quantity: number;
|
|
64
68
|
};
|
|
65
69
|
|
|
66
70
|
/** @internal */
|
|
@@ -99,6 +103,7 @@ export const Price$inboundSchema: z.ZodType<Price, z.ZodTypeDef, unknown> = z
|
|
|
99
103
|
),
|
|
100
104
|
features: z.array(PriceFeature$inboundSchema).optional(),
|
|
101
105
|
grantDiscountEnabled: z.boolean().default(false),
|
|
106
|
+
quantity: z.number().int().default(1),
|
|
102
107
|
});
|
|
103
108
|
|
|
104
109
|
export function priceFromJSON(
|
|
@@ -86,7 +86,7 @@ export type PriceProperties2 = {
|
|
|
86
86
|
*/
|
|
87
87
|
export type PriceProperties1 = {
|
|
88
88
|
/**
|
|
89
|
-
* Per-unit cost in decimal format for fixed-rate pricing. Sample values: '0.00002' represents $0.00002 per token, '0.15' represents $0.15 per gigabyte stored, '0.05' represents $0.05 per API call
|
|
89
|
+
* Per-unit cost in decimal format for fixed-rate pricing. Sample values: '0.00002' represents $0.00002 per token, '0.15' represents $0.15 per gigabyte stored, '0.05' represents $0.05 per API call. Per unit. Total per period = quantity × unitPrice; see the `quantity` field.
|
|
90
90
|
*/
|
|
91
91
|
unitPrice: string;
|
|
92
92
|
};
|
|
@@ -38,11 +38,11 @@ export type PurchaseGrantRequest = {
|
|
|
38
38
|
*/
|
|
39
39
|
paymentExpiresAt?: Date | undefined;
|
|
40
40
|
/**
|
|
41
|
-
* Maximum balance carried over at the entitlement's reset boundary. If omitted, the purchased grant balance rolls over until consumed or expired. Set to 0 to discard any remaining balance at each reset.
|
|
41
|
+
* Maximum balance carried over at the entitlement's reset boundary. If omitted, the purchased grant balance rolls over until consumed or expired. Set to 0 to discard any remaining balance at each reset. Ignored when the target entitlement has no `usagePeriod` (one-time entitlement) — one-time entitlements have no reset boundary, so this field has no effect.
|
|
42
42
|
*/
|
|
43
43
|
resetMaxRollover?: number | undefined;
|
|
44
44
|
/**
|
|
45
|
-
* Minimum balance at the entitlement's reset boundary; balances below this are floored up. Defaults to 0 (no floor).
|
|
45
|
+
* Minimum balance at the entitlement's reset boundary; balances below this are floored up. Defaults to 0 (no floor). Ignored when the target entitlement has no `usagePeriod` (one-time entitlement).
|
|
46
46
|
*/
|
|
47
47
|
resetMinRollover?: number | undefined;
|
|
48
48
|
};
|
|
@@ -67,6 +67,10 @@ export type SchemasPrice = {
|
|
|
67
67
|
* When true, grants applied to a subscription will discount usage charged by this price. Only supported for standard metered prices.
|
|
68
68
|
*/
|
|
69
69
|
grantDiscountEnabled: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Quantity for invoice line items. Total per period = quantity × unitPrice. Only supported for fee prices; metered prices derive quantity from usage. Defaults to 1.
|
|
72
|
+
*/
|
|
73
|
+
quantity: number;
|
|
70
74
|
};
|
|
71
75
|
|
|
72
76
|
/** @internal */
|
|
@@ -103,6 +107,7 @@ export const SchemasPrice$inboundSchema: z.ZodType<
|
|
|
103
107
|
updatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
104
108
|
features: z.array(PriceFeature$inboundSchema).optional(),
|
|
105
109
|
grantDiscountEnabled: z.boolean().default(false),
|
|
110
|
+
quantity: z.number().int(),
|
|
106
111
|
});
|
|
107
112
|
|
|
108
113
|
export function schemasPriceFromJSON(
|
package/src/sdk/subscriptions.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { subscriptionsGeneratePortalLink } from "../funcs/subscriptionsGenerateP
|
|
|
7
7
|
import { subscriptionsGet } from "../funcs/subscriptionsGet.js";
|
|
8
8
|
import { subscriptionsList } from "../funcs/subscriptionsList.js";
|
|
9
9
|
import { subscriptionsTerminate } from "../funcs/subscriptionsTerminate.js";
|
|
10
|
+
import { subscriptionsUpdateSubscription } from "../funcs/subscriptionsUpdateSubscription.js";
|
|
10
11
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
11
12
|
import * as models from "../models/index.js";
|
|
12
13
|
import * as operations from "../models/operations/index.js";
|
|
@@ -58,6 +59,20 @@ export class Subscriptions extends ClientSDK {
|
|
|
58
59
|
));
|
|
59
60
|
}
|
|
60
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Update
|
|
64
|
+
*/
|
|
65
|
+
async updateSubscription(
|
|
66
|
+
request: operations.UpdateSubscriptionRequest,
|
|
67
|
+
options?: RequestOptions,
|
|
68
|
+
): Promise<models.Subscription> {
|
|
69
|
+
return unwrapAsync(subscriptionsUpdateSubscription(
|
|
70
|
+
this,
|
|
71
|
+
request,
|
|
72
|
+
options,
|
|
73
|
+
));
|
|
74
|
+
}
|
|
75
|
+
|
|
61
76
|
/**
|
|
62
77
|
* Generate Portal Link
|
|
63
78
|
*
|