@openmeter/client 1.0.0-beta.231 → 1.0.0-beta.232

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 (44) hide show
  1. package/README.md +24 -14
  2. package/dist/core.js +7 -4
  3. package/dist/funcs/addons.js +59 -11
  4. package/dist/funcs/apps.d.ts +41 -1
  5. package/dist/funcs/apps.js +164 -3
  6. package/dist/funcs/billing.js +34 -7
  7. package/dist/funcs/currencies.d.ts +9 -1
  8. package/dist/funcs/currencies.js +62 -5
  9. package/dist/funcs/customers.js +214 -43
  10. package/dist/funcs/entitlements.js +12 -3
  11. package/dist/funcs/events.js +3 -0
  12. package/dist/funcs/features.js +48 -9
  13. package/dist/funcs/invoices.d.ts +58 -1
  14. package/dist/funcs/invoices.js +202 -7
  15. package/dist/funcs/llmCost.js +26 -5
  16. package/dist/funcs/meters.js +59 -11
  17. package/dist/funcs/planAddons.js +65 -17
  18. package/dist/funcs/plans.js +59 -11
  19. package/dist/funcs/subscriptions.js +87 -17
  20. package/dist/funcs/tax.js +34 -7
  21. package/dist/index.d.ts +1 -2
  22. package/dist/index.js +0 -1
  23. package/dist/lib/config.d.ts +2 -2
  24. package/dist/lib/paginate.d.ts +1 -1
  25. package/dist/lib/version.d.ts +1 -1
  26. package/dist/lib/version.js +1 -1
  27. package/dist/lib/wire.d.ts +1 -0
  28. package/dist/lib/wire.js +26 -4
  29. package/dist/models/operations/apps.d.ts +25 -1
  30. package/dist/models/operations/currencies.d.ts +10 -0
  31. package/dist/models/operations/customers.d.ts +2 -1
  32. package/dist/models/operations/invoices.d.ts +16 -0
  33. package/dist/models/schemas.d.ts +15256 -9856
  34. package/dist/models/schemas.js +938 -447
  35. package/dist/models/types.d.ts +503 -259
  36. package/dist/sdk/apps.d.ts +44 -2
  37. package/dist/sdk/apps.js +53 -1
  38. package/dist/sdk/internal.d.ts +151 -3
  39. package/dist/sdk/internal.js +182 -2
  40. package/dist/sdk/invoices.d.ts +15 -0
  41. package/dist/sdk/invoices.js +32 -0
  42. package/dist/sdk/sdk.d.ts +0 -3
  43. package/dist/sdk/sdk.js +0 -5
  44. package/package.json +3 -3
package/README.md CHANGED
@@ -25,7 +25,6 @@ TypeSpec definitions and ships fully-typed request and response models.
25
25
  - [Customers](#customers)
26
26
  - [Entitlements](#entitlements)
27
27
  - [Subscriptions](#subscriptions)
28
- - [Apps](#apps)
29
28
  - [Billing](#billing)
30
29
  - [Tax](#tax)
31
30
  - [Features](#features)
@@ -36,6 +35,7 @@ TypeSpec definitions and ships fully-typed request and response models.
36
35
  - [Defaults](#defaults)
37
36
  - [Internal Operations](#internal-operations)
38
37
  - [Internal Subscriptions](#internal-subscriptions)
38
+ - [Internal Apps](#internal-apps)
39
39
  - [Internal Invoices](#internal-invoices)
40
40
  - [Internal Currencies](#internal-currencies)
41
41
  - [Internal Governance](#internal-governance)
@@ -321,13 +321,6 @@ The full call path, HTTP route, and a short description are listed below.
321
321
  | `client.subscriptions.listAddons` | `GET /openmeter/subscriptions/{subscriptionId}/addons` | List the add-ons of a subscription. |
322
322
  | `client.subscriptions.getAddon` | `GET /openmeter/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}` | Get an add-on association for a subscription. |
323
323
 
324
- ### Apps
325
-
326
- | Method | HTTP | Description |
327
- | ------------------ | ----------------------------- | --------------------- |
328
- | `client.apps.list` | `GET /openmeter/apps` | List installed apps. |
329
- | `client.apps.get` | `GET /openmeter/apps/{appId}` | Get an installed app. |
330
-
331
324
  ### Billing
332
325
 
333
326
  | Method | HTTP | Description |
@@ -423,14 +416,30 @@ they can change or be removed without notice or semver consideration.
423
416
  | ------------------------------------------- | ------------------------------------------------------- | ----------------------------- |
424
417
  | `client.internal.subscriptions.createAddon` | `POST /openmeter/subscriptions/{subscriptionId}/addons` | Add add-on to a subscription. |
425
418
 
419
+ ### Internal Apps
420
+
421
+ | Method | HTTP | Description |
422
+ | ------------------------------------- | -------------------------------------- | -------------------------------- |
423
+ | `client.internal.apps.list` | `GET /openmeter/apps` | List installed apps. |
424
+ | `client.internal.apps.get` | `GET /openmeter/apps/{appId}` | Get an installed app. |
425
+ | `client.internal.apps.uninstall` | `DELETE /openmeter/apps/{appId}` | Uninstall an app by ID. |
426
+ | `client.internal.apps.update` | `PUT /openmeter/apps/{appId}` | Update an installed app. |
427
+ | `client.internal.apps.listCatalog` | `GET /openmeter/app-catalog` | List available apps. |
428
+ | `client.internal.apps.getCatalogItem` | `GET /openmeter/app-catalog/{appType}` | Get an app catalog item by type. |
429
+ | `client.internal.apps.install` | `POST /openmeter/app-catalog/install` | Install an app from the catalog. |
430
+
426
431
  ### Internal Invoices
427
432
 
428
- | Method | HTTP | Description |
429
- | --------------------------------- | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
430
- | `client.internal.invoices.list` | `GET /openmeter/billing/invoices` | List billing invoices. Returns a page of invoices. Gathering invoices are never included. Use `filter` to narrow by status, customer, dates, or service period start. Use `sort` to control ordering. |
431
- | `client.internal.invoices.get` | `GET /openmeter/billing/invoices/{invoiceId}` | Get a billing invoice by ID. Returns the full invoice resource including line items, status details, totals, and workflow configuration snapshot. |
432
- | `client.internal.invoices.update` | `PUT /openmeter/billing/invoices/{invoiceId}` | Update a billing invoice. Only the mutable fields of the invoice can be edited: description, labels, supplier, customer, workflow settings, and top-level lines. Top-level lines are matched by `id`; lines without an `id` are created, and existing lines omitted from `lines` are deleted. Detailed (child) lines are always computed and cannot be edited directly. Only invoices in draft status can be updated. |
433
- | `client.internal.invoices.delete` | `DELETE /openmeter/billing/invoices/{invoiceId}` | Delete a billing invoice. Only standard invoices in draft status can be deleted. Deleting an invoice will also delete all associated line items and workflow configuration. |
433
+ | Method | HTTP | Description |
434
+ | --------------------------------------------- | ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
435
+ | `client.internal.invoices.list` | `GET /openmeter/billing/invoices` | List billing invoices. Returns a page of invoices. Gathering invoices are never included. Use `filter` to narrow by status, customer, dates, or service period start. Use `sort` to control ordering. |
436
+ | `client.internal.invoices.get` | `GET /openmeter/billing/invoices/{invoiceId}` | Get a billing invoice by ID. Returns the full invoice resource including line items, status details, totals, and workflow configuration snapshot. |
437
+ | `client.internal.invoices.update` | `PUT /openmeter/billing/invoices/{invoiceId}` | Update a billing invoice. Only the mutable fields of the invoice can be edited: description, labels, supplier, customer, workflow settings, and top-level lines. Top-level lines are matched by `id`; lines without an `id` are created, and existing lines omitted from `lines` are deleted. Detailed (child) lines are always computed and cannot be edited directly. Only invoices in draft status can be updated. |
438
+ | `client.internal.invoices.delete` | `DELETE /openmeter/billing/invoices/{invoiceId}` | Delete a billing invoice. Only standard invoices in draft status can be deleted. Deleting an invoice will also delete all associated line items and workflow configuration. |
439
+ | `client.internal.invoices.advance` | `POST /openmeter/billing/invoices/{invoiceId}/advance` | Advance a billing invoice. Advances the invoice to the next workflow state. The next state is determined by the invoice's current status and workflow configuration. Only invoices in draft or issued status can be advanced. |
440
+ | `client.internal.invoices.approve` | `POST /openmeter/billing/invoices/{invoiceId}/approve` | Approve a billing invoice. This call instantly sends the invoice to the customer using the configured billing profile app. This call is valid in two invoice statuses: - draft: the invoice will be sent to the customer, the invoice state becomes issued - manual_approval_needed: the invoice will be sent to the customer, the invoice state becomes issued |
441
+ | `client.internal.invoices.retry` | `POST /openmeter/billing/invoices/{invoiceId}/retry` | Retry sending a billing invoice. Retry advancing the invoice after a failed attempt. The action can be called when the invoice's statusDetails' actions field contain the "retry" action. |
442
+ | `client.internal.invoices.snapshotQuantities` | `POST /openmeter/billing/invoices/{invoiceId}/snapshot-quantities` | Snapshot quantities for usage-based line items. This call will snapshot the quantities for all usage based line items in the invoice. This call is only valid in draft.waiting_for_collection status, where the collection period can be skipped using this action. |
434
443
 
435
444
  ### Internal Currencies
436
445
 
@@ -438,6 +447,7 @@ they can change or be removed without notice or semver consideration.
438
447
  | ------------------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
439
448
  | `client.internal.currencies.list` | `GET /openmeter/currencies` | List currencies supported by the billing system. |
440
449
  | `client.internal.currencies.createCustomCurrency` | `POST /openmeter/currencies/custom` | Create a custom currency. This operation allows defining your own custom currency for billing purposes. |
450
+ | `client.internal.currencies.getCustomCurrency` | `GET /openmeter/currencies/custom/{currencyId}` | Get a custom currency. |
441
451
  | `client.internal.currencies.listCostBases` | `GET /openmeter/currencies/custom/{currencyId}/cost-bases` | List cost bases for a currency. For custom currencies, there can be multiple cost bases with different `effective_from` dates. |
442
452
  | `client.internal.currencies.createCostBasis` | `POST /openmeter/currencies/custom/{currencyId}/cost-bases` | Create a cost basis for a currency. |
443
453
 
package/dist/core.js CHANGED
@@ -22,10 +22,13 @@ export class Client {
22
22
  beforeRequest: [
23
23
  ...(options.hooks?.beforeRequest ?? []),
24
24
  async ({ request }) => {
25
- // Browsers treat User-Agent as a forbidden header and silently drop
26
- // it; that's fine here, this is only observable server-side (e.g.
27
- // request logs) and Node/server callers get it.
28
- if (!request.headers.has('User-Agent')) {
25
+ // User-Agent is settable on the web but is not CORS-safelisted, so
26
+ // setting it would preflight otherwise-simple cross-origin requests.
27
+ // Gate on a positive Node check, not `window`: workers are also
28
+ // CORS-bound yet have no `window`.
29
+ if (typeof process !== 'undefined' &&
30
+ process.versions?.node != null &&
31
+ !request.headers.has('User-Agent')) {
29
32
  request.headers.set('User-Agent', `openmeter-node/${SDK_VERSION}`);
30
33
  }
31
34
  const token = typeof options.apiKey === 'function'
@@ -2,7 +2,7 @@
2
2
  import { http } from '../core.js';
3
3
  import { request } from '../lib/request.js';
4
4
  import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
5
- import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
5
+ import { toWire, toPathWire, fromWire, assertValid, toSnakeCase, } from '../lib/wire.js';
6
6
  import * as schemas from '../models/schemas.js';
7
7
  /**
8
8
  * List add-ons
@@ -13,6 +13,9 @@ import * as schemas from '../models/schemas.js';
13
13
  */
14
14
  export function listAddons(client, req = {}, options) {
15
15
  return request(() => {
16
+ if (client._options.validate && req.sort !== undefined) {
17
+ assertValid(schemas.listAddonsQueryParams.shape.sort, req.sort);
18
+ }
16
19
  const query = toWire({
17
20
  page: req.page,
18
21
  sort: encodeSort(req.sort, toSnakeCase),
@@ -66,11 +69,20 @@ export function createAddon(client, req, options) {
66
69
  */
67
70
  export function updateAddon(client, req, options) {
68
71
  return request(() => {
72
+ const pathParamsInput = {
73
+ addonId: req.addonId,
74
+ };
75
+ const pathParams = client._options.validate
76
+ ? toPathWire(pathParamsInput, schemas.updateAddonPathParams)
77
+ : pathParamsInput;
78
+ if (client._options.validate) {
79
+ assertValid(schemas.updateAddonPathParamsWire, pathParams);
80
+ }
69
81
  const path = `openmeter/addons/${(() => {
70
- if (req.addonId === undefined) {
82
+ if (pathParams.addonId === undefined) {
71
83
  throw new Error('missing path parameter: addonId');
72
84
  }
73
- return encodeURIComponent(String(req.addonId));
85
+ return encodeURIComponent(String(pathParams.addonId));
74
86
  })()}`;
75
87
  const body = toWire(req.body, schemas.updateAddonBody);
76
88
  if (client._options.validate) {
@@ -96,11 +108,20 @@ export function updateAddon(client, req, options) {
96
108
  */
97
109
  export function getAddon(client, req, options) {
98
110
  return request(() => {
111
+ const pathParamsInput = {
112
+ addonId: req.addonId,
113
+ };
114
+ const pathParams = client._options.validate
115
+ ? toPathWire(pathParamsInput, schemas.getAddonPathParams)
116
+ : pathParamsInput;
117
+ if (client._options.validate) {
118
+ assertValid(schemas.getAddonPathParamsWire, pathParams);
119
+ }
99
120
  const path = `openmeter/addons/${(() => {
100
- if (req.addonId === undefined) {
121
+ if (pathParams.addonId === undefined) {
101
122
  throw new Error('missing path parameter: addonId');
102
123
  }
103
- return encodeURIComponent(String(req.addonId));
124
+ return encodeURIComponent(String(pathParams.addonId));
104
125
  })()}`;
105
126
  return http(client)
106
127
  .get(path, options)
@@ -122,11 +143,20 @@ export function getAddon(client, req, options) {
122
143
  */
123
144
  export function deleteAddon(client, req, options) {
124
145
  return request(async () => {
146
+ const pathParamsInput = {
147
+ addonId: req.addonId,
148
+ };
149
+ const pathParams = client._options.validate
150
+ ? toPathWire(pathParamsInput, schemas.deleteAddonPathParams)
151
+ : pathParamsInput;
152
+ if (client._options.validate) {
153
+ assertValid(schemas.deleteAddonPathParamsWire, pathParams);
154
+ }
125
155
  const path = `openmeter/addons/${(() => {
126
- if (req.addonId === undefined) {
156
+ if (pathParams.addonId === undefined) {
127
157
  throw new Error('missing path parameter: addonId');
128
158
  }
129
- return encodeURIComponent(String(req.addonId));
159
+ return encodeURIComponent(String(pathParams.addonId));
130
160
  })()}`;
131
161
  await http(client).delete(path, options);
132
162
  });
@@ -140,11 +170,20 @@ export function deleteAddon(client, req, options) {
140
170
  */
141
171
  export function archiveAddon(client, req, options) {
142
172
  return request(() => {
173
+ const pathParamsInput = {
174
+ addonId: req.addonId,
175
+ };
176
+ const pathParams = client._options.validate
177
+ ? toPathWire(pathParamsInput, schemas.archiveAddonPathParams)
178
+ : pathParamsInput;
179
+ if (client._options.validate) {
180
+ assertValid(schemas.archiveAddonPathParamsWire, pathParams);
181
+ }
143
182
  const path = `openmeter/addons/${(() => {
144
- if (req.addonId === undefined) {
183
+ if (pathParams.addonId === undefined) {
145
184
  throw new Error('missing path parameter: addonId');
146
185
  }
147
- return encodeURIComponent(String(req.addonId));
186
+ return encodeURIComponent(String(pathParams.addonId));
148
187
  })()}/archive`;
149
188
  return http(client)
150
189
  .post(path, options)
@@ -166,11 +205,20 @@ export function archiveAddon(client, req, options) {
166
205
  */
167
206
  export function publishAddon(client, req, options) {
168
207
  return request(() => {
208
+ const pathParamsInput = {
209
+ addonId: req.addonId,
210
+ };
211
+ const pathParams = client._options.validate
212
+ ? toPathWire(pathParamsInput, schemas.publishAddonPathParams)
213
+ : pathParamsInput;
214
+ if (client._options.validate) {
215
+ assertValid(schemas.publishAddonPathParamsWire, pathParams);
216
+ }
169
217
  const path = `openmeter/addons/${(() => {
170
- if (req.addonId === undefined) {
218
+ if (pathParams.addonId === undefined) {
171
219
  throw new Error('missing path parameter: addonId');
172
220
  }
173
- return encodeURIComponent(String(req.addonId));
221
+ return encodeURIComponent(String(pathParams.addonId));
174
222
  })()}/publish`;
175
223
  return http(client)
176
224
  .post(path, options)
@@ -1,6 +1,6 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type Result, type RequestOptions } from '../lib/types.js';
3
- import type { ListAppsRequest, ListAppsResponse, GetAppRequest, GetAppResponse } from '../models/operations/apps.js';
3
+ import type { ListAppsRequest, ListAppsResponse, GetAppRequest, GetAppResponse, UninstallAppRequest, UninstallAppResponse, UpdateAppRequest, UpdateAppResponse, ListAppCatalogRequest, ListAppCatalogResponse, GetAppCatalogItemRequest, GetAppCatalogItemResponse, InstallAppRequest, InstallAppResponse } from '../models/operations/apps.js';
4
4
  /**
5
5
  * List apps
6
6
  *
@@ -17,3 +17,43 @@ export declare function listApps(client: Client, req?: ListAppsRequest, options?
17
17
  * GET /openmeter/apps/{appId}
18
18
  */
19
19
  export declare function getApp(client: Client, req: GetAppRequest, options?: RequestOptions): Promise<Result<GetAppResponse>>;
20
+ /**
21
+ * Uninstall app
22
+ *
23
+ * Uninstall an app by ID.
24
+ *
25
+ * DELETE /openmeter/apps/{appId}
26
+ */
27
+ export declare function uninstallApp(client: Client, req: UninstallAppRequest, options?: RequestOptions): Promise<Result<UninstallAppResponse>>;
28
+ /**
29
+ * Update app
30
+ *
31
+ * Update an installed app.
32
+ *
33
+ * PUT /openmeter/apps/{appId}
34
+ */
35
+ export declare function updateApp(client: Client, req: UpdateAppRequest, options?: RequestOptions): Promise<Result<UpdateAppResponse>>;
36
+ /**
37
+ * List app catalog
38
+ *
39
+ * List available apps.
40
+ *
41
+ * GET /openmeter/app-catalog
42
+ */
43
+ export declare function listAppCatalog(client: Client, req?: ListAppCatalogRequest, options?: RequestOptions): Promise<Result<ListAppCatalogResponse>>;
44
+ /**
45
+ * Get app catalog item by type
46
+ *
47
+ * Get an app catalog item by type.
48
+ *
49
+ * GET /openmeter/app-catalog/{appType}
50
+ */
51
+ export declare function getAppCatalogItem(client: Client, req: GetAppCatalogItemRequest, options?: RequestOptions): Promise<Result<GetAppCatalogItemResponse>>;
52
+ /**
53
+ * Install app from the catalog
54
+ *
55
+ * Install an app from the catalog.
56
+ *
57
+ * POST /openmeter/app-catalog/install
58
+ */
59
+ export declare function installApp(client: Client, req: InstallAppRequest, options?: RequestOptions): Promise<Result<InstallAppResponse>>;
@@ -2,7 +2,7 @@
2
2
  import { http } from '../core.js';
3
3
  import { request } from '../lib/request.js';
4
4
  import { toURLSearchParams } from '../lib/encodings.js';
5
- import { toWire, fromWire, assertValid } from '../lib/wire.js';
5
+ import { toWire, toPathWire, fromWire, assertValid } from '../lib/wire.js';
6
6
  import * as schemas from '../models/schemas.js';
7
7
  /**
8
8
  * List apps
@@ -40,11 +40,20 @@ export function listApps(client, req = {}, options) {
40
40
  */
41
41
  export function getApp(client, req, options) {
42
42
  return request(() => {
43
+ const pathParamsInput = {
44
+ appId: req.appId,
45
+ };
46
+ const pathParams = client._options.validate
47
+ ? toPathWire(pathParamsInput, schemas.getAppPathParams)
48
+ : pathParamsInput;
49
+ if (client._options.validate) {
50
+ assertValid(schemas.getAppPathParamsWire, pathParams);
51
+ }
43
52
  const path = `openmeter/apps/${(() => {
44
- if (req.appId === undefined) {
53
+ if (pathParams.appId === undefined) {
45
54
  throw new Error('missing path parameter: appId');
46
55
  }
47
- return encodeURIComponent(String(req.appId));
56
+ return encodeURIComponent(String(pathParams.appId));
48
57
  })()}`;
49
58
  return http(client)
50
59
  .get(path, options)
@@ -57,3 +66,155 @@ export function getApp(client, req, options) {
57
66
  });
58
67
  });
59
68
  }
69
+ /**
70
+ * Uninstall app
71
+ *
72
+ * Uninstall an app by ID.
73
+ *
74
+ * DELETE /openmeter/apps/{appId}
75
+ */
76
+ export function uninstallApp(client, req, options) {
77
+ return request(async () => {
78
+ const pathParamsInput = {
79
+ appId: req.appId,
80
+ };
81
+ const pathParams = client._options.validate
82
+ ? toPathWire(pathParamsInput, schemas.uninstallAppPathParams)
83
+ : pathParamsInput;
84
+ if (client._options.validate) {
85
+ assertValid(schemas.uninstallAppPathParamsWire, pathParams);
86
+ }
87
+ const path = `openmeter/apps/${(() => {
88
+ if (pathParams.appId === undefined) {
89
+ throw new Error('missing path parameter: appId');
90
+ }
91
+ return encodeURIComponent(String(pathParams.appId));
92
+ })()}`;
93
+ await http(client).delete(path, options);
94
+ });
95
+ }
96
+ /**
97
+ * Update app
98
+ *
99
+ * Update an installed app.
100
+ *
101
+ * PUT /openmeter/apps/{appId}
102
+ */
103
+ export function updateApp(client, req, options) {
104
+ return request(() => {
105
+ const pathParamsInput = {
106
+ appId: req.appId,
107
+ };
108
+ const pathParams = client._options.validate
109
+ ? toPathWire(pathParamsInput, schemas.updateAppPathParams)
110
+ : pathParamsInput;
111
+ if (client._options.validate) {
112
+ assertValid(schemas.updateAppPathParamsWire, pathParams);
113
+ }
114
+ const path = `openmeter/apps/${(() => {
115
+ if (pathParams.appId === undefined) {
116
+ throw new Error('missing path parameter: appId');
117
+ }
118
+ return encodeURIComponent(String(pathParams.appId));
119
+ })()}`;
120
+ const body = toWire(req.body, schemas.updateAppBody);
121
+ if (client._options.validate) {
122
+ assertValid(schemas.updateAppBodyWire, body);
123
+ }
124
+ return http(client)
125
+ .put(path, { ...options, json: body })
126
+ .json()
127
+ .then((data) => {
128
+ if (client._options.validate) {
129
+ assertValid(schemas.updateAppResponseWire, data);
130
+ }
131
+ return fromWire(data, schemas.updateAppResponse);
132
+ });
133
+ });
134
+ }
135
+ /**
136
+ * List app catalog
137
+ *
138
+ * List available apps.
139
+ *
140
+ * GET /openmeter/app-catalog
141
+ */
142
+ export function listAppCatalog(client, req = {}, options) {
143
+ return request(() => {
144
+ const query = toWire({
145
+ page: req.page,
146
+ }, schemas.listAppCatalogQueryParams);
147
+ if (client._options.validate) {
148
+ assertValid(schemas.listAppCatalogQueryParamsWire, query);
149
+ }
150
+ const searchParams = toURLSearchParams(query);
151
+ return http(client)
152
+ .get('openmeter/app-catalog', { ...options, searchParams })
153
+ .json()
154
+ .then((data) => {
155
+ if (client._options.validate) {
156
+ assertValid(schemas.listAppCatalogResponseWire, data);
157
+ }
158
+ return fromWire(data, schemas.listAppCatalogResponse);
159
+ });
160
+ });
161
+ }
162
+ /**
163
+ * Get app catalog item by type
164
+ *
165
+ * Get an app catalog item by type.
166
+ *
167
+ * GET /openmeter/app-catalog/{appType}
168
+ */
169
+ export function getAppCatalogItem(client, req, options) {
170
+ return request(() => {
171
+ const pathParamsInput = {
172
+ appType: req.appType,
173
+ };
174
+ const pathParams = client._options.validate
175
+ ? toPathWire(pathParamsInput, schemas.getAppCatalogItemPathParams)
176
+ : pathParamsInput;
177
+ if (client._options.validate) {
178
+ assertValid(schemas.getAppCatalogItemPathParamsWire, pathParams);
179
+ }
180
+ const path = `openmeter/app-catalog/${(() => {
181
+ if (pathParams.appType === undefined) {
182
+ throw new Error('missing path parameter: appType');
183
+ }
184
+ return encodeURIComponent(String(pathParams.appType));
185
+ })()}`;
186
+ return http(client)
187
+ .get(path, options)
188
+ .json()
189
+ .then((data) => {
190
+ if (client._options.validate) {
191
+ assertValid(schemas.getAppCatalogItemResponseWire, data);
192
+ }
193
+ return fromWire(data, schemas.getAppCatalogItemResponse);
194
+ });
195
+ });
196
+ }
197
+ /**
198
+ * Install app from the catalog
199
+ *
200
+ * Install an app from the catalog.
201
+ *
202
+ * POST /openmeter/app-catalog/install
203
+ */
204
+ export function installApp(client, req, options) {
205
+ return request(() => {
206
+ const body = toWire(req, schemas.installAppBody);
207
+ if (client._options.validate) {
208
+ assertValid(schemas.installAppBodyWire, body);
209
+ }
210
+ return http(client)
211
+ .post('openmeter/app-catalog/install', { ...options, json: body })
212
+ .json()
213
+ .then((data) => {
214
+ if (client._options.validate) {
215
+ assertValid(schemas.installAppResponseWire, data);
216
+ }
217
+ return fromWire(data, schemas.installAppResponse);
218
+ });
219
+ });
220
+ }
@@ -2,7 +2,7 @@
2
2
  import { http } from '../core.js';
3
3
  import { request } from '../lib/request.js';
4
4
  import { toURLSearchParams } from '../lib/encodings.js';
5
- import { toWire, fromWire, assertValid } from '../lib/wire.js';
5
+ import { toWire, toPathWire, fromWire, assertValid } from '../lib/wire.js';
6
6
  import * as schemas from '../models/schemas.js';
7
7
  /**
8
8
  * List billing profiles
@@ -69,11 +69,20 @@ export function createBillingProfile(client, req, options) {
69
69
  */
70
70
  export function getBillingProfile(client, req, options) {
71
71
  return request(() => {
72
+ const pathParamsInput = {
73
+ id: req.id,
74
+ };
75
+ const pathParams = client._options.validate
76
+ ? toPathWire(pathParamsInput, schemas.getBillingProfilePathParams)
77
+ : pathParamsInput;
78
+ if (client._options.validate) {
79
+ assertValid(schemas.getBillingProfilePathParamsWire, pathParams);
80
+ }
72
81
  const path = `openmeter/profiles/${(() => {
73
- if (req.id === undefined) {
82
+ if (pathParams.id === undefined) {
74
83
  throw new Error('missing path parameter: id');
75
84
  }
76
- return encodeURIComponent(String(req.id));
85
+ return encodeURIComponent(String(pathParams.id));
77
86
  })()}`;
78
87
  return http(client)
79
88
  .get(path, options)
@@ -95,11 +104,20 @@ export function getBillingProfile(client, req, options) {
95
104
  */
96
105
  export function updateBillingProfile(client, req, options) {
97
106
  return request(() => {
107
+ const pathParamsInput = {
108
+ id: req.id,
109
+ };
110
+ const pathParams = client._options.validate
111
+ ? toPathWire(pathParamsInput, schemas.updateBillingProfilePathParams)
112
+ : pathParamsInput;
113
+ if (client._options.validate) {
114
+ assertValid(schemas.updateBillingProfilePathParamsWire, pathParams);
115
+ }
98
116
  const path = `openmeter/profiles/${(() => {
99
- if (req.id === undefined) {
117
+ if (pathParams.id === undefined) {
100
118
  throw new Error('missing path parameter: id');
101
119
  }
102
- return encodeURIComponent(String(req.id));
120
+ return encodeURIComponent(String(pathParams.id));
103
121
  })()}`;
104
122
  const body = toWire(req.body, schemas.updateBillingProfileBody);
105
123
  if (client._options.validate) {
@@ -131,11 +149,20 @@ export function updateBillingProfile(client, req, options) {
131
149
  */
132
150
  export function deleteBillingProfile(client, req, options) {
133
151
  return request(async () => {
152
+ const pathParamsInput = {
153
+ id: req.id,
154
+ };
155
+ const pathParams = client._options.validate
156
+ ? toPathWire(pathParamsInput, schemas.deleteBillingProfilePathParams)
157
+ : pathParamsInput;
158
+ if (client._options.validate) {
159
+ assertValid(schemas.deleteBillingProfilePathParamsWire, pathParams);
160
+ }
134
161
  const path = `openmeter/profiles/${(() => {
135
- if (req.id === undefined) {
162
+ if (pathParams.id === undefined) {
136
163
  throw new Error('missing path parameter: id');
137
164
  }
138
- return encodeURIComponent(String(req.id));
165
+ return encodeURIComponent(String(pathParams.id));
139
166
  })()}`;
140
167
  await http(client).delete(path, options);
141
168
  });
@@ -1,6 +1,6 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type Result, type RequestOptions } from '../lib/types.js';
3
- import type { ListCurrenciesRequest, ListCurrenciesResponse, CreateCustomCurrencyRequest, CreateCustomCurrencyResponse, ListCostBasesRequest, ListCostBasesResponse, CreateCostBasisRequest, CreateCostBasisResponse } from '../models/operations/currencies.js';
3
+ import type { ListCurrenciesRequest, ListCurrenciesResponse, CreateCustomCurrencyRequest, CreateCustomCurrencyResponse, GetCustomCurrencyRequest, GetCustomCurrencyResponse, ListCostBasesRequest, ListCostBasesResponse, CreateCostBasisRequest, CreateCostBasisResponse } from '../models/operations/currencies.js';
4
4
  /**
5
5
  * List currencies
6
6
  *
@@ -18,6 +18,14 @@ export declare function listCurrencies(client: Client, req?: ListCurrenciesReque
18
18
  * POST /openmeter/currencies/custom
19
19
  */
20
20
  export declare function createCustomCurrency(client: Client, req: CreateCustomCurrencyRequest, options?: RequestOptions): Promise<Result<CreateCustomCurrencyResponse>>;
21
+ /**
22
+ * Get custom currency
23
+ *
24
+ * Get a custom currency.
25
+ *
26
+ * GET /openmeter/currencies/custom/{currencyId}
27
+ */
28
+ export declare function getCustomCurrency(client: Client, req: GetCustomCurrencyRequest, options?: RequestOptions): Promise<Result<GetCustomCurrencyResponse>>;
21
29
  /**
22
30
  * List cost bases
23
31
  *