@openmeter/client 1.0.0-beta-4d26c6d3c7fe → 1.0.0-beta-e7a04be10ed8

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 +316 -55
  3. package/dist/core.d.ts +0 -1
  4. package/dist/core.js +8 -1
  5. package/dist/funcs/addons.d.ts +49 -1
  6. package/dist/funcs/addons.js +50 -1
  7. package/dist/funcs/apps.d.ts +14 -1
  8. package/dist/funcs/apps.js +15 -1
  9. package/dist/funcs/billing.d.ts +46 -1
  10. package/dist/funcs/billing.js +47 -1
  11. package/dist/funcs/currencies.d.ts +30 -1
  12. package/dist/funcs/currencies.js +31 -1
  13. package/dist/funcs/customers.d.ts +148 -1
  14. package/dist/funcs/customers.js +149 -1
  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 +6 -1
  19. package/dist/funcs/events.d.ts +14 -1
  20. package/dist/funcs/events.js +15 -1
  21. package/dist/funcs/features.d.ts +42 -1
  22. package/dist/funcs/features.js +43 -1
  23. package/dist/funcs/index.d.ts +0 -3
  24. package/dist/funcs/index.js +1 -3
  25. package/dist/funcs/llmCost.d.ts +36 -1
  26. package/dist/funcs/llmCost.js +37 -1
  27. package/dist/funcs/meters.d.ts +53 -1
  28. package/dist/funcs/meters.js +54 -1
  29. package/dist/funcs/planAddons.d.ts +35 -1
  30. package/dist/funcs/planAddons.js +36 -1
  31. package/dist/funcs/plans.d.ts +49 -1
  32. package/dist/funcs/plans.js +50 -1
  33. package/dist/funcs/subscriptions.d.ts +59 -1
  34. package/dist/funcs/subscriptions.js +60 -1
  35. package/dist/funcs/tax.d.ts +25 -1
  36. package/dist/funcs/tax.js +26 -1
  37. package/dist/index.d.ts +4 -8
  38. package/dist/index.js +4 -5
  39. package/dist/lib/config.d.ts +0 -1
  40. package/dist/lib/config.js +1 -1
  41. package/dist/lib/encodings.d.ts +0 -1
  42. package/dist/lib/encodings.js +1 -1
  43. package/dist/lib/paginate.d.ts +56 -0
  44. package/dist/lib/paginate.js +60 -0
  45. package/dist/lib/request.d.ts +0 -1
  46. package/dist/lib/request.js +1 -1
  47. package/dist/lib/to-error.d.ts +0 -1
  48. package/dist/lib/to-error.js +1 -1
  49. package/dist/lib/types.d.ts +0 -1
  50. package/dist/lib/types.js +1 -1
  51. package/dist/lib/version.d.ts +1 -0
  52. package/dist/lib/version.js +5 -0
  53. package/dist/lib/wire.d.ts +3 -1
  54. package/dist/lib/wire.js +93 -4
  55. package/dist/models/errors.d.ts +13 -2
  56. package/dist/models/errors.js +31 -4
  57. package/dist/models/operations/addons.d.ts +0 -1
  58. package/dist/models/operations/addons.js +1 -1
  59. package/dist/models/operations/apps.d.ts +2 -5
  60. package/dist/models/operations/apps.js +1 -1
  61. package/dist/models/operations/billing.d.ts +0 -1
  62. package/dist/models/operations/billing.js +1 -1
  63. package/dist/models/operations/currencies.d.ts +0 -1
  64. package/dist/models/operations/currencies.js +1 -1
  65. package/dist/models/operations/customers.d.ts +3 -6
  66. package/dist/models/operations/customers.js +1 -1
  67. package/dist/models/operations/defaults.d.ts +0 -1
  68. package/dist/models/operations/defaults.js +1 -1
  69. package/dist/models/operations/entitlements.d.ts +0 -1
  70. package/dist/models/operations/entitlements.js +1 -1
  71. package/dist/models/operations/events.d.ts +0 -1
  72. package/dist/models/operations/events.js +1 -1
  73. package/dist/models/operations/features.d.ts +0 -1
  74. package/dist/models/operations/features.js +1 -1
  75. package/dist/models/operations/llmCost.d.ts +0 -1
  76. package/dist/models/operations/llmCost.js +1 -1
  77. package/dist/models/operations/meters.d.ts +0 -1
  78. package/dist/models/operations/meters.js +1 -1
  79. package/dist/models/operations/planAddons.d.ts +0 -1
  80. package/dist/models/operations/planAddons.js +1 -1
  81. package/dist/models/operations/plans.d.ts +0 -1
  82. package/dist/models/operations/plans.js +1 -1
  83. package/dist/models/operations/subscriptions.d.ts +0 -1
  84. package/dist/models/operations/subscriptions.js +1 -1
  85. package/dist/models/operations/tax.d.ts +0 -1
  86. package/dist/models/operations/tax.js +1 -1
  87. package/dist/models/schemas.d.ts +4453 -6950
  88. package/dist/models/schemas.js +1 -73
  89. package/dist/models/types.d.ts +381 -566
  90. package/dist/models/types.js +1 -1
  91. package/dist/sdk/addons.d.ts +60 -1
  92. package/dist/sdk/addons.js +63 -1
  93. package/dist/sdk/apps.d.ts +25 -1
  94. package/dist/sdk/apps.js +28 -1
  95. package/dist/sdk/billing.d.ts +57 -1
  96. package/dist/sdk/billing.js +60 -1
  97. package/dist/sdk/customers.d.ts +194 -1
  98. package/dist/sdk/customers.js +203 -1
  99. package/dist/sdk/defaults.d.ts +10 -1
  100. package/dist/sdk/defaults.js +11 -1
  101. package/dist/sdk/entitlements.d.ts +5 -1
  102. package/dist/sdk/entitlements.js +6 -1
  103. package/dist/sdk/events.d.ts +25 -1
  104. package/dist/sdk/events.js +28 -1
  105. package/dist/sdk/features.d.ts +53 -1
  106. package/dist/sdk/features.js +56 -1
  107. package/dist/sdk/internal.d.ts +89 -0
  108. package/dist/sdk/internal.js +113 -0
  109. package/dist/sdk/llmCost.d.ts +57 -1
  110. package/dist/sdk/llmCost.js +62 -1
  111. package/dist/sdk/meters.d.ts +64 -1
  112. package/dist/sdk/meters.js +67 -1
  113. package/dist/sdk/planAddons.d.ts +46 -1
  114. package/dist/sdk/planAddons.js +49 -1
  115. package/dist/sdk/plans.d.ts +60 -1
  116. package/dist/sdk/plans.js +63 -1
  117. package/dist/sdk/sdk.d.ts +9 -10
  118. package/dist/sdk/sdk.js +11 -15
  119. package/dist/sdk/subscriptions.d.ts +72 -3
  120. package/dist/sdk/subscriptions.js +77 -5
  121. package/dist/sdk/tax.d.ts +34 -1
  122. package/dist/sdk/tax.js +37 -1
  123. package/package.json +28 -4
  124. package/dist/funcs/governance.d.ts +0 -5
  125. package/dist/funcs/governance.js +0 -34
  126. package/dist/funcs/invoices.d.ts +0 -8
  127. package/dist/funcs/invoices.js +0 -81
  128. package/dist/models/operations/governance.d.ts +0 -10
  129. package/dist/models/operations/governance.js +0 -2
  130. package/dist/models/operations/invoices.d.ts +0 -48
  131. package/dist/models/operations/invoices.js +0 -2
  132. package/dist/sdk/currencies.d.ts +0 -12
  133. package/dist/sdk/currencies.js +0 -21
  134. package/dist/sdk/governance.d.ts +0 -9
  135. package/dist/sdk/governance.js +0 -12
  136. package/dist/sdk/invoices.d.ts +0 -12
  137. package/dist/sdk/invoices.js +0 -21
@@ -0,0 +1,113 @@
1
+ // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
2
+ import { unwrap } from '../lib/types.js';
3
+ import { paginatePages } from '../lib/paginate.js';
4
+ import { createSubscriptionAddon } from '../funcs/subscriptions.js';
5
+ import { listCurrencies, createCustomCurrency, listCostBases, createCostBasis, } from '../funcs/currencies.js';
6
+ /**
7
+ * Operations marked internal in the API definition. They are not part of
8
+ * the customer surface: they may require additional permissions, and they
9
+ * can change or be removed without notice or semver consideration.
10
+ */
11
+ export class Internal {
12
+ _client;
13
+ constructor(_client) {
14
+ this._client = _client;
15
+ }
16
+ _subscriptions;
17
+ get subscriptions() {
18
+ return (this._subscriptions ??= new InternalSubscriptions(this._client));
19
+ }
20
+ _currencies;
21
+ get currencies() {
22
+ return (this._currencies ??= new InternalCurrencies(this._client));
23
+ }
24
+ }
25
+ export class InternalSubscriptions {
26
+ _client;
27
+ constructor(_client) {
28
+ this._client = _client;
29
+ }
30
+ /**
31
+ * Create a new subscription add-on
32
+ *
33
+ * Add add-on to a subscription.
34
+ *
35
+ * POST /openmeter/subscriptions/{subscriptionId}/addons
36
+ */
37
+ async createAddon(request, options) {
38
+ return unwrap(await createSubscriptionAddon(this._client, request, options));
39
+ }
40
+ }
41
+ export class InternalCurrencies {
42
+ _client;
43
+ constructor(_client) {
44
+ this._client = _client;
45
+ }
46
+ /**
47
+ * List currencies
48
+ *
49
+ * List currencies supported by the billing system.
50
+ *
51
+ * GET /openmeter/currencies
52
+ */
53
+ async list(request, options) {
54
+ return unwrap(await listCurrencies(this._client, request, options));
55
+ }
56
+ /**
57
+ * List currencies
58
+ *
59
+ * List currencies supported by the billing system.
60
+ *
61
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
62
+ *
63
+ * GET /openmeter/currencies
64
+ */
65
+ listAll(request, options) {
66
+ return paginatePages((req, opts) => listCurrencies(this._client, req, opts), request ?? {}, options);
67
+ }
68
+ /**
69
+ * Create custom currency
70
+ *
71
+ * Create a custom currency. This operation allows defining your own custom
72
+ * currency for billing purposes.
73
+ *
74
+ * POST /openmeter/currencies/custom
75
+ */
76
+ async createCustomCurrency(request, options) {
77
+ return unwrap(await createCustomCurrency(this._client, request, options));
78
+ }
79
+ /**
80
+ * List cost bases
81
+ *
82
+ * List cost bases for a currency. For custom currencies, there can be multiple
83
+ * cost bases with different `effective_from` dates.
84
+ *
85
+ * GET /openmeter/currencies/custom/{currencyId}/cost-bases
86
+ */
87
+ async listCostBases(request, options) {
88
+ return unwrap(await listCostBases(this._client, request, options));
89
+ }
90
+ /**
91
+ * List cost bases
92
+ *
93
+ * List cost bases for a currency. For custom currencies, there can be multiple
94
+ * cost bases with different `effective_from` dates.
95
+ *
96
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
97
+ *
98
+ * GET /openmeter/currencies/custom/{currencyId}/cost-bases
99
+ */
100
+ listCostBasesAll(request, options) {
101
+ return paginatePages((req, opts) => listCostBases(this._client, req, opts), request, options);
102
+ }
103
+ /**
104
+ * Create cost basis
105
+ *
106
+ * Create a cost basis for a currency.
107
+ *
108
+ * POST /openmeter/currencies/custom/{currencyId}/cost-bases
109
+ */
110
+ async createCostBasis(request, options) {
111
+ return unwrap(await createCostBasis(this._client, request, options));
112
+ }
113
+ }
@@ -1,13 +1,69 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type RequestOptions } from '../lib/types.js';
3
3
  import type { ListLlmCostPricesRequest, ListLlmCostPricesResponse, GetLlmCostPriceRequest, GetLlmCostPriceResponse, ListLlmCostOverridesRequest, ListLlmCostOverridesResponse, CreateLlmCostOverrideRequest, CreateLlmCostOverrideResponse, DeleteLlmCostOverrideRequest, DeleteLlmCostOverrideResponse } from '../models/operations/llmCost.js';
4
+ import type { LlmCostPrice } from '../models/types.js';
4
5
  export declare class LLMCost {
5
6
  private readonly _client;
6
7
  constructor(_client: Client);
8
+ /**
9
+ * List LLM cost prices
10
+ *
11
+ * List global LLM cost prices. Returns prices with overrides applied if any.
12
+ *
13
+ * GET /openmeter/llm-cost/prices
14
+ */
7
15
  listPrices(request?: ListLlmCostPricesRequest, options?: RequestOptions): Promise<ListLlmCostPricesResponse>;
16
+ /**
17
+ * List LLM cost prices
18
+ *
19
+ * List global LLM cost prices. Returns prices with overrides applied if any.
20
+ *
21
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
22
+ *
23
+ * GET /openmeter/llm-cost/prices
24
+ */
25
+ listPricesAll(request?: ListLlmCostPricesRequest, options?: RequestOptions): AsyncIterable<LlmCostPrice>;
26
+ /**
27
+ * Get LLM cost price
28
+ *
29
+ * Get a specific LLM cost price by ID. Returns the price with overrides applied if
30
+ * any.
31
+ *
32
+ * GET /openmeter/llm-cost/prices/{priceId}
33
+ */
8
34
  getPrice(request: GetLlmCostPriceRequest, options?: RequestOptions): Promise<GetLlmCostPriceResponse>;
35
+ /**
36
+ * List LLM cost overrides
37
+ *
38
+ * List per-namespace price overrides.
39
+ *
40
+ * GET /openmeter/llm-cost/overrides
41
+ */
9
42
  listOverrides(request?: ListLlmCostOverridesRequest, options?: RequestOptions): Promise<ListLlmCostOverridesResponse>;
43
+ /**
44
+ * List LLM cost overrides
45
+ *
46
+ * List per-namespace price overrides.
47
+ *
48
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
49
+ *
50
+ * GET /openmeter/llm-cost/overrides
51
+ */
52
+ listOverridesAll(request?: ListLlmCostOverridesRequest, options?: RequestOptions): AsyncIterable<LlmCostPrice>;
53
+ /**
54
+ * Create LLM cost override
55
+ *
56
+ * Create a per-namespace price override.
57
+ *
58
+ * POST /openmeter/llm-cost/overrides
59
+ */
10
60
  createOverride(request: CreateLlmCostOverrideRequest, options?: RequestOptions): Promise<CreateLlmCostOverrideResponse>;
61
+ /**
62
+ * Delete LLM cost override
63
+ *
64
+ * Delete a per-namespace price override.
65
+ *
66
+ * DELETE /openmeter/llm-cost/overrides/{priceId}
67
+ */
11
68
  deleteOverride(request: DeleteLlmCostOverrideRequest, options?: RequestOptions): Promise<DeleteLlmCostOverrideResponse>;
12
69
  }
13
- //# sourceMappingURL=llmCost.d.ts.map
@@ -1,24 +1,85 @@
1
+ // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
1
2
  import { unwrap } from '../lib/types.js';
3
+ import { paginatePages } from '../lib/paginate.js';
2
4
  import { listLlmCostPrices, getLlmCostPrice, listLlmCostOverrides, createLlmCostOverride, deleteLlmCostOverride, } from '../funcs/llmCost.js';
3
5
  export class LLMCost {
4
6
  _client;
5
7
  constructor(_client) {
6
8
  this._client = _client;
7
9
  }
10
+ /**
11
+ * List LLM cost prices
12
+ *
13
+ * List global LLM cost prices. Returns prices with overrides applied if any.
14
+ *
15
+ * GET /openmeter/llm-cost/prices
16
+ */
8
17
  async listPrices(request, options) {
9
18
  return unwrap(await listLlmCostPrices(this._client, request, options));
10
19
  }
20
+ /**
21
+ * List LLM cost prices
22
+ *
23
+ * List global LLM cost prices. Returns prices with overrides applied if any.
24
+ *
25
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
26
+ *
27
+ * GET /openmeter/llm-cost/prices
28
+ */
29
+ listPricesAll(request, options) {
30
+ return paginatePages((req, opts) => listLlmCostPrices(this._client, req, opts), request ?? {}, options);
31
+ }
32
+ /**
33
+ * Get LLM cost price
34
+ *
35
+ * Get a specific LLM cost price by ID. Returns the price with overrides applied if
36
+ * any.
37
+ *
38
+ * GET /openmeter/llm-cost/prices/{priceId}
39
+ */
11
40
  async getPrice(request, options) {
12
41
  return unwrap(await getLlmCostPrice(this._client, request, options));
13
42
  }
43
+ /**
44
+ * List LLM cost overrides
45
+ *
46
+ * List per-namespace price overrides.
47
+ *
48
+ * GET /openmeter/llm-cost/overrides
49
+ */
14
50
  async listOverrides(request, options) {
15
51
  return unwrap(await listLlmCostOverrides(this._client, request, options));
16
52
  }
53
+ /**
54
+ * List LLM cost overrides
55
+ *
56
+ * List per-namespace price overrides.
57
+ *
58
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
59
+ *
60
+ * GET /openmeter/llm-cost/overrides
61
+ */
62
+ listOverridesAll(request, options) {
63
+ return paginatePages((req, opts) => listLlmCostOverrides(this._client, req, opts), request ?? {}, options);
64
+ }
65
+ /**
66
+ * Create LLM cost override
67
+ *
68
+ * Create a per-namespace price override.
69
+ *
70
+ * POST /openmeter/llm-cost/overrides
71
+ */
17
72
  async createOverride(request, options) {
18
73
  return unwrap(await createLlmCostOverride(this._client, request, options));
19
74
  }
75
+ /**
76
+ * Delete LLM cost override
77
+ *
78
+ * Delete a per-namespace price override.
79
+ *
80
+ * DELETE /openmeter/llm-cost/overrides/{priceId}
81
+ */
20
82
  async deleteOverride(request, options) {
21
83
  return unwrap(await deleteLlmCostOverride(this._client, request, options));
22
84
  }
23
85
  }
24
- //# sourceMappingURL=llmCost.js.map
@@ -1,15 +1,78 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type RequestOptions } from '../lib/types.js';
3
3
  import type { CreateMeterRequest, CreateMeterResponse, GetMeterRequest, GetMeterResponse, ListMetersRequest, ListMetersResponse, UpdateMeterRequest, UpdateMeterResponse, DeleteMeterRequest, DeleteMeterResponse, QueryMeterRequest, QueryMeterResponse, QueryMeterCsvRequest, QueryMeterCsvResponse } from '../models/operations/meters.js';
4
+ import type { Meter } from '../models/types.js';
4
5
  export declare class Meters {
5
6
  private readonly _client;
6
7
  constructor(_client: Client);
8
+ /**
9
+ * Create meter
10
+ *
11
+ * Create a meter.
12
+ *
13
+ * POST /openmeter/meters
14
+ */
7
15
  create(request: CreateMeterRequest, options?: RequestOptions): Promise<CreateMeterResponse>;
16
+ /**
17
+ * Get meter
18
+ *
19
+ * Get a meter by ID.
20
+ *
21
+ * GET /openmeter/meters/{meterId}
22
+ */
8
23
  get(request: GetMeterRequest, options?: RequestOptions): Promise<GetMeterResponse>;
24
+ /**
25
+ * List meters
26
+ *
27
+ * List meters.
28
+ *
29
+ * GET /openmeter/meters
30
+ */
9
31
  list(request?: ListMetersRequest, options?: RequestOptions): Promise<ListMetersResponse>;
32
+ /**
33
+ * List meters
34
+ *
35
+ * List meters.
36
+ *
37
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
38
+ *
39
+ * GET /openmeter/meters
40
+ */
41
+ listAll(request?: ListMetersRequest, options?: RequestOptions): AsyncIterable<Meter>;
42
+ /**
43
+ * Update meter
44
+ *
45
+ * Update a meter.
46
+ *
47
+ * PUT /openmeter/meters/{meterId}
48
+ */
10
49
  update(request: UpdateMeterRequest, options?: RequestOptions): Promise<UpdateMeterResponse>;
50
+ /**
51
+ * Delete meter
52
+ *
53
+ * Delete a meter.
54
+ *
55
+ * DELETE /openmeter/meters/{meterId}
56
+ */
11
57
  delete(request: DeleteMeterRequest, options?: RequestOptions): Promise<DeleteMeterResponse>;
58
+ /**
59
+ * Query meter
60
+ *
61
+ * Query a meter for usage.
62
+ *
63
+ * Set `Accept: application/json` (the default) to get a structured JSON response.
64
+ * Set `Accept: text/csv` to download the same data as a CSV file suitable for
65
+ * spreadsheets. The CSV columns, in order, are:
66
+ *
67
+ * `from, to, [subject,] [customer_id, customer_key, customer_name,] <dimensions...>, value`
68
+ *
69
+ * The `subject` column is emitted only when `subject` is in the query's
70
+ * `group_by_dimensions`. The three `customer_*` columns are emitted together only
71
+ * when `customer_id` is in the query's `group_by_dimensions`.
72
+ *
73
+ * POST /openmeter/meters/{meterId}/query
74
+ */
12
75
  query(request: QueryMeterRequest, options?: RequestOptions): Promise<QueryMeterResponse>;
76
+ /** POST /openmeter/meters/{meterId}/query */
13
77
  queryCsv(request: QueryMeterCsvRequest, options?: RequestOptions): Promise<QueryMeterCsvResponse>;
14
78
  }
15
- //# sourceMappingURL=meters.d.ts.map
@@ -1,30 +1,96 @@
1
+ // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
1
2
  import { unwrap } from '../lib/types.js';
3
+ import { paginatePages } from '../lib/paginate.js';
2
4
  import { createMeter, getMeter, listMeters, updateMeter, deleteMeter, queryMeter, queryMeterCsv, } from '../funcs/meters.js';
3
5
  export class Meters {
4
6
  _client;
5
7
  constructor(_client) {
6
8
  this._client = _client;
7
9
  }
10
+ /**
11
+ * Create meter
12
+ *
13
+ * Create a meter.
14
+ *
15
+ * POST /openmeter/meters
16
+ */
8
17
  async create(request, options) {
9
18
  return unwrap(await createMeter(this._client, request, options));
10
19
  }
20
+ /**
21
+ * Get meter
22
+ *
23
+ * Get a meter by ID.
24
+ *
25
+ * GET /openmeter/meters/{meterId}
26
+ */
11
27
  async get(request, options) {
12
28
  return unwrap(await getMeter(this._client, request, options));
13
29
  }
30
+ /**
31
+ * List meters
32
+ *
33
+ * List meters.
34
+ *
35
+ * GET /openmeter/meters
36
+ */
14
37
  async list(request, options) {
15
38
  return unwrap(await listMeters(this._client, request, options));
16
39
  }
40
+ /**
41
+ * List meters
42
+ *
43
+ * List meters.
44
+ *
45
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
46
+ *
47
+ * GET /openmeter/meters
48
+ */
49
+ listAll(request, options) {
50
+ return paginatePages((req, opts) => listMeters(this._client, req, opts), request ?? {}, options);
51
+ }
52
+ /**
53
+ * Update meter
54
+ *
55
+ * Update a meter.
56
+ *
57
+ * PUT /openmeter/meters/{meterId}
58
+ */
17
59
  async update(request, options) {
18
60
  return unwrap(await updateMeter(this._client, request, options));
19
61
  }
62
+ /**
63
+ * Delete meter
64
+ *
65
+ * Delete a meter.
66
+ *
67
+ * DELETE /openmeter/meters/{meterId}
68
+ */
20
69
  async delete(request, options) {
21
70
  return unwrap(await deleteMeter(this._client, request, options));
22
71
  }
72
+ /**
73
+ * Query meter
74
+ *
75
+ * Query a meter for usage.
76
+ *
77
+ * Set `Accept: application/json` (the default) to get a structured JSON response.
78
+ * Set `Accept: text/csv` to download the same data as a CSV file suitable for
79
+ * spreadsheets. The CSV columns, in order, are:
80
+ *
81
+ * `from, to, [subject,] [customer_id, customer_key, customer_name,] <dimensions...>, value`
82
+ *
83
+ * The `subject` column is emitted only when `subject` is in the query's
84
+ * `group_by_dimensions`. The three `customer_*` columns are emitted together only
85
+ * when `customer_id` is in the query's `group_by_dimensions`.
86
+ *
87
+ * POST /openmeter/meters/{meterId}/query
88
+ */
23
89
  async query(request, options) {
24
90
  return unwrap(await queryMeter(this._client, request, options));
25
91
  }
92
+ /** POST /openmeter/meters/{meterId}/query */
26
93
  async queryCsv(request, options) {
27
94
  return unwrap(await queryMeterCsv(this._client, request, options));
28
95
  }
29
96
  }
30
- //# sourceMappingURL=meters.js.map
@@ -1,13 +1,58 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type RequestOptions } from '../lib/types.js';
3
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
+ */
7
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>;
26
+ /**
27
+ * Add add-on to plan
28
+ *
29
+ * Add an add-on to a plan.
30
+ *
31
+ * POST /openmeter/plans/{planId}/addons
32
+ */
8
33
  create(request: CreatePlanAddonRequest, options?: RequestOptions): Promise<CreatePlanAddonResponse>;
34
+ /**
35
+ * Get add-on association for plan
36
+ *
37
+ * Get an add-on association for a plan.
38
+ *
39
+ * GET /openmeter/plans/{planId}/addons/{planAddonId}
40
+ */
9
41
  get(request: GetPlanAddonRequest, options?: RequestOptions): Promise<GetPlanAddonResponse>;
42
+ /**
43
+ * Update add-on association for plan
44
+ *
45
+ * Update an add-on association for a plan.
46
+ *
47
+ * PUT /openmeter/plans/{planId}/addons/{planAddonId}
48
+ */
10
49
  update(request: UpdatePlanAddonRequest, options?: RequestOptions): Promise<UpdatePlanAddonResponse>;
50
+ /**
51
+ * Remove add-on from plan
52
+ *
53
+ * Remove an add-on from a plan.
54
+ *
55
+ * DELETE /openmeter/plans/{planId}/addons/{planAddonId}
56
+ */
11
57
  delete(request: DeletePlanAddonRequest, options?: RequestOptions): Promise<DeletePlanAddonResponse>;
12
58
  }
13
- //# sourceMappingURL=planAddons.d.ts.map
@@ -1,24 +1,72 @@
1
+ // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
1
2
  import { unwrap } from '../lib/types.js';
3
+ import { paginatePages } from '../lib/paginate.js';
2
4
  import { listPlanAddons, createPlanAddon, getPlanAddon, updatePlanAddon, deletePlanAddon, } from '../funcs/planAddons.js';
3
5
  export class PlanAddons {
4
6
  _client;
5
7
  constructor(_client) {
6
8
  this._client = _client;
7
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
+ */
8
17
  async list(request, options) {
9
18
  return unwrap(await listPlanAddons(this._client, request, options));
10
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
+ }
32
+ /**
33
+ * Add add-on to plan
34
+ *
35
+ * Add an add-on to a plan.
36
+ *
37
+ * POST /openmeter/plans/{planId}/addons
38
+ */
11
39
  async create(request, options) {
12
40
  return unwrap(await createPlanAddon(this._client, request, options));
13
41
  }
42
+ /**
43
+ * Get add-on association for plan
44
+ *
45
+ * Get an add-on association for a plan.
46
+ *
47
+ * GET /openmeter/plans/{planId}/addons/{planAddonId}
48
+ */
14
49
  async get(request, options) {
15
50
  return unwrap(await getPlanAddon(this._client, request, options));
16
51
  }
52
+ /**
53
+ * Update add-on association for plan
54
+ *
55
+ * Update an add-on association for a plan.
56
+ *
57
+ * PUT /openmeter/plans/{planId}/addons/{planAddonId}
58
+ */
17
59
  async update(request, options) {
18
60
  return unwrap(await updatePlanAddon(this._client, request, options));
19
61
  }
62
+ /**
63
+ * Remove add-on from plan
64
+ *
65
+ * Remove an add-on from a plan.
66
+ *
67
+ * DELETE /openmeter/plans/{planId}/addons/{planAddonId}
68
+ */
20
69
  async delete(request, options) {
21
70
  return unwrap(await deletePlanAddon(this._client, request, options));
22
71
  }
23
72
  }
24
- //# sourceMappingURL=planAddons.js.map
@@ -1,15 +1,74 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type RequestOptions } from '../lib/types.js';
3
3
  import type { ListPlansRequest, ListPlansResponse, CreatePlanRequest, CreatePlanResponse, UpdatePlanRequest, UpdatePlanResponse, GetPlanRequest, GetPlanResponse, DeletePlanRequest, DeletePlanResponse, ArchivePlanRequest, ArchivePlanResponse, PublishPlanRequest, PublishPlanResponse } from '../models/operations/plans.js';
4
+ import type { Plan } from '../models/types.js';
4
5
  export declare class Plans {
5
6
  private readonly _client;
6
7
  constructor(_client: Client);
8
+ /**
9
+ * List plans
10
+ *
11
+ * List all plans.
12
+ *
13
+ * GET /openmeter/plans
14
+ */
7
15
  list(request?: ListPlansRequest, options?: RequestOptions): Promise<ListPlansResponse>;
16
+ /**
17
+ * List plans
18
+ *
19
+ * List all plans.
20
+ *
21
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
22
+ *
23
+ * GET /openmeter/plans
24
+ */
25
+ listAll(request?: ListPlansRequest, options?: RequestOptions): AsyncIterable<Plan>;
26
+ /**
27
+ * Create plan
28
+ *
29
+ * Create a new plan.
30
+ *
31
+ * POST /openmeter/plans
32
+ */
8
33
  create(request: CreatePlanRequest, options?: RequestOptions): Promise<CreatePlanResponse>;
34
+ /**
35
+ * Update plan
36
+ *
37
+ * Update a plan by id.
38
+ *
39
+ * PUT /openmeter/plans/{planId}
40
+ */
9
41
  update(request: UpdatePlanRequest, options?: RequestOptions): Promise<UpdatePlanResponse>;
42
+ /**
43
+ * Get plan
44
+ *
45
+ * Get a plan by id.
46
+ *
47
+ * GET /openmeter/plans/{planId}
48
+ */
10
49
  get(request: GetPlanRequest, options?: RequestOptions): Promise<GetPlanResponse>;
50
+ /**
51
+ * Delete plan
52
+ *
53
+ * Delete a plan by id.
54
+ *
55
+ * DELETE /openmeter/plans/{planId}
56
+ */
11
57
  delete(request: DeletePlanRequest, options?: RequestOptions): Promise<DeletePlanResponse>;
58
+ /**
59
+ * Archive plan version
60
+ *
61
+ * Archive a plan version.
62
+ *
63
+ * POST /openmeter/plans/{planId}/archive
64
+ */
12
65
  archive(request: ArchivePlanRequest, options?: RequestOptions): Promise<ArchivePlanResponse>;
66
+ /**
67
+ * Publish plan version
68
+ *
69
+ * Publish a plan version.
70
+ *
71
+ * POST /openmeter/plans/{planId}/publish
72
+ */
13
73
  publish(request: PublishPlanRequest, options?: RequestOptions): Promise<PublishPlanResponse>;
14
74
  }
15
- //# sourceMappingURL=plans.d.ts.map