@openmeter/client 1.0.0-beta-72c0e4789aae → 1.0.0-beta-e609679efd27

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.
@@ -1,9 +1,28 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type RequestOptions } from '../lib/types.js';
3
- import type { CreatePlanAddonRequest, CreatePlanAddonResponse, GetPlanAddonRequest, GetPlanAddonResponse, UpdatePlanAddonRequest, UpdatePlanAddonResponse, DeletePlanAddonRequest, DeletePlanAddonResponse } from '../models/operations/planAddons.js';
3
+ import type { ListPlanAddonsRequest, ListPlanAddonsResponse, CreatePlanAddonRequest, CreatePlanAddonResponse, GetPlanAddonRequest, GetPlanAddonResponse, UpdatePlanAddonRequest, UpdatePlanAddonResponse, DeletePlanAddonRequest, DeletePlanAddonResponse } from '../models/operations/planAddons.js';
4
+ import type { PlanAddon } from '../models/types.js';
4
5
  export declare class PlanAddons {
5
6
  private readonly _client;
6
7
  constructor(_client: Client);
8
+ /**
9
+ * List add-ons for plan
10
+ *
11
+ * List add-ons associated with a plan.
12
+ *
13
+ * GET /openmeter/plans/{planId}/addons
14
+ */
15
+ list(request: ListPlanAddonsRequest, options?: RequestOptions): Promise<ListPlanAddonsResponse>;
16
+ /**
17
+ * List add-ons for plan
18
+ *
19
+ * List add-ons associated with a plan.
20
+ *
21
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
22
+ *
23
+ * GET /openmeter/plans/{planId}/addons
24
+ */
25
+ listAll(request: ListPlanAddonsRequest, options?: RequestOptions): AsyncIterable<PlanAddon>;
7
26
  /**
8
27
  * Add add-on to plan
9
28
  *
@@ -1,11 +1,34 @@
1
1
  // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
2
2
  import { unwrap } from '../lib/types.js';
3
- import { createPlanAddon, getPlanAddon, updatePlanAddon, deletePlanAddon, } from '../funcs/planAddons.js';
3
+ import { paginatePages } from '../lib/paginate.js';
4
+ import { listPlanAddons, createPlanAddon, getPlanAddon, updatePlanAddon, deletePlanAddon, } from '../funcs/planAddons.js';
4
5
  export class PlanAddons {
5
6
  _client;
6
7
  constructor(_client) {
7
8
  this._client = _client;
8
9
  }
10
+ /**
11
+ * List add-ons for plan
12
+ *
13
+ * List add-ons associated with a plan.
14
+ *
15
+ * GET /openmeter/plans/{planId}/addons
16
+ */
17
+ async list(request, options) {
18
+ return unwrap(await listPlanAddons(this._client, request, options));
19
+ }
20
+ /**
21
+ * List add-ons for plan
22
+ *
23
+ * List add-ons associated with a plan.
24
+ *
25
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
26
+ *
27
+ * GET /openmeter/plans/{planId}/addons
28
+ */
29
+ listAll(request, options) {
30
+ return paginatePages((req, opts) => listPlanAddons(this._client, req, opts), request, options);
31
+ }
9
32
  /**
10
33
  * Add add-on to plan
11
34
  *
package/dist/sdk/sdk.d.ts CHANGED
@@ -3,16 +3,22 @@ import { Events } from './events.js';
3
3
  import { Meters } from './meters.js';
4
4
  import { Customers } from './customers.js';
5
5
  import { Entitlements } from './entitlements.js';
6
+ import { Grants } from './grants.js';
6
7
  import { Subscriptions } from './subscriptions.js';
7
8
  import { Apps } from './apps.js';
8
9
  import { Billing } from './billing.js';
10
+ import { Invoices } from './invoices.js';
11
+ import { Charges } from './charges.js';
9
12
  import { Tax } from './tax.js';
13
+ import { Currencies } from './currencies.js';
10
14
  import { Features } from './features.js';
11
15
  import { LLMCost } from './llmCost.js';
12
16
  import { Plans } from './plans.js';
13
17
  import { Addons } from './addons.js';
14
18
  import { PlanAddons } from './planAddons.js';
15
19
  import { Defaults } from './defaults.js';
20
+ import { EntitlementAccess } from './entitlementAccess.js';
21
+ import { Notifications } from './notifications.js';
16
22
  import { Internal } from './internal.js';
17
23
  export declare class OpenMeter extends Client {
18
24
  private _events?;
@@ -23,14 +29,22 @@ export declare class OpenMeter extends Client {
23
29
  get customers(): Customers;
24
30
  private _entitlements?;
25
31
  get entitlements(): Entitlements;
32
+ private _grants?;
33
+ get grants(): Grants;
26
34
  private _subscriptions?;
27
35
  get subscriptions(): Subscriptions;
28
36
  private _apps?;
29
37
  get apps(): Apps;
30
38
  private _billing?;
31
39
  get billing(): Billing;
40
+ private _invoices?;
41
+ get invoices(): Invoices;
42
+ private _charges?;
43
+ get charges(): Charges;
32
44
  private _tax?;
33
45
  get tax(): Tax;
46
+ private _currencies?;
47
+ get currencies(): Currencies;
34
48
  private _features?;
35
49
  get features(): Features;
36
50
  private _llmCost?;
@@ -43,6 +57,10 @@ export declare class OpenMeter extends Client {
43
57
  get planAddons(): PlanAddons;
44
58
  private _defaults?;
45
59
  get defaults(): Defaults;
60
+ private _entitlementAccess?;
61
+ get entitlementAccess(): EntitlementAccess;
62
+ private _notifications?;
63
+ get notifications(): Notifications;
46
64
  private _internal?;
47
65
  /**
48
66
  * Operations marked internal in the API definition. They are not part
package/dist/sdk/sdk.js CHANGED
@@ -4,16 +4,22 @@ import { Events } from './events.js';
4
4
  import { Meters } from './meters.js';
5
5
  import { Customers } from './customers.js';
6
6
  import { Entitlements } from './entitlements.js';
7
+ import { Grants } from './grants.js';
7
8
  import { Subscriptions } from './subscriptions.js';
8
9
  import { Apps } from './apps.js';
9
10
  import { Billing } from './billing.js';
11
+ import { Invoices } from './invoices.js';
12
+ import { Charges } from './charges.js';
10
13
  import { Tax } from './tax.js';
14
+ import { Currencies } from './currencies.js';
11
15
  import { Features } from './features.js';
12
16
  import { LLMCost } from './llmCost.js';
13
17
  import { Plans } from './plans.js';
14
18
  import { Addons } from './addons.js';
15
19
  import { PlanAddons } from './planAddons.js';
16
20
  import { Defaults } from './defaults.js';
21
+ import { EntitlementAccess } from './entitlementAccess.js';
22
+ import { Notifications } from './notifications.js';
17
23
  import { Internal } from './internal.js';
18
24
  export class OpenMeter extends Client {
19
25
  _events;
@@ -32,6 +38,10 @@ export class OpenMeter extends Client {
32
38
  get entitlements() {
33
39
  return (this._entitlements ??= new Entitlements(this));
34
40
  }
41
+ _grants;
42
+ get grants() {
43
+ return (this._grants ??= new Grants(this));
44
+ }
35
45
  _subscriptions;
36
46
  get subscriptions() {
37
47
  return (this._subscriptions ??= new Subscriptions(this));
@@ -44,10 +54,22 @@ export class OpenMeter extends Client {
44
54
  get billing() {
45
55
  return (this._billing ??= new Billing(this));
46
56
  }
57
+ _invoices;
58
+ get invoices() {
59
+ return (this._invoices ??= new Invoices(this));
60
+ }
61
+ _charges;
62
+ get charges() {
63
+ return (this._charges ??= new Charges(this));
64
+ }
47
65
  _tax;
48
66
  get tax() {
49
67
  return (this._tax ??= new Tax(this));
50
68
  }
69
+ _currencies;
70
+ get currencies() {
71
+ return (this._currencies ??= new Currencies(this));
72
+ }
51
73
  _features;
52
74
  get features() {
53
75
  return (this._features ??= new Features(this));
@@ -72,6 +94,14 @@ export class OpenMeter extends Client {
72
94
  get defaults() {
73
95
  return (this._defaults ??= new Defaults(this));
74
96
  }
97
+ _entitlementAccess;
98
+ get entitlementAccess() {
99
+ return (this._entitlementAccess ??= new EntitlementAccess(this));
100
+ }
101
+ _notifications;
102
+ get notifications() {
103
+ return (this._notifications ??= new Notifications(this));
104
+ }
75
105
  _internal;
76
106
  /**
77
107
  * Operations marked internal in the API definition. They are not part
@@ -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, ChangeSubscriptionRequest, ChangeSubscriptionResponse, EditSubscriptionRequest, EditSubscriptionResponse, ListSubscriptionAddonsRequest, ListSubscriptionAddonsResponse, GetSubscriptionAddonRequest, GetSubscriptionAddonResponse } 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, ListSubscriptionAddonsRequest, ListSubscriptionAddonsResponse, GetSubscriptionAddonRequest, GetSubscriptionAddonResponse } 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;
@@ -48,6 +48,29 @@ export declare class Subscriptions {
48
48
  * POST /openmeter/subscriptions/{subscriptionId}/unschedule-cancelation
49
49
  */
50
50
  unscheduleCancelation(request: UnscheduleCancelationRequest, options?: RequestOptions): Promise<UnscheduleCancelationResponse>;
51
+ /**
52
+ * Unschedule subscription
53
+ *
54
+ * Deletes a scheduled subscription that has not yet become active, removing it and
55
+ * resolving any scheduling conflict it was holding. This is distinct from
56
+ * canceling: cancel ends a running subscription, whereas unscheduling removes a
57
+ * not-yet-active one. Only scheduled subscriptions can be unscheduled;
58
+ * unscheduling an active or already-started subscription is rejected.
59
+ *
60
+ * POST /openmeter/subscriptions/{subscriptionId}/unschedule
61
+ */
62
+ unschedule(request: UnscheduleSubscriptionRequest, options?: RequestOptions): Promise<UnscheduleSubscriptionResponse>;
63
+ /**
64
+ * Restore subscription
65
+ *
66
+ * Restores the subscription by deleting any later-scheduled successor
67
+ * subscriptions and continuing this one indefinitely. This is the inverse of a
68
+ * future-dated change, which schedules a successor. Restore is not available when
69
+ * multi-subscription is enabled.
70
+ *
71
+ * POST /openmeter/subscriptions/{subscriptionId}/restore
72
+ */
73
+ restore(request: RestoreSubscriptionRequest, options?: RequestOptions): Promise<RestoreSubscriptionResponse>;
51
74
  /**
52
75
  * Change subscription
53
76
  *
@@ -57,6 +80,21 @@ export declare class Subscriptions {
57
80
  * POST /openmeter/subscriptions/{subscriptionId}/change
58
81
  */
59
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>;
60
98
  /**
61
99
  * Edit subscription
62
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, changeSubscription, editSubscription, listSubscriptionAddons, getSubscriptionAddon, } from '../funcs/subscriptions.js';
4
+ import { createSubscription, listSubscriptions, getSubscription, cancelSubscription, unscheduleCancelation, unscheduleSubscription, restoreSubscription, changeSubscription, migrateSubscription, editSubscription, listSubscriptionAddons, getSubscriptionAddon, } from '../funcs/subscriptions.js';
5
5
  export class Subscriptions {
6
6
  _client;
7
7
  constructor(_client) {
@@ -62,6 +62,33 @@ export class Subscriptions {
62
62
  async unscheduleCancelation(request, options) {
63
63
  return unwrap(await unscheduleCancelation(this._client, request, options));
64
64
  }
65
+ /**
66
+ * Unschedule subscription
67
+ *
68
+ * Deletes a scheduled subscription that has not yet become active, removing it and
69
+ * resolving any scheduling conflict it was holding. This is distinct from
70
+ * canceling: cancel ends a running subscription, whereas unscheduling removes a
71
+ * not-yet-active one. Only scheduled subscriptions can be unscheduled;
72
+ * unscheduling an active or already-started subscription is rejected.
73
+ *
74
+ * POST /openmeter/subscriptions/{subscriptionId}/unschedule
75
+ */
76
+ async unschedule(request, options) {
77
+ return unwrap(await unscheduleSubscription(this._client, request, options));
78
+ }
79
+ /**
80
+ * Restore subscription
81
+ *
82
+ * Restores the subscription by deleting any later-scheduled successor
83
+ * subscriptions and continuing this one indefinitely. This is the inverse of a
84
+ * future-dated change, which schedules a successor. Restore is not available when
85
+ * multi-subscription is enabled.
86
+ *
87
+ * POST /openmeter/subscriptions/{subscriptionId}/restore
88
+ */
89
+ async restore(request, options) {
90
+ return unwrap(await restoreSubscription(this._client, request, options));
91
+ }
65
92
  /**
66
93
  * Change subscription
67
94
  *
@@ -73,6 +100,23 @@ export class Subscriptions {
73
100
  async change(request, options) {
74
101
  return unwrap(await changeSubscription(this._client, request, options));
75
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
+ }
76
120
  /**
77
121
  * Edit subscription
78
122
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmeter/client",
3
- "version": "1.0.0-beta-72c0e4789aae",
3
+ "version": "1.0.0-beta-e609679efd27",
4
4
  "description": "Official TypeScript SDK for the OpenMeter API — usage metering and billing",
5
5
  "keywords": [
6
6
  "openmeter",