@openmeter/client 1.0.0-beta.230 → 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 (137) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +365 -76
  3. package/dist/core.d.ts +0 -1
  4. package/dist/core.js +11 -1
  5. package/dist/funcs/addons.d.ts +49 -1
  6. package/dist/funcs/addons.js +109 -12
  7. package/dist/funcs/apps.d.ts +55 -2
  8. package/dist/funcs/apps.js +179 -4
  9. package/dist/funcs/billing.d.ts +46 -1
  10. package/dist/funcs/billing.js +81 -8
  11. package/dist/funcs/currencies.d.ts +39 -2
  12. package/dist/funcs/currencies.js +93 -6
  13. package/dist/funcs/customers.d.ts +165 -2
  14. package/dist/funcs/customers.js +402 -40
  15. package/dist/funcs/defaults.d.ts +10 -1
  16. package/dist/funcs/defaults.js +11 -1
  17. package/dist/funcs/entitlements.d.ts +5 -1
  18. package/dist/funcs/entitlements.js +18 -4
  19. package/dist/funcs/events.d.ts +14 -1
  20. package/dist/funcs/events.js +18 -1
  21. package/dist/funcs/features.d.ts +42 -1
  22. package/dist/funcs/features.js +91 -10
  23. package/dist/funcs/governance.d.ts +14 -1
  24. package/dist/funcs/governance.js +15 -1
  25. package/dist/funcs/index.d.ts +0 -1
  26. package/dist/funcs/index.js +1 -1
  27. package/dist/funcs/invoices.d.ts +102 -2
  28. package/dist/funcs/invoices.js +247 -8
  29. package/dist/funcs/llmCost.d.ts +36 -1
  30. package/dist/funcs/llmCost.js +63 -6
  31. package/dist/funcs/meters.d.ts +53 -1
  32. package/dist/funcs/meters.js +113 -12
  33. package/dist/funcs/planAddons.d.ts +35 -1
  34. package/dist/funcs/planAddons.js +101 -18
  35. package/dist/funcs/plans.d.ts +49 -1
  36. package/dist/funcs/plans.js +109 -12
  37. package/dist/funcs/subscriptions.d.ts +59 -1
  38. package/dist/funcs/subscriptions.js +147 -18
  39. package/dist/funcs/tax.d.ts +25 -1
  40. package/dist/funcs/tax.js +60 -8
  41. package/dist/index.d.ts +4 -7
  42. package/dist/index.js +4 -6
  43. package/dist/lib/config.d.ts +2 -3
  44. package/dist/lib/config.js +1 -1
  45. package/dist/lib/encodings.d.ts +0 -1
  46. package/dist/lib/encodings.js +1 -1
  47. package/dist/lib/paginate.d.ts +56 -0
  48. package/dist/lib/paginate.js +60 -0
  49. package/dist/lib/request.d.ts +0 -1
  50. package/dist/lib/request.js +1 -1
  51. package/dist/lib/to-error.d.ts +0 -1
  52. package/dist/lib/to-error.js +1 -1
  53. package/dist/lib/types.d.ts +0 -1
  54. package/dist/lib/types.js +1 -1
  55. package/dist/lib/version.d.ts +1 -0
  56. package/dist/lib/version.js +5 -0
  57. package/dist/lib/wire.d.ts +4 -1
  58. package/dist/lib/wire.js +118 -7
  59. package/dist/models/errors.d.ts +13 -2
  60. package/dist/models/errors.js +31 -4
  61. package/dist/models/operations/addons.d.ts +0 -1
  62. package/dist/models/operations/addons.js +1 -1
  63. package/dist/models/operations/apps.d.ts +26 -5
  64. package/dist/models/operations/apps.js +1 -1
  65. package/dist/models/operations/billing.d.ts +0 -1
  66. package/dist/models/operations/billing.js +1 -1
  67. package/dist/models/operations/currencies.d.ts +10 -1
  68. package/dist/models/operations/currencies.js +1 -1
  69. package/dist/models/operations/customers.d.ts +11 -7
  70. package/dist/models/operations/customers.js +1 -1
  71. package/dist/models/operations/defaults.d.ts +0 -1
  72. package/dist/models/operations/defaults.js +1 -1
  73. package/dist/models/operations/entitlements.d.ts +0 -1
  74. package/dist/models/operations/entitlements.js +1 -1
  75. package/dist/models/operations/events.d.ts +0 -1
  76. package/dist/models/operations/events.js +1 -1
  77. package/dist/models/operations/features.d.ts +0 -1
  78. package/dist/models/operations/features.js +1 -1
  79. package/dist/models/operations/governance.d.ts +0 -1
  80. package/dist/models/operations/governance.js +1 -1
  81. package/dist/models/operations/invoices.d.ts +20 -7
  82. package/dist/models/operations/invoices.js +1 -1
  83. package/dist/models/operations/llmCost.d.ts +0 -1
  84. package/dist/models/operations/llmCost.js +1 -1
  85. package/dist/models/operations/meters.d.ts +0 -1
  86. package/dist/models/operations/meters.js +1 -1
  87. package/dist/models/operations/planAddons.d.ts +0 -1
  88. package/dist/models/operations/planAddons.js +1 -1
  89. package/dist/models/operations/plans.d.ts +0 -1
  90. package/dist/models/operations/plans.js +1 -1
  91. package/dist/models/operations/subscriptions.d.ts +0 -1
  92. package/dist/models/operations/subscriptions.js +1 -1
  93. package/dist/models/operations/tax.d.ts +0 -1
  94. package/dist/models/operations/tax.js +1 -1
  95. package/dist/models/schemas.d.ts +11651 -6090
  96. package/dist/models/schemas.js +991 -468
  97. package/dist/models/types.d.ts +941 -810
  98. package/dist/models/types.js +1 -1
  99. package/dist/sdk/addons.d.ts +60 -1
  100. package/dist/sdk/addons.js +63 -1
  101. package/dist/sdk/apps.d.ts +68 -2
  102. package/dist/sdk/apps.js +81 -2
  103. package/dist/sdk/billing.d.ts +57 -1
  104. package/dist/sdk/billing.js +60 -1
  105. package/dist/sdk/customers.d.ts +211 -2
  106. package/dist/sdk/customers.js +222 -2
  107. package/dist/sdk/defaults.d.ts +10 -1
  108. package/dist/sdk/defaults.js +11 -1
  109. package/dist/sdk/entitlements.d.ts +5 -1
  110. package/dist/sdk/entitlements.js +6 -1
  111. package/dist/sdk/events.d.ts +25 -1
  112. package/dist/sdk/events.js +28 -1
  113. package/dist/sdk/features.d.ts +53 -1
  114. package/dist/sdk/features.js +56 -1
  115. package/dist/sdk/internal.d.ts +328 -0
  116. package/dist/sdk/internal.js +404 -0
  117. package/dist/sdk/invoices.d.ts +5 -2
  118. package/dist/sdk/invoices.js +13 -2
  119. package/dist/sdk/llmCost.d.ts +57 -1
  120. package/dist/sdk/llmCost.js +62 -1
  121. package/dist/sdk/meters.d.ts +64 -1
  122. package/dist/sdk/meters.js +67 -1
  123. package/dist/sdk/planAddons.d.ts +46 -1
  124. package/dist/sdk/planAddons.js +49 -1
  125. package/dist/sdk/plans.d.ts +60 -1
  126. package/dist/sdk/plans.js +63 -1
  127. package/dist/sdk/sdk.d.ts +9 -13
  128. package/dist/sdk/sdk.js +11 -20
  129. package/dist/sdk/subscriptions.d.ts +72 -3
  130. package/dist/sdk/subscriptions.js +77 -5
  131. package/dist/sdk/tax.d.ts +34 -1
  132. package/dist/sdk/tax.js +37 -1
  133. package/package.json +30 -6
  134. package/dist/sdk/currencies.d.ts +0 -12
  135. package/dist/sdk/currencies.js +0 -21
  136. package/dist/sdk/governance.d.ts +0 -9
  137. package/dist/sdk/governance.js +0 -12
package/dist/core.js CHANGED
@@ -1,5 +1,7 @@
1
+ // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
1
2
  import ky from 'ky';
2
3
  import { encodePath } from './lib/encodings.js';
4
+ import { SDK_VERSION } from './lib/version.js';
3
5
  export class Client {
4
6
  _options;
5
7
  _http;
@@ -20,6 +22,15 @@ export class Client {
20
22
  beforeRequest: [
21
23
  ...(options.hooks?.beforeRequest ?? []),
22
24
  async ({ request }) => {
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')) {
32
+ request.headers.set('User-Agent', `openmeter-node/${SDK_VERSION}`);
33
+ }
23
34
  const token = typeof options.apiKey === 'function'
24
35
  ? await options.apiKey()
25
36
  : options.apiKey;
@@ -35,4 +46,3 @@ export class Client {
35
46
  export function http(client) {
36
47
  return client._http;
37
48
  }
38
- //# sourceMappingURL=core.js.map
@@ -1,11 +1,59 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type Result, type RequestOptions } from '../lib/types.js';
3
3
  import type { ListAddonsRequest, ListAddonsResponse, CreateAddonRequest, CreateAddonResponse, UpdateAddonRequest, UpdateAddonResponse, GetAddonRequest, GetAddonResponse, DeleteAddonRequest, DeleteAddonResponse, ArchiveAddonRequest, ArchiveAddonResponse, PublishAddonRequest, PublishAddonResponse } from '../models/operations/addons.js';
4
+ /**
5
+ * List add-ons
6
+ *
7
+ * List all add-ons.
8
+ *
9
+ * GET /openmeter/addons
10
+ */
4
11
  export declare function listAddons(client: Client, req?: ListAddonsRequest, options?: RequestOptions): Promise<Result<ListAddonsResponse>>;
12
+ /**
13
+ * Create add-on
14
+ *
15
+ * Create a new add-on.
16
+ *
17
+ * POST /openmeter/addons
18
+ */
5
19
  export declare function createAddon(client: Client, req: CreateAddonRequest, options?: RequestOptions): Promise<Result<CreateAddonResponse>>;
20
+ /**
21
+ * Update add-on
22
+ *
23
+ * Update an add-on by id.
24
+ *
25
+ * PUT /openmeter/addons/{addonId}
26
+ */
6
27
  export declare function updateAddon(client: Client, req: UpdateAddonRequest, options?: RequestOptions): Promise<Result<UpdateAddonResponse>>;
28
+ /**
29
+ * Get add-on
30
+ *
31
+ * Get add-on by id.
32
+ *
33
+ * GET /openmeter/addons/{addonId}
34
+ */
7
35
  export declare function getAddon(client: Client, req: GetAddonRequest, options?: RequestOptions): Promise<Result<GetAddonResponse>>;
36
+ /**
37
+ * Soft delete add-on
38
+ *
39
+ * Soft delete add-on by id.
40
+ *
41
+ * DELETE /openmeter/addons/{addonId}
42
+ */
8
43
  export declare function deleteAddon(client: Client, req: DeleteAddonRequest, options?: RequestOptions): Promise<Result<DeleteAddonResponse>>;
44
+ /**
45
+ * Archive add-on version
46
+ *
47
+ * Archive an add-on version.
48
+ *
49
+ * POST /openmeter/addons/{addonId}/archive
50
+ */
9
51
  export declare function archiveAddon(client: Client, req: ArchiveAddonRequest, options?: RequestOptions): Promise<Result<ArchiveAddonResponse>>;
52
+ /**
53
+ * Publish add-on version
54
+ *
55
+ * Publish an add-on version.
56
+ *
57
+ * POST /openmeter/addons/{addonId}/publish
58
+ */
10
59
  export declare function publishAddon(client: Client, req: PublishAddonRequest, options?: RequestOptions): Promise<Result<PublishAddonResponse>>;
11
- //# sourceMappingURL=addons.d.ts.map
@@ -1,10 +1,21 @@
1
+ // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
1
2
  import { http } from '../core.js';
2
3
  import { request } from '../lib/request.js';
3
4
  import { toURLSearchParams, encodeSort } from '../lib/encodings.js';
4
- import { toWire, fromWire, assertValid, toSnakeCase } from '../lib/wire.js';
5
+ import { toWire, toPathWire, fromWire, assertValid, toSnakeCase, } from '../lib/wire.js';
5
6
  import * as schemas from '../models/schemas.js';
7
+ /**
8
+ * List add-ons
9
+ *
10
+ * List all add-ons.
11
+ *
12
+ * GET /openmeter/addons
13
+ */
6
14
  export function listAddons(client, req = {}, options) {
7
15
  return request(() => {
16
+ if (client._options.validate && req.sort !== undefined) {
17
+ assertValid(schemas.listAddonsQueryParams.shape.sort, req.sort);
18
+ }
8
19
  const query = toWire({
9
20
  page: req.page,
10
21
  sort: encodeSort(req.sort, toSnakeCase),
@@ -25,6 +36,13 @@ export function listAddons(client, req = {}, options) {
25
36
  });
26
37
  });
27
38
  }
39
+ /**
40
+ * Create add-on
41
+ *
42
+ * Create a new add-on.
43
+ *
44
+ * POST /openmeter/addons
45
+ */
28
46
  export function createAddon(client, req, options) {
29
47
  return request(() => {
30
48
  const body = toWire(req, schemas.createAddonBody);
@@ -42,13 +60,29 @@ export function createAddon(client, req, options) {
42
60
  });
43
61
  });
44
62
  }
63
+ /**
64
+ * Update add-on
65
+ *
66
+ * Update an add-on by id.
67
+ *
68
+ * PUT /openmeter/addons/{addonId}
69
+ */
45
70
  export function updateAddon(client, req, options) {
46
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
+ }
47
81
  const path = `openmeter/addons/${(() => {
48
- if (req.addonId === undefined) {
82
+ if (pathParams.addonId === undefined) {
49
83
  throw new Error('missing path parameter: addonId');
50
84
  }
51
- return encodeURIComponent(String(req.addonId));
85
+ return encodeURIComponent(String(pathParams.addonId));
52
86
  })()}`;
53
87
  const body = toWire(req.body, schemas.updateAddonBody);
54
88
  if (client._options.validate) {
@@ -65,13 +99,29 @@ export function updateAddon(client, req, options) {
65
99
  });
66
100
  });
67
101
  }
102
+ /**
103
+ * Get add-on
104
+ *
105
+ * Get add-on by id.
106
+ *
107
+ * GET /openmeter/addons/{addonId}
108
+ */
68
109
  export function getAddon(client, req, options) {
69
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
+ }
70
120
  const path = `openmeter/addons/${(() => {
71
- if (req.addonId === undefined) {
121
+ if (pathParams.addonId === undefined) {
72
122
  throw new Error('missing path parameter: addonId');
73
123
  }
74
- return encodeURIComponent(String(req.addonId));
124
+ return encodeURIComponent(String(pathParams.addonId));
75
125
  })()}`;
76
126
  return http(client)
77
127
  .get(path, options)
@@ -84,24 +134,56 @@ export function getAddon(client, req, options) {
84
134
  });
85
135
  });
86
136
  }
137
+ /**
138
+ * Soft delete add-on
139
+ *
140
+ * Soft delete add-on by id.
141
+ *
142
+ * DELETE /openmeter/addons/{addonId}
143
+ */
87
144
  export function deleteAddon(client, req, options) {
88
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
+ }
89
155
  const path = `openmeter/addons/${(() => {
90
- if (req.addonId === undefined) {
156
+ if (pathParams.addonId === undefined) {
91
157
  throw new Error('missing path parameter: addonId');
92
158
  }
93
- return encodeURIComponent(String(req.addonId));
159
+ return encodeURIComponent(String(pathParams.addonId));
94
160
  })()}`;
95
161
  await http(client).delete(path, options);
96
162
  });
97
163
  }
164
+ /**
165
+ * Archive add-on version
166
+ *
167
+ * Archive an add-on version.
168
+ *
169
+ * POST /openmeter/addons/{addonId}/archive
170
+ */
98
171
  export function archiveAddon(client, req, options) {
99
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
+ }
100
182
  const path = `openmeter/addons/${(() => {
101
- if (req.addonId === undefined) {
183
+ if (pathParams.addonId === undefined) {
102
184
  throw new Error('missing path parameter: addonId');
103
185
  }
104
- return encodeURIComponent(String(req.addonId));
186
+ return encodeURIComponent(String(pathParams.addonId));
105
187
  })()}/archive`;
106
188
  return http(client)
107
189
  .post(path, options)
@@ -114,13 +196,29 @@ export function archiveAddon(client, req, options) {
114
196
  });
115
197
  });
116
198
  }
199
+ /**
200
+ * Publish add-on version
201
+ *
202
+ * Publish an add-on version.
203
+ *
204
+ * POST /openmeter/addons/{addonId}/publish
205
+ */
117
206
  export function publishAddon(client, req, options) {
118
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
+ }
119
217
  const path = `openmeter/addons/${(() => {
120
- if (req.addonId === undefined) {
218
+ if (pathParams.addonId === undefined) {
121
219
  throw new Error('missing path parameter: addonId');
122
220
  }
123
- return encodeURIComponent(String(req.addonId));
221
+ return encodeURIComponent(String(pathParams.addonId));
124
222
  })()}/publish`;
125
223
  return http(client)
126
224
  .post(path, options)
@@ -133,4 +231,3 @@ export function publishAddon(client, req, options) {
133
231
  });
134
232
  });
135
233
  }
136
- //# sourceMappingURL=addons.js.map
@@ -1,6 +1,59 @@
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
+ /**
5
+ * List apps
6
+ *
7
+ * List installed apps.
8
+ *
9
+ * GET /openmeter/apps
10
+ */
4
11
  export declare function listApps(client: Client, req?: ListAppsRequest, options?: RequestOptions): Promise<Result<ListAppsResponse>>;
12
+ /**
13
+ * Get app
14
+ *
15
+ * Get an installed app.
16
+ *
17
+ * GET /openmeter/apps/{appId}
18
+ */
5
19
  export declare function getApp(client: Client, req: GetAppRequest, options?: RequestOptions): Promise<Result<GetAppResponse>>;
6
- //# sourceMappingURL=apps.d.ts.map
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>>;
@@ -1,8 +1,16 @@
1
+ // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
1
2
  import { http } from '../core.js';
2
3
  import { request } from '../lib/request.js';
3
4
  import { toURLSearchParams } from '../lib/encodings.js';
4
- import { toWire, fromWire, assertValid } from '../lib/wire.js';
5
+ import { toWire, toPathWire, fromWire, assertValid } from '../lib/wire.js';
5
6
  import * as schemas from '../models/schemas.js';
7
+ /**
8
+ * List apps
9
+ *
10
+ * List installed apps.
11
+ *
12
+ * GET /openmeter/apps
13
+ */
6
14
  export function listApps(client, req = {}, options) {
7
15
  return request(() => {
8
16
  const query = toWire({
@@ -23,13 +31,29 @@ export function listApps(client, req = {}, options) {
23
31
  });
24
32
  });
25
33
  }
34
+ /**
35
+ * Get app
36
+ *
37
+ * Get an installed app.
38
+ *
39
+ * GET /openmeter/apps/{appId}
40
+ */
26
41
  export function getApp(client, req, options) {
27
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
+ }
28
52
  const path = `openmeter/apps/${(() => {
29
- if (req.appId === undefined) {
53
+ if (pathParams.appId === undefined) {
30
54
  throw new Error('missing path parameter: appId');
31
55
  }
32
- return encodeURIComponent(String(req.appId));
56
+ return encodeURIComponent(String(pathParams.appId));
33
57
  })()}`;
34
58
  return http(client)
35
59
  .get(path, options)
@@ -42,4 +66,155 @@ export function getApp(client, req, options) {
42
66
  });
43
67
  });
44
68
  }
45
- //# sourceMappingURL=apps.js.map
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
+ }
@@ -1,9 +1,54 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type Result, type RequestOptions } from '../lib/types.js';
3
3
  import type { ListBillingProfilesRequest, ListBillingProfilesResponse, CreateBillingProfileRequest, CreateBillingProfileResponse, GetBillingProfileRequest, GetBillingProfileResponse, UpdateBillingProfileRequest, UpdateBillingProfileResponse, DeleteBillingProfileRequest, DeleteBillingProfileResponse } from '../models/operations/billing.js';
4
+ /**
5
+ * List billing profiles
6
+ *
7
+ * List billing profiles.
8
+ *
9
+ * GET /openmeter/profiles
10
+ */
4
11
  export declare function listBillingProfiles(client: Client, req?: ListBillingProfilesRequest, options?: RequestOptions): Promise<Result<ListBillingProfilesResponse>>;
12
+ /**
13
+ * Create a new billing profile
14
+ *
15
+ * Create a new billing profile.
16
+ *
17
+ * Billing profiles contain the settings for billing and controls invoice
18
+ * generation. An organization can have multiple billing profiles defined. A
19
+ * billing profile is linked to a specific app. This association is established
20
+ * during the billing profile's creation and remains immutable.
21
+ *
22
+ * POST /openmeter/profiles
23
+ */
5
24
  export declare function createBillingProfile(client: Client, req: CreateBillingProfileRequest, options?: RequestOptions): Promise<Result<CreateBillingProfileResponse>>;
25
+ /**
26
+ * Get a billing profile
27
+ *
28
+ * Get a billing profile.
29
+ *
30
+ * GET /openmeter/profiles/{id}
31
+ */
6
32
  export declare function getBillingProfile(client: Client, req: GetBillingProfileRequest, options?: RequestOptions): Promise<Result<GetBillingProfileResponse>>;
33
+ /**
34
+ * Update a billing profile
35
+ *
36
+ * Update a billing profile.
37
+ *
38
+ * PUT /openmeter/profiles/{id}
39
+ */
7
40
  export declare function updateBillingProfile(client: Client, req: UpdateBillingProfileRequest, options?: RequestOptions): Promise<Result<UpdateBillingProfileResponse>>;
41
+ /**
42
+ * Delete a billing profile
43
+ *
44
+ * Delete a billing profile.
45
+ *
46
+ * Only such billing profiles can be deleted that are:
47
+ *
48
+ * - not the default profile
49
+ * - not pinned to any customer using customer overrides
50
+ * - only have finalized invoices
51
+ *
52
+ * DELETE /openmeter/profiles/{id}
53
+ */
8
54
  export declare function deleteBillingProfile(client: Client, req: DeleteBillingProfileRequest, options?: RequestOptions): Promise<Result<DeleteBillingProfileResponse>>;
9
- //# sourceMappingURL=billing.d.ts.map