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

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 (135) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +364 -66
  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 +161 -29
  7. package/dist/funcs/apps.d.ts +14 -1
  8. package/dist/funcs/apps.js +52 -9
  9. package/dist/funcs/billing.d.ts +46 -1
  10. package/dist/funcs/billing.js +126 -17
  11. package/dist/funcs/currencies.d.ts +30 -1
  12. package/dist/funcs/currencies.js +113 -23
  13. package/dist/funcs/customers.d.ts +167 -2
  14. package/dist/funcs/customers.js +580 -90
  15. package/dist/funcs/defaults.d.ts +10 -1
  16. package/dist/funcs/defaults.js +35 -5
  17. package/dist/funcs/entitlements.d.ts +5 -1
  18. package/dist/funcs/entitlements.js +25 -6
  19. package/dist/funcs/events.d.ts +14 -1
  20. package/dist/funcs/events.js +41 -9
  21. package/dist/funcs/features.d.ts +42 -1
  22. package/dist/funcs/features.js +142 -28
  23. package/dist/funcs/governance.d.ts +14 -1
  24. package/dist/funcs/governance.js +42 -10
  25. package/dist/funcs/index.d.ts +1 -1
  26. package/dist/funcs/index.js +2 -1
  27. package/dist/funcs/invoices.d.ts +51 -0
  28. package/dist/funcs/invoices.js +125 -0
  29. package/dist/funcs/llmCost.d.ts +36 -1
  30. package/dist/funcs/llmCost.js +114 -24
  31. package/dist/funcs/meters.d.ts +55 -2
  32. package/dist/funcs/meters.js +172 -28
  33. package/dist/funcs/planAddons.d.ts +35 -1
  34. package/dist/funcs/planAddons.js +139 -29
  35. package/dist/funcs/plans.d.ts +49 -1
  36. package/dist/funcs/plans.js +163 -25
  37. package/dist/funcs/subscriptions.d.ts +61 -2
  38. package/dist/funcs/subscriptions.js +238 -40
  39. package/dist/funcs/tax.d.ts +25 -1
  40. package/dist/funcs/tax.js +104 -22
  41. package/dist/index.d.ts +6 -4
  42. package/dist/index.js +4 -3
  43. package/dist/lib/config.d.ts +9 -1
  44. package/dist/lib/config.js +1 -1
  45. package/dist/lib/encodings.d.ts +1 -2
  46. package/dist/lib/encodings.js +6 -5
  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 +20 -0
  58. package/dist/lib/wire.js +401 -0
  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 +17 -6
  62. package/dist/models/operations/addons.js +1 -1
  63. package/dist/models/operations/apps.d.ts +4 -6
  64. package/dist/models/operations/apps.js +1 -1
  65. package/dist/models/operations/billing.d.ts +5 -5
  66. package/dist/models/operations/billing.js +1 -1
  67. package/dist/models/operations/currencies.d.ts +27 -10
  68. package/dist/models/operations/currencies.js +1 -1
  69. package/dist/models/operations/customers.d.ts +87 -33
  70. package/dist/models/operations/customers.js +1 -1
  71. package/dist/models/operations/defaults.d.ts +2 -2
  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 +20 -5
  76. package/dist/models/operations/events.js +1 -1
  77. package/dist/models/operations/features.d.ts +24 -9
  78. package/dist/models/operations/features.js +1 -1
  79. package/dist/models/operations/governance.d.ts +3 -3
  80. package/dist/models/operations/governance.js +1 -1
  81. package/dist/models/operations/invoices.d.ts +45 -0
  82. package/dist/models/operations/invoices.js +2 -0
  83. package/dist/models/operations/llmCost.d.ts +16 -5
  84. package/dist/models/operations/llmCost.js +1 -1
  85. package/dist/models/operations/meters.d.ts +29 -9
  86. package/dist/models/operations/meters.js +1 -1
  87. package/dist/models/operations/planAddons.d.ts +7 -7
  88. package/dist/models/operations/planAddons.js +1 -1
  89. package/dist/models/operations/plans.d.ts +14 -6
  90. package/dist/models/operations/plans.js +1 -1
  91. package/dist/models/operations/subscriptions.d.ts +36 -11
  92. package/dist/models/operations/subscriptions.js +1 -1
  93. package/dist/models/operations/tax.d.ts +6 -6
  94. package/dist/models/operations/tax.js +1 -1
  95. package/dist/models/schemas.d.ts +27484 -3125
  96. package/dist/models/schemas.js +6247 -495
  97. package/dist/models/types.d.ts +4548 -1398
  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 +25 -1
  102. package/dist/sdk/apps.js +28 -1
  103. package/dist/sdk/billing.d.ts +57 -1
  104. package/dist/sdk/billing.js +60 -1
  105. package/dist/sdk/customers.d.ts +213 -2
  106. package/dist/sdk/customers.js +228 -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 +180 -0
  116. package/dist/sdk/internal.js +224 -0
  117. package/dist/sdk/llmCost.d.ts +57 -1
  118. package/dist/sdk/llmCost.js +62 -1
  119. package/dist/sdk/meters.d.ts +66 -2
  120. package/dist/sdk/meters.js +71 -2
  121. package/dist/sdk/planAddons.d.ts +46 -1
  122. package/dist/sdk/planAddons.js +49 -1
  123. package/dist/sdk/plans.d.ts +60 -1
  124. package/dist/sdk/plans.js +63 -1
  125. package/dist/sdk/sdk.d.ts +9 -7
  126. package/dist/sdk/sdk.js +11 -10
  127. package/dist/sdk/subscriptions.d.ts +71 -1
  128. package/dist/sdk/subscriptions.js +76 -1
  129. package/dist/sdk/tax.d.ts +34 -1
  130. package/dist/sdk/tax.js +37 -1
  131. package/package.json +31 -6
  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
@@ -1,2 +1,2 @@
1
+ // Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
1
2
  export {};
2
- //# sourceMappingURL=types.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 { ListAddonsRequest, ListAddonsResponse, CreateAddonRequest, CreateAddonResponse, UpdateAddonRequest, UpdateAddonResponse, GetAddonRequest, GetAddonResponse, DeleteAddonRequest, DeleteAddonResponse, ArchiveAddonRequest, ArchiveAddonResponse, PublishAddonRequest, PublishAddonResponse } from '../models/operations/addons.js';
4
+ import type { Addon } from '../models/types.js';
4
5
  export declare class Addons {
5
6
  private readonly _client;
6
7
  constructor(_client: Client);
8
+ /**
9
+ * List add-ons
10
+ *
11
+ * List all add-ons.
12
+ *
13
+ * GET /openmeter/addons
14
+ */
7
15
  list(request?: ListAddonsRequest, options?: RequestOptions): Promise<ListAddonsResponse>;
16
+ /**
17
+ * List add-ons
18
+ *
19
+ * List all add-ons.
20
+ *
21
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
22
+ *
23
+ * GET /openmeter/addons
24
+ */
25
+ listAll(request?: ListAddonsRequest, options?: RequestOptions): AsyncIterable<Addon>;
26
+ /**
27
+ * Create add-on
28
+ *
29
+ * Create a new add-on.
30
+ *
31
+ * POST /openmeter/addons
32
+ */
8
33
  create(request: CreateAddonRequest, options?: RequestOptions): Promise<CreateAddonResponse>;
34
+ /**
35
+ * Update add-on
36
+ *
37
+ * Update an add-on by id.
38
+ *
39
+ * PUT /openmeter/addons/{addonId}
40
+ */
9
41
  update(request: UpdateAddonRequest, options?: RequestOptions): Promise<UpdateAddonResponse>;
42
+ /**
43
+ * Get add-on
44
+ *
45
+ * Get add-on by id.
46
+ *
47
+ * GET /openmeter/addons/{addonId}
48
+ */
10
49
  get(request: GetAddonRequest, options?: RequestOptions): Promise<GetAddonResponse>;
50
+ /**
51
+ * Soft delete add-on
52
+ *
53
+ * Soft delete add-on by id.
54
+ *
55
+ * DELETE /openmeter/addons/{addonId}
56
+ */
11
57
  delete(request: DeleteAddonRequest, options?: RequestOptions): Promise<DeleteAddonResponse>;
58
+ /**
59
+ * Archive add-on version
60
+ *
61
+ * Archive an add-on version.
62
+ *
63
+ * POST /openmeter/addons/{addonId}/archive
64
+ */
12
65
  archive(request: ArchiveAddonRequest, options?: RequestOptions): Promise<ArchiveAddonResponse>;
66
+ /**
67
+ * Publish add-on version
68
+ *
69
+ * Publish an add-on version.
70
+ *
71
+ * POST /openmeter/addons/{addonId}/publish
72
+ */
13
73
  publish(request: PublishAddonRequest, options?: RequestOptions): Promise<PublishAddonResponse>;
14
74
  }
15
- //# sourceMappingURL=addons.d.ts.map
@@ -1,30 +1,92 @@
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 { listAddons, createAddon, updateAddon, getAddon, deleteAddon, archiveAddon, publishAddon, } from '../funcs/addons.js';
3
5
  export class Addons {
4
6
  _client;
5
7
  constructor(_client) {
6
8
  this._client = _client;
7
9
  }
10
+ /**
11
+ * List add-ons
12
+ *
13
+ * List all add-ons.
14
+ *
15
+ * GET /openmeter/addons
16
+ */
8
17
  async list(request, options) {
9
18
  return unwrap(await listAddons(this._client, request, options));
10
19
  }
20
+ /**
21
+ * List add-ons
22
+ *
23
+ * List all add-ons.
24
+ *
25
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
26
+ *
27
+ * GET /openmeter/addons
28
+ */
29
+ listAll(request, options) {
30
+ return paginatePages((req, opts) => listAddons(this._client, req, opts), request ?? {}, options);
31
+ }
32
+ /**
33
+ * Create add-on
34
+ *
35
+ * Create a new add-on.
36
+ *
37
+ * POST /openmeter/addons
38
+ */
11
39
  async create(request, options) {
12
40
  return unwrap(await createAddon(this._client, request, options));
13
41
  }
42
+ /**
43
+ * Update add-on
44
+ *
45
+ * Update an add-on by id.
46
+ *
47
+ * PUT /openmeter/addons/{addonId}
48
+ */
14
49
  async update(request, options) {
15
50
  return unwrap(await updateAddon(this._client, request, options));
16
51
  }
52
+ /**
53
+ * Get add-on
54
+ *
55
+ * Get add-on by id.
56
+ *
57
+ * GET /openmeter/addons/{addonId}
58
+ */
17
59
  async get(request, options) {
18
60
  return unwrap(await getAddon(this._client, request, options));
19
61
  }
62
+ /**
63
+ * Soft delete add-on
64
+ *
65
+ * Soft delete add-on by id.
66
+ *
67
+ * DELETE /openmeter/addons/{addonId}
68
+ */
20
69
  async delete(request, options) {
21
70
  return unwrap(await deleteAddon(this._client, request, options));
22
71
  }
72
+ /**
73
+ * Archive add-on version
74
+ *
75
+ * Archive an add-on version.
76
+ *
77
+ * POST /openmeter/addons/{addonId}/archive
78
+ */
23
79
  async archive(request, options) {
24
80
  return unwrap(await archiveAddon(this._client, request, options));
25
81
  }
82
+ /**
83
+ * Publish add-on version
84
+ *
85
+ * Publish an add-on version.
86
+ *
87
+ * POST /openmeter/addons/{addonId}/publish
88
+ */
26
89
  async publish(request, options) {
27
90
  return unwrap(await publishAddon(this._client, request, options));
28
91
  }
29
92
  }
30
- //# sourceMappingURL=addons.js.map
@@ -1,10 +1,34 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type RequestOptions } from '../lib/types.js';
3
3
  import type { ListAppsRequest, ListAppsResponse, GetAppRequest, GetAppResponse } from '../models/operations/apps.js';
4
+ import type { App } from '../models/types.js';
4
5
  export declare class Apps {
5
6
  private readonly _client;
6
7
  constructor(_client: Client);
8
+ /**
9
+ * List apps
10
+ *
11
+ * List installed apps.
12
+ *
13
+ * GET /openmeter/apps
14
+ */
7
15
  list(request?: ListAppsRequest, options?: RequestOptions): Promise<ListAppsResponse>;
16
+ /**
17
+ * List apps
18
+ *
19
+ * List installed apps.
20
+ *
21
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
22
+ *
23
+ * GET /openmeter/apps
24
+ */
25
+ listAll(request?: ListAppsRequest, options?: RequestOptions): AsyncIterable<App>;
26
+ /**
27
+ * Get app
28
+ *
29
+ * Get an installed app.
30
+ *
31
+ * GET /openmeter/apps/{appId}
32
+ */
8
33
  get(request: GetAppRequest, options?: RequestOptions): Promise<GetAppResponse>;
9
34
  }
10
- //# sourceMappingURL=apps.d.ts.map
package/dist/sdk/apps.js CHANGED
@@ -1,15 +1,42 @@
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 { listApps, getApp } from '../funcs/apps.js';
3
5
  export class Apps {
4
6
  _client;
5
7
  constructor(_client) {
6
8
  this._client = _client;
7
9
  }
10
+ /**
11
+ * List apps
12
+ *
13
+ * List installed apps.
14
+ *
15
+ * GET /openmeter/apps
16
+ */
8
17
  async list(request, options) {
9
18
  return unwrap(await listApps(this._client, request, options));
10
19
  }
20
+ /**
21
+ * List apps
22
+ *
23
+ * List installed apps.
24
+ *
25
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
26
+ *
27
+ * GET /openmeter/apps
28
+ */
29
+ listAll(request, options) {
30
+ return paginatePages((req, opts) => listApps(this._client, req, opts), request ?? {}, options);
31
+ }
32
+ /**
33
+ * Get app
34
+ *
35
+ * Get an installed app.
36
+ *
37
+ * GET /openmeter/apps/{appId}
38
+ */
11
39
  async get(request, options) {
12
40
  return unwrap(await getApp(this._client, request, options));
13
41
  }
14
42
  }
15
- //# sourceMappingURL=apps.js.map
@@ -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 { ListBillingProfilesRequest, ListBillingProfilesResponse, CreateBillingProfileRequest, CreateBillingProfileResponse, GetBillingProfileRequest, GetBillingProfileResponse, UpdateBillingProfileRequest, UpdateBillingProfileResponse, DeleteBillingProfileRequest, DeleteBillingProfileResponse } from '../models/operations/billing.js';
4
+ import type { Profile } from '../models/types.js';
4
5
  export declare class Billing {
5
6
  private readonly _client;
6
7
  constructor(_client: Client);
8
+ /**
9
+ * List billing profiles
10
+ *
11
+ * List billing profiles.
12
+ *
13
+ * GET /openmeter/profiles
14
+ */
7
15
  listProfiles(request?: ListBillingProfilesRequest, options?: RequestOptions): Promise<ListBillingProfilesResponse>;
16
+ /**
17
+ * List billing profiles
18
+ *
19
+ * List billing profiles.
20
+ *
21
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
22
+ *
23
+ * GET /openmeter/profiles
24
+ */
25
+ listProfilesAll(request?: ListBillingProfilesRequest, options?: RequestOptions): AsyncIterable<Profile>;
26
+ /**
27
+ * Create a new billing profile
28
+ *
29
+ * Create a new billing profile.
30
+ *
31
+ * Billing profiles contain the settings for billing and controls invoice
32
+ * generation. An organization can have multiple billing profiles defined. A
33
+ * billing profile is linked to a specific app. This association is established
34
+ * during the billing profile's creation and remains immutable.
35
+ *
36
+ * POST /openmeter/profiles
37
+ */
8
38
  createProfile(request: CreateBillingProfileRequest, options?: RequestOptions): Promise<CreateBillingProfileResponse>;
39
+ /**
40
+ * Get a billing profile
41
+ *
42
+ * Get a billing profile.
43
+ *
44
+ * GET /openmeter/profiles/{id}
45
+ */
9
46
  getProfile(request: GetBillingProfileRequest, options?: RequestOptions): Promise<GetBillingProfileResponse>;
47
+ /**
48
+ * Update a billing profile
49
+ *
50
+ * Update a billing profile.
51
+ *
52
+ * PUT /openmeter/profiles/{id}
53
+ */
10
54
  updateProfile(request: UpdateBillingProfileRequest, options?: RequestOptions): Promise<UpdateBillingProfileResponse>;
55
+ /**
56
+ * Delete a billing profile
57
+ *
58
+ * Delete a billing profile.
59
+ *
60
+ * Only such billing profiles can be deleted that are:
61
+ *
62
+ * - not the default profile
63
+ * - not pinned to any customer using customer overrides
64
+ * - only have finalized invoices
65
+ *
66
+ * DELETE /openmeter/profiles/{id}
67
+ */
11
68
  deleteProfile(request: DeleteBillingProfileRequest, options?: RequestOptions): Promise<DeleteBillingProfileResponse>;
12
69
  }
13
- //# sourceMappingURL=billing.d.ts.map
@@ -1,24 +1,83 @@
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 { listBillingProfiles, createBillingProfile, getBillingProfile, updateBillingProfile, deleteBillingProfile, } from '../funcs/billing.js';
3
5
  export class Billing {
4
6
  _client;
5
7
  constructor(_client) {
6
8
  this._client = _client;
7
9
  }
10
+ /**
11
+ * List billing profiles
12
+ *
13
+ * List billing profiles.
14
+ *
15
+ * GET /openmeter/profiles
16
+ */
8
17
  async listProfiles(request, options) {
9
18
  return unwrap(await listBillingProfiles(this._client, request, options));
10
19
  }
20
+ /**
21
+ * List billing profiles
22
+ *
23
+ * List billing profiles.
24
+ *
25
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
26
+ *
27
+ * GET /openmeter/profiles
28
+ */
29
+ listProfilesAll(request, options) {
30
+ return paginatePages((req, opts) => listBillingProfiles(this._client, req, opts), request ?? {}, options);
31
+ }
32
+ /**
33
+ * Create a new billing profile
34
+ *
35
+ * Create a new billing profile.
36
+ *
37
+ * Billing profiles contain the settings for billing and controls invoice
38
+ * generation. An organization can have multiple billing profiles defined. A
39
+ * billing profile is linked to a specific app. This association is established
40
+ * during the billing profile's creation and remains immutable.
41
+ *
42
+ * POST /openmeter/profiles
43
+ */
11
44
  async createProfile(request, options) {
12
45
  return unwrap(await createBillingProfile(this._client, request, options));
13
46
  }
47
+ /**
48
+ * Get a billing profile
49
+ *
50
+ * Get a billing profile.
51
+ *
52
+ * GET /openmeter/profiles/{id}
53
+ */
14
54
  async getProfile(request, options) {
15
55
  return unwrap(await getBillingProfile(this._client, request, options));
16
56
  }
57
+ /**
58
+ * Update a billing profile
59
+ *
60
+ * Update a billing profile.
61
+ *
62
+ * PUT /openmeter/profiles/{id}
63
+ */
17
64
  async updateProfile(request, options) {
18
65
  return unwrap(await updateBillingProfile(this._client, request, options));
19
66
  }
67
+ /**
68
+ * Delete a billing profile
69
+ *
70
+ * Delete a billing profile.
71
+ *
72
+ * Only such billing profiles can be deleted that are:
73
+ *
74
+ * - not the default profile
75
+ * - not pinned to any customer using customer overrides
76
+ * - only have finalized invoices
77
+ *
78
+ * DELETE /openmeter/profiles/{id}
79
+ */
20
80
  async deleteProfile(request, options) {
21
81
  return unwrap(await deleteBillingProfile(this._client, request, options));
22
82
  }
23
83
  }
24
- //# sourceMappingURL=billing.js.map
@@ -1,13 +1,47 @@
1
1
  import { type Client } from '../core.js';
2
2
  import { type RequestOptions } from '../lib/types.js';
3
- import type { CreateCustomerRequest, CreateCustomerResponse, GetCustomerRequest, GetCustomerResponse, ListCustomersRequest, ListCustomersResponse, UpsertCustomerRequest, UpsertCustomerResponse, DeleteCustomerRequest, DeleteCustomerResponse, GetCustomerBillingRequest, GetCustomerBillingResponse, UpdateCustomerBillingRequest, UpdateCustomerBillingResponse, UpdateCustomerBillingAppDataRequest, UpdateCustomerBillingAppDataResponse, CreateCustomerStripeCheckoutSessionRequest, CreateCustomerStripeCheckoutSessionResponse, CreateCustomerStripePortalSessionRequest, CreateCustomerStripePortalSessionResponse, CreateCreditGrantRequest, CreateCreditGrantResponse, GetCreditGrantRequest, GetCreditGrantResponse, ListCreditGrantsRequest, ListCreditGrantsResponse, GetCustomerCreditBalanceRequest, GetCustomerCreditBalanceResponse, CreateCreditAdjustmentRequest, CreateCreditAdjustmentResponse, ListCreditTransactionsRequest, ListCreditTransactionsResponse, ListCustomerChargesRequest, ListCustomerChargesResponse } from '../models/operations/customers.js';
3
+ import type { CreateCustomerRequest, CreateCustomerResponse, GetCustomerRequest, GetCustomerResponse, ListCustomersRequest, ListCustomersResponse, UpsertCustomerRequest, UpsertCustomerResponse, DeleteCustomerRequest, DeleteCustomerResponse, GetCustomerBillingRequest, GetCustomerBillingResponse, UpdateCustomerBillingRequest, UpdateCustomerBillingResponse, UpdateCustomerBillingAppDataRequest, UpdateCustomerBillingAppDataResponse, CreateCustomerStripeCheckoutSessionRequest, CreateCustomerStripeCheckoutSessionResponse, CreateCustomerStripePortalSessionRequest, CreateCustomerStripePortalSessionResponse, CreateCreditGrantRequest, CreateCreditGrantResponse, GetCreditGrantRequest, GetCreditGrantResponse, ListCreditGrantsRequest, ListCreditGrantsResponse, GetCustomerCreditBalanceRequest, GetCustomerCreditBalanceResponse, CreateCreditAdjustmentRequest, CreateCreditAdjustmentResponse, VoidCreditGrantRequest, VoidCreditGrantResponse, UpdateCreditGrantExternalSettlementRequest, UpdateCreditGrantExternalSettlementResponse, ListCreditTransactionsRequest, ListCreditTransactionsResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } from '../models/operations/customers.js';
4
+ import type { Charge, CreditGrant, CreditTransaction, Customer } from '../models/types.js';
4
5
  export declare class Customers {
5
6
  private readonly _client;
6
7
  constructor(_client: Client);
8
+ /**
9
+ * Create customer
10
+ *
11
+ * POST /openmeter/customers
12
+ */
7
13
  create(request: CreateCustomerRequest, options?: RequestOptions): Promise<CreateCustomerResponse>;
14
+ /**
15
+ * Get customer
16
+ *
17
+ * GET /openmeter/customers/{customerId}
18
+ */
8
19
  get(request: GetCustomerRequest, options?: RequestOptions): Promise<GetCustomerResponse>;
20
+ /**
21
+ * List customers
22
+ *
23
+ * GET /openmeter/customers
24
+ */
9
25
  list(request?: ListCustomersRequest, options?: RequestOptions): Promise<ListCustomersResponse>;
26
+ /**
27
+ * List customers
28
+ *
29
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
30
+ *
31
+ * GET /openmeter/customers
32
+ */
33
+ listAll(request?: ListCustomersRequest, options?: RequestOptions): AsyncIterable<Customer>;
34
+ /**
35
+ * Upsert customer
36
+ *
37
+ * PUT /openmeter/customers/{customerId}
38
+ */
10
39
  upsert(request: UpsertCustomerRequest, options?: RequestOptions): Promise<UpsertCustomerResponse>;
40
+ /**
41
+ * Delete customer
42
+ *
43
+ * DELETE /openmeter/customers/{customerId}
44
+ */
11
45
  delete(request: DeleteCustomerRequest, options?: RequestOptions): Promise<DeleteCustomerResponse>;
12
46
  private _billing?;
13
47
  get billing(): CustomersBilling;
@@ -19,10 +53,54 @@ export declare class Customers {
19
53
  export declare class CustomersBilling {
20
54
  private readonly _client;
21
55
  constructor(_client: Client);
56
+ /**
57
+ * Get customer billing data
58
+ *
59
+ * GET /openmeter/customers/{customerId}/billing
60
+ */
22
61
  get(request: GetCustomerBillingRequest, options?: RequestOptions): Promise<GetCustomerBillingResponse>;
62
+ /**
63
+ * Update customer billing data
64
+ *
65
+ * PUT /openmeter/customers/{customerId}/billing
66
+ */
23
67
  update(request: UpdateCustomerBillingRequest, options?: RequestOptions): Promise<UpdateCustomerBillingResponse>;
68
+ /**
69
+ * Update customer billing app data
70
+ *
71
+ * PUT /openmeter/customers/{customerId}/billing/app-data
72
+ */
24
73
  updateAppData(request: UpdateCustomerBillingAppDataRequest, options?: RequestOptions): Promise<UpdateCustomerBillingAppDataResponse>;
74
+ /**
75
+ * Create Stripe Checkout Session
76
+ *
77
+ * Create a [Stripe Checkout Session](https://docs.stripe.com/payments/checkout)
78
+ * for the customer.
79
+ *
80
+ * Creates a Checkout Session for collecting payment method information from
81
+ * customers. The session operates in "setup" mode, which collects payment details
82
+ * without charging the customer immediately. The collected payment method can be
83
+ * used for future subscription billing.
84
+ *
85
+ * For hosted checkout sessions, redirect customers to the returned URL. For
86
+ * embedded sessions, use the client_secret to initialize Stripe.js in your
87
+ * application.
88
+ *
89
+ * POST /openmeter/customers/{customerId}/billing/stripe/checkout-sessions
90
+ */
25
91
  createStripeCheckoutSession(request: CreateCustomerStripeCheckoutSessionRequest, options?: RequestOptions): Promise<CreateCustomerStripeCheckoutSessionResponse>;
92
+ /**
93
+ * Create Stripe customer portal session
94
+ *
95
+ * Create Stripe Customer Portal Session.
96
+ *
97
+ * Useful to redirect the customer to the Stripe Customer Portal to manage their
98
+ * payment methods, change their billing address and access their invoice history.
99
+ * Only returns URL if the customer billing profile is linked to a stripe app and
100
+ * customer.
101
+ *
102
+ * POST /openmeter/customers/{customerId}/billing/stripe/portal-sessions
103
+ */
26
104
  createStripePortalSession(request: CreateCustomerStripePortalSessionRequest, options?: RequestOptions): Promise<CreateCustomerStripePortalSessionResponse>;
27
105
  }
28
106
  export declare class CustomersCredits {
@@ -40,28 +118,161 @@ export declare class CustomersCredits {
40
118
  export declare class CustomersCreditsGrants {
41
119
  private readonly _client;
42
120
  constructor(_client: Client);
121
+ /**
122
+ * Create a new credit grant
123
+ *
124
+ * Create a new credit grant. A credit grant represents an allocation of prepaid
125
+ * credits to a customer.
126
+ *
127
+ * POST /openmeter/customers/{customerId}/credits/grants
128
+ */
43
129
  create(request: CreateCreditGrantRequest, options?: RequestOptions): Promise<CreateCreditGrantResponse>;
130
+ /**
131
+ * Get a credit grant
132
+ *
133
+ * Get a credit grant.
134
+ *
135
+ * GET /openmeter/customers/{customerId}/credits/grants/{creditGrantId}
136
+ */
44
137
  get(request: GetCreditGrantRequest, options?: RequestOptions): Promise<GetCreditGrantResponse>;
138
+ /**
139
+ * List credit grants
140
+ *
141
+ * List credit grants.
142
+ *
143
+ * GET /openmeter/customers/{customerId}/credits/grants
144
+ */
45
145
  list(request: ListCreditGrantsRequest, options?: RequestOptions): Promise<ListCreditGrantsResponse>;
146
+ /**
147
+ * List credit grants
148
+ *
149
+ * List credit grants.
150
+ *
151
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
152
+ *
153
+ * GET /openmeter/customers/{customerId}/credits/grants
154
+ */
155
+ listAll(request: ListCreditGrantsRequest, options?: RequestOptions): AsyncIterable<CreditGrant>;
156
+ /**
157
+ * Void credit grant
158
+ *
159
+ * Void a credit grant, forfeiting the remaining unused balance.
160
+ *
161
+ * Voiding is a forward-looking, irreversible operation. Credits already consumed
162
+ * by usage remain unaffected — only the remaining balance is forfeited. The grant
163
+ * reads as `voided` status afterwards. Payment state is not adjusted when
164
+ * `payment_adjustment` is `none`, so invoice-backed or externally collected
165
+ * payments may still collect the original amount. Only `active` grants can be
166
+ * voided; voiding a pending, expired, or fully consumed grant returns a conflict.
167
+ * Retrying a successful void is an idempotent success.
168
+ *
169
+ * POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/void
170
+ */
171
+ void(request: VoidCreditGrantRequest, options?: RequestOptions): Promise<VoidCreditGrantResponse>;
172
+ /**
173
+ * Update credit grant external settlement status
174
+ *
175
+ * Update the payment settlement status of an externally funded credit grant.
176
+ *
177
+ * Use this endpoint to synchronize the payment state of an external payment with
178
+ * the system so that revenue recognition and credit availability work as expected.
179
+ *
180
+ * POST /openmeter/customers/{customerId}/credits/grants/{creditGrantId}/settlement/external
181
+ */
182
+ updateExternalSettlement(request: UpdateCreditGrantExternalSettlementRequest, options?: RequestOptions): Promise<UpdateCreditGrantExternalSettlementResponse>;
46
183
  }
47
184
  export declare class CustomersCreditsBalance {
48
185
  private readonly _client;
49
186
  constructor(_client: Client);
187
+ /**
188
+ * Get a customer's credit balance
189
+ *
190
+ * Get a credit balance.
191
+ *
192
+ * GET /openmeter/customers/{customerId}/credits/balance
193
+ */
50
194
  get(request: GetCustomerCreditBalanceRequest, options?: RequestOptions): Promise<GetCustomerCreditBalanceResponse>;
51
195
  }
52
196
  export declare class CustomersCreditsAdjustments {
53
197
  private readonly _client;
54
198
  constructor(_client: Client);
199
+ /**
200
+ * Create a credit adjustment
201
+ *
202
+ * A credit adjustment can be used to make manual adjustments to a customer's
203
+ * credit balance.
204
+ *
205
+ * Supported use-cases:
206
+ *
207
+ * - Usage correction
208
+ *
209
+ * POST /openmeter/customers/{customerId}/credits/adjustments
210
+ */
55
211
  create(request: CreateCreditAdjustmentRequest, options?: RequestOptions): Promise<CreateCreditAdjustmentResponse>;
56
212
  }
57
213
  export declare class CustomersCreditsTransactions {
58
214
  private readonly _client;
59
215
  constructor(_client: Client);
216
+ /**
217
+ * List credit transactions
218
+ *
219
+ * List credit transactions for a customer.
220
+ *
221
+ * Returns an immutable, chronological record of credit movements: funded credits
222
+ * and consumed credits. Transactions are returned in reverse chronological order
223
+ * by default.
224
+ *
225
+ * GET /openmeter/customers/{customerId}/credits/transactions
226
+ */
60
227
  list(request: ListCreditTransactionsRequest, options?: RequestOptions): Promise<ListCreditTransactionsResponse>;
228
+ /**
229
+ * List credit transactions
230
+ *
231
+ * List credit transactions for a customer.
232
+ *
233
+ * Returns an immutable, chronological record of credit movements: funded credits
234
+ * and consumed credits. Transactions are returned in reverse chronological order
235
+ * by default.
236
+ *
237
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
238
+ *
239
+ * GET /openmeter/customers/{customerId}/credits/transactions
240
+ */
241
+ listAll(request: ListCreditTransactionsRequest, options?: RequestOptions): AsyncIterable<CreditTransaction>;
61
242
  }
62
243
  export declare class CustomersCharges {
63
244
  private readonly _client;
64
245
  constructor(_client: Client);
246
+ /**
247
+ * List customer charges
248
+ *
249
+ * List customer charges.
250
+ *
251
+ * Returns the customer's charges that are represented as either flat fee or
252
+ * usage-based charges.
253
+ *
254
+ * GET /openmeter/customers/{customerId}/charges
255
+ */
65
256
  list(request: ListCustomerChargesRequest, options?: RequestOptions): Promise<ListCustomerChargesResponse>;
257
+ /**
258
+ * List customer charges
259
+ *
260
+ * List customer charges.
261
+ *
262
+ * Returns the customer's charges that are represented as either flat fee or
263
+ * usage-based charges.
264
+ *
265
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
266
+ *
267
+ * GET /openmeter/customers/{customerId}/charges
268
+ */
269
+ listAll(request: ListCustomerChargesRequest, options?: RequestOptions): AsyncIterable<Charge>;
270
+ /**
271
+ * Create customer charge
272
+ *
273
+ * Create customer charge.
274
+ *
275
+ * POST /openmeter/customers/{customerId}/charges
276
+ */
277
+ create(request: CreateCustomerChargesRequest, options?: RequestOptions): Promise<CreateCustomerChargesResponse>;
66
278
  }
67
- //# sourceMappingURL=customers.d.ts.map