@openmeter/client 1.0.0-beta.230 → 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.
- package/LICENSE +202 -0
- package/README.md +347 -68
- package/dist/core.d.ts +0 -1
- package/dist/core.js +8 -1
- package/dist/funcs/addons.d.ts +49 -1
- package/dist/funcs/addons.js +50 -1
- package/dist/funcs/apps.d.ts +14 -1
- package/dist/funcs/apps.js +15 -1
- package/dist/funcs/billing.d.ts +46 -1
- package/dist/funcs/billing.js +47 -1
- package/dist/funcs/currencies.d.ts +30 -1
- package/dist/funcs/currencies.js +31 -1
- package/dist/funcs/customers.d.ts +165 -2
- package/dist/funcs/customers.js +192 -1
- package/dist/funcs/defaults.d.ts +10 -1
- package/dist/funcs/defaults.js +11 -1
- package/dist/funcs/entitlements.d.ts +5 -1
- package/dist/funcs/entitlements.js +6 -1
- package/dist/funcs/events.d.ts +14 -1
- package/dist/funcs/events.js +15 -1
- package/dist/funcs/features.d.ts +42 -1
- package/dist/funcs/features.js +43 -1
- package/dist/funcs/governance.d.ts +14 -1
- package/dist/funcs/governance.js +15 -1
- package/dist/funcs/index.d.ts +0 -1
- package/dist/funcs/index.js +1 -1
- package/dist/funcs/invoices.d.ts +44 -1
- package/dist/funcs/invoices.js +45 -1
- package/dist/funcs/llmCost.d.ts +36 -1
- package/dist/funcs/llmCost.js +37 -1
- package/dist/funcs/meters.d.ts +53 -1
- package/dist/funcs/meters.js +54 -1
- package/dist/funcs/planAddons.d.ts +35 -1
- package/dist/funcs/planAddons.js +36 -1
- package/dist/funcs/plans.d.ts +49 -1
- package/dist/funcs/plans.js +50 -1
- package/dist/funcs/subscriptions.d.ts +59 -1
- package/dist/funcs/subscriptions.js +60 -1
- package/dist/funcs/tax.d.ts +25 -1
- package/dist/funcs/tax.js +26 -1
- package/dist/index.d.ts +4 -6
- package/dist/index.js +4 -5
- package/dist/lib/config.d.ts +0 -1
- package/dist/lib/config.js +1 -1
- package/dist/lib/encodings.d.ts +0 -1
- package/dist/lib/encodings.js +1 -1
- package/dist/lib/paginate.d.ts +56 -0
- package/dist/lib/paginate.js +60 -0
- package/dist/lib/request.d.ts +0 -1
- package/dist/lib/request.js +1 -1
- package/dist/lib/to-error.d.ts +0 -1
- package/dist/lib/to-error.js +1 -1
- package/dist/lib/types.d.ts +0 -1
- package/dist/lib/types.js +1 -1
- package/dist/lib/version.d.ts +1 -0
- package/dist/lib/version.js +5 -0
- package/dist/lib/wire.d.ts +3 -1
- package/dist/lib/wire.js +93 -4
- package/dist/models/errors.d.ts +13 -2
- package/dist/models/errors.js +31 -4
- package/dist/models/operations/addons.d.ts +0 -1
- package/dist/models/operations/addons.js +1 -1
- package/dist/models/operations/apps.d.ts +2 -5
- package/dist/models/operations/apps.js +1 -1
- package/dist/models/operations/billing.d.ts +0 -1
- package/dist/models/operations/billing.js +1 -1
- package/dist/models/operations/currencies.d.ts +0 -1
- package/dist/models/operations/currencies.js +1 -1
- package/dist/models/operations/customers.d.ts +9 -6
- package/dist/models/operations/customers.js +1 -1
- package/dist/models/operations/defaults.d.ts +0 -1
- package/dist/models/operations/defaults.js +1 -1
- package/dist/models/operations/entitlements.d.ts +0 -1
- package/dist/models/operations/entitlements.js +1 -1
- package/dist/models/operations/events.d.ts +0 -1
- package/dist/models/operations/events.js +1 -1
- package/dist/models/operations/features.d.ts +0 -1
- package/dist/models/operations/features.js +1 -1
- package/dist/models/operations/governance.d.ts +0 -1
- package/dist/models/operations/governance.js +1 -1
- package/dist/models/operations/invoices.d.ts +4 -7
- package/dist/models/operations/invoices.js +1 -1
- package/dist/models/operations/llmCost.d.ts +0 -1
- package/dist/models/operations/llmCost.js +1 -1
- package/dist/models/operations/meters.d.ts +0 -1
- package/dist/models/operations/meters.js +1 -1
- package/dist/models/operations/planAddons.d.ts +0 -1
- package/dist/models/operations/planAddons.js +1 -1
- package/dist/models/operations/plans.d.ts +0 -1
- package/dist/models/operations/plans.js +1 -1
- package/dist/models/operations/subscriptions.d.ts +0 -1
- package/dist/models/operations/subscriptions.js +1 -1
- package/dist/models/operations/tax.d.ts +0 -1
- package/dist/models/operations/tax.js +1 -1
- package/dist/models/schemas.d.ts +162 -1
- package/dist/models/schemas.js +37 -5
- package/dist/models/types.d.ts +464 -577
- package/dist/models/types.js +1 -1
- package/dist/sdk/addons.d.ts +60 -1
- package/dist/sdk/addons.js +63 -1
- package/dist/sdk/apps.d.ts +25 -1
- package/dist/sdk/apps.js +28 -1
- package/dist/sdk/billing.d.ts +57 -1
- package/dist/sdk/billing.js +60 -1
- package/dist/sdk/customers.d.ts +211 -2
- package/dist/sdk/customers.js +222 -2
- package/dist/sdk/defaults.d.ts +10 -1
- package/dist/sdk/defaults.js +11 -1
- package/dist/sdk/entitlements.d.ts +5 -1
- package/dist/sdk/entitlements.js +6 -1
- package/dist/sdk/events.d.ts +25 -1
- package/dist/sdk/events.js +28 -1
- package/dist/sdk/features.d.ts +53 -1
- package/dist/sdk/features.js +56 -1
- package/dist/sdk/internal.d.ts +180 -0
- package/dist/sdk/internal.js +224 -0
- package/dist/sdk/llmCost.d.ts +57 -1
- package/dist/sdk/llmCost.js +62 -1
- package/dist/sdk/meters.d.ts +64 -1
- package/dist/sdk/meters.js +67 -1
- package/dist/sdk/planAddons.d.ts +46 -1
- package/dist/sdk/planAddons.js +49 -1
- package/dist/sdk/plans.d.ts +60 -1
- package/dist/sdk/plans.js +63 -1
- package/dist/sdk/sdk.d.ts +9 -10
- package/dist/sdk/sdk.js +11 -15
- package/dist/sdk/subscriptions.d.ts +72 -3
- package/dist/sdk/subscriptions.js +77 -5
- package/dist/sdk/tax.d.ts +34 -1
- package/dist/sdk/tax.js +37 -1
- package/package.json +28 -4
- package/dist/sdk/currencies.d.ts +0 -12
- package/dist/sdk/currencies.js +0 -21
- package/dist/sdk/governance.d.ts +0 -9
- package/dist/sdk/governance.js +0 -12
- package/dist/sdk/invoices.d.ts +0 -12
- package/dist/sdk/invoices.js +0 -21
package/dist/models/types.js
CHANGED
package/dist/sdk/addons.d.ts
CHANGED
|
@@ -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
|
package/dist/sdk/addons.js
CHANGED
|
@@ -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
|
package/dist/sdk/apps.d.ts
CHANGED
|
@@ -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
|
package/dist/sdk/billing.d.ts
CHANGED
|
@@ -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
|
package/dist/sdk/billing.js
CHANGED
|
@@ -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
|
package/dist/sdk/customers.d.ts
CHANGED
|
@@ -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, UpdateCreditGrantExternalSettlementRequest, UpdateCreditGrantExternalSettlementResponse, ListCreditTransactionsRequest, ListCreditTransactionsResponse, ListCustomerChargesRequest, ListCustomerChargesResponse, CreateCustomerChargesRequest, CreateCustomerChargesResponse } 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,30 +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
|
+
*/
|
|
46
182
|
updateExternalSettlement(request: UpdateCreditGrantExternalSettlementRequest, options?: RequestOptions): Promise<UpdateCreditGrantExternalSettlementResponse>;
|
|
47
183
|
}
|
|
48
184
|
export declare class CustomersCreditsBalance {
|
|
49
185
|
private readonly _client;
|
|
50
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
|
+
*/
|
|
51
194
|
get(request: GetCustomerCreditBalanceRequest, options?: RequestOptions): Promise<GetCustomerCreditBalanceResponse>;
|
|
52
195
|
}
|
|
53
196
|
export declare class CustomersCreditsAdjustments {
|
|
54
197
|
private readonly _client;
|
|
55
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
|
+
*/
|
|
56
211
|
create(request: CreateCreditAdjustmentRequest, options?: RequestOptions): Promise<CreateCreditAdjustmentResponse>;
|
|
57
212
|
}
|
|
58
213
|
export declare class CustomersCreditsTransactions {
|
|
59
214
|
private readonly _client;
|
|
60
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
|
+
*/
|
|
61
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>;
|
|
62
242
|
}
|
|
63
243
|
export declare class CustomersCharges {
|
|
64
244
|
private readonly _client;
|
|
65
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
|
+
*/
|
|
66
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
|
+
*/
|
|
67
277
|
create(request: CreateCustomerChargesRequest, options?: RequestOptions): Promise<CreateCustomerChargesResponse>;
|
|
68
278
|
}
|
|
69
|
-
//# sourceMappingURL=customers.d.ts.map
|