@openmeter/client 1.0.0-beta-62b7ce950326 → 1.0.0-beta-106e6d4e7951

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.
@@ -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
  * Create customer
@@ -33,11 +33,20 @@ export function createCustomer(client, req, options) {
33
33
  */
34
34
  export function getCustomer(client, req, options) {
35
35
  return request(() => {
36
+ const pathParamsInput = {
37
+ customerId: req.customerId,
38
+ };
39
+ const pathParams = client._options.validate
40
+ ? toPathWire(pathParamsInput, schemas.getCustomerPathParams)
41
+ : pathParamsInput;
42
+ if (client._options.validate) {
43
+ assertValid(schemas.getCustomerPathParamsWire, pathParams);
44
+ }
36
45
  const path = `openmeter/customers/${(() => {
37
- if (req.customerId === undefined) {
46
+ if (pathParams.customerId === undefined) {
38
47
  throw new Error('missing path parameter: customerId');
39
48
  }
40
- return encodeURIComponent(String(req.customerId));
49
+ return encodeURIComponent(String(pathParams.customerId));
41
50
  })()}`;
42
51
  return http(client)
43
52
  .get(path, options)
@@ -57,6 +66,9 @@ export function getCustomer(client, req, options) {
57
66
  */
58
67
  export function listCustomers(client, req = {}, options) {
59
68
  return request(() => {
69
+ if (client._options.validate && req.sort !== undefined) {
70
+ assertValid(schemas.listCustomersQueryParams.shape.sort, req.sort);
71
+ }
60
72
  const query = toWire({
61
73
  page: req.page,
62
74
  sort: encodeSort(req.sort, toSnakeCase),
@@ -84,11 +96,20 @@ export function listCustomers(client, req = {}, options) {
84
96
  */
85
97
  export function upsertCustomer(client, req, options) {
86
98
  return request(() => {
99
+ const pathParamsInput = {
100
+ customerId: req.customerId,
101
+ };
102
+ const pathParams = client._options.validate
103
+ ? toPathWire(pathParamsInput, schemas.upsertCustomerPathParams)
104
+ : pathParamsInput;
105
+ if (client._options.validate) {
106
+ assertValid(schemas.upsertCustomerPathParamsWire, pathParams);
107
+ }
87
108
  const path = `openmeter/customers/${(() => {
88
- if (req.customerId === undefined) {
109
+ if (pathParams.customerId === undefined) {
89
110
  throw new Error('missing path parameter: customerId');
90
111
  }
91
- return encodeURIComponent(String(req.customerId));
112
+ return encodeURIComponent(String(pathParams.customerId));
92
113
  })()}`;
93
114
  const body = toWire(req.body, schemas.upsertCustomerBody);
94
115
  if (client._options.validate) {
@@ -112,11 +133,20 @@ export function upsertCustomer(client, req, options) {
112
133
  */
113
134
  export function deleteCustomer(client, req, options) {
114
135
  return request(async () => {
136
+ const pathParamsInput = {
137
+ customerId: req.customerId,
138
+ };
139
+ const pathParams = client._options.validate
140
+ ? toPathWire(pathParamsInput, schemas.deleteCustomerPathParams)
141
+ : pathParamsInput;
142
+ if (client._options.validate) {
143
+ assertValid(schemas.deleteCustomerPathParamsWire, pathParams);
144
+ }
115
145
  const path = `openmeter/customers/${(() => {
116
- if (req.customerId === undefined) {
146
+ if (pathParams.customerId === undefined) {
117
147
  throw new Error('missing path parameter: customerId');
118
148
  }
119
- return encodeURIComponent(String(req.customerId));
149
+ return encodeURIComponent(String(pathParams.customerId));
120
150
  })()}`;
121
151
  await http(client).delete(path, options);
122
152
  });
@@ -128,11 +158,20 @@ export function deleteCustomer(client, req, options) {
128
158
  */
129
159
  export function getCustomerBilling(client, req, options) {
130
160
  return request(() => {
161
+ const pathParamsInput = {
162
+ customerId: req.customerId,
163
+ };
164
+ const pathParams = client._options.validate
165
+ ? toPathWire(pathParamsInput, schemas.getCustomerBillingPathParams)
166
+ : pathParamsInput;
167
+ if (client._options.validate) {
168
+ assertValid(schemas.getCustomerBillingPathParamsWire, pathParams);
169
+ }
131
170
  const path = `openmeter/customers/${(() => {
132
- if (req.customerId === undefined) {
171
+ if (pathParams.customerId === undefined) {
133
172
  throw new Error('missing path parameter: customerId');
134
173
  }
135
- return encodeURIComponent(String(req.customerId));
174
+ return encodeURIComponent(String(pathParams.customerId));
136
175
  })()}/billing`;
137
176
  return http(client)
138
177
  .get(path, options)
@@ -152,11 +191,20 @@ export function getCustomerBilling(client, req, options) {
152
191
  */
153
192
  export function updateCustomerBilling(client, req, options) {
154
193
  return request(() => {
194
+ const pathParamsInput = {
195
+ customerId: req.customerId,
196
+ };
197
+ const pathParams = client._options.validate
198
+ ? toPathWire(pathParamsInput, schemas.updateCustomerBillingPathParams)
199
+ : pathParamsInput;
200
+ if (client._options.validate) {
201
+ assertValid(schemas.updateCustomerBillingPathParamsWire, pathParams);
202
+ }
155
203
  const path = `openmeter/customers/${(() => {
156
- if (req.customerId === undefined) {
204
+ if (pathParams.customerId === undefined) {
157
205
  throw new Error('missing path parameter: customerId');
158
206
  }
159
- return encodeURIComponent(String(req.customerId));
207
+ return encodeURIComponent(String(pathParams.customerId));
160
208
  })()}/billing`;
161
209
  const body = toWire(req.body, schemas.updateCustomerBillingBody);
162
210
  if (client._options.validate) {
@@ -180,11 +228,20 @@ export function updateCustomerBilling(client, req, options) {
180
228
  */
181
229
  export function updateCustomerBillingAppData(client, req, options) {
182
230
  return request(() => {
231
+ const pathParamsInput = {
232
+ customerId: req.customerId,
233
+ };
234
+ const pathParams = client._options.validate
235
+ ? toPathWire(pathParamsInput, schemas.updateCustomerBillingAppDataPathParams)
236
+ : pathParamsInput;
237
+ if (client._options.validate) {
238
+ assertValid(schemas.updateCustomerBillingAppDataPathParamsWire, pathParams);
239
+ }
183
240
  const path = `openmeter/customers/${(() => {
184
- if (req.customerId === undefined) {
241
+ if (pathParams.customerId === undefined) {
185
242
  throw new Error('missing path parameter: customerId');
186
243
  }
187
- return encodeURIComponent(String(req.customerId));
244
+ return encodeURIComponent(String(pathParams.customerId));
188
245
  })()}/billing/app-data`;
189
246
  const body = toWire(req.body, schemas.updateCustomerBillingAppDataBody);
190
247
  if (client._options.validate) {
@@ -220,11 +277,20 @@ export function updateCustomerBillingAppData(client, req, options) {
220
277
  */
221
278
  export function createCustomerStripeCheckoutSession(client, req, options) {
222
279
  return request(() => {
280
+ const pathParamsInput = {
281
+ customerId: req.customerId,
282
+ };
283
+ const pathParams = client._options.validate
284
+ ? toPathWire(pathParamsInput, schemas.createCustomerStripeCheckoutSessionPathParams)
285
+ : pathParamsInput;
286
+ if (client._options.validate) {
287
+ assertValid(schemas.createCustomerStripeCheckoutSessionPathParamsWire, pathParams);
288
+ }
223
289
  const path = `openmeter/customers/${(() => {
224
- if (req.customerId === undefined) {
290
+ if (pathParams.customerId === undefined) {
225
291
  throw new Error('missing path parameter: customerId');
226
292
  }
227
- return encodeURIComponent(String(req.customerId));
293
+ return encodeURIComponent(String(pathParams.customerId));
228
294
  })()}/billing/stripe/checkout-sessions`;
229
295
  const body = toWire(req.body, schemas.createCustomerStripeCheckoutSessionBody);
230
296
  if (client._options.validate) {
@@ -255,11 +321,20 @@ export function createCustomerStripeCheckoutSession(client, req, options) {
255
321
  */
256
322
  export function createCustomerStripePortalSession(client, req, options) {
257
323
  return request(() => {
324
+ const pathParamsInput = {
325
+ customerId: req.customerId,
326
+ };
327
+ const pathParams = client._options.validate
328
+ ? toPathWire(pathParamsInput, schemas.createCustomerStripePortalSessionPathParams)
329
+ : pathParamsInput;
330
+ if (client._options.validate) {
331
+ assertValid(schemas.createCustomerStripePortalSessionPathParamsWire, pathParams);
332
+ }
258
333
  const path = `openmeter/customers/${(() => {
259
- if (req.customerId === undefined) {
334
+ if (pathParams.customerId === undefined) {
260
335
  throw new Error('missing path parameter: customerId');
261
336
  }
262
- return encodeURIComponent(String(req.customerId));
337
+ return encodeURIComponent(String(pathParams.customerId));
263
338
  })()}/billing/stripe/portal-sessions`;
264
339
  const body = toWire(req.body, schemas.createCustomerStripePortalSessionBody);
265
340
  if (client._options.validate) {
@@ -286,11 +361,20 @@ export function createCustomerStripePortalSession(client, req, options) {
286
361
  */
287
362
  export function createCreditGrant(client, req, options) {
288
363
  return request(() => {
364
+ const pathParamsInput = {
365
+ customerId: req.customerId,
366
+ };
367
+ const pathParams = client._options.validate
368
+ ? toPathWire(pathParamsInput, schemas.createCreditGrantPathParams)
369
+ : pathParamsInput;
370
+ if (client._options.validate) {
371
+ assertValid(schemas.createCreditGrantPathParamsWire, pathParams);
372
+ }
289
373
  const path = `openmeter/customers/${(() => {
290
- if (req.customerId === undefined) {
374
+ if (pathParams.customerId === undefined) {
291
375
  throw new Error('missing path parameter: customerId');
292
376
  }
293
- return encodeURIComponent(String(req.customerId));
377
+ return encodeURIComponent(String(pathParams.customerId));
294
378
  })()}/credits/grants`;
295
379
  const body = toWire(req.body, schemas.createCreditGrantBody);
296
380
  if (client._options.validate) {
@@ -316,16 +400,26 @@ export function createCreditGrant(client, req, options) {
316
400
  */
317
401
  export function getCreditGrant(client, req, options) {
318
402
  return request(() => {
403
+ const pathParamsInput = {
404
+ customerId: req.customerId,
405
+ creditGrantId: req.creditGrantId,
406
+ };
407
+ const pathParams = client._options.validate
408
+ ? toPathWire(pathParamsInput, schemas.getCreditGrantPathParams)
409
+ : pathParamsInput;
410
+ if (client._options.validate) {
411
+ assertValid(schemas.getCreditGrantPathParamsWire, pathParams);
412
+ }
319
413
  const path = `openmeter/customers/${(() => {
320
- if (req.customerId === undefined) {
414
+ if (pathParams.customerId === undefined) {
321
415
  throw new Error('missing path parameter: customerId');
322
416
  }
323
- return encodeURIComponent(String(req.customerId));
417
+ return encodeURIComponent(String(pathParams.customerId));
324
418
  })()}/credits/grants/${(() => {
325
- if (req.creditGrantId === undefined) {
419
+ if (pathParams.creditGrantId === undefined) {
326
420
  throw new Error('missing path parameter: creditGrantId');
327
421
  }
328
- return encodeURIComponent(String(req.creditGrantId));
422
+ return encodeURIComponent(String(pathParams.creditGrantId));
329
423
  })()}`;
330
424
  return http(client)
331
425
  .get(path, options)
@@ -347,11 +441,20 @@ export function getCreditGrant(client, req, options) {
347
441
  */
348
442
  export function listCreditGrants(client, req, options) {
349
443
  return request(() => {
444
+ const pathParamsInput = {
445
+ customerId: req.customerId,
446
+ };
447
+ const pathParams = client._options.validate
448
+ ? toPathWire(pathParamsInput, schemas.listCreditGrantsPathParams)
449
+ : pathParamsInput;
450
+ if (client._options.validate) {
451
+ assertValid(schemas.listCreditGrantsPathParamsWire, pathParams);
452
+ }
350
453
  const path = `openmeter/customers/${(() => {
351
- if (req.customerId === undefined) {
454
+ if (pathParams.customerId === undefined) {
352
455
  throw new Error('missing path parameter: customerId');
353
456
  }
354
- return encodeURIComponent(String(req.customerId));
457
+ return encodeURIComponent(String(pathParams.customerId));
355
458
  })()}/credits/grants`;
356
459
  const query = toWire({
357
460
  page: req.page,
@@ -381,11 +484,20 @@ export function listCreditGrants(client, req, options) {
381
484
  */
382
485
  export function getCustomerCreditBalance(client, req, options) {
383
486
  return request(() => {
487
+ const pathParamsInput = {
488
+ customerId: req.customerId,
489
+ };
490
+ const pathParams = client._options.validate
491
+ ? toPathWire(pathParamsInput, schemas.getCustomerCreditBalancePathParams)
492
+ : pathParamsInput;
493
+ if (client._options.validate) {
494
+ assertValid(schemas.getCustomerCreditBalancePathParamsWire, pathParams);
495
+ }
384
496
  const path = `openmeter/customers/${(() => {
385
- if (req.customerId === undefined) {
497
+ if (pathParams.customerId === undefined) {
386
498
  throw new Error('missing path parameter: customerId');
387
499
  }
388
- return encodeURIComponent(String(req.customerId));
500
+ return encodeURIComponent(String(pathParams.customerId));
389
501
  })()}/credits/balance`;
390
502
  const query = toWire({
391
503
  timestamp: req.timestamp,
@@ -420,11 +532,20 @@ export function getCustomerCreditBalance(client, req, options) {
420
532
  */
421
533
  export function createCreditAdjustment(client, req, options) {
422
534
  return request(() => {
535
+ const pathParamsInput = {
536
+ customerId: req.customerId,
537
+ };
538
+ const pathParams = client._options.validate
539
+ ? toPathWire(pathParamsInput, schemas.createCreditAdjustmentPathParams)
540
+ : pathParamsInput;
541
+ if (client._options.validate) {
542
+ assertValid(schemas.createCreditAdjustmentPathParamsWire, pathParams);
543
+ }
423
544
  const path = `openmeter/customers/${(() => {
424
- if (req.customerId === undefined) {
545
+ if (pathParams.customerId === undefined) {
425
546
  throw new Error('missing path parameter: customerId');
426
547
  }
427
- return encodeURIComponent(String(req.customerId));
548
+ return encodeURIComponent(String(pathParams.customerId));
428
549
  })()}/credits/adjustments`;
429
550
  const body = toWire(req.body, schemas.createCreditAdjustmentBody);
430
551
  if (client._options.validate) {
@@ -458,16 +579,26 @@ export function createCreditAdjustment(client, req, options) {
458
579
  */
459
580
  export function voidCreditGrant(client, req, options) {
460
581
  return request(() => {
582
+ const pathParamsInput = {
583
+ customerId: req.customerId,
584
+ creditGrantId: req.creditGrantId,
585
+ };
586
+ const pathParams = client._options.validate
587
+ ? toPathWire(pathParamsInput, schemas.voidCreditGrantPathParams)
588
+ : pathParamsInput;
589
+ if (client._options.validate) {
590
+ assertValid(schemas.voidCreditGrantPathParamsWire, pathParams);
591
+ }
461
592
  const path = `openmeter/customers/${(() => {
462
- if (req.customerId === undefined) {
593
+ if (pathParams.customerId === undefined) {
463
594
  throw new Error('missing path parameter: customerId');
464
595
  }
465
- return encodeURIComponent(String(req.customerId));
596
+ return encodeURIComponent(String(pathParams.customerId));
466
597
  })()}/credits/grants/${(() => {
467
- if (req.creditGrantId === undefined) {
598
+ if (pathParams.creditGrantId === undefined) {
468
599
  throw new Error('missing path parameter: creditGrantId');
469
600
  }
470
- return encodeURIComponent(String(req.creditGrantId));
601
+ return encodeURIComponent(String(pathParams.creditGrantId));
471
602
  })()}/void`;
472
603
  const body = toWire(req.body, schemas.voidCreditGrantBody);
473
604
  if (client._options.validate) {
@@ -496,16 +627,26 @@ export function voidCreditGrant(client, req, options) {
496
627
  */
497
628
  export function updateCreditGrantExternalSettlement(client, req, options) {
498
629
  return request(() => {
630
+ const pathParamsInput = {
631
+ customerId: req.customerId,
632
+ creditGrantId: req.creditGrantId,
633
+ };
634
+ const pathParams = client._options.validate
635
+ ? toPathWire(pathParamsInput, schemas.updateCreditGrantExternalSettlementPathParams)
636
+ : pathParamsInput;
637
+ if (client._options.validate) {
638
+ assertValid(schemas.updateCreditGrantExternalSettlementPathParamsWire, pathParams);
639
+ }
499
640
  const path = `openmeter/customers/${(() => {
500
- if (req.customerId === undefined) {
641
+ if (pathParams.customerId === undefined) {
501
642
  throw new Error('missing path parameter: customerId');
502
643
  }
503
- return encodeURIComponent(String(req.customerId));
644
+ return encodeURIComponent(String(pathParams.customerId));
504
645
  })()}/credits/grants/${(() => {
505
- if (req.creditGrantId === undefined) {
646
+ if (pathParams.creditGrantId === undefined) {
506
647
  throw new Error('missing path parameter: creditGrantId');
507
648
  }
508
- return encodeURIComponent(String(req.creditGrantId));
649
+ return encodeURIComponent(String(pathParams.creditGrantId));
509
650
  })()}/settlement/external`;
510
651
  const body = toWire(req.body, schemas.updateCreditGrantExternalSettlementBody);
511
652
  if (client._options.validate) {
@@ -535,11 +676,20 @@ export function updateCreditGrantExternalSettlement(client, req, options) {
535
676
  */
536
677
  export function listCreditTransactions(client, req, options) {
537
678
  return request(() => {
679
+ const pathParamsInput = {
680
+ customerId: req.customerId,
681
+ };
682
+ const pathParams = client._options.validate
683
+ ? toPathWire(pathParamsInput, schemas.listCreditTransactionsPathParams)
684
+ : pathParamsInput;
685
+ if (client._options.validate) {
686
+ assertValid(schemas.listCreditTransactionsPathParamsWire, pathParams);
687
+ }
538
688
  const path = `openmeter/customers/${(() => {
539
- if (req.customerId === undefined) {
689
+ if (pathParams.customerId === undefined) {
540
690
  throw new Error('missing path parameter: customerId');
541
691
  }
542
- return encodeURIComponent(String(req.customerId));
692
+ return encodeURIComponent(String(pathParams.customerId));
543
693
  })()}/credits/transactions`;
544
694
  const query = toWire({
545
695
  page: req.page,
@@ -572,12 +722,24 @@ export function listCreditTransactions(client, req, options) {
572
722
  */
573
723
  export function listCustomerCharges(client, req, options) {
574
724
  return request(() => {
725
+ const pathParamsInput = {
726
+ customerId: req.customerId,
727
+ };
728
+ const pathParams = client._options.validate
729
+ ? toPathWire(pathParamsInput, schemas.listCustomerChargesPathParams)
730
+ : pathParamsInput;
731
+ if (client._options.validate) {
732
+ assertValid(schemas.listCustomerChargesPathParamsWire, pathParams);
733
+ }
575
734
  const path = `openmeter/customers/${(() => {
576
- if (req.customerId === undefined) {
735
+ if (pathParams.customerId === undefined) {
577
736
  throw new Error('missing path parameter: customerId');
578
737
  }
579
- return encodeURIComponent(String(req.customerId));
738
+ return encodeURIComponent(String(pathParams.customerId));
580
739
  })()}/charges`;
740
+ if (client._options.validate && req.sort !== undefined) {
741
+ assertValid(schemas.listCustomerChargesQueryParams.shape.sort, req.sort);
742
+ }
581
743
  const query = toWire({
582
744
  page: req.page,
583
745
  sort: encodeSort(req.sort, toSnakeCase),
@@ -608,11 +770,20 @@ export function listCustomerCharges(client, req, options) {
608
770
  */
609
771
  export function createCustomerCharges(client, req, options) {
610
772
  return request(() => {
773
+ const pathParamsInput = {
774
+ customerId: req.customerId,
775
+ };
776
+ const pathParams = client._options.validate
777
+ ? toPathWire(pathParamsInput, schemas.createCustomerChargesPathParams)
778
+ : pathParamsInput;
779
+ if (client._options.validate) {
780
+ assertValid(schemas.createCustomerChargesPathParamsWire, pathParams);
781
+ }
611
782
  const path = `openmeter/customers/${(() => {
612
- if (req.customerId === undefined) {
783
+ if (pathParams.customerId === undefined) {
613
784
  throw new Error('missing path parameter: customerId');
614
785
  }
615
- return encodeURIComponent(String(req.customerId));
786
+ return encodeURIComponent(String(pathParams.customerId));
616
787
  })()}/charges`;
617
788
  const body = toWire(req.body, schemas.createCustomerChargesBody);
618
789
  if (client._options.validate) {
@@ -1,7 +1,7 @@
1
1
  // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
2
2
  import { http } from '../core.js';
3
3
  import { request } from '../lib/request.js';
4
- import { fromWire, assertValid } from '../lib/wire.js';
4
+ import { toPathWire, fromWire, assertValid } from '../lib/wire.js';
5
5
  import * as schemas from '../models/schemas.js';
6
6
  /**
7
7
  * List customer entitlement access
@@ -10,11 +10,20 @@ import * as schemas from '../models/schemas.js';
10
10
  */
11
11
  export function listCustomerEntitlementAccess(client, req, options) {
12
12
  return request(() => {
13
+ const pathParamsInput = {
14
+ customerId: req.customerId,
15
+ };
16
+ const pathParams = client._options.validate
17
+ ? toPathWire(pathParamsInput, schemas.listCustomerEntitlementAccessPathParams)
18
+ : pathParamsInput;
19
+ if (client._options.validate) {
20
+ assertValid(schemas.listCustomerEntitlementAccessPathParamsWire, pathParams);
21
+ }
13
22
  const path = `openmeter/customers/${(() => {
14
- if (req.customerId === undefined) {
23
+ if (pathParams.customerId === undefined) {
15
24
  throw new Error('missing path parameter: customerId');
16
25
  }
17
- return encodeURIComponent(String(req.customerId));
26
+ return encodeURIComponent(String(pathParams.customerId));
18
27
  })()}/entitlement-access`;
19
28
  return http(client)
20
29
  .get(path, options)
@@ -13,6 +13,9 @@ import * as schemas from '../models/schemas.js';
13
13
  */
14
14
  export function listMeteringEvents(client, req = {}, options) {
15
15
  return request(() => {
16
+ if (client._options.validate && req.sort !== undefined) {
17
+ assertValid(schemas.listMeteringEventsQueryParams.shape.sort, req.sort);
18
+ }
16
19
  const query = toWire({
17
20
  page: req.page,
18
21
  filter: req.filter,
@@ -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 features
@@ -13,6 +13,9 @@ import * as schemas from '../models/schemas.js';
13
13
  */
14
14
  export function listFeatures(client, req = {}, options) {
15
15
  return request(() => {
16
+ if (client._options.validate && req.sort !== undefined) {
17
+ assertValid(schemas.listFeaturesQueryParams.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 createFeature(client, req, options) {
66
69
  */
67
70
  export function getFeature(client, req, options) {
68
71
  return request(() => {
72
+ const pathParamsInput = {
73
+ featureId: req.featureId,
74
+ };
75
+ const pathParams = client._options.validate
76
+ ? toPathWire(pathParamsInput, schemas.getFeaturePathParams)
77
+ : pathParamsInput;
78
+ if (client._options.validate) {
79
+ assertValid(schemas.getFeaturePathParamsWire, pathParams);
80
+ }
69
81
  const path = `openmeter/features/${(() => {
70
- if (req.featureId === undefined) {
82
+ if (pathParams.featureId === undefined) {
71
83
  throw new Error('missing path parameter: featureId');
72
84
  }
73
- return encodeURIComponent(String(req.featureId));
85
+ return encodeURIComponent(String(pathParams.featureId));
74
86
  })()}`;
75
87
  return http(client)
76
88
  .get(path, options)
@@ -92,11 +104,20 @@ export function getFeature(client, req, options) {
92
104
  */
93
105
  export function updateFeature(client, req, options) {
94
106
  return request(() => {
107
+ const pathParamsInput = {
108
+ featureId: req.featureId,
109
+ };
110
+ const pathParams = client._options.validate
111
+ ? toPathWire(pathParamsInput, schemas.updateFeaturePathParams)
112
+ : pathParamsInput;
113
+ if (client._options.validate) {
114
+ assertValid(schemas.updateFeaturePathParamsWire, pathParams);
115
+ }
95
116
  const path = `openmeter/features/${(() => {
96
- if (req.featureId === undefined) {
117
+ if (pathParams.featureId === undefined) {
97
118
  throw new Error('missing path parameter: featureId');
98
119
  }
99
- return encodeURIComponent(String(req.featureId));
120
+ return encodeURIComponent(String(pathParams.featureId));
100
121
  })()}`;
101
122
  const body = toWire(req.body, schemas.updateFeatureBody);
102
123
  if (client._options.validate) {
@@ -122,11 +143,20 @@ export function updateFeature(client, req, options) {
122
143
  */
123
144
  export function deleteFeature(client, req, options) {
124
145
  return request(async () => {
146
+ const pathParamsInput = {
147
+ featureId: req.featureId,
148
+ };
149
+ const pathParams = client._options.validate
150
+ ? toPathWire(pathParamsInput, schemas.deleteFeaturePathParams)
151
+ : pathParamsInput;
152
+ if (client._options.validate) {
153
+ assertValid(schemas.deleteFeaturePathParamsWire, pathParams);
154
+ }
125
155
  const path = `openmeter/features/${(() => {
126
- if (req.featureId === undefined) {
156
+ if (pathParams.featureId === undefined) {
127
157
  throw new Error('missing path parameter: featureId');
128
158
  }
129
- return encodeURIComponent(String(req.featureId));
159
+ return encodeURIComponent(String(pathParams.featureId));
130
160
  })()}`;
131
161
  await http(client).delete(path, options);
132
162
  });
@@ -140,11 +170,20 @@ export function deleteFeature(client, req, options) {
140
170
  */
141
171
  export function queryFeatureCost(client, req, options) {
142
172
  return request(() => {
173
+ const pathParamsInput = {
174
+ featureId: req.featureId,
175
+ };
176
+ const pathParams = client._options.validate
177
+ ? toPathWire(pathParamsInput, schemas.queryFeatureCostPathParams)
178
+ : pathParamsInput;
179
+ if (client._options.validate) {
180
+ assertValid(schemas.queryFeatureCostPathParamsWire, pathParams);
181
+ }
143
182
  const path = `openmeter/features/${(() => {
144
- if (req.featureId === undefined) {
183
+ if (pathParams.featureId === undefined) {
145
184
  throw new Error('missing path parameter: featureId');
146
185
  }
147
- return encodeURIComponent(String(req.featureId));
186
+ return encodeURIComponent(String(pathParams.featureId));
148
187
  })()}/cost/query`;
149
188
  const body = toWire(req.body, schemas.queryFeatureCostBody);
150
189
  if (client._options.validate) {