@paygentic/sdk 0.10.6 → 0.10.8

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 (94) hide show
  1. package/dist/commonjs/funcs/billableMetricsListEvents.d.ts +1 -1
  2. package/dist/commonjs/funcs/billableMetricsListEvents.js +1 -1
  3. package/dist/commonjs/funcs/externalReferencesDeleteExternalReference.js +2 -2
  4. package/dist/commonjs/funcs/externalReferencesDeleteExternalReference.js.map +1 -1
  5. package/dist/commonjs/lib/config.d.ts +2 -2
  6. package/dist/commonjs/lib/config.js +2 -2
  7. package/dist/commonjs/models/entitytype.d.ts +8 -6
  8. package/dist/commonjs/models/entitytype.d.ts.map +1 -1
  9. package/dist/commonjs/models/entitytype.js +6 -5
  10. package/dist/commonjs/models/entitytype.js.map +1 -1
  11. package/dist/commonjs/models/entitytypeinput.d.ts +16 -0
  12. package/dist/commonjs/models/entitytypeinput.d.ts.map +1 -0
  13. package/dist/commonjs/models/entitytypeinput.js +50 -0
  14. package/dist/commonjs/models/entitytypeinput.js.map +1 -0
  15. package/dist/commonjs/models/externalreference.d.ts +1 -1
  16. package/dist/commonjs/models/index.d.ts +1 -0
  17. package/dist/commonjs/models/index.d.ts.map +1 -1
  18. package/dist/commonjs/models/index.js +1 -0
  19. package/dist/commonjs/models/index.js.map +1 -1
  20. package/dist/commonjs/models/operations/createexternalreference.d.ts +2 -2
  21. package/dist/commonjs/models/operations/createexternalreference.d.ts.map +1 -1
  22. package/dist/commonjs/models/operations/createexternalreference.js +1 -1
  23. package/dist/commonjs/models/operations/createexternalreference.js.map +1 -1
  24. package/dist/commonjs/models/operations/createplan.d.ts +1 -1
  25. package/dist/commonjs/models/operations/createsubscription.d.ts +5 -0
  26. package/dist/commonjs/models/operations/createsubscription.d.ts.map +1 -1
  27. package/dist/commonjs/models/operations/createsubscription.js +1 -0
  28. package/dist/commonjs/models/operations/createsubscription.js.map +1 -1
  29. package/dist/commonjs/models/operations/updatesubscription.d.ts +0 -1
  30. package/dist/commonjs/models/operations/updatesubscription.d.ts.map +1 -1
  31. package/dist/commonjs/models/operations/updatesubscription.js +0 -1
  32. package/dist/commonjs/models/operations/updatesubscription.js.map +1 -1
  33. package/dist/commonjs/models/permission.d.ts +6 -3
  34. package/dist/commonjs/models/permission.d.ts.map +1 -1
  35. package/dist/commonjs/models/permission.js +5 -3
  36. package/dist/commonjs/models/permission.js.map +1 -1
  37. package/dist/commonjs/models/plan.d.ts +1 -1
  38. package/dist/commonjs/sdk/billablemetrics.d.ts +1 -1
  39. package/dist/commonjs/sdk/billablemetrics.js +1 -1
  40. package/dist/esm/funcs/billableMetricsListEvents.d.ts +1 -1
  41. package/dist/esm/funcs/billableMetricsListEvents.js +1 -1
  42. package/dist/esm/funcs/externalReferencesDeleteExternalReference.js +2 -2
  43. package/dist/esm/funcs/externalReferencesDeleteExternalReference.js.map +1 -1
  44. package/dist/esm/lib/config.d.ts +2 -2
  45. package/dist/esm/lib/config.js +2 -2
  46. package/dist/esm/models/entitytype.d.ts +8 -6
  47. package/dist/esm/models/entitytype.d.ts.map +1 -1
  48. package/dist/esm/models/entitytype.js +6 -5
  49. package/dist/esm/models/entitytype.js.map +1 -1
  50. package/dist/esm/models/entitytypeinput.d.ts +16 -0
  51. package/dist/esm/models/entitytypeinput.d.ts.map +1 -0
  52. package/dist/esm/models/entitytypeinput.js +14 -0
  53. package/dist/esm/models/entitytypeinput.js.map +1 -0
  54. package/dist/esm/models/externalreference.d.ts +1 -1
  55. package/dist/esm/models/index.d.ts +1 -0
  56. package/dist/esm/models/index.d.ts.map +1 -1
  57. package/dist/esm/models/index.js +1 -0
  58. package/dist/esm/models/index.js.map +1 -1
  59. package/dist/esm/models/operations/createexternalreference.d.ts +2 -2
  60. package/dist/esm/models/operations/createexternalreference.d.ts.map +1 -1
  61. package/dist/esm/models/operations/createexternalreference.js +1 -1
  62. package/dist/esm/models/operations/createexternalreference.js.map +1 -1
  63. package/dist/esm/models/operations/createplan.d.ts +1 -1
  64. package/dist/esm/models/operations/createsubscription.d.ts +5 -0
  65. package/dist/esm/models/operations/createsubscription.d.ts.map +1 -1
  66. package/dist/esm/models/operations/createsubscription.js +1 -0
  67. package/dist/esm/models/operations/createsubscription.js.map +1 -1
  68. package/dist/esm/models/operations/updatesubscription.d.ts +0 -1
  69. package/dist/esm/models/operations/updatesubscription.d.ts.map +1 -1
  70. package/dist/esm/models/operations/updatesubscription.js +0 -1
  71. package/dist/esm/models/operations/updatesubscription.js.map +1 -1
  72. package/dist/esm/models/permission.d.ts +6 -3
  73. package/dist/esm/models/permission.d.ts.map +1 -1
  74. package/dist/esm/models/permission.js +5 -3
  75. package/dist/esm/models/permission.js.map +1 -1
  76. package/dist/esm/models/plan.d.ts +1 -1
  77. package/dist/esm/sdk/billablemetrics.d.ts +1 -1
  78. package/dist/esm/sdk/billablemetrics.js +1 -1
  79. package/jsr.json +1 -1
  80. package/package.json +1 -1
  81. package/src/funcs/billableMetricsListEvents.ts +1 -1
  82. package/src/funcs/externalReferencesDeleteExternalReference.ts +2 -2
  83. package/src/lib/config.ts +2 -2
  84. package/src/models/entitytype.ts +17 -8
  85. package/src/models/entitytypeinput.ts +23 -0
  86. package/src/models/externalreference.ts +1 -1
  87. package/src/models/index.ts +1 -0
  88. package/src/models/operations/createexternalreference.ts +3 -3
  89. package/src/models/operations/createplan.ts +1 -1
  90. package/src/models/operations/createsubscription.ts +6 -0
  91. package/src/models/operations/updatesubscription.ts +0 -1
  92. package/src/models/permission.ts +11 -4
  93. package/src/models/plan.ts +1 -1
  94. package/src/sdk/billablemetrics.ts +1 -1
@@ -135,7 +135,7 @@ async function $do(
135
135
 
136
136
  const doResult = await client._do(req, {
137
137
  context,
138
- errorCodes: ["401", "403", "404", "4XX", "500", "5XX"],
138
+ errorCodes: ["401", "403", "404", "409", "4XX", "500", "5XX"],
139
139
  retryConfig: context.retryConfig,
140
140
  retryCodes: context.retryCodes,
141
141
  });
@@ -161,7 +161,7 @@ async function $do(
161
161
  | SDKValidationError
162
162
  >(
163
163
  M.nil(204, z.void()),
164
- M.jsonErr([401, 403, 404], errors.ErrorT$inboundSchema),
164
+ M.jsonErr([401, 403, 404, 409], errors.ErrorT$inboundSchema),
165
165
  M.jsonErr(500, errors.ErrorT$inboundSchema),
166
166
  M.fail("4XX"),
167
167
  M.fail("5XX"),
package/src/lib/config.ts CHANGED
@@ -65,7 +65,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
65
65
  export const SDK_METADATA = {
66
66
  language: "typescript",
67
67
  openapiDocVersion: "0.1.0",
68
- sdkVersion: "0.10.6",
68
+ sdkVersion: "0.10.8",
69
69
  genVersion: "2.879.13",
70
- userAgent: "speakeasy-sdk/typescript 0.10.6 2.879.13 0.1.0 @paygentic/sdk",
70
+ userAgent: "speakeasy-sdk/typescript 0.10.8 2.879.13 0.1.0 @paygentic/sdk",
71
71
  } as const;
@@ -3,23 +3,32 @@
3
3
  */
4
4
 
5
5
  import * as z from "zod/v3";
6
- import { ClosedEnum } from "../types/enums.js";
6
+ import * as openEnums from "../types/enums.js";
7
+ import { OpenEnum } from "../types/enums.js";
7
8
 
8
9
  /**
9
- * The type of Paygentic entity this external reference points at
10
+ * The type of Paygentic entity this external reference points at. `subscriptionProposal` and `subscription` references link a subscription proposal, and the subscription its approval creates, to the CRM record they come from. They are read-only through these endpoints.
10
11
  */
11
12
  export const EntityType = {
12
13
  Item: "item",
13
14
  Customer: "customer",
15
+ SubscriptionProposal: "subscriptionProposal",
16
+ Subscription: "subscription",
14
17
  } as const;
15
18
  /**
16
- * The type of Paygentic entity this external reference points at
19
+ * The type of Paygentic entity this external reference points at. `subscriptionProposal` and `subscription` references link a subscription proposal, and the subscription its approval creates, to the CRM record they come from. They are read-only through these endpoints.
17
20
  */
18
- export type EntityType = ClosedEnum<typeof EntityType>;
21
+ export type EntityType = OpenEnum<typeof EntityType>;
19
22
 
20
23
  /** @internal */
21
- export const EntityType$inboundSchema: z.ZodNativeEnum<typeof EntityType> = z
22
- .nativeEnum(EntityType);
24
+ export const EntityType$inboundSchema: z.ZodType<
25
+ EntityType,
26
+ z.ZodTypeDef,
27
+ unknown
28
+ > = openEnums.inboundSchema(EntityType);
23
29
  /** @internal */
24
- export const EntityType$outboundSchema: z.ZodNativeEnum<typeof EntityType> =
25
- EntityType$inboundSchema;
30
+ export const EntityType$outboundSchema: z.ZodType<
31
+ string,
32
+ z.ZodTypeDef,
33
+ EntityType
34
+ > = openEnums.outboundSchema(EntityType);
@@ -0,0 +1,23 @@
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
+ * The type of Paygentic entity a new external reference points at
10
+ */
11
+ export const EntityTypeInput = {
12
+ Item: "item",
13
+ Customer: "customer",
14
+ } as const;
15
+ /**
16
+ * The type of Paygentic entity a new external reference points at
17
+ */
18
+ export type EntityTypeInput = ClosedEnum<typeof EntityTypeInput>;
19
+
20
+ /** @internal */
21
+ export const EntityTypeInput$outboundSchema: z.ZodNativeEnum<
22
+ typeof EntityTypeInput
23
+ > = z.nativeEnum(EntityTypeInput);
@@ -30,7 +30,7 @@ export type ExternalReference = {
30
30
  */
31
31
  merchantId: string;
32
32
  /**
33
- * The type of Paygentic entity this external reference points at
33
+ * The type of Paygentic entity this external reference points at. `subscriptionProposal` and `subscription` references link a subscription proposal, and the subscription its approval creates, to the CRM record they come from. They are read-only through these endpoints.
34
34
  */
35
35
  entityType: EntityType;
36
36
  entityId: string;
@@ -41,6 +41,7 @@ export * from "./entitlementlistitem.js";
41
41
  export * from "./entitlementstatus.js";
42
42
  export * from "./entitlementtemplate.js";
43
43
  export * from "./entitytype.js";
44
+ export * from "./entitytypeinput.js";
44
45
  export * from "./eventresponse.js";
45
46
  export * from "./externalreference.js";
46
47
  export * from "./feature.js";
@@ -11,9 +11,9 @@ export type CreateExternalReferenceRequest = {
11
11
  */
12
12
  merchantId: string;
13
13
  /**
14
- * The type of Paygentic entity this external reference points at
14
+ * The type of Paygentic entity a new external reference points at
15
15
  */
16
- entityType: models.EntityType;
16
+ entityType: models.EntityTypeInput;
17
17
  /**
18
18
  * Paygentic id of the entity, e.g. `itm_xxx`
19
19
  */
@@ -77,7 +77,7 @@ export const CreateExternalReferenceRequest$outboundSchema: z.ZodType<
77
77
  CreateExternalReferenceRequest
78
78
  > = z.object({
79
79
  merchantId: z.string(),
80
- entityType: models.EntityType$outboundSchema,
80
+ entityType: models.EntityTypeInput$outboundSchema,
81
81
  entityId: z.string(),
82
82
  provider: z.string(),
83
83
  externalId: z.string(),
@@ -123,7 +123,7 @@ export type CreatePlanRequest = {
123
123
  */
124
124
  billingVersion?: BillingVersion | undefined;
125
125
  /**
126
- * ISO 8601 datetime reference point for billing period alignment. Must be in the past or present. When set, subscriptions created under this plan align their first billing period to the next recurrence of this anchor.
126
+ * ISO 8601 datetime reference point for billing period alignment. Must be in the past or present. When set, subscriptions created under this plan align their first billing period to the next recurrence of this anchor, unless the create names its own `billingAnchor`.
127
127
  */
128
128
  billingAnchor?: Date | null | undefined;
129
129
  /**
@@ -101,6 +101,10 @@ export type CreateSubscriptionRequest = {
101
101
  * Whether a backdated start bills its elapsed periods. A start is backdated when `startedAt` is more than 24 hours before the subscription is created. `none` bills only charges that fall due from the moment of creation, for a customer whose earlier periods another system already billed. `per_period` bills every charge that fell due from `startedAt`, on one first invoice; it refuses a `startedAt` more than 12 months back. Has no effect on a start that is not backdated. Defaults to `none`.
102
102
  */
103
103
  elapsedPeriodBilling?: models.ElapsedPeriodBilling | undefined;
104
+ /**
105
+ * A billing anchor for this subscription, in place of the plan's. Any instant, past or future. The subscription's billing anchor is its first recurrence on or after `startedAt`, stepping back or forward by whole billing cadences. Example: on a monthly plan, an anchor of '2027-01-31T00:00:00Z' with a start of '2026-10-10T00:00:00Z' gives '2026-10-31T00:00:00Z'. A create is refused with 400 when the resolved anchor does not line up with the usage period anchor of a feature that credits unused balance. Omit it to use the plan's billing anchor. A repeated create that names an anchor resolving to a different instant than the existing subscription's gets 409.
106
+ */
107
+ billingAnchor?: Date | undefined;
104
108
  /**
105
109
  * Test clock identifier for simulating time-based billing scenarios. Sample values: 'tc_abc123xyz', 'tc_789def456'. Restricted to non-production environments (local, dev, sandbox). Must belong to the same merchant organization.
106
110
  */
@@ -231,6 +235,7 @@ export type CreateSubscriptionRequest$Outbound = {
231
235
  redirectUrls?: RedirectUrls$Outbound | undefined;
232
236
  startedAt: string;
233
237
  elapsedPeriodBilling: string;
238
+ billingAnchor?: string | undefined;
234
239
  testClockId?: string | undefined;
235
240
  renewalReminderEnabled?: boolean | null | undefined;
236
241
  renewalReminderDays?: number | null | undefined;
@@ -265,6 +270,7 @@ export const CreateSubscriptionRequest$outboundSchema: z.ZodType<
265
270
  elapsedPeriodBilling: models.ElapsedPeriodBilling$outboundSchema.default(
266
271
  "none",
267
272
  ),
273
+ billingAnchor: z.date().transform(v => v.toISOString()).optional(),
268
274
  testClockId: z.string().optional(),
269
275
  renewalReminderEnabled: z.nullable(z.boolean()).optional(),
270
276
  renewalReminderDays: z.nullable(z.number().int()).optional(),
@@ -8,7 +8,6 @@ import { ClosedEnum } from "../../types/enums.js";
8
8
  import * as models from "../index.js";
9
9
 
10
10
  export const UpdateSubscriptionStatus = {
11
- Active: "active",
12
11
  Terminated: "terminated",
13
12
  } as const;
14
13
  export type UpdateSubscriptionStatus = ClosedEnum<
@@ -3,7 +3,8 @@
3
3
  */
4
4
 
5
5
  import * as z from "zod/v3";
6
- import { ClosedEnum } from "../types/enums.js";
6
+ import * as openEnums from "../types/enums.js";
7
+ import { OpenEnum } from "../types/enums.js";
7
8
 
8
9
  /**
9
10
  * A permission of the catalog: a resource read or write, or a sensitive action.
@@ -26,6 +27,7 @@ export const Permission = {
26
27
  PricingUnitsRead: "pricingUnits:read",
27
28
  SubscriptionsRead: "subscriptions:read",
28
29
  SubscriptionAdjustmentsRead: "subscriptionAdjustments:read",
30
+ SubscriptionProposalsRead: "subscriptionProposals:read",
29
31
  DiscountsRead: "discounts:read",
30
32
  GrantsRead: "grants:read",
31
33
  EntitlementsRead: "entitlements:read",
@@ -71,6 +73,7 @@ export const Permission = {
71
73
  PricingUnitsWrite: "pricingUnits:write",
72
74
  SubscriptionsWrite: "subscriptions:write",
73
75
  SubscriptionAdjustmentsWrite: "subscriptionAdjustments:write",
76
+ SubscriptionProposalsWrite: "subscriptionProposals:write",
74
77
  DiscountsWrite: "discounts:write",
75
78
  GrantsWrite: "grants:write",
76
79
  EntitlementsWrite: "entitlements:write",
@@ -113,12 +116,16 @@ export const Permission = {
113
116
  SubscriptionsTaxExempt: "subscriptions:taxExempt",
114
117
  SubscriptionsAutoApprove: "subscriptions:autoApprove",
115
118
  OrganizationResetData: "organization:resetData",
119
+ SubscriptionProposalsApprove: "subscriptionProposals:approve",
116
120
  } as const;
117
121
  /**
118
122
  * A permission of the catalog: a resource read or write, or a sensitive action.
119
123
  */
120
- export type Permission = ClosedEnum<typeof Permission>;
124
+ export type Permission = OpenEnum<typeof Permission>;
121
125
 
122
126
  /** @internal */
123
- export const Permission$inboundSchema: z.ZodNativeEnum<typeof Permission> = z
124
- .nativeEnum(Permission);
127
+ export const Permission$inboundSchema: z.ZodType<
128
+ Permission,
129
+ z.ZodTypeDef,
130
+ unknown
131
+ > = openEnums.inboundSchema(Permission);
@@ -115,7 +115,7 @@ export type Plan = {
115
115
  */
116
116
  billingVersion?: number | undefined;
117
117
  /**
118
- * ISO 8601 datetime reference point for billing period alignment. Must be in the past or present at the time of creation or update. When set, all subscriptions created under this plan align their first billing period to the next recurrence of this anchor. Null means each subscription uses its own start time (hour-rounded) as the anchor.
118
+ * ISO 8601 datetime reference point for billing period alignment. Must be in the past or present at the time of creation or update. When set, subscriptions created under this plan align their first billing period to the next recurrence of this anchor, unless the create names its own `billingAnchor`. Null means each subscription uses its own start time (hour-rounded) as the anchor, unless the create names one.
119
119
  */
120
120
  billingAnchor?: Date | null | undefined;
121
121
  /**
@@ -94,7 +94,7 @@ export class BillableMetrics extends ClientSDK {
94
94
  * List Meter Events
95
95
  *
96
96
  * @remarks
97
- * List raw underlying events for a billable metric from the metering service. Returns events ordered by time descending.
97
+ * List raw underlying events for a billable metric from the metering service. Returns events ordered by time descending. Events before the metric's `eventFrom` are left out, as its usage leaves them out.
98
98
  */
99
99
  async listEvents(
100
100
  request: operations.ListBillableMetricEventsRequest,