@flexprice/sdk 2.1.38 → 2.1.40

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.
Files changed (134) hide show
  1. package/docs/sdk/models/analytics-view-definition.md +1 -0
  2. package/docs/sdk/models/create-customer-portal-session-request.md +17 -0
  3. package/docs/sdk/models/family.md +17 -0
  4. package/docs/sdk/models/invoice-billing-reason.md +2 -2
  5. package/docs/sdk/models/metric.md +2 -2
  6. package/docs/sdk/models/modify-subscription-params.md +6 -5
  7. package/docs/sdk/models/modify-subscription-type.md +2 -2
  8. package/docs/sdk/models/pause-subscription-request-request.md +19 -0
  9. package/docs/sdk/models/pause-subscription-request.md +19 -0
  10. package/docs/sdk/models/pause-subscription-response.md +127 -0
  11. package/docs/sdk/models/portal-session-response.md +17 -0
  12. package/docs/sdk/models/resume-subscription-request-request.md +19 -0
  13. package/docs/sdk/models/resume-subscription-request.md +18 -0
  14. package/docs/sdk/models/resume-subscription-response.md +127 -0
  15. package/docs/sdk/models/shape.md +2 -2
  16. package/docs/sdk/models/subscription-pause-response.md +35 -0
  17. package/docs/sdks/analytics/README.md +6 -6
  18. package/docs/sdks/customers/README.md +72 -0
  19. package/docs/sdks/subscriptions/README.md +146 -0
  20. package/esm/funcs/customers-create-customer-portal-session.d.ts +17 -0
  21. package/esm/funcs/customers-create-customer-portal-session.d.ts.map +1 -0
  22. package/esm/funcs/customers-create-customer-portal-session.js +91 -0
  23. package/esm/funcs/customers-create-customer-portal-session.js.map +1 -0
  24. package/esm/funcs/subscriptions-pause-subscription.d.ts +17 -0
  25. package/esm/funcs/subscriptions-pause-subscription.d.ts.map +1 -0
  26. package/esm/funcs/subscriptions-pause-subscription.js +93 -0
  27. package/esm/funcs/subscriptions-pause-subscription.js.map +1 -0
  28. package/esm/funcs/subscriptions-resume-subscription.d.ts +17 -0
  29. package/esm/funcs/subscriptions-resume-subscription.d.ts.map +1 -0
  30. package/esm/funcs/subscriptions-resume-subscription.js +93 -0
  31. package/esm/funcs/subscriptions-resume-subscription.js.map +1 -0
  32. package/esm/lib/config.d.ts +2 -2
  33. package/esm/lib/config.js +2 -2
  34. package/esm/sdk/customers.d.ts +7 -0
  35. package/esm/sdk/customers.d.ts.map +1 -1
  36. package/esm/sdk/customers.js +10 -0
  37. package/esm/sdk/customers.js.map +1 -1
  38. package/esm/sdk/models/analytics-view-definition.d.ts +3 -0
  39. package/esm/sdk/models/analytics-view-definition.d.ts.map +1 -1
  40. package/esm/sdk/models/analytics-view-definition.js +3 -0
  41. package/esm/sdk/models/analytics-view-definition.js.map +1 -1
  42. package/esm/sdk/models/create-customer-portal-session-op.d.ts +15 -0
  43. package/esm/sdk/models/create-customer-portal-session-op.d.ts.map +1 -0
  44. package/esm/sdk/models/create-customer-portal-session-op.js +17 -0
  45. package/esm/sdk/models/create-customer-portal-session-op.js.map +1 -0
  46. package/esm/sdk/models/family.d.ts +12 -0
  47. package/esm/sdk/models/family.d.ts.map +1 -0
  48. package/esm/sdk/models/family.js +15 -0
  49. package/esm/sdk/models/family.js.map +1 -0
  50. package/esm/sdk/models/index.d.ts +10 -0
  51. package/esm/sdk/models/index.d.ts.map +1 -1
  52. package/esm/sdk/models/index.js +10 -0
  53. package/esm/sdk/models/index.js.map +1 -1
  54. package/esm/sdk/models/invoice-billing-reason.d.ts +2 -0
  55. package/esm/sdk/models/invoice-billing-reason.d.ts.map +1 -1
  56. package/esm/sdk/models/invoice-billing-reason.js +2 -0
  57. package/esm/sdk/models/invoice-billing-reason.js.map +1 -1
  58. package/esm/sdk/models/metric.d.ts +1 -0
  59. package/esm/sdk/models/metric.d.ts.map +1 -1
  60. package/esm/sdk/models/metric.js +1 -0
  61. package/esm/sdk/models/metric.js.map +1 -1
  62. package/esm/sdk/models/modify-subscription-params.d.ts +5 -0
  63. package/esm/sdk/models/modify-subscription-params.d.ts.map +1 -1
  64. package/esm/sdk/models/modify-subscription-params.js +2 -0
  65. package/esm/sdk/models/modify-subscription-params.js.map +1 -1
  66. package/esm/sdk/models/modify-subscription-type.d.ts +1 -0
  67. package/esm/sdk/models/modify-subscription-type.d.ts.map +1 -1
  68. package/esm/sdk/models/modify-subscription-type.js +1 -0
  69. package/esm/sdk/models/modify-subscription-type.js.map +1 -1
  70. package/esm/sdk/models/pause-subscription-op.d.ts +21 -0
  71. package/esm/sdk/models/pause-subscription-op.d.ts.map +1 -0
  72. package/esm/sdk/models/pause-subscription-op.js +14 -0
  73. package/esm/sdk/models/pause-subscription-op.js.map +1 -0
  74. package/esm/sdk/models/pause-subscription-request.d.ts +37 -0
  75. package/esm/sdk/models/pause-subscription-request.d.ts.map +1 -0
  76. package/esm/sdk/models/pause-subscription-request.js +20 -0
  77. package/esm/sdk/models/pause-subscription-request.js.map +1 -0
  78. package/esm/sdk/models/pause-subscription-response.d.ts +19 -0
  79. package/esm/sdk/models/pause-subscription-response.d.ts.map +1 -0
  80. package/esm/sdk/models/pause-subscription-response.js +17 -0
  81. package/esm/sdk/models/pause-subscription-response.js.map +1 -0
  82. package/esm/sdk/models/portal-session-response.d.ts +12 -0
  83. package/esm/sdk/models/portal-session-response.d.ts.map +1 -0
  84. package/esm/sdk/models/portal-session-response.js +21 -0
  85. package/esm/sdk/models/portal-session-response.js.map +1 -0
  86. package/esm/sdk/models/resume-subscription-op.d.ts +21 -0
  87. package/esm/sdk/models/resume-subscription-op.d.ts.map +1 -0
  88. package/esm/sdk/models/resume-subscription-op.js +14 -0
  89. package/esm/sdk/models/resume-subscription-op.js.map +1 -0
  90. package/esm/sdk/models/resume-subscription-request.d.ts +28 -0
  91. package/esm/sdk/models/resume-subscription-request.d.ts.map +1 -0
  92. package/esm/sdk/models/resume-subscription-request.js +19 -0
  93. package/esm/sdk/models/resume-subscription-request.js.map +1 -0
  94. package/esm/sdk/models/resume-subscription-response.d.ts +19 -0
  95. package/esm/sdk/models/resume-subscription-response.d.ts.map +1 -0
  96. package/esm/sdk/models/resume-subscription-response.js +17 -0
  97. package/esm/sdk/models/resume-subscription-response.js.map +1 -0
  98. package/esm/sdk/models/shape.d.ts +1 -0
  99. package/esm/sdk/models/shape.d.ts.map +1 -1
  100. package/esm/sdk/models/shape.js +1 -0
  101. package/esm/sdk/models/shape.js.map +1 -1
  102. package/esm/sdk/models/subscription-pause-response.d.ts +64 -0
  103. package/esm/sdk/models/subscription-pause-response.d.ts.map +1 -0
  104. package/esm/sdk/models/subscription-pause-response.js +55 -0
  105. package/esm/sdk/models/subscription-pause-response.js.map +1 -0
  106. package/esm/sdk/subscriptions.d.ts +14 -0
  107. package/esm/sdk/subscriptions.d.ts.map +1 -1
  108. package/esm/sdk/subscriptions.js +20 -0
  109. package/esm/sdk/subscriptions.js.map +1 -1
  110. package/jsr.json +1 -1
  111. package/package.json +1 -1
  112. package/src/funcs/customers-create-customer-portal-session.ts +182 -0
  113. package/src/funcs/subscriptions-pause-subscription.ts +187 -0
  114. package/src/funcs/subscriptions-resume-subscription.ts +187 -0
  115. package/src/lib/config.ts +2 -2
  116. package/src/sdk/customers.ts +18 -0
  117. package/src/sdk/models/analytics-view-definition.ts +9 -0
  118. package/src/sdk/models/create-customer-portal-session-op.ts +43 -0
  119. package/src/sdk/models/family.ts +20 -0
  120. package/src/sdk/models/index.ts +10 -0
  121. package/src/sdk/models/invoice-billing-reason.ts +2 -0
  122. package/src/sdk/models/metric.ts +1 -0
  123. package/src/sdk/models/modify-subscription-params.ts +7 -0
  124. package/src/sdk/models/modify-subscription-type.ts +1 -0
  125. package/src/sdk/models/pause-subscription-op.ts +46 -0
  126. package/src/sdk/models/pause-subscription-request.ts +64 -0
  127. package/src/sdk/models/pause-subscription-response.ts +47 -0
  128. package/src/sdk/models/portal-session-response.ts +43 -0
  129. package/src/sdk/models/resume-subscription-op.ts +46 -0
  130. package/src/sdk/models/resume-subscription-request.ts +54 -0
  131. package/src/sdk/models/resume-subscription-response.ts +47 -0
  132. package/src/sdk/models/shape.ts +1 -0
  133. package/src/sdk/models/subscription-pause-response.ts +123 -0
  134. package/src/sdk/subscriptions.ts +40 -0
@@ -2,6 +2,7 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ import { customersCreateCustomerPortalSession } from "../funcs/customers-create-customer-portal-session.js";
5
6
  import { customersCreateCustomer } from "../funcs/customers-create-customer.js";
6
7
  import { customersDeleteCustomer } from "../funcs/customers-delete-customer.js";
7
8
  import { customersGetCustomerByExternalId } from "../funcs/customers-get-customer-by-external-id.js";
@@ -110,6 +111,23 @@ export class Customers extends ClientSDK {
110
111
  ));
111
112
  }
112
113
 
114
+ /**
115
+ * Create customer portal session
116
+ *
117
+ * @remarks
118
+ * Use when sending a customer to their self-serve billing portal (invoices, usage, payment methods). Returns a short-lived URL and token scoped to that customer.
119
+ */
120
+ async createCustomerPortalSession(
121
+ externalId: string,
122
+ options?: RequestOptions,
123
+ ): Promise<models.PortalSessionResponse> {
124
+ return unwrapAsync(customersCreateCustomerPortalSession(
125
+ this,
126
+ externalId,
127
+ options,
128
+ ));
129
+ }
130
+
113
131
  /**
114
132
  * Query customers
115
133
  *
@@ -30,6 +30,11 @@ import {
30
30
  AnalyticsVariable$Outbound,
31
31
  AnalyticsVariable$outboundSchema,
32
32
  } from "./analytics-variable.js";
33
+ import {
34
+ Family,
35
+ Family$inboundSchema,
36
+ Family$outboundSchema,
37
+ } from "./family.js";
33
38
  import {
34
39
  Metric,
35
40
  Metric$inboundSchema,
@@ -40,6 +45,7 @@ import { Shape, Shape$inboundSchema, Shape$outboundSchema } from "./shape.js";
40
45
 
41
46
  export type AnalyticsViewDefinition = {
42
47
  dimensions?: Array<string> | undefined;
48
+ family?: Family | undefined;
43
49
  filters?: Array<AnalyticsFilter> | undefined;
44
50
  limit?: number | undefined;
45
51
  metrics: Array<Metric>;
@@ -55,6 +61,7 @@ export const AnalyticsViewDefinition$inboundSchema: z.ZodMiniType<
55
61
  unknown
56
62
  > = z.object({
57
63
  dimensions: types.optional(z.array(types.string())),
64
+ family: types.optional(Family$inboundSchema),
58
65
  filters: types.optional(z.array(AnalyticsFilter$inboundSchema)),
59
66
  limit: types.optional(types.number()),
60
67
  metrics: z.array(Metric$inboundSchema),
@@ -66,6 +73,7 @@ export const AnalyticsViewDefinition$inboundSchema: z.ZodMiniType<
66
73
  /** @internal */
67
74
  export type AnalyticsViewDefinition$Outbound = {
68
75
  dimensions?: Array<string> | undefined;
76
+ family?: string | undefined;
69
77
  filters?: Array<AnalyticsFilter$Outbound> | undefined;
70
78
  limit?: number | undefined;
71
79
  metrics: Array<string>;
@@ -81,6 +89,7 @@ export const AnalyticsViewDefinition$outboundSchema: z.ZodMiniType<
81
89
  AnalyticsViewDefinition
82
90
  > = z.object({
83
91
  dimensions: z.optional(z.array(z.string())),
92
+ family: z.optional(Family$outboundSchema),
84
93
  filters: z.optional(z.array(AnalyticsFilter$outboundSchema)),
85
94
  limit: z.optional(z.int()),
86
95
  metrics: z.array(Metric$outboundSchema),
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+
8
+ export type CreateCustomerPortalSessionRequest = {
9
+ /**
10
+ * Customer external ID
11
+ */
12
+ externalId: string;
13
+ };
14
+
15
+ /** @internal */
16
+ export type CreateCustomerPortalSessionRequest$Outbound = {
17
+ external_id: string;
18
+ };
19
+
20
+ /** @internal */
21
+ export const CreateCustomerPortalSessionRequest$outboundSchema: z.ZodMiniType<
22
+ CreateCustomerPortalSessionRequest$Outbound,
23
+ CreateCustomerPortalSessionRequest
24
+ > = z.pipe(
25
+ z.object({
26
+ externalId: z.string(),
27
+ }),
28
+ z.transform((v) => {
29
+ return remap$(v, {
30
+ externalId: "external_id",
31
+ });
32
+ }),
33
+ );
34
+
35
+ export function createCustomerPortalSessionRequestToJSON(
36
+ createCustomerPortalSessionRequest: CreateCustomerPortalSessionRequest,
37
+ ): string {
38
+ return JSON.stringify(
39
+ CreateCustomerPortalSessionRequest$outboundSchema.parse(
40
+ createCustomerPortalSessionRequest,
41
+ ),
42
+ );
43
+ }
@@ -0,0 +1,20 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import * as openEnums from "../../types/enums.js";
7
+ import { OpenEnum } from "../../types/enums.js";
8
+
9
+ export const Family = {
10
+ Usage: "usage",
11
+ Billing: "billing",
12
+ } as const;
13
+ export type Family = OpenEnum<typeof Family>;
14
+
15
+ /** @internal */
16
+ export const Family$inboundSchema: z.ZodMiniType<Family, unknown> = openEnums
17
+ .inboundSchema(Family);
18
+ /** @internal */
19
+ export const Family$outboundSchema: z.ZodMiniType<string, Family> = openEnums
20
+ .outboundSchema(Family);
@@ -134,6 +134,7 @@ export * from "./create-coupon-request.js";
134
134
  export * from "./create-credit-grant-request.js";
135
135
  export * from "./create-credit-note-line-item-request.js";
136
136
  export * from "./create-credit-note-request.js";
137
+ export * from "./create-customer-portal-session-op.js";
137
138
  export * from "./create-customer-request.js";
138
139
  export * from "./create-entitlement-request.js";
139
140
  export * from "./create-entity-integration-mapping-request.js";
@@ -258,6 +259,7 @@ export * from "./external-tax-details.js";
258
259
  export * from "./fact-status.js";
259
260
  export * from "./failure-point-type.js";
260
261
  export * from "./failure-point.js";
262
+ export * from "./family.js";
261
263
  export * from "./feature-filter.js";
262
264
  export * from "./feature-response.js";
263
265
  export * from "./feature-type.js";
@@ -459,6 +461,9 @@ export * from "./override-line-item-request.js";
459
461
  export * from "./pagination-response.js";
460
462
  export * from "./pause-mode.js";
461
463
  export * from "./pause-status.js";
464
+ export * from "./pause-subscription-op.js";
465
+ export * from "./pause-subscription-request.js";
466
+ export * from "./pause-subscription-response.js";
462
467
  export * from "./pay-invoice-params.js";
463
468
  export * from "./payment-action-type.js";
464
469
  export * from "./payment-action.js";
@@ -480,6 +485,7 @@ export * from "./plan-response.js";
480
485
  export * from "./plan-summary.js";
481
486
  export * from "./plan.js";
482
487
  export * from "./point-bucket.js";
488
+ export * from "./portal-session-response.js";
483
489
  export * from "./preview-subscription-change-op.js";
484
490
  export * from "./preview-subscription-modify-op.js";
485
491
  export * from "./preview-subscription-plan-change-v2-op.js";
@@ -524,6 +530,9 @@ export * from "./reporting-unit.js";
524
530
  export * from "./reset-usage.js";
525
531
  export * from "./response-validation-error.js";
526
532
  export * from "./resume-mode.js";
533
+ export * from "./resume-subscription-op.js";
534
+ export * from "./resume-subscription-request.js";
535
+ export * from "./resume-subscription-response.js";
527
536
  export * from "./retry-refund-op.js";
528
537
  export * from "./revenue-allocation-policy.js";
529
538
  export * from "./revenue-analytics-request.js";
@@ -592,6 +601,7 @@ export * from "./subscription-line-item-response.js";
592
601
  export * from "./subscription-modification-action.js";
593
602
  export * from "./subscription-modify-response.js";
594
603
  export * from "./subscription-modify-type.js";
604
+ export * from "./subscription-pause-response.js";
595
605
  export * from "./subscription-phase-create-request.js";
596
606
  export * from "./subscription-phase-response.js";
597
607
  export * from "./subscription-price-create-request.js";
@@ -15,6 +15,8 @@ export const InvoiceBillingReason = {
15
15
  Manual: "MANUAL",
16
16
  AutoInvoiceThreshold: "AUTO_INVOICE_THRESHOLD",
17
17
  WalletAutoTopup: "WALLET_AUTO_TOPUP",
18
+ SubscriptionPaused: "SUBSCRIPTION_PAUSED",
19
+ SubscriptionResume: "SUBSCRIPTION_RESUME",
18
20
  } as const;
19
21
  export type InvoiceBillingReason = ClosedEnum<typeof InvoiceBillingReason>;
20
22
 
@@ -9,6 +9,7 @@ import { OpenEnum } from "../../types/enums.js";
9
9
  export const Metric = {
10
10
  UsageQuantity: "usage_quantity",
11
11
  EventCount: "event_count",
12
+ InvoiceTotal: "invoice_total",
12
13
  } as const;
13
14
  export type Metric = OpenEnum<typeof Metric>;
14
15
 
@@ -18,6 +18,10 @@ export type ModifySubscriptionParams = {
18
18
  lineItemModifications?: Array<ModifySubscriptionLineItem> | undefined;
19
19
  modifyType?: ModifySubscriptionType | undefined;
20
20
  subscriptionId?: string | undefined;
21
+ /**
22
+ * TrialEndAt is where a trial_end checkout starts the first paid period.
23
+ */
24
+ trialEndAt?: Date | undefined;
21
25
  };
22
26
 
23
27
  /** @internal */
@@ -27,6 +31,7 @@ export type ModifySubscriptionParams$Outbound = {
27
31
  | undefined;
28
32
  modify_type?: string | undefined;
29
33
  subscription_id?: string | undefined;
34
+ trial_end_at?: string | undefined;
30
35
  };
31
36
 
32
37
  /** @internal */
@@ -40,12 +45,14 @@ export const ModifySubscriptionParams$outboundSchema: z.ZodMiniType<
40
45
  ),
41
46
  modifyType: z.optional(ModifySubscriptionType$outboundSchema),
42
47
  subscriptionId: z.optional(z.string()),
48
+ trialEndAt: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))),
43
49
  }),
44
50
  z.transform((v) => {
45
51
  return remap$(v, {
46
52
  lineItemModifications: "line_item_modifications",
47
53
  modifyType: "modify_type",
48
54
  subscriptionId: "subscription_id",
55
+ trialEndAt: "trial_end_at",
49
56
  });
50
57
  }),
51
58
  );
@@ -8,6 +8,7 @@ import { ClosedEnum } from "../../types/enums.js";
8
8
  export const ModifySubscriptionType = {
9
9
  QuantityChange: "quantity_change",
10
10
  LineItemChange: "line_item_change",
11
+ TrialEnd: "trial_end",
11
12
  } as const;
12
13
  export type ModifySubscriptionType = ClosedEnum<typeof ModifySubscriptionType>;
13
14
 
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import {
7
+ PauseSubscriptionRequest,
8
+ PauseSubscriptionRequest$Outbound,
9
+ PauseSubscriptionRequest$outboundSchema,
10
+ } from "./pause-subscription-request.js";
11
+
12
+ export type PauseSubscriptionRequestRequest = {
13
+ /**
14
+ * Subscription ID
15
+ */
16
+ id: string;
17
+ /**
18
+ * Pause subscription request
19
+ */
20
+ body: PauseSubscriptionRequest;
21
+ };
22
+
23
+ /** @internal */
24
+ export type PauseSubscriptionRequestRequest$Outbound = {
25
+ id: string;
26
+ body: PauseSubscriptionRequest$Outbound;
27
+ };
28
+
29
+ /** @internal */
30
+ export const PauseSubscriptionRequestRequest$outboundSchema: z.ZodMiniType<
31
+ PauseSubscriptionRequestRequest$Outbound,
32
+ PauseSubscriptionRequestRequest
33
+ > = z.object({
34
+ id: z.string(),
35
+ body: PauseSubscriptionRequest$outboundSchema,
36
+ });
37
+
38
+ export function pauseSubscriptionRequestRequestToJSON(
39
+ pauseSubscriptionRequestRequest: PauseSubscriptionRequestRequest,
40
+ ): string {
41
+ return JSON.stringify(
42
+ PauseSubscriptionRequestRequest$outboundSchema.parse(
43
+ pauseSubscriptionRequestRequest,
44
+ ),
45
+ );
46
+ }
@@ -0,0 +1,64 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import {
8
+ ProrationBehavior,
9
+ ProrationBehavior$outboundSchema,
10
+ } from "./proration-behavior.js";
11
+
12
+ /**
13
+ * Pauses an active subscription now. Usage and arrear fixed charges up to the pause are billed on a closing invoice.
14
+ */
15
+ export type PauseSubscriptionRequest = {
16
+ /**
17
+ * Metadata stored on the pause
18
+ *
19
+ * @remarks
20
+ * @Example {"requested_by": "customer", "channel": "support_ticket"}
21
+ */
22
+ metadata?: { [k: string]: string } | undefined;
23
+ prorationBehavior?: ProrationBehavior | undefined;
24
+ /**
25
+ * Reason for pausing the subscription
26
+ *
27
+ * @remarks
28
+ * @Description Optional reason for the pause. Maximum 255 characters
29
+ * @Example "Customer requested temporary suspension"
30
+ */
31
+ reason?: string | undefined;
32
+ };
33
+
34
+ /** @internal */
35
+ export type PauseSubscriptionRequest$Outbound = {
36
+ metadata?: { [k: string]: string } | undefined;
37
+ proration_behavior?: string | undefined;
38
+ reason?: string | undefined;
39
+ };
40
+
41
+ /** @internal */
42
+ export const PauseSubscriptionRequest$outboundSchema: z.ZodMiniType<
43
+ PauseSubscriptionRequest$Outbound,
44
+ PauseSubscriptionRequest
45
+ > = z.pipe(
46
+ z.object({
47
+ metadata: z.optional(z.record(z.string(), z.string())),
48
+ prorationBehavior: z.optional(ProrationBehavior$outboundSchema),
49
+ reason: z.optional(z.string()),
50
+ }),
51
+ z.transform((v) => {
52
+ return remap$(v, {
53
+ prorationBehavior: "proration_behavior",
54
+ });
55
+ }),
56
+ );
57
+
58
+ export function pauseSubscriptionRequestToJSON(
59
+ pauseSubscriptionRequest: PauseSubscriptionRequest,
60
+ ): string {
61
+ return JSON.stringify(
62
+ PauseSubscriptionRequest$outboundSchema.parse(pauseSubscriptionRequest),
63
+ );
64
+ }
@@ -0,0 +1,47 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import * as types from "../../types/primitives.js";
9
+ import { SDKValidationError } from "./sdk-validation-error.js";
10
+ import {
11
+ SubscriptionPauseResponse,
12
+ SubscriptionPauseResponse$inboundSchema,
13
+ } from "./subscription-pause-response.js";
14
+ import {
15
+ SubscriptionResponse,
16
+ SubscriptionResponse$inboundSchema,
17
+ } from "./subscription-response.js";
18
+
19
+ /**
20
+ * The paused subscription and its pause
21
+ */
22
+ export type PauseSubscriptionResponse = {
23
+ /**
24
+ * Response object containing subscription pause information
25
+ */
26
+ pause?: SubscriptionPauseResponse | undefined;
27
+ subscription?: SubscriptionResponse | undefined;
28
+ };
29
+
30
+ /** @internal */
31
+ export const PauseSubscriptionResponse$inboundSchema: z.ZodMiniType<
32
+ PauseSubscriptionResponse,
33
+ unknown
34
+ > = z.object({
35
+ pause: types.optional(SubscriptionPauseResponse$inboundSchema),
36
+ subscription: types.optional(SubscriptionResponse$inboundSchema),
37
+ });
38
+
39
+ export function pauseSubscriptionResponseFromJSON(
40
+ jsonString: string,
41
+ ): SafeParseResult<PauseSubscriptionResponse, SDKValidationError> {
42
+ return safeParse(
43
+ jsonString,
44
+ (x) => PauseSubscriptionResponse$inboundSchema.parse(JSON.parse(x)),
45
+ `Failed to parse 'PauseSubscriptionResponse' from JSON`,
46
+ );
47
+ }
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import { SDKValidationError } from "./sdk-validation-error.js";
11
+
12
+ export type PortalSessionResponse = {
13
+ expiresAt?: Date | undefined;
14
+ token?: string | undefined;
15
+ url?: string | undefined;
16
+ };
17
+
18
+ /** @internal */
19
+ export const PortalSessionResponse$inboundSchema: z.ZodMiniType<
20
+ PortalSessionResponse,
21
+ unknown
22
+ > = z.pipe(
23
+ z.object({
24
+ expires_at: types.optional(types.date()),
25
+ token: types.optional(types.string()),
26
+ url: types.optional(types.string()),
27
+ }),
28
+ z.transform((v) => {
29
+ return remap$(v, {
30
+ "expires_at": "expiresAt",
31
+ });
32
+ }),
33
+ );
34
+
35
+ export function portalSessionResponseFromJSON(
36
+ jsonString: string,
37
+ ): SafeParseResult<PortalSessionResponse, SDKValidationError> {
38
+ return safeParse(
39
+ jsonString,
40
+ (x) => PortalSessionResponse$inboundSchema.parse(JSON.parse(x)),
41
+ `Failed to parse 'PortalSessionResponse' from JSON`,
42
+ );
43
+ }
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import {
7
+ ResumeSubscriptionRequest,
8
+ ResumeSubscriptionRequest$Outbound,
9
+ ResumeSubscriptionRequest$outboundSchema,
10
+ } from "./resume-subscription-request.js";
11
+
12
+ export type ResumeSubscriptionRequestRequest = {
13
+ /**
14
+ * Subscription ID
15
+ */
16
+ id: string;
17
+ /**
18
+ * Resume subscription request
19
+ */
20
+ body: ResumeSubscriptionRequest;
21
+ };
22
+
23
+ /** @internal */
24
+ export type ResumeSubscriptionRequestRequest$Outbound = {
25
+ id: string;
26
+ body: ResumeSubscriptionRequest$Outbound;
27
+ };
28
+
29
+ /** @internal */
30
+ export const ResumeSubscriptionRequestRequest$outboundSchema: z.ZodMiniType<
31
+ ResumeSubscriptionRequestRequest$Outbound,
32
+ ResumeSubscriptionRequestRequest
33
+ > = z.object({
34
+ id: z.string(),
35
+ body: ResumeSubscriptionRequest$outboundSchema,
36
+ });
37
+
38
+ export function resumeSubscriptionRequestRequestToJSON(
39
+ resumeSubscriptionRequestRequest: ResumeSubscriptionRequestRequest,
40
+ ): string {
41
+ return JSON.stringify(
42
+ ResumeSubscriptionRequestRequest$outboundSchema.parse(
43
+ resumeSubscriptionRequestRequest,
44
+ ),
45
+ );
46
+ }
@@ -0,0 +1,54 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import {
8
+ ProrationBehavior,
9
+ ProrationBehavior$outboundSchema,
10
+ } from "./proration-behavior.js";
11
+
12
+ /**
13
+ * Resumes a paused subscription now. The billing anchor is kept, so the first period runs from the resume time to the next billing date.
14
+ */
15
+ export type ResumeSubscriptionRequest = {
16
+ /**
17
+ * Metadata merged into the pause
18
+ *
19
+ * @remarks
20
+ * @Example {"resumed_by": "admin"}
21
+ */
22
+ metadata?: { [k: string]: string } | undefined;
23
+ prorationBehavior?: ProrationBehavior | undefined;
24
+ };
25
+
26
+ /** @internal */
27
+ export type ResumeSubscriptionRequest$Outbound = {
28
+ metadata?: { [k: string]: string } | undefined;
29
+ proration_behavior?: string | undefined;
30
+ };
31
+
32
+ /** @internal */
33
+ export const ResumeSubscriptionRequest$outboundSchema: z.ZodMiniType<
34
+ ResumeSubscriptionRequest$Outbound,
35
+ ResumeSubscriptionRequest
36
+ > = z.pipe(
37
+ z.object({
38
+ metadata: z.optional(z.record(z.string(), z.string())),
39
+ prorationBehavior: z.optional(ProrationBehavior$outboundSchema),
40
+ }),
41
+ z.transform((v) => {
42
+ return remap$(v, {
43
+ prorationBehavior: "proration_behavior",
44
+ });
45
+ }),
46
+ );
47
+
48
+ export function resumeSubscriptionRequestToJSON(
49
+ resumeSubscriptionRequest: ResumeSubscriptionRequest,
50
+ ): string {
51
+ return JSON.stringify(
52
+ ResumeSubscriptionRequest$outboundSchema.parse(resumeSubscriptionRequest),
53
+ );
54
+ }
@@ -0,0 +1,47 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import * as types from "../../types/primitives.js";
9
+ import { SDKValidationError } from "./sdk-validation-error.js";
10
+ import {
11
+ SubscriptionPauseResponse,
12
+ SubscriptionPauseResponse$inboundSchema,
13
+ } from "./subscription-pause-response.js";
14
+ import {
15
+ SubscriptionResponse,
16
+ SubscriptionResponse$inboundSchema,
17
+ } from "./subscription-response.js";
18
+
19
+ /**
20
+ * The resumed subscription and the pause it ended
21
+ */
22
+ export type ResumeSubscriptionResponse = {
23
+ /**
24
+ * Response object containing subscription pause information
25
+ */
26
+ pause?: SubscriptionPauseResponse | undefined;
27
+ subscription?: SubscriptionResponse | undefined;
28
+ };
29
+
30
+ /** @internal */
31
+ export const ResumeSubscriptionResponse$inboundSchema: z.ZodMiniType<
32
+ ResumeSubscriptionResponse,
33
+ unknown
34
+ > = z.object({
35
+ pause: types.optional(SubscriptionPauseResponse$inboundSchema),
36
+ subscription: types.optional(SubscriptionResponse$inboundSchema),
37
+ });
38
+
39
+ export function resumeSubscriptionResponseFromJSON(
40
+ jsonString: string,
41
+ ): SafeParseResult<ResumeSubscriptionResponse, SDKValidationError> {
42
+ return safeParse(
43
+ jsonString,
44
+ (x) => ResumeSubscriptionResponse$inboundSchema.parse(JSON.parse(x)),
45
+ `Failed to parse 'ResumeSubscriptionResponse' from JSON`,
46
+ );
47
+ }
@@ -9,6 +9,7 @@ import { OpenEnum } from "../../types/enums.js";
9
9
  export const Shape = {
10
10
  Timeseries: "timeseries",
11
11
  Breakdown: "breakdown",
12
+ Scalar: "scalar",
12
13
  } as const;
13
14
  export type Shape = OpenEnum<typeof Shape>;
14
15