@flexprice/sdk 2.1.25 → 2.1.26

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 (181) hide show
  1. package/docs/sdk/models/billing-period-behaviour.md +17 -0
  2. package/docs/sdk/models/billing-period-config.md +18 -0
  3. package/docs/sdk/models/credit-grant-application-response.md +1 -1
  4. package/docs/sdk/models/entitlement-response.md +1 -1
  5. package/docs/sdk/models/entity-change-behaviour.md +2 -2
  6. package/docs/sdk/models/entity-change-policy.md +4 -4
  7. package/docs/sdk/models/entity-change-result.md +6 -6
  8. package/docs/sdk/models/invoice-sync-settings.md +6 -4
  9. package/docs/sdk/models/list-usage-records-response.md +16 -0
  10. package/docs/sdk/models/metadata-custom-field-source.md +17 -0
  11. package/docs/sdk/models/metadata-custom-field.md +17 -0
  12. package/docs/sdk/models/on-pending-schedule-policy.md +15 -0
  13. package/docs/sdk/models/plan-price-sync-status-response.md +17 -0
  14. package/docs/sdk/models/plan-response.md +1 -0
  15. package/docs/sdk/models/price-feature-response.md +15 -0
  16. package/docs/sdk/models/price-response.md +1 -0
  17. package/docs/sdk/models/subscription-change-billing-period-result.md +18 -0
  18. package/docs/sdk/models/subscription-change-conflict-policies.md +15 -0
  19. package/docs/sdk/models/subscription-change-entity-type.md +17 -0
  20. package/docs/sdk/models/subscription-change-v2-request.md +11 -8
  21. package/docs/sdk/models/subscription-change-v2-response.md +16 -14
  22. package/docs/sdk/models/usage-record-filter-order.md +15 -0
  23. package/docs/sdk/models/usage-record-filter.md +31 -0
  24. package/docs/sdk/models/usage-record-response.md +33 -0
  25. package/docs/sdk/models/usage-record-sync-entry.md +20 -0
  26. package/docs/sdks/prices/README.md +1 -1
  27. package/docs/sdks/subscriptions/README.md +3 -1
  28. package/docs/sdks/usagerecords/README.md +78 -0
  29. package/esm/funcs/prices-get-price-by-lookup-key.js +1 -1
  30. package/esm/funcs/prices-get-price-by-lookup-key.js.map +1 -1
  31. package/esm/funcs/subscriptions-execute-subscription-plan-change-v2.d.ts +3 -1
  32. package/esm/funcs/subscriptions-execute-subscription-plan-change-v2.d.ts.map +1 -1
  33. package/esm/funcs/subscriptions-execute-subscription-plan-change-v2.js +3 -1
  34. package/esm/funcs/subscriptions-execute-subscription-plan-change-v2.js.map +1 -1
  35. package/esm/funcs/usage-records-post-usage-records-search.d.ts +17 -0
  36. package/esm/funcs/usage-records-post-usage-records-search.d.ts.map +1 -0
  37. package/esm/funcs/usage-records-post-usage-records-search.js +83 -0
  38. package/esm/funcs/usage-records-post-usage-records-search.js.map +1 -0
  39. package/esm/lib/config.d.ts +3 -3
  40. package/esm/lib/config.js +3 -3
  41. package/esm/sdk/models/billing-period-behaviour.d.ts +13 -0
  42. package/esm/sdk/models/billing-period-behaviour.d.ts.map +1 -0
  43. package/esm/sdk/models/billing-period-behaviour.js +14 -0
  44. package/esm/sdk/models/billing-period-behaviour.js.map +1 -0
  45. package/esm/sdk/models/billing-period-config.d.ts +20 -0
  46. package/esm/sdk/models/billing-period-config.d.ts.map +1 -0
  47. package/esm/sdk/models/billing-period-config.js +25 -0
  48. package/esm/sdk/models/billing-period-config.js.map +1 -0
  49. package/esm/sdk/models/credit-grant-application-response.d.ts +1 -1
  50. package/esm/sdk/models/credit-grant-application-response.js +1 -1
  51. package/esm/sdk/models/entitlement-response.d.ts +1 -1
  52. package/esm/sdk/models/entitlement-response.js +1 -1
  53. package/esm/sdk/models/entity-change-behaviour.d.ts +1 -0
  54. package/esm/sdk/models/entity-change-behaviour.d.ts.map +1 -1
  55. package/esm/sdk/models/entity-change-behaviour.js +1 -0
  56. package/esm/sdk/models/entity-change-behaviour.js.map +1 -1
  57. package/esm/sdk/models/entity-change-policy.d.ts +3 -0
  58. package/esm/sdk/models/entity-change-policy.d.ts.map +1 -1
  59. package/esm/sdk/models/entity-change-policy.js.map +1 -1
  60. package/esm/sdk/models/entity-change-result.d.ts +2 -2
  61. package/esm/sdk/models/entity-change-result.d.ts.map +1 -1
  62. package/esm/sdk/models/entity-change-result.js +2 -2
  63. package/esm/sdk/models/entity-change-result.js.map +1 -1
  64. package/esm/sdk/models/index.d.ts +14 -0
  65. package/esm/sdk/models/index.d.ts.map +1 -1
  66. package/esm/sdk/models/index.js +14 -0
  67. package/esm/sdk/models/index.js.map +1 -1
  68. package/esm/sdk/models/invoice-sync-settings.d.ts +17 -0
  69. package/esm/sdk/models/invoice-sync-settings.d.ts.map +1 -1
  70. package/esm/sdk/models/invoice-sync-settings.js +5 -0
  71. package/esm/sdk/models/invoice-sync-settings.js.map +1 -1
  72. package/esm/sdk/models/list-usage-records-response.d.ts +13 -0
  73. package/esm/sdk/models/list-usage-records-response.d.ts.map +1 -0
  74. package/esm/sdk/models/list-usage-records-response.js +17 -0
  75. package/esm/sdk/models/list-usage-records-response.js.map +1 -0
  76. package/esm/sdk/models/metadata-custom-field-source.d.ts +10 -0
  77. package/esm/sdk/models/metadata-custom-field-source.d.ts.map +1 -0
  78. package/esm/sdk/models/metadata-custom-field-source.js +11 -0
  79. package/esm/sdk/models/metadata-custom-field-source.js.map +1 -0
  80. package/esm/sdk/models/metadata-custom-field.d.ts +13 -0
  81. package/esm/sdk/models/metadata-custom-field.d.ts.map +1 -0
  82. package/esm/sdk/models/metadata-custom-field.js +22 -0
  83. package/esm/sdk/models/metadata-custom-field.js.map +1 -0
  84. package/esm/sdk/models/on-pending-schedule-policy.d.ts +10 -0
  85. package/esm/sdk/models/on-pending-schedule-policy.d.ts.map +1 -0
  86. package/esm/sdk/models/on-pending-schedule-policy.js +11 -0
  87. package/esm/sdk/models/on-pending-schedule-policy.js.map +1 -0
  88. package/esm/sdk/models/plan-price-sync-status-response.d.ts +12 -0
  89. package/esm/sdk/models/plan-price-sync-status-response.d.ts.map +1 -0
  90. package/esm/sdk/models/plan-price-sync-status-response.js +22 -0
  91. package/esm/sdk/models/plan-price-sync-status-response.js.map +1 -0
  92. package/esm/sdk/models/plan-response.d.ts +2 -0
  93. package/esm/sdk/models/plan-response.d.ts.map +1 -1
  94. package/esm/sdk/models/plan-response.js +3 -0
  95. package/esm/sdk/models/plan-response.js.map +1 -1
  96. package/esm/sdk/models/price-feature-response.d.ts +11 -0
  97. package/esm/sdk/models/price-feature-response.d.ts.map +1 -0
  98. package/esm/sdk/models/price-feature-response.js +20 -0
  99. package/esm/sdk/models/price-feature-response.js.map +1 -0
  100. package/esm/sdk/models/price-response.d.ts +2 -0
  101. package/esm/sdk/models/price-response.d.ts.map +1 -1
  102. package/esm/sdk/models/price-response.js +2 -0
  103. package/esm/sdk/models/price-response.js.map +1 -1
  104. package/esm/sdk/models/subscription-change-billing-period-result.d.ts +14 -0
  105. package/esm/sdk/models/subscription-change-billing-period-result.d.ts.map +1 -0
  106. package/esm/sdk/models/subscription-change-billing-period-result.js +25 -0
  107. package/esm/sdk/models/subscription-change-billing-period-result.js.map +1 -0
  108. package/esm/sdk/models/subscription-change-conflict-policies.d.ts +13 -0
  109. package/esm/sdk/models/subscription-change-conflict-policies.d.ts.map +1 -0
  110. package/esm/sdk/models/subscription-change-conflict-policies.js +18 -0
  111. package/esm/sdk/models/subscription-change-conflict-policies.js.map +1 -0
  112. package/esm/sdk/models/subscription-change-entity-type.d.ts +13 -0
  113. package/esm/sdk/models/subscription-change-entity-type.d.ts.map +1 -0
  114. package/esm/sdk/models/subscription-change-entity-type.js +14 -0
  115. package/esm/sdk/models/subscription-change-entity-type.js.map +1 -0
  116. package/esm/sdk/models/subscription-change-v2-request.d.ts +9 -0
  117. package/esm/sdk/models/subscription-change-v2-request.d.ts.map +1 -1
  118. package/esm/sdk/models/subscription-change-v2-request.js +9 -0
  119. package/esm/sdk/models/subscription-change-v2-request.js.map +1 -1
  120. package/esm/sdk/models/subscription-change-v2-response.d.ts +9 -0
  121. package/esm/sdk/models/subscription-change-v2-response.d.ts.map +1 -1
  122. package/esm/sdk/models/subscription-change-v2-response.js +5 -0
  123. package/esm/sdk/models/subscription-change-v2-response.js.map +1 -1
  124. package/esm/sdk/models/usage-record-filter.d.ts +67 -0
  125. package/esm/sdk/models/usage-record-filter.d.ts.map +1 -0
  126. package/esm/sdk/models/usage-record-filter.js +49 -0
  127. package/esm/sdk/models/usage-record-filter.js.map +1 -0
  128. package/esm/sdk/models/usage-record-response.d.ts +32 -0
  129. package/esm/sdk/models/usage-record-response.d.ts.map +1 -0
  130. package/esm/sdk/models/usage-record-response.js +50 -0
  131. package/esm/sdk/models/usage-record-response.js.map +1 -0
  132. package/esm/sdk/models/usage-record-sync-entry.d.ts +32 -0
  133. package/esm/sdk/models/usage-record-sync-entry.d.ts.map +1 -0
  134. package/esm/sdk/models/usage-record-sync-entry.js +28 -0
  135. package/esm/sdk/models/usage-record-sync-entry.js.map +1 -0
  136. package/esm/sdk/sdk.d.ts +3 -0
  137. package/esm/sdk/sdk.d.ts.map +1 -1
  138. package/esm/sdk/sdk.js +5 -0
  139. package/esm/sdk/sdk.js.map +1 -1
  140. package/esm/sdk/subscriptions.d.ts +3 -1
  141. package/esm/sdk/subscriptions.d.ts.map +1 -1
  142. package/esm/sdk/subscriptions.js +3 -1
  143. package/esm/sdk/subscriptions.js.map +1 -1
  144. package/esm/sdk/usage-records.d.ts +12 -0
  145. package/esm/sdk/usage-records.d.ts.map +1 -0
  146. package/esm/sdk/usage-records.js +18 -0
  147. package/esm/sdk/usage-records.js.map +1 -0
  148. package/jsr.json +1 -1
  149. package/package.json +1 -1
  150. package/src/funcs/prices-get-price-by-lookup-key.ts +1 -1
  151. package/src/funcs/subscriptions-execute-subscription-plan-change-v2.ts +3 -1
  152. package/src/funcs/usage-records-post-usage-records-search.ts +172 -0
  153. package/src/lib/config.ts +3 -3
  154. package/src/sdk/models/billing-period-behaviour.ts +25 -0
  155. package/src/sdk/models/billing-period-config.ts +57 -0
  156. package/src/sdk/models/credit-grant-application-response.ts +2 -2
  157. package/src/sdk/models/entitlement-response.ts +2 -2
  158. package/src/sdk/models/entity-change-behaviour.ts +1 -0
  159. package/src/sdk/models/entity-change-policy.ts +3 -0
  160. package/src/sdk/models/entity-change-result.ts +5 -5
  161. package/src/sdk/models/index.ts +14 -0
  162. package/src/sdk/models/invoice-sync-settings.ts +26 -0
  163. package/src/sdk/models/list-usage-records-response.ts +41 -0
  164. package/src/sdk/models/metadata-custom-field-source.ts +21 -0
  165. package/src/sdk/models/metadata-custom-field.ts +47 -0
  166. package/src/sdk/models/on-pending-schedule-policy.ts +19 -0
  167. package/src/sdk/models/plan-price-sync-status-response.ts +44 -0
  168. package/src/sdk/models/plan-response.ts +9 -0
  169. package/src/sdk/models/price-feature-response.ts +43 -0
  170. package/src/sdk/models/price-response.ts +6 -0
  171. package/src/sdk/models/subscription-change-billing-period-result.ts +52 -0
  172. package/src/sdk/models/subscription-change-conflict-policies.ts +44 -0
  173. package/src/sdk/models/subscription-change-entity-type.ts +24 -0
  174. package/src/sdk/models/subscription-change-v2-request.ts +30 -0
  175. package/src/sdk/models/subscription-change-v2-response.ts +18 -0
  176. package/src/sdk/models/usage-record-filter.ts +130 -0
  177. package/src/sdk/models/usage-record-response.ts +93 -0
  178. package/src/sdk/models/usage-record-sync-entry.ts +70 -0
  179. package/src/sdk/sdk.ts +6 -0
  180. package/src/sdk/subscriptions.ts +3 -1
  181. package/src/sdk/usage-records.ts +27 -0
@@ -0,0 +1,57 @@
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 { BillingCycle, BillingCycle$outboundSchema } from "./billing-cycle.js";
8
+ import {
9
+ BillingPeriod,
10
+ BillingPeriod$outboundSchema,
11
+ } from "./billing-period.js";
12
+
13
+ export type BillingPeriodConfig = {
14
+ billingAnchor?: Date | undefined;
15
+ billingCycle?: BillingCycle | undefined;
16
+ billingPeriodCount?: number | undefined;
17
+ billingPeriodUnit?: BillingPeriod | undefined;
18
+ };
19
+
20
+ /** @internal */
21
+ export type BillingPeriodConfig$Outbound = {
22
+ billing_anchor?: string | undefined;
23
+ billing_cycle?: string | undefined;
24
+ billing_period_count?: number | undefined;
25
+ billing_period_unit?: string | undefined;
26
+ };
27
+
28
+ /** @internal */
29
+ export const BillingPeriodConfig$outboundSchema: z.ZodMiniType<
30
+ BillingPeriodConfig$Outbound,
31
+ BillingPeriodConfig
32
+ > = z.pipe(
33
+ z.object({
34
+ billingAnchor: z.optional(
35
+ z.pipe(z.date(), z.transform(v => v.toISOString())),
36
+ ),
37
+ billingCycle: z.optional(BillingCycle$outboundSchema),
38
+ billingPeriodCount: z.optional(z.int()),
39
+ billingPeriodUnit: z.optional(BillingPeriod$outboundSchema),
40
+ }),
41
+ z.transform((v) => {
42
+ return remap$(v, {
43
+ billingAnchor: "billing_anchor",
44
+ billingCycle: "billing_cycle",
45
+ billingPeriodCount: "billing_period_count",
46
+ billingPeriodUnit: "billing_period_unit",
47
+ });
48
+ }),
49
+ );
50
+
51
+ export function billingPeriodConfigToJSON(
52
+ billingPeriodConfig: BillingPeriodConfig,
53
+ ): string {
54
+ return JSON.stringify(
55
+ BillingPeriodConfig$outboundSchema.parse(billingPeriodConfig),
56
+ );
57
+ }
@@ -29,7 +29,7 @@ export type CreditGrantApplicationResponse = {
29
29
  createdAt?: Date | undefined;
30
30
  createdBy?: string | undefined;
31
31
  creditGrantId?: string | undefined;
32
- credits?: number | undefined;
32
+ credits?: string | undefined;
33
33
  environmentId?: string | undefined;
34
34
  failureReason?: string | undefined;
35
35
  id?: string | undefined;
@@ -61,7 +61,7 @@ export const CreditGrantApplicationResponse$inboundSchema: z.ZodMiniType<
61
61
  created_at: types.optional(types.date()),
62
62
  created_by: types.optional(types.string()),
63
63
  credit_grant_id: types.optional(types.string()),
64
- credits: types.optional(types.number()),
64
+ credits: types.optional(types.string()),
65
65
  environment_id: types.optional(types.string()),
66
66
  failure_reason: types.optional(types.string()),
67
67
  id: types.optional(types.string()),
@@ -62,7 +62,7 @@ export type EntitlementResponse = {
62
62
  grantDurationUnit?: EntitlementGrantDurationUnit | undefined;
63
63
  grantDurationValue?: number | undefined;
64
64
  grantMeasure?: EntitlementGrantMeasure | undefined;
65
- grantQuota?: number | undefined;
65
+ grantQuota?: string | undefined;
66
66
  id?: string | undefined;
67
67
  isEnabled?: boolean | undefined;
68
68
  isSoftLimit?: boolean | undefined;
@@ -109,7 +109,7 @@ export const EntitlementResponse$inboundSchema: z.ZodMiniType<
109
109
  ),
110
110
  grant_duration_value: types.optional(types.number()),
111
111
  grant_measure: types.optional(EntitlementGrantMeasure$inboundSchema),
112
- grant_quota: types.optional(types.number()),
112
+ grant_quota: types.optional(types.string()),
113
113
  id: types.optional(types.string()),
114
114
  is_enabled: types.optional(types.boolean()),
115
115
  is_soft_limit: types.optional(types.boolean()),
@@ -9,6 +9,7 @@ import { OpenEnum } from "../../types/enums.js";
9
9
  export const EntityChangeBehaviour = {
10
10
  Carry: "carry",
11
11
  Drop: "drop",
12
+ Add: "add",
12
13
  } as const;
13
14
  export type EntityChangeBehaviour = OpenEnum<typeof EntityChangeBehaviour>;
14
15
 
@@ -13,6 +13,9 @@ export type EntityChangePolicy = {
13
13
  defaultBehaviour?: EntityChangeBehaviour | undefined;
14
14
  /**
15
15
  * Overrides is keyed by addon_associations.id (instance), not catalogue addon_id.
16
+ *
17
+ * @remarks
18
+ * That is the id an EntityChangeResult reports as EntityID.
16
19
  */
17
20
  overrides?: { [k: string]: EntityChangeBehaviour } | undefined;
18
21
  };
@@ -13,14 +13,14 @@ import {
13
13
  } from "./entity-change-behaviour.js";
14
14
  import { SDKValidationError } from "./sdk-validation-error.js";
15
15
  import {
16
- SubscriptionLineItemEntityType,
17
- SubscriptionLineItemEntityType$inboundSchema,
18
- } from "./subscription-line-item-entity-type.js";
16
+ SubscriptionChangeEntityType,
17
+ SubscriptionChangeEntityType$inboundSchema,
18
+ } from "./subscription-change-entity-type.js";
19
19
 
20
20
  export type EntityChangeResult = {
21
21
  behaviour?: EntityChangeBehaviour | undefined;
22
22
  entityId?: string | undefined;
23
- entityType?: SubscriptionLineItemEntityType | undefined;
23
+ entityType?: SubscriptionChangeEntityType | undefined;
24
24
  referenceId?: string | undefined;
25
25
  };
26
26
 
@@ -32,7 +32,7 @@ export const EntityChangeResult$inboundSchema: z.ZodMiniType<
32
32
  z.object({
33
33
  behaviour: types.optional(EntityChangeBehaviour$inboundSchema),
34
34
  entity_id: types.optional(types.string()),
35
- entity_type: types.optional(SubscriptionLineItemEntityType$inboundSchema),
35
+ entity_type: types.optional(SubscriptionChangeEntityType$inboundSchema),
36
36
  reference_id: types.optional(types.string()),
37
37
  }),
38
38
  z.transform((v) => {
@@ -43,6 +43,8 @@ export * from "./billing-cadence.js";
43
43
  export * from "./billing-cycle-info.js";
44
44
  export * from "./billing-cycle.js";
45
45
  export * from "./billing-model.js";
46
+ export * from "./billing-period-behaviour.js";
47
+ export * from "./billing-period-config.js";
46
48
  export * from "./billing-period-info.js";
47
49
  export * from "./billing-period.js";
48
50
  export * from "./billing-tier.js";
@@ -367,12 +369,15 @@ export * from "./list-tasks-response.js";
367
369
  export * from "./list-tax-associations-op.js";
368
370
  export * from "./list-tax-associations-response.js";
369
371
  export * from "./list-tax-rates-response.js";
372
+ export * from "./list-usage-records-response.js";
370
373
  export * from "./list-users-response.js";
371
374
  export * from "./list-wallet-transactions-response.js";
372
375
  export * from "./list-workflows-response.js";
373
376
  export * from "./matched-meter.js";
374
377
  export * from "./matched-price.js";
375
378
  export * from "./matched-subscription-line-item.js";
379
+ export * from "./metadata-custom-field-source.js";
380
+ export * from "./metadata-custom-field.js";
376
381
  export * from "./meter-aggregation.js";
377
382
  export * from "./meter-filter.js";
378
383
  export * from "./meter-matching-result.js";
@@ -382,6 +387,7 @@ export * from "./meter-usage-attribution.js";
382
387
  export * from "./models-temporal-workflow-result.js";
383
388
  export * from "./modify-subscription-line-item.js";
384
389
  export * from "./modify-subscription-params.js";
390
+ export * from "./on-pending-schedule-policy.js";
385
391
  export * from "./override-entitlement-request.js";
386
392
  export * from "./override-line-item-request.js";
387
393
  export * from "./pagination-response.js";
@@ -399,6 +405,7 @@ export * from "./payment-response.js";
399
405
  export * from "./payment-status.js";
400
406
  export * from "./payment-terms.js";
401
407
  export * from "./plan-filter.js";
408
+ export * from "./plan-price-sync-status-response.js";
402
409
  export * from "./plan-response.js";
403
410
  export * from "./plan-summary.js";
404
411
  export * from "./plan.js";
@@ -407,6 +414,7 @@ export * from "./preview-subscription-change-op.js";
407
414
  export * from "./preview-subscription-modify-op.js";
408
415
  export * from "./preview-subscription-plan-change-v2-op.js";
409
416
  export * from "./price-entity-type.js";
417
+ export * from "./price-feature-response.js";
410
418
  export * from "./price-filter.js";
411
419
  export * from "./price-jsonb-transform-quantity.js";
412
420
  export * from "./price-lookup-result.js";
@@ -468,7 +476,10 @@ export * from "./sub-modify-quantity-change-request.js";
468
476
  export * from "./sub-modify-tax-action.js";
469
477
  export * from "./sub-modify-tax-params.js";
470
478
  export * from "./sub-modify-trial-end-request.js";
479
+ export * from "./subscription-change-billing-period-result.js";
480
+ export * from "./subscription-change-conflict-policies.js";
471
481
  export * from "./subscription-change-entity-policies.js";
482
+ export * from "./subscription-change-entity-type.js";
472
483
  export * from "./subscription-change-execute-response.js";
473
484
  export * from "./subscription-change-preview-response.js";
474
485
  export * from "./subscription-change-request.js";
@@ -585,6 +596,9 @@ export * from "./update-wallet-request.js";
585
596
  export * from "./usage-analytic-item.js";
586
597
  export * from "./usage-analytic-point.js";
587
598
  export * from "./usage-breakdown-item.js";
599
+ export * from "./usage-record-filter.js";
600
+ export * from "./usage-record-response.js";
601
+ export * from "./usage-record-sync-entry.js";
588
602
  export * from "./usage-result.js";
589
603
  export * from "./user-filter.js";
590
604
  export * from "./user-response.js";
@@ -11,6 +11,10 @@ import {
11
11
  BillingPeriod,
12
12
  BillingPeriod$inboundSchema,
13
13
  } from "./billing-period.js";
14
+ import {
15
+ MetadataCustomField,
16
+ MetadataCustomField$inboundSchema,
17
+ } from "./metadata-custom-field.js";
14
18
  import { SDKValidationError } from "./sdk-validation-error.js";
15
19
  import {
16
20
  ServicePeriodCustomFields,
@@ -18,8 +22,24 @@ import {
18
22
  } from "./service-period-custom-fields.js";
19
23
 
20
24
  export type InvoiceSyncSettings = {
25
+ /**
26
+ * MetadataCustomFields copies metadata values onto Zoho invoice custom fields
27
+ *
28
+ * @remarks
29
+ * verbatim.
30
+ */
31
+ metadataCustomFields?: Array<MetadataCustomField> | undefined;
21
32
  normalizeFixedTo?: BillingPeriod | undefined;
22
33
  servicePeriodCustomFields?: ServicePeriodCustomFields | undefined;
34
+ /**
35
+ * SubmitForApproval submits the synced invoice into the merchant's Zoho Books approval
36
+ *
37
+ * @remarks
38
+ * flow before recording payment. Zoho rejects payments on draft invoices, and merchants
39
+ * configure a Zoho auto-approval rule for FlexPrice-sent invoices, so we submit, wait for
40
+ * that rule to fire, then pay.
41
+ */
42
+ submitForApproval?: boolean | undefined;
23
43
  };
24
44
 
25
45
  /** @internal */
@@ -28,15 +48,21 @@ export const InvoiceSyncSettings$inboundSchema: z.ZodMiniType<
28
48
  unknown
29
49
  > = z.pipe(
30
50
  z.object({
51
+ metadata_custom_fields: types.optional(
52
+ z.array(MetadataCustomField$inboundSchema),
53
+ ),
31
54
  normalize_fixed_to: types.optional(BillingPeriod$inboundSchema),
32
55
  service_period_custom_fields: types.optional(
33
56
  ServicePeriodCustomFields$inboundSchema,
34
57
  ),
58
+ submit_for_approval: types.optional(types.boolean()),
35
59
  }),
36
60
  z.transform((v) => {
37
61
  return remap$(v, {
62
+ "metadata_custom_fields": "metadataCustomFields",
38
63
  "normalize_fixed_to": "normalizeFixedTo",
39
64
  "service_period_custom_fields": "servicePeriodCustomFields",
65
+ "submit_for_approval": "submitForApproval",
40
66
  });
41
67
  }),
42
68
  );
@@ -0,0 +1,41 @@
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 {
10
+ PaginationResponse,
11
+ PaginationResponse$inboundSchema,
12
+ } from "./pagination-response.js";
13
+ import { SDKValidationError } from "./sdk-validation-error.js";
14
+ import {
15
+ UsageRecordResponse,
16
+ UsageRecordResponse$inboundSchema,
17
+ } from "./usage-record-response.js";
18
+
19
+ export type ListUsageRecordsResponse = {
20
+ items?: Array<UsageRecordResponse> | undefined;
21
+ pagination?: PaginationResponse | undefined;
22
+ };
23
+
24
+ /** @internal */
25
+ export const ListUsageRecordsResponse$inboundSchema: z.ZodMiniType<
26
+ ListUsageRecordsResponse,
27
+ unknown
28
+ > = z.object({
29
+ items: types.optional(z.array(UsageRecordResponse$inboundSchema)),
30
+ pagination: types.optional(PaginationResponse$inboundSchema),
31
+ });
32
+
33
+ export function listUsageRecordsResponseFromJSON(
34
+ jsonString: string,
35
+ ): SafeParseResult<ListUsageRecordsResponse, SDKValidationError> {
36
+ return safeParse(
37
+ jsonString,
38
+ (x) => ListUsageRecordsResponse$inboundSchema.parse(JSON.parse(x)),
39
+ `Failed to parse 'ListUsageRecordsResponse' from JSON`,
40
+ );
41
+ }
@@ -0,0 +1,21 @@
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 MetadataCustomFieldSource = {
10
+ Customer: "customer",
11
+ Invoice: "invoice",
12
+ } as const;
13
+ export type MetadataCustomFieldSource = OpenEnum<
14
+ typeof MetadataCustomFieldSource
15
+ >;
16
+
17
+ /** @internal */
18
+ export const MetadataCustomFieldSource$inboundSchema: z.ZodMiniType<
19
+ MetadataCustomFieldSource,
20
+ unknown
21
+ > = openEnums.inboundSchema(MetadataCustomFieldSource);
@@ -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 { 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 {
11
+ MetadataCustomFieldSource,
12
+ MetadataCustomFieldSource$inboundSchema,
13
+ } from "./metadata-custom-field-source.js";
14
+ import { SDKValidationError } from "./sdk-validation-error.js";
15
+
16
+ export type MetadataCustomField = {
17
+ field?: string | undefined;
18
+ metadataKey?: string | undefined;
19
+ source?: MetadataCustomFieldSource | undefined;
20
+ };
21
+
22
+ /** @internal */
23
+ export const MetadataCustomField$inboundSchema: z.ZodMiniType<
24
+ MetadataCustomField,
25
+ unknown
26
+ > = z.pipe(
27
+ z.object({
28
+ field: types.optional(types.string()),
29
+ metadata_key: types.optional(types.string()),
30
+ source: types.optional(MetadataCustomFieldSource$inboundSchema),
31
+ }),
32
+ z.transform((v) => {
33
+ return remap$(v, {
34
+ "metadata_key": "metadataKey",
35
+ });
36
+ }),
37
+ );
38
+
39
+ export function metadataCustomFieldFromJSON(
40
+ jsonString: string,
41
+ ): SafeParseResult<MetadataCustomField, SDKValidationError> {
42
+ return safeParse(
43
+ jsonString,
44
+ (x) => MetadataCustomField$inboundSchema.parse(JSON.parse(x)),
45
+ `Failed to parse 'MetadataCustomField' from JSON`,
46
+ );
47
+ }
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { ClosedEnum } from "../../types/enums.js";
7
+
8
+ export const OnPendingSchedulePolicy = {
9
+ Reject: "reject",
10
+ Supersede: "supersede",
11
+ } as const;
12
+ export type OnPendingSchedulePolicy = ClosedEnum<
13
+ typeof OnPendingSchedulePolicy
14
+ >;
15
+
16
+ /** @internal */
17
+ export const OnPendingSchedulePolicy$outboundSchema: z.ZodMiniEnum<
18
+ typeof OnPendingSchedulePolicy
19
+ > = z.enum(OnPendingSchedulePolicy);
@@ -0,0 +1,44 @@
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 PlanPriceSyncStatusResponse = {
13
+ currentSequence?: number | undefined;
14
+ synced?: boolean | undefined;
15
+ unsyncedSubscriptionCount?: number | undefined;
16
+ };
17
+
18
+ /** @internal */
19
+ export const PlanPriceSyncStatusResponse$inboundSchema: z.ZodMiniType<
20
+ PlanPriceSyncStatusResponse,
21
+ unknown
22
+ > = z.pipe(
23
+ z.object({
24
+ current_sequence: types.optional(types.number()),
25
+ synced: types.optional(types.boolean()),
26
+ unsynced_subscription_count: types.optional(types.number()),
27
+ }),
28
+ z.transform((v) => {
29
+ return remap$(v, {
30
+ "current_sequence": "currentSequence",
31
+ "unsynced_subscription_count": "unsyncedSubscriptionCount",
32
+ });
33
+ }),
34
+ );
35
+
36
+ export function planPriceSyncStatusResponseFromJSON(
37
+ jsonString: string,
38
+ ): SafeParseResult<PlanPriceSyncStatusResponse, SDKValidationError> {
39
+ return safeParse(
40
+ jsonString,
41
+ (x) => PlanPriceSyncStatusResponse$inboundSchema.parse(JSON.parse(x)),
42
+ `Failed to parse 'PlanPriceSyncStatusResponse' from JSON`,
43
+ );
44
+ }
@@ -15,6 +15,10 @@ import {
15
15
  EntitlementResponse,
16
16
  EntitlementResponse$inboundSchema,
17
17
  } from "./entitlement-response.js";
18
+ import {
19
+ PlanPriceSyncStatusResponse,
20
+ PlanPriceSyncStatusResponse$inboundSchema,
21
+ } from "./plan-price-sync-status-response.js";
18
22
  import {
19
23
  PriceResponse,
20
24
  PriceResponse$inboundSchema,
@@ -34,6 +38,7 @@ export type PlanResponse = {
34
38
  lookupKey?: string | undefined;
35
39
  metadata?: { [k: string]: string } | undefined;
36
40
  name?: string | undefined;
41
+ priceSyncStatus?: PlanPriceSyncStatusResponse | undefined;
37
42
  /**
38
43
  * TODO: Add inline addons
39
44
  */
@@ -61,6 +66,9 @@ export const PlanResponse$inboundSchema: z.ZodMiniType<PlanResponse, unknown> =
61
66
  lookup_key: types.optional(types.string()),
62
67
  metadata: types.optional(z.record(z.string(), types.string())),
63
68
  name: types.optional(types.string()),
69
+ price_sync_status: types.optional(
70
+ PlanPriceSyncStatusResponse$inboundSchema,
71
+ ),
64
72
  prices: types.optional(
65
73
  z.array(z.lazy(() => PriceResponse$inboundSchema)),
66
74
  ),
@@ -77,6 +85,7 @@ export const PlanResponse$inboundSchema: z.ZodMiniType<PlanResponse, unknown> =
77
85
  "display_order": "displayOrder",
78
86
  "environment_id": "environmentId",
79
87
  "lookup_key": "lookupKey",
88
+ "price_sync_status": "priceSyncStatus",
80
89
  "tenant_id": "tenantId",
81
90
  "updated_at": "updatedAt",
82
91
  "updated_by": "updatedBy",
@@ -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 {
11
+ ReportingUnit,
12
+ ReportingUnit$inboundSchema,
13
+ } from "./reporting-unit.js";
14
+ import { SDKValidationError } from "./sdk-validation-error.js";
15
+
16
+ export type PriceFeatureResponse = {
17
+ reportingUnit?: ReportingUnit | undefined;
18
+ };
19
+
20
+ /** @internal */
21
+ export const PriceFeatureResponse$inboundSchema: z.ZodMiniType<
22
+ PriceFeatureResponse,
23
+ unknown
24
+ > = z.pipe(
25
+ z.object({
26
+ reporting_unit: types.optional(ReportingUnit$inboundSchema),
27
+ }),
28
+ z.transform((v) => {
29
+ return remap$(v, {
30
+ "reporting_unit": "reportingUnit",
31
+ });
32
+ }),
33
+ );
34
+
35
+ export function priceFeatureResponseFromJSON(
36
+ jsonString: string,
37
+ ): SafeParseResult<PriceFeatureResponse, SDKValidationError> {
38
+ return safeParse(
39
+ jsonString,
40
+ (x) => PriceFeatureResponse$inboundSchema.parse(JSON.parse(x)),
41
+ `Failed to parse 'PriceFeatureResponse' from JSON`,
42
+ );
43
+ }
@@ -38,6 +38,10 @@ import {
38
38
  PriceEntityType,
39
39
  PriceEntityType$inboundSchema,
40
40
  } from "./price-entity-type.js";
41
+ import {
42
+ PriceFeatureResponse,
43
+ PriceFeatureResponse$inboundSchema,
44
+ } from "./price-feature-response.js";
41
45
  import {
42
46
  PriceJSONBTransformQuantity,
43
47
  PriceJSONBTransformQuantity$inboundSchema,
@@ -116,6 +120,7 @@ export type PriceResponse = {
116
120
  * EnvironmentID is the environment identifier for the price
117
121
  */
118
122
  environmentId?: string | undefined;
123
+ feature?: PriceFeatureResponse | undefined;
119
124
  group?: GroupResponse | undefined;
120
125
  /**
121
126
  * GroupID references the group this price belongs to
@@ -217,6 +222,7 @@ export const PriceResponse$inboundSchema: z.ZodMiniType<
217
222
  entity_id: types.optional(types.string()),
218
223
  entity_type: types.optional(PriceEntityType$inboundSchema),
219
224
  environment_id: types.optional(types.string()),
225
+ feature: types.optional(PriceFeatureResponse$inboundSchema),
220
226
  group: types.optional(GroupResponse$inboundSchema),
221
227
  group_id: types.optional(types.string()),
222
228
  id: types.optional(types.string()),
@@ -0,0 +1,52 @@
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 {
11
+ BillingPeriodBehaviour,
12
+ BillingPeriodBehaviour$inboundSchema,
13
+ } from "./billing-period-behaviour.js";
14
+ import { SDKValidationError } from "./sdk-validation-error.js";
15
+
16
+ export type SubscriptionChangeBillingPeriodResult = {
17
+ behaviour?: BillingPeriodBehaviour | undefined;
18
+ billingAnchor?: Date | undefined;
19
+ currentPeriodEnd?: Date | undefined;
20
+ currentPeriodStart?: Date | undefined;
21
+ };
22
+
23
+ /** @internal */
24
+ export const SubscriptionChangeBillingPeriodResult$inboundSchema: z.ZodMiniType<
25
+ SubscriptionChangeBillingPeriodResult,
26
+ unknown
27
+ > = z.pipe(
28
+ z.object({
29
+ behaviour: types.optional(BillingPeriodBehaviour$inboundSchema),
30
+ billing_anchor: types.optional(types.date()),
31
+ current_period_end: types.optional(types.date()),
32
+ current_period_start: types.optional(types.date()),
33
+ }),
34
+ z.transform((v) => {
35
+ return remap$(v, {
36
+ "billing_anchor": "billingAnchor",
37
+ "current_period_end": "currentPeriodEnd",
38
+ "current_period_start": "currentPeriodStart",
39
+ });
40
+ }),
41
+ );
42
+
43
+ export function subscriptionChangeBillingPeriodResultFromJSON(
44
+ jsonString: string,
45
+ ): SafeParseResult<SubscriptionChangeBillingPeriodResult, SDKValidationError> {
46
+ return safeParse(
47
+ jsonString,
48
+ (x) =>
49
+ SubscriptionChangeBillingPeriodResult$inboundSchema.parse(JSON.parse(x)),
50
+ `Failed to parse 'SubscriptionChangeBillingPeriodResult' from JSON`,
51
+ );
52
+ }
@@ -0,0 +1,44 @@
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
+ OnPendingSchedulePolicy,
9
+ OnPendingSchedulePolicy$outboundSchema,
10
+ } from "./on-pending-schedule-policy.js";
11
+
12
+ export type SubscriptionChangeConflictPolicies = {
13
+ onPendingSchedule?: OnPendingSchedulePolicy | undefined;
14
+ };
15
+
16
+ /** @internal */
17
+ export type SubscriptionChangeConflictPolicies$Outbound = {
18
+ on_pending_schedule?: string | undefined;
19
+ };
20
+
21
+ /** @internal */
22
+ export const SubscriptionChangeConflictPolicies$outboundSchema: z.ZodMiniType<
23
+ SubscriptionChangeConflictPolicies$Outbound,
24
+ SubscriptionChangeConflictPolicies
25
+ > = z.pipe(
26
+ z.object({
27
+ onPendingSchedule: z.optional(OnPendingSchedulePolicy$outboundSchema),
28
+ }),
29
+ z.transform((v) => {
30
+ return remap$(v, {
31
+ onPendingSchedule: "on_pending_schedule",
32
+ });
33
+ }),
34
+ );
35
+
36
+ export function subscriptionChangeConflictPoliciesToJSON(
37
+ subscriptionChangeConflictPolicies: SubscriptionChangeConflictPolicies,
38
+ ): string {
39
+ return JSON.stringify(
40
+ SubscriptionChangeConflictPolicies$outboundSchema.parse(
41
+ subscriptionChangeConflictPolicies,
42
+ ),
43
+ );
44
+ }
@@ -0,0 +1,24 @@
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 SubscriptionChangeEntityType = {
10
+ Plan: "plan",
11
+ Addon: "addon",
12
+ CreditGrant: "credit_grant",
13
+ Entitlement: "entitlement",
14
+ EntitlementGrant: "entitlement_grant",
15
+ } as const;
16
+ export type SubscriptionChangeEntityType = OpenEnum<
17
+ typeof SubscriptionChangeEntityType
18
+ >;
19
+
20
+ /** @internal */
21
+ export const SubscriptionChangeEntityType$inboundSchema: z.ZodMiniType<
22
+ SubscriptionChangeEntityType,
23
+ unknown
24
+ > = openEnums.inboundSchema(SubscriptionChangeEntityType);