@openmeter/client 1.0.0-beta-14ec9d225214 → 1.0.0-beta-80ea9ac3b74b

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.
@@ -3227,6 +3227,40 @@ export const workflowCollectionAlignmentAnchored = z
3227
3227
  recurringPeriod: recurringPeriod,
3228
3228
  })
3229
3229
  .describe('BillingWorkflowCollectionAlignmentAnchored specifies the alignment for collecting the pending line items into an invoice.');
3230
+ export const subscriptionBase = z
3231
+ .object({
3232
+ id: ulid,
3233
+ labels: labels.optional(),
3234
+ createdAt: dateTime,
3235
+ updatedAt: dateTime,
3236
+ deletedAt: dateTime.optional(),
3237
+ name: z
3238
+ .string()
3239
+ .min(1)
3240
+ .max(256)
3241
+ .describe('Display name of the subscription. Defaults to the plan name when the subscription is created from a plan.'),
3242
+ description: z
3243
+ .string()
3244
+ .max(1024)
3245
+ .optional()
3246
+ .describe('Optional description of the subscription.'),
3247
+ activeFrom: dateTime,
3248
+ activeTo: dateTime.optional(),
3249
+ customerId: ulid,
3250
+ planId: ulid.optional(),
3251
+ plan: subscriptionPlanReference.optional(),
3252
+ invoiceCurrency: currencyCode,
3253
+ costBasisMode: subscriptionCostBasisMode.default('dynamic'),
3254
+ costBasisPins: z
3255
+ .array(subscriptionCostBasisPin)
3256
+ .describe('Cost bases pinned to custom-currency pairs for this subscription.'),
3257
+ billingCadence: iso8601Duration,
3258
+ proRatingConfig: subscriptionProRatingConfig.optional(),
3259
+ billingAnchor: dateTime,
3260
+ status: subscriptionStatus,
3261
+ settlementMode: settlementMode.optional(),
3262
+ })
3263
+ .describe('Subscription fields without phases or the current billing period.');
3230
3264
  export const invoiceStatusDetails = z
3231
3265
  .object({
3232
3266
  immutable: z
@@ -3250,6 +3284,23 @@ export const subscriptionCancel = z
3250
3284
  timing: subscriptionEditTiming.optional().default('immediate'),
3251
3285
  })
3252
3286
  .describe('Request for canceling a subscription.');
3287
+ export const subscriptionMigrate = z
3288
+ .object({
3289
+ timing: subscriptionEditTiming.optional().default('immediate'),
3290
+ targetVersion: z
3291
+ .number()
3292
+ .int()
3293
+ .gte(1)
3294
+ .optional()
3295
+ .describe('A strictly later version of the current plan. Omit to use its latest version.'),
3296
+ startingPhase: z
3297
+ .string()
3298
+ .min(1)
3299
+ .optional()
3300
+ .describe('Explicitly replace the subscription, starting in this target plan phase. Always selects replacement, even when the phase matches the current one. Replacement may produce billing adjustments and does not transfer addons.'),
3301
+ billingAnchor: dateTime.optional(),
3302
+ })
3303
+ .describe("Request for migrating to a later version of the subscription's current plan.");
3253
3304
  export const createSubscriptionAddonRequest = z
3254
3305
  .object({
3255
3306
  labels: labels.optional(),
@@ -4979,6 +5030,12 @@ export const subscriptionChangeResponse = z
4979
5030
  next: subscription,
4980
5031
  })
4981
5032
  .describe('Response for changing a subscription.');
5033
+ export const subscriptionMigrateResponse = z
5034
+ .object({
5035
+ current: subscriptionBase,
5036
+ next: subscription,
5037
+ })
5038
+ .describe('Response for migrating a subscription.');
4982
5039
  export const invoice = z
4983
5040
  .discriminatedUnion('type', [invoiceStandard])
4984
5041
  .describe('An invoice issued to a customer. The `type` field determines the concrete variant: - `standard`: a standard invoice for charges owed.');
@@ -5361,6 +5418,11 @@ export const changeSubscriptionPathParams = z.object({
5361
5418
  });
5362
5419
  export const changeSubscriptionBody = subscriptionChange;
5363
5420
  export const changeSubscriptionResponse = subscriptionChangeResponse;
5421
+ export const migrateSubscriptionPathParams = z.object({
5422
+ subscriptionId: ulid,
5423
+ });
5424
+ export const migrateSubscriptionBody = subscriptionMigrate;
5425
+ export const migrateSubscriptionResponse = subscriptionMigrateResponse;
5364
5426
  export const editSubscriptionPathParams = z.object({
5365
5427
  subscriptionId: ulid,
5366
5428
  });
@@ -9066,6 +9128,40 @@ export const workflowCollectionAlignmentAnchoredWire = z
9066
9128
  recurring_period: recurringPeriodWire,
9067
9129
  })
9068
9130
  .describe('BillingWorkflowCollectionAlignmentAnchored specifies the alignment for collecting the pending line items into an invoice.');
9131
+ export const subscriptionBaseWire = z
9132
+ .strictObject({
9133
+ id: ulidWire,
9134
+ labels: labelsWire.optional(),
9135
+ created_at: dateTimeWire,
9136
+ updated_at: dateTimeWire,
9137
+ deleted_at: dateTimeWire.optional(),
9138
+ name: z
9139
+ .string()
9140
+ .min(1)
9141
+ .max(256)
9142
+ .describe('Display name of the subscription. Defaults to the plan name when the subscription is created from a plan.'),
9143
+ description: z
9144
+ .string()
9145
+ .max(1024)
9146
+ .optional()
9147
+ .describe('Optional description of the subscription.'),
9148
+ active_from: dateTimeWire,
9149
+ active_to: dateTimeWire.optional(),
9150
+ customer_id: ulidWire,
9151
+ plan_id: ulidWire.optional(),
9152
+ plan: subscriptionPlanReferenceWire.optional(),
9153
+ invoice_currency: currencyCodeWire,
9154
+ cost_basis_mode: subscriptionCostBasisModeWire,
9155
+ cost_basis_pins: z
9156
+ .array(subscriptionCostBasisPinWire)
9157
+ .describe('Cost bases pinned to custom-currency pairs for this subscription.'),
9158
+ billing_cadence: iso8601DurationWire,
9159
+ pro_rating_config: subscriptionProRatingConfigWire.optional(),
9160
+ billing_anchor: dateTimeWire,
9161
+ status: subscriptionStatusWire,
9162
+ settlement_mode: settlementModeWire.optional(),
9163
+ })
9164
+ .describe('Subscription fields without phases or the current billing period.');
9069
9165
  export const invoiceStatusDetailsWire = z
9070
9166
  .strictObject({
9071
9167
  immutable: z
@@ -9089,6 +9185,23 @@ export const subscriptionCancelWire = z
9089
9185
  timing: subscriptionEditTimingWire.optional(),
9090
9186
  })
9091
9187
  .describe('Request for canceling a subscription.');
9188
+ export const subscriptionMigrateWire = z
9189
+ .strictObject({
9190
+ timing: subscriptionEditTimingWire.optional(),
9191
+ target_version: z
9192
+ .number()
9193
+ .int()
9194
+ .gte(1)
9195
+ .optional()
9196
+ .describe('A strictly later version of the current plan. Omit to use its latest version.'),
9197
+ starting_phase: z
9198
+ .string()
9199
+ .min(1)
9200
+ .optional()
9201
+ .describe('Explicitly replace the subscription, starting in this target plan phase. Always selects replacement, even when the phase matches the current one. Replacement may produce billing adjustments and does not transfer addons.'),
9202
+ billing_anchor: dateTimeWire.optional(),
9203
+ })
9204
+ .describe("Request for migrating to a later version of the subscription's current plan.");
9092
9205
  export const createSubscriptionAddonRequestWire = z
9093
9206
  .strictObject({
9094
9207
  labels: labelsWire.optional(),
@@ -10813,6 +10926,12 @@ export const subscriptionChangeResponseWire = z
10813
10926
  next: subscriptionWire,
10814
10927
  })
10815
10928
  .describe('Response for changing a subscription.');
10929
+ export const subscriptionMigrateResponseWire = z
10930
+ .strictObject({
10931
+ current: subscriptionBaseWire,
10932
+ next: subscriptionWire,
10933
+ })
10934
+ .describe('Response for migrating a subscription.');
10816
10935
  export const invoiceWire = z
10817
10936
  .discriminatedUnion('type', [invoiceStandardWire])
10818
10937
  .describe('An invoice issued to a customer. The `type` field determines the concrete variant: - `standard`: a standard invoice for charges owed.');
@@ -11213,6 +11332,11 @@ export const changeSubscriptionPathParamsWire = z.object({
11213
11332
  });
11214
11333
  export const changeSubscriptionBodyWire = subscriptionChangeWire;
11215
11334
  export const changeSubscriptionResponseWire = subscriptionChangeResponseWire;
11335
+ export const migrateSubscriptionPathParamsWire = z.object({
11336
+ subscriptionId: ulidWire,
11337
+ });
11338
+ export const migrateSubscriptionBodyWire = subscriptionMigrateWire;
11339
+ export const migrateSubscriptionResponseWire = subscriptionMigrateResponseWire;
11216
11340
  export const editSubscriptionPathParamsWire = z.object({
11217
11341
  subscriptionId: ulidWire,
11218
11342
  });
@@ -3171,6 +3171,82 @@ export interface WorkflowCollectionAlignmentAnchored {
3171
3171
  /** The recurring period for the alignment. */
3172
3172
  recurringPeriod: RecurringPeriod;
3173
3173
  }
3174
+ /** Subscription fields without phases or the current billing period. */
3175
+ export interface SubscriptionBase {
3176
+ id: string;
3177
+ labels?: Labels;
3178
+ /** An ISO-8601 timestamp representation of entity creation date. */
3179
+ createdAt: Date;
3180
+ /** An ISO-8601 timestamp representation of entity last update date. */
3181
+ updatedAt: Date;
3182
+ /** An ISO-8601 timestamp representation of entity deletion date. */
3183
+ deletedAt?: Date;
3184
+ /**
3185
+ * Display name of the subscription. Defaults to the plan name when the
3186
+ * subscription is created from a plan.
3187
+ */
3188
+ name: string;
3189
+ /** Optional description of the subscription. */
3190
+ description?: string;
3191
+ /**
3192
+ * An ISO-8601 timestamp representation of when the subscription became (or will
3193
+ * become) active.
3194
+ */
3195
+ activeFrom: Date;
3196
+ /**
3197
+ * An ISO-8601 timestamp representation of when the subscription stops being
3198
+ * active. Open-ended when not set.
3199
+ */
3200
+ activeTo?: Date;
3201
+ /** The customer ID of the subscription. */
3202
+ customerId: string;
3203
+ /** The plan ID of the subscription. Set if subscription is created from a plan. */
3204
+ planId?: string;
3205
+ /**
3206
+ * The plan the subscription was created from, if any. Includes the plan key and
3207
+ * version so clients can resolve the exact plan revision.
3208
+ */
3209
+ plan?: SubscriptionPlanReference;
3210
+ /** The fiat currency in which the subscription is invoiced. */
3211
+ invoiceCurrency: string;
3212
+ /**
3213
+ * Controls whether custom-currency cost bases are resolved dynamically or pinned
3214
+ * when their currency pair is introduced to the subscription.
3215
+ */
3216
+ costBasisMode: 'dynamic' | 'pinned';
3217
+ /** Cost bases pinned to custom-currency pairs for this subscription. */
3218
+ costBasisPins: SubscriptionCostBasisPin[];
3219
+ /**
3220
+ * The billing cadence of the subscription in ISO-8601 duration format. Defines how
3221
+ * often the customer is billed. Examples: `P1M` (monthly), `P3M` (quarterly),
3222
+ * `P1Y` (annually).
3223
+ */
3224
+ billingCadence: string;
3225
+ /** The pro-rating configuration of the subscription. */
3226
+ proRatingConfig?: SubscriptionProRatingConfig;
3227
+ /**
3228
+ * A billing anchor is the fixed point in time that determines the subscription's
3229
+ * recurring billing cycle. It affects when charges occur and how prorations are
3230
+ * calculated. Common anchors:
3231
+ *
3232
+ * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
3233
+ * - Subscription anniversary (day customer signed up)
3234
+ * - Custom date (customer-specified day)
3235
+ */
3236
+ billingAnchor: Date;
3237
+ /** The status of the subscription. */
3238
+ status: 'active' | 'inactive' | 'canceled' | 'scheduled';
3239
+ /**
3240
+ * Settlement mode for billing.
3241
+ *
3242
+ * Values:
3243
+ *
3244
+ * - `credit_then_invoice`: Credits are applied first, then any remainder is
3245
+ * invoiced.
3246
+ * - `credit_only`: Usage is settled exclusively against credits.
3247
+ */
3248
+ settlementMode?: 'credit_then_invoice' | 'credit_only';
3249
+ }
3174
3250
  /** Detailed status information for a standard invoice. */
3175
3251
  export interface InvoiceStatusDetails {
3176
3252
  /** Whether the invoice is immutable (i.e. cannot be modified or deleted). */
@@ -3203,6 +3279,30 @@ export interface SubscriptionCancel {
3203
3279
  /** If not provided the subscription is canceled immediately. */
3204
3280
  timing: SubscriptionEditTiming;
3205
3281
  }
3282
+ /** Request for migrating to a later version of the subscription's current plan. */
3283
+ export interface SubscriptionMigrate {
3284
+ /**
3285
+ * When the migration takes effect: immediately (default), at the next billing
3286
+ * cycle, or at an explicit billing-aligned timestamp. In-place migrations may
3287
+ * target a later phase when the phase timelines match. The target plan reference
3288
+ * is saved now; changed items take effect at the requested time.
3289
+ */
3290
+ timing: SubscriptionEditTiming;
3291
+ /** A strictly later version of the current plan. Omit to use its latest version. */
3292
+ targetVersion?: number;
3293
+ /**
3294
+ * Explicitly replace the subscription, starting in this target plan phase. Always
3295
+ * selects replacement, even when the phase matches the current one. Replacement
3296
+ * may produce billing adjustments and does not transfer addons.
3297
+ */
3298
+ startingPhase?: string;
3299
+ /**
3300
+ * Providing a different billing anchor explicitly replaces the subscription. The
3301
+ * supplied anchor is preserved and may be before or after the replacement's start
3302
+ * time. Omit to retain the existing anchor.
3303
+ */
3304
+ billingAnchor?: Date;
3305
+ }
3206
3306
  /** SubscriptionAddon create request. */
3207
3307
  export interface CreateSubscriptionAddonRequest {
3208
3308
  labels?: Labels;
@@ -5906,6 +6006,17 @@ export interface SubscriptionChangeResponse {
5906
6006
  /** The new state of the subscription after the change. */
5907
6007
  next: Subscription;
5908
6008
  }
6009
+ /** Response for migrating a subscription. */
6010
+ export interface SubscriptionMigrateResponse {
6011
+ /**
6012
+ * The original subscription's own fields returned by the migration. For an
6013
+ * in-place migration this is the before snapshot; for replacement it includes the
6014
+ * cancellation. Does not include phases or the current billing period.
6015
+ */
6016
+ current: SubscriptionBase;
6017
+ /** The resulting subscription, including its phases and items. */
6018
+ next: Subscription;
6019
+ }
5909
6020
  /** A flat fee charge for a customer. */
5910
6021
  export interface ChargeFlatFee {
5911
6022
  id: string;
@@ -6628,6 +6739,82 @@ export interface IngestedEventInput {
6628
6739
  /** The validation errors of the ingested event. */
6629
6740
  validationErrors?: IngestedEventValidationError[];
6630
6741
  }
6742
+ /** Subscription fields without phases or the current billing period. */
6743
+ export interface SubscriptionBaseInput {
6744
+ id: string;
6745
+ labels?: Labels;
6746
+ /** An ISO-8601 timestamp representation of entity creation date. */
6747
+ createdAt: Date;
6748
+ /** An ISO-8601 timestamp representation of entity last update date. */
6749
+ updatedAt: Date;
6750
+ /** An ISO-8601 timestamp representation of entity deletion date. */
6751
+ deletedAt?: Date;
6752
+ /**
6753
+ * Display name of the subscription. Defaults to the plan name when the
6754
+ * subscription is created from a plan.
6755
+ */
6756
+ name: string;
6757
+ /** Optional description of the subscription. */
6758
+ description?: string;
6759
+ /**
6760
+ * An ISO-8601 timestamp representation of when the subscription became (or will
6761
+ * become) active.
6762
+ */
6763
+ activeFrom: Date;
6764
+ /**
6765
+ * An ISO-8601 timestamp representation of when the subscription stops being
6766
+ * active. Open-ended when not set.
6767
+ */
6768
+ activeTo?: Date;
6769
+ /** The customer ID of the subscription. */
6770
+ customerId: string;
6771
+ /** The plan ID of the subscription. Set if subscription is created from a plan. */
6772
+ planId?: string;
6773
+ /**
6774
+ * The plan the subscription was created from, if any. Includes the plan key and
6775
+ * version so clients can resolve the exact plan revision.
6776
+ */
6777
+ plan?: SubscriptionPlanReference;
6778
+ /** The fiat currency in which the subscription is invoiced. */
6779
+ invoiceCurrency: string;
6780
+ /**
6781
+ * Controls whether custom-currency cost bases are resolved dynamically or pinned
6782
+ * when their currency pair is introduced to the subscription.
6783
+ */
6784
+ costBasisMode?: 'dynamic' | 'pinned';
6785
+ /** Cost bases pinned to custom-currency pairs for this subscription. */
6786
+ costBasisPins: SubscriptionCostBasisPin[];
6787
+ /**
6788
+ * The billing cadence of the subscription in ISO-8601 duration format. Defines how
6789
+ * often the customer is billed. Examples: `P1M` (monthly), `P3M` (quarterly),
6790
+ * `P1Y` (annually).
6791
+ */
6792
+ billingCadence: string;
6793
+ /** The pro-rating configuration of the subscription. */
6794
+ proRatingConfig?: SubscriptionProRatingConfig;
6795
+ /**
6796
+ * A billing anchor is the fixed point in time that determines the subscription's
6797
+ * recurring billing cycle. It affects when charges occur and how prorations are
6798
+ * calculated. Common anchors:
6799
+ *
6800
+ * - Calendar month (1st of each month): `2025-01-01T00:00:00Z`
6801
+ * - Subscription anniversary (day customer signed up)
6802
+ * - Custom date (customer-specified day)
6803
+ */
6804
+ billingAnchor: Date;
6805
+ /** The status of the subscription. */
6806
+ status: 'active' | 'inactive' | 'canceled' | 'scheduled';
6807
+ /**
6808
+ * Settlement mode for billing.
6809
+ *
6810
+ * Values:
6811
+ *
6812
+ * - `credit_then_invoice`: Credits are applied first, then any remainder is
6813
+ * invoiced.
6814
+ * - `credit_only`: Usage is settled exclusively against credits.
6815
+ */
6816
+ settlementMode?: 'credit_then_invoice' | 'credit_only';
6817
+ }
6631
6818
  /**
6632
6819
  * Invoice-level snapshot of the workflow configuration.
6633
6820
  *
@@ -6646,6 +6833,30 @@ export interface SubscriptionCancelInput {
6646
6833
  /** If not provided the subscription is canceled immediately. */
6647
6834
  timing?: SubscriptionEditTiming;
6648
6835
  }
6836
+ /** Request for migrating to a later version of the subscription's current plan. */
6837
+ export interface SubscriptionMigrateInput {
6838
+ /**
6839
+ * When the migration takes effect: immediately (default), at the next billing
6840
+ * cycle, or at an explicit billing-aligned timestamp. In-place migrations may
6841
+ * target a later phase when the phase timelines match. The target plan reference
6842
+ * is saved now; changed items take effect at the requested time.
6843
+ */
6844
+ timing?: SubscriptionEditTiming;
6845
+ /** A strictly later version of the current plan. Omit to use its latest version. */
6846
+ targetVersion?: number;
6847
+ /**
6848
+ * Explicitly replace the subscription, starting in this target plan phase. Always
6849
+ * selects replacement, even when the phase matches the current one. Replacement
6850
+ * may produce billing adjustments and does not transfer addons.
6851
+ */
6852
+ startingPhase?: string;
6853
+ /**
6854
+ * Providing a different billing anchor explicitly replaces the subscription. The
6855
+ * supplied anchor is preserved and may be before or after the replacement's start
6856
+ * time. Omit to retain the existing anchor.
6857
+ */
6858
+ billingAnchor?: Date;
6859
+ }
6649
6860
  /**
6650
6861
  * Invoice-level snapshot of the workflow configuration.
6651
6862
  *
@@ -8447,6 +8658,17 @@ export interface SubscriptionChangeResponseInput {
8447
8658
  /** The new state of the subscription after the change. */
8448
8659
  next: SubscriptionInput;
8449
8660
  }
8661
+ /** Response for migrating a subscription. */
8662
+ export interface SubscriptionMigrateResponseInput {
8663
+ /**
8664
+ * The original subscription's own fields returned by the migration. For an
8665
+ * in-place migration this is the before snapshot; for replacement it includes the
8666
+ * cancellation. Does not include phases or the current billing period.
8667
+ */
8668
+ current: SubscriptionBaseInput;
8669
+ /** The resulting subscription, including its phases and items. */
8670
+ next: SubscriptionInput;
8671
+ }
8450
8672
  /** A flat fee charge for a customer. */
8451
8673
  export interface ChargeFlatFeeInput {
8452
8674
  id: string;
@@ -1,6 +1,6 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type RequestOptions } from '../lib/types.js';
3
- import type { CreateSubscriptionRequest, CreateSubscriptionResponse, ListSubscriptionsRequest, ListSubscriptionsResponse, GetSubscriptionRequest, GetSubscriptionResponse, CancelSubscriptionRequest, CancelSubscriptionResponse, UnscheduleCancelationRequest, UnscheduleCancelationResponse, UnscheduleSubscriptionRequest, UnscheduleSubscriptionResponse, RestoreSubscriptionRequest, RestoreSubscriptionResponse, ChangeSubscriptionRequest, ChangeSubscriptionResponse, EditSubscriptionRequest, EditSubscriptionResponse, CreateSubscriptionAddonRequest, CreateSubscriptionAddonResponse, ListSubscriptionAddonsRequest, ListSubscriptionAddonsResponse, GetSubscriptionAddonRequest, GetSubscriptionAddonResponse, UpdateSubscriptionAddonRequest, UpdateSubscriptionAddonResponse } from '../models/operations/subscriptions.js';
3
+ import type { CreateSubscriptionRequest, CreateSubscriptionResponse, ListSubscriptionsRequest, ListSubscriptionsResponse, GetSubscriptionRequest, GetSubscriptionResponse, CancelSubscriptionRequest, CancelSubscriptionResponse, UnscheduleCancelationRequest, UnscheduleCancelationResponse, UnscheduleSubscriptionRequest, UnscheduleSubscriptionResponse, RestoreSubscriptionRequest, RestoreSubscriptionResponse, ChangeSubscriptionRequest, ChangeSubscriptionResponse, MigrateSubscriptionRequest, MigrateSubscriptionResponse, EditSubscriptionRequest, EditSubscriptionResponse, CreateSubscriptionAddonRequest, CreateSubscriptionAddonResponse, ListSubscriptionAddonsRequest, ListSubscriptionAddonsResponse, GetSubscriptionAddonRequest, GetSubscriptionAddonResponse, UpdateSubscriptionAddonRequest, UpdateSubscriptionAddonResponse } from '../models/operations/subscriptions.js';
4
4
  import type { Subscription, SubscriptionAddon } from '../models/types.js';
5
5
  export declare class Subscriptions {
6
6
  private readonly _client;
@@ -80,6 +80,21 @@ export declare class Subscriptions {
80
80
  * POST /openmeter/subscriptions/{subscriptionId}/change
81
81
  */
82
82
  change(request: ChangeSubscriptionRequest, options?: RequestOptions): Promise<ChangeSubscriptionResponse>;
83
+ /**
84
+ * Migrate subscription
85
+ *
86
+ * Migrates to a later version of the current plan. With starting_phase omitted and
87
+ * billing_anchor omitted or unchanged, migration amends the subscription in place:
88
+ * unchanged items retain their service periods and both response entries have the
89
+ * same ID. Existing addons must remain compatible with the target plan.
90
+ * Incompatible phase timelines or billing settings return an error. Providing
91
+ * starting_phase or a different billing_anchor explicitly requests replacement,
92
+ * which resets the phase timeline, may produce billing adjustments, and does not
93
+ * transfer addons. Custom subscriptions cannot be migrated.
94
+ *
95
+ * POST /openmeter/subscriptions/{subscriptionId}/migrate
96
+ */
97
+ migrate(request: MigrateSubscriptionRequest, options?: RequestOptions): Promise<MigrateSubscriptionResponse>;
83
98
  /**
84
99
  * Edit subscription
85
100
  *
@@ -1,7 +1,7 @@
1
1
  // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
2
2
  import { unwrap } from '../lib/types.js';
3
3
  import { paginatePages } from '../lib/paginate.js';
4
- import { createSubscription, listSubscriptions, getSubscription, cancelSubscription, unscheduleCancelation, unscheduleSubscription, restoreSubscription, changeSubscription, editSubscription, createSubscriptionAddon, listSubscriptionAddons, getSubscriptionAddon, updateSubscriptionAddon, } from '../funcs/subscriptions.js';
4
+ import { createSubscription, listSubscriptions, getSubscription, cancelSubscription, unscheduleCancelation, unscheduleSubscription, restoreSubscription, changeSubscription, migrateSubscription, editSubscription, createSubscriptionAddon, listSubscriptionAddons, getSubscriptionAddon, updateSubscriptionAddon, } from '../funcs/subscriptions.js';
5
5
  export class Subscriptions {
6
6
  _client;
7
7
  constructor(_client) {
@@ -100,6 +100,23 @@ export class Subscriptions {
100
100
  async change(request, options) {
101
101
  return unwrap(await changeSubscription(this._client, request, options));
102
102
  }
103
+ /**
104
+ * Migrate subscription
105
+ *
106
+ * Migrates to a later version of the current plan. With starting_phase omitted and
107
+ * billing_anchor omitted or unchanged, migration amends the subscription in place:
108
+ * unchanged items retain their service periods and both response entries have the
109
+ * same ID. Existing addons must remain compatible with the target plan.
110
+ * Incompatible phase timelines or billing settings return an error. Providing
111
+ * starting_phase or a different billing_anchor explicitly requests replacement,
112
+ * which resets the phase timeline, may produce billing adjustments, and does not
113
+ * transfer addons. Custom subscriptions cannot be migrated.
114
+ *
115
+ * POST /openmeter/subscriptions/{subscriptionId}/migrate
116
+ */
117
+ async migrate(request, options) {
118
+ return unwrap(await migrateSubscription(this._client, request, options));
119
+ }
103
120
  /**
104
121
  * Edit subscription
105
122
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmeter/client",
3
- "version": "1.0.0-beta-14ec9d225214",
3
+ "version": "1.0.0-beta-80ea9ac3b74b",
4
4
  "description": "Official TypeScript SDK for the OpenMeter API — usage metering and billing",
5
5
  "keywords": [
6
6
  "openmeter",