@openmeter/sdk 1.0.0-beta.22 → 1.0.0-beta.221
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/Makefile +43 -0
- package/README.md +38 -150
- package/dist/cjs/index.cjs +18 -0
- package/dist/cjs/index.d.cts +1 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/src/client/addons.cjs +105 -0
- package/dist/cjs/src/client/addons.d.cts +152 -0
- package/dist/cjs/src/client/addons.js.map +1 -0
- package/dist/cjs/src/client/apps.cjs +247 -0
- package/dist/cjs/src/client/apps.d.cts +327 -0
- package/dist/cjs/src/client/apps.js.map +1 -0
- package/dist/cjs/src/client/billing.cjs +361 -0
- package/dist/cjs/src/client/billing.d.cts +526 -0
- package/dist/cjs/src/client/billing.js.map +1 -0
- package/dist/cjs/src/client/common.cjs +47 -0
- package/dist/cjs/src/client/common.d.cts +30 -0
- package/dist/cjs/src/client/common.js.map +1 -0
- package/dist/cjs/src/client/customers.cjs +283 -0
- package/dist/cjs/src/client/customers.d.cts +251 -0
- package/dist/cjs/src/client/customers.js.map +1 -0
- package/dist/cjs/src/client/debug.cjs +27 -0
- package/dist/cjs/src/client/debug.d.cts +17 -0
- package/dist/cjs/src/client/debug.js.map +1 -0
- package/dist/cjs/src/client/entitlements.cjs +281 -0
- package/dist/cjs/src/client/entitlements.d.cts +556 -0
- package/dist/cjs/src/client/entitlements.js.map +1 -0
- package/dist/cjs/src/client/events.cjs +113 -0
- package/dist/cjs/src/client/events.d.cts +48 -0
- package/dist/cjs/src/client/events.js.map +1 -0
- package/dist/cjs/src/client/features.cjs +78 -0
- package/dist/cjs/src/client/features.d.cts +78 -0
- package/dist/cjs/src/client/features.js.map +1 -0
- package/dist/cjs/src/client/index.cjs +120 -0
- package/dist/cjs/src/client/index.d.cts +53 -0
- package/dist/cjs/src/client/index.js.map +1 -0
- package/dist/cjs/src/client/info.cjs +42 -0
- package/dist/cjs/src/client/info.d.cts +34 -0
- package/dist/cjs/src/client/info.js.map +1 -0
- package/dist/cjs/src/client/meters.cjs +115 -0
- package/dist/cjs/src/client/meters.d.cts +123 -0
- package/dist/cjs/src/client/meters.js.map +1 -0
- package/dist/cjs/src/client/notifications.cjs +249 -0
- package/dist/cjs/src/client/notifications.d.cts +397 -0
- package/dist/cjs/src/client/notifications.js.map +1 -0
- package/dist/cjs/src/client/plans.cjs +204 -0
- package/dist/cjs/src/client/plans.d.cts +247 -0
- package/dist/cjs/src/client/plans.js.map +1 -0
- package/dist/cjs/src/client/portal.cjs +55 -0
- package/dist/cjs/src/client/portal.d.cts +48 -0
- package/dist/cjs/src/client/portal.js.map +1 -0
- package/dist/cjs/src/client/schemas.cjs +3 -0
- package/dist/cjs/src/client/schemas.d.cts +25246 -0
- package/dist/cjs/src/client/schemas.js.map +1 -0
- package/dist/cjs/src/client/subjects.cjs +76 -0
- package/dist/cjs/src/client/subjects.d.cts +70 -0
- package/dist/cjs/src/client/subjects.js.map +1 -0
- package/dist/cjs/src/client/subscription-addons.cjs +70 -0
- package/dist/cjs/src/client/subscription-addons.d.cts +123 -0
- package/dist/cjs/src/client/subscription-addons.js.map +1 -0
- package/dist/cjs/src/client/subscriptions.cjs +132 -0
- package/dist/cjs/src/client/subscriptions.d.cts +170 -0
- package/dist/cjs/src/client/subscriptions.js.map +1 -0
- package/dist/cjs/src/client/utils.cjs +69 -0
- package/dist/cjs/src/client/utils.d.cts +12 -0
- package/dist/cjs/src/client/utils.js.map +1 -0
- package/dist/cjs/src/portal/index.cjs +89 -0
- package/dist/cjs/src/portal/index.d.cts +43 -0
- package/dist/cjs/src/portal/index.js.map +1 -0
- package/dist/cjs/src/react/context.cjs +35 -0
- package/dist/cjs/src/react/context.d.cts +9 -0
- package/dist/cjs/src/react/context.js.map +1 -0
- package/dist/cjs/src/zod/index.cjs +12205 -0
- package/dist/cjs/src/zod/index.d.cts +19139 -0
- package/dist/cjs/src/zod/index.js.map +1 -0
- package/dist/cjs/tsconfig.0bedc47d.tsbuildinfo +1 -0
- package/dist/cjs/tsconfig.c449a50f.tsbuildinfo +1 -0
- package/dist/index.d.ts +1 -14
- package/dist/index.js +2 -15
- package/dist/index.js.map +1 -0
- package/dist/src/client/addons.d.ts +152 -0
- package/dist/src/client/addons.js +101 -0
- package/dist/src/client/addons.js.map +1 -0
- package/dist/src/client/apps.d.ts +327 -0
- package/dist/src/client/apps.js +240 -0
- package/dist/src/client/apps.js.map +1 -0
- package/dist/src/client/billing.d.ts +526 -0
- package/dist/src/client/billing.js +354 -0
- package/dist/src/client/billing.js.map +1 -0
- package/dist/src/client/common.d.ts +30 -0
- package/dist/src/client/common.js +42 -0
- package/dist/src/client/common.js.map +1 -0
- package/dist/src/client/customers.d.ts +251 -0
- package/dist/src/client/customers.js +276 -0
- package/dist/src/client/customers.js.map +1 -0
- package/dist/src/client/debug.d.ts +17 -0
- package/dist/src/client/debug.js +23 -0
- package/dist/src/client/debug.js.map +1 -0
- package/dist/src/client/entitlements.d.ts +556 -0
- package/dist/src/client/entitlements.js +276 -0
- package/dist/src/client/entitlements.js.map +1 -0
- package/dist/src/client/events.d.ts +48 -0
- package/dist/src/client/events.js +108 -0
- package/dist/src/client/events.js.map +1 -0
- package/dist/src/client/features.d.ts +78 -0
- package/dist/src/client/features.js +74 -0
- package/dist/src/client/features.js.map +1 -0
- package/dist/src/client/index.d.ts +53 -0
- package/dist/src/client/index.js +80 -0
- package/dist/src/client/index.js.map +1 -0
- package/dist/src/client/info.d.ts +34 -0
- package/dist/src/client/info.js +38 -0
- package/dist/src/client/info.js.map +1 -0
- package/dist/src/client/meters.d.ts +123 -0
- package/dist/src/client/meters.js +111 -0
- package/dist/src/client/meters.js.map +1 -0
- package/dist/src/client/notifications.d.ts +397 -0
- package/dist/src/client/notifications.js +242 -0
- package/dist/src/client/notifications.js.map +1 -0
- package/dist/src/client/plans.d.ts +247 -0
- package/dist/src/client/plans.js +199 -0
- package/dist/src/client/plans.js.map +1 -0
- package/dist/src/client/portal.d.ts +48 -0
- package/dist/src/client/portal.js +51 -0
- package/dist/src/client/portal.js.map +1 -0
- package/dist/src/client/schemas.d.ts +25246 -0
- package/dist/src/client/schemas.js +2 -0
- package/dist/src/client/schemas.js.map +1 -0
- package/dist/src/client/subjects.d.ts +70 -0
- package/dist/src/client/subjects.js +72 -0
- package/dist/src/client/subjects.js.map +1 -0
- package/dist/src/client/subscription-addons.d.ts +123 -0
- package/dist/src/client/subscription-addons.js +66 -0
- package/dist/src/client/subscription-addons.js.map +1 -0
- package/dist/src/client/subscriptions.d.ts +170 -0
- package/dist/src/client/subscriptions.js +128 -0
- package/dist/src/client/subscriptions.js.map +1 -0
- package/dist/src/client/utils.d.ts +12 -0
- package/dist/src/client/utils.js +63 -0
- package/dist/src/client/utils.js.map +1 -0
- package/dist/src/portal/index.d.ts +43 -0
- package/dist/src/portal/index.js +52 -0
- package/dist/src/portal/index.js.map +1 -0
- package/dist/src/react/context.d.ts +9 -0
- package/dist/src/react/context.js +16 -0
- package/dist/src/react/context.js.map +1 -0
- package/dist/src/zod/index.d.ts +19139 -0
- package/dist/src/zod/index.js +12178 -0
- package/dist/src/zod/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/orval.config.ts +42 -0
- package/package.json +89 -35
- package/patches/openapi-typescript.patch +6194 -0
- package/dist/clients/client.d.ts +0 -40
- package/dist/clients/client.js +0 -104
- package/dist/clients/event.d.ts +0 -79
- package/dist/clients/event.js +0 -53
- package/dist/clients/meter.d.ts +0 -71
- package/dist/clients/meter.js +0 -64
- package/dist/clients/portal.d.ts +0 -23
- package/dist/clients/portal.js +0 -37
- package/dist/next.d.ts +0 -15
- package/dist/next.js +0 -46
- package/dist/schemas/openapi.d.ts +0 -460
- package/dist/schemas/openapi.js +0 -5
- package/dist/test/agent.d.ts +0 -2
- package/dist/test/agent.js +0 -178
- package/dist/test/mocks.d.ts +0 -12
- package/dist/test/mocks.js +0 -32
- package/index.ts +0 -22
- package/next.ts +0 -76
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../../src/client/schemas.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Subjects = void 0;
|
|
4
|
+
const utils_js_1 = require("./utils.cjs");
|
|
5
|
+
/**
|
|
6
|
+
* Subjects
|
|
7
|
+
* @description Subjects are entities that consume resources you wish to meter. These can range from users, servers, and services to devices. The design of subjects is intentionally generic, enabling flexible application across various metering scenarios. Meters are aggregating events for each subject..
|
|
8
|
+
*/
|
|
9
|
+
class Subjects {
|
|
10
|
+
client;
|
|
11
|
+
constructor(client) {
|
|
12
|
+
this.client = client;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Upsert one or multiple subjects
|
|
16
|
+
* If the subject does not exist, it will be created, otherwise it will be updated.
|
|
17
|
+
*
|
|
18
|
+
* @param subjects - The subjects to upsert
|
|
19
|
+
* @param signal - An optional abort signal
|
|
20
|
+
* @returns The upserted subjects
|
|
21
|
+
*/
|
|
22
|
+
async upsert(subjects, options) {
|
|
23
|
+
const resp = await this.client.POST('/api/v1/subjects', {
|
|
24
|
+
body: Array.isArray(subjects) ? subjects : [subjects],
|
|
25
|
+
...options,
|
|
26
|
+
});
|
|
27
|
+
return (0, utils_js_1.transformResponse)(resp);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get a subject by ID or key
|
|
31
|
+
* @param idOrKey - The ID or key of the subject
|
|
32
|
+
* @param signal - An optional abort signal
|
|
33
|
+
* @returns The subject
|
|
34
|
+
*/
|
|
35
|
+
async get(idOrKey, options) {
|
|
36
|
+
const resp = await this.client.GET('/api/v1/subjects/{subjectIdOrKey}', {
|
|
37
|
+
params: {
|
|
38
|
+
path: {
|
|
39
|
+
subjectIdOrKey: idOrKey,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
...options,
|
|
43
|
+
});
|
|
44
|
+
return (0, utils_js_1.transformResponse)(resp);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* List subjects
|
|
48
|
+
* @param signal - An optional abort signal
|
|
49
|
+
* @returns The subjects
|
|
50
|
+
*/
|
|
51
|
+
async list(options) {
|
|
52
|
+
const resp = await this.client.GET('/api/v1/subjects', {
|
|
53
|
+
...options,
|
|
54
|
+
});
|
|
55
|
+
return (0, utils_js_1.transformResponse)(resp);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Delete a subject by ID or key
|
|
59
|
+
* @param idOrKey - The ID or key of the subject
|
|
60
|
+
* @param signal - An optional abort signal
|
|
61
|
+
* @returns The deleted subject
|
|
62
|
+
*/
|
|
63
|
+
async delete(idOrKey, options) {
|
|
64
|
+
const resp = await this.client.DELETE('/api/v1/subjects/{subjectIdOrKey}', {
|
|
65
|
+
params: {
|
|
66
|
+
path: {
|
|
67
|
+
subjectIdOrKey: idOrKey,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
...options,
|
|
71
|
+
});
|
|
72
|
+
return (0, utils_js_1.transformResponse)(resp);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.Subjects = Subjects;
|
|
76
|
+
//# sourceMappingURL=subjects.js.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { RequestOptions } from './common.cjs';
|
|
2
|
+
import type { operations, paths, SubjectUpsert } from './schemas.cjs';
|
|
3
|
+
import type { Client } from 'openapi-fetch';
|
|
4
|
+
/**
|
|
5
|
+
* Subjects
|
|
6
|
+
* @description Subjects are entities that consume resources you wish to meter. These can range from users, servers, and services to devices. The design of subjects is intentionally generic, enabling flexible application across various metering scenarios. Meters are aggregating events for each subject..
|
|
7
|
+
*/
|
|
8
|
+
export declare class Subjects {
|
|
9
|
+
private client;
|
|
10
|
+
constructor(client: Client<paths, `${string}/${string}`>);
|
|
11
|
+
/**
|
|
12
|
+
* Upsert one or multiple subjects
|
|
13
|
+
* If the subject does not exist, it will be created, otherwise it will be updated.
|
|
14
|
+
*
|
|
15
|
+
* @param subjects - The subjects to upsert
|
|
16
|
+
* @param signal - An optional abort signal
|
|
17
|
+
* @returns The upserted subjects
|
|
18
|
+
*/
|
|
19
|
+
upsert(subjects: SubjectUpsert | SubjectUpsert[], options?: RequestOptions): Promise<{
|
|
20
|
+
readonly id: string;
|
|
21
|
+
key: string;
|
|
22
|
+
displayName?: string | null;
|
|
23
|
+
metadata?: {
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
} | null;
|
|
26
|
+
currentPeriodStart?: Date;
|
|
27
|
+
currentPeriodEnd?: Date;
|
|
28
|
+
stripeCustomerId?: string | null;
|
|
29
|
+
}[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Get a subject by ID or key
|
|
32
|
+
* @param idOrKey - The ID or key of the subject
|
|
33
|
+
* @param signal - An optional abort signal
|
|
34
|
+
* @returns The subject
|
|
35
|
+
*/
|
|
36
|
+
get(idOrKey: operations['getSubject']['parameters']['path']['subjectIdOrKey'], options?: RequestOptions): Promise<{
|
|
37
|
+
readonly id: string;
|
|
38
|
+
key: string;
|
|
39
|
+
displayName?: string | null;
|
|
40
|
+
metadata?: {
|
|
41
|
+
[key: string]: unknown;
|
|
42
|
+
} | null;
|
|
43
|
+
currentPeriodStart?: Date;
|
|
44
|
+
currentPeriodEnd?: Date;
|
|
45
|
+
stripeCustomerId?: string | null;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* List subjects
|
|
49
|
+
* @param signal - An optional abort signal
|
|
50
|
+
* @returns The subjects
|
|
51
|
+
*/
|
|
52
|
+
list(options?: RequestOptions): Promise<{
|
|
53
|
+
readonly id: string;
|
|
54
|
+
key: string;
|
|
55
|
+
displayName?: string | null;
|
|
56
|
+
metadata?: {
|
|
57
|
+
[key: string]: unknown;
|
|
58
|
+
} | null;
|
|
59
|
+
currentPeriodStart?: Date;
|
|
60
|
+
currentPeriodEnd?: Date;
|
|
61
|
+
stripeCustomerId?: string | null;
|
|
62
|
+
}[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Delete a subject by ID or key
|
|
65
|
+
* @param idOrKey - The ID or key of the subject
|
|
66
|
+
* @param signal - An optional abort signal
|
|
67
|
+
* @returns The deleted subject
|
|
68
|
+
*/
|
|
69
|
+
delete(idOrKey: operations['deleteSubject']['parameters']['path']['subjectIdOrKey'], options?: RequestOptions): Promise<undefined>;
|
|
70
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subjects.js","sourceRoot":"","sources":["../../../../src/client/subjects.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAK9C;;;GAGG;AACH,MAAa,QAAQ;IACC;IAApB,YAAoB,MAA4C;QAA5C,WAAM,GAAN,MAAM,CAAsC;IAAG,CAAC;IAEpE;;;;;;;OAOG;IACI,KAAK,CAAC,MAAM,CACjB,QAAyC,EACzC,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE;YACtD,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;YACrD,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,GAAG,CACd,OAAyE,EACzE,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,mCAAmC,EAAE;YACtE,MAAM,EAAE;gBACN,IAAI,EAAE;oBACJ,cAAc,EAAE,OAAO;iBACxB;aACF;YACD,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,IAAI,CAAC,OAAwB;QACxC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAkB,EAAE;YACrD,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CACjB,OAA4E,EAC5E,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,mCAAmC,EAAE;YACzE,MAAM,EAAE;gBACN,IAAI,EAAE;oBACJ,cAAc,EAAE,OAAO;iBACxB;aACF;YACD,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACF;AA/ED,4BA+EC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubscriptionAddons = void 0;
|
|
4
|
+
const utils_js_1 = require("./utils.cjs");
|
|
5
|
+
class SubscriptionAddons {
|
|
6
|
+
client;
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Create a new subscription addon
|
|
12
|
+
* @param subscriptionId - The ID of the subscription
|
|
13
|
+
* @param addon - The subscription addon to create
|
|
14
|
+
* @param options - Optional request options
|
|
15
|
+
* @returns The created subscription addon
|
|
16
|
+
*/
|
|
17
|
+
async create(subscriptionId, addon, options) {
|
|
18
|
+
const resp = await this.client.POST('/api/v1/subscriptions/{subscriptionId}/addons', {
|
|
19
|
+
body: addon,
|
|
20
|
+
params: { path: { subscriptionId } },
|
|
21
|
+
...options,
|
|
22
|
+
});
|
|
23
|
+
return (0, utils_js_1.transformResponse)(resp);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* List all addons of a subscription
|
|
27
|
+
* @param subscriptionId - The ID of the subscription
|
|
28
|
+
* @param options - Optional request options
|
|
29
|
+
* @returns A list of subscription addons
|
|
30
|
+
*/
|
|
31
|
+
async list(subscriptionId, options) {
|
|
32
|
+
const resp = await this.client.GET('/api/v1/subscriptions/{subscriptionId}/addons', {
|
|
33
|
+
params: { path: { subscriptionId } },
|
|
34
|
+
...options,
|
|
35
|
+
});
|
|
36
|
+
return (0, utils_js_1.transformResponse)(resp);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get a subscription addon by id
|
|
40
|
+
* @param subscriptionId - The ID of the subscription
|
|
41
|
+
* @param subscriptionAddonId - The ID of the subscription addon
|
|
42
|
+
* @param options - Optional request options
|
|
43
|
+
* @returns The subscription addon
|
|
44
|
+
*/
|
|
45
|
+
async get(subscriptionId, subscriptionAddonId, options) {
|
|
46
|
+
const resp = await this.client.GET('/api/v1/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}', {
|
|
47
|
+
params: { path: { subscriptionAddonId, subscriptionId } },
|
|
48
|
+
...options,
|
|
49
|
+
});
|
|
50
|
+
return (0, utils_js_1.transformResponse)(resp);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Updates a subscription addon
|
|
54
|
+
* @param subscriptionId - The ID of the subscription
|
|
55
|
+
* @param subscriptionAddonId - The ID of the subscription addon to update
|
|
56
|
+
* @param addon - The subscription addon data to update
|
|
57
|
+
* @param options - Optional request options
|
|
58
|
+
* @returns The updated subscription addon
|
|
59
|
+
*/
|
|
60
|
+
async update(subscriptionId, subscriptionAddonId, addon, options) {
|
|
61
|
+
const resp = await this.client.PATCH('/api/v1/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}', {
|
|
62
|
+
body: addon,
|
|
63
|
+
params: { path: { subscriptionAddonId, subscriptionId } },
|
|
64
|
+
...options,
|
|
65
|
+
});
|
|
66
|
+
return (0, utils_js_1.transformResponse)(resp);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.SubscriptionAddons = SubscriptionAddons;
|
|
70
|
+
//# sourceMappingURL=subscription-addons.js.map
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { RequestOptions } from './common.cjs';
|
|
2
|
+
import type { operations, paths } from './schemas.cjs';
|
|
3
|
+
import type { Client } from 'openapi-fetch';
|
|
4
|
+
export declare class SubscriptionAddons {
|
|
5
|
+
private client;
|
|
6
|
+
constructor(client: Client<paths, `${string}/${string}`>);
|
|
7
|
+
/**
|
|
8
|
+
* Create a new subscription addon
|
|
9
|
+
* @param subscriptionId - The ID of the subscription
|
|
10
|
+
* @param addon - The subscription addon to create
|
|
11
|
+
* @param options - Optional request options
|
|
12
|
+
* @returns The created subscription addon
|
|
13
|
+
*/
|
|
14
|
+
create(subscriptionId: string, addon: operations['createSubscriptionAddon']['requestBody']['content']['application/json'], options?: RequestOptions): Promise<{
|
|
15
|
+
readonly id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
|
|
19
|
+
readonly createdAt: Date;
|
|
20
|
+
readonly updatedAt: Date;
|
|
21
|
+
readonly deletedAt?: Date;
|
|
22
|
+
readonly activeFrom: Date;
|
|
23
|
+
readonly activeTo?: Date;
|
|
24
|
+
addon: {
|
|
25
|
+
id: string;
|
|
26
|
+
readonly key: string;
|
|
27
|
+
readonly version: number;
|
|
28
|
+
readonly instanceType: import("./schemas.cjs").components["schemas"]["AddonInstanceType"];
|
|
29
|
+
};
|
|
30
|
+
readonly quantityAt: Date;
|
|
31
|
+
quantity: number;
|
|
32
|
+
readonly timeline: import("./schemas.cjs").components["schemas"]["SubscriptionAddonTimelineSegment"][];
|
|
33
|
+
readonly subscriptionId: string;
|
|
34
|
+
readonly rateCards: import("./schemas.cjs").components["schemas"]["SubscriptionAddonRateCard"][];
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* List all addons of a subscription
|
|
38
|
+
* @param subscriptionId - The ID of the subscription
|
|
39
|
+
* @param options - Optional request options
|
|
40
|
+
* @returns A list of subscription addons
|
|
41
|
+
*/
|
|
42
|
+
list(subscriptionId: string, options?: RequestOptions): Promise<{
|
|
43
|
+
readonly id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
|
|
47
|
+
readonly createdAt: Date;
|
|
48
|
+
readonly updatedAt: Date;
|
|
49
|
+
readonly deletedAt?: Date;
|
|
50
|
+
readonly activeFrom: Date;
|
|
51
|
+
readonly activeTo?: Date;
|
|
52
|
+
addon: {
|
|
53
|
+
id: string;
|
|
54
|
+
readonly key: string;
|
|
55
|
+
readonly version: number;
|
|
56
|
+
readonly instanceType: import("./schemas.cjs").components["schemas"]["AddonInstanceType"];
|
|
57
|
+
};
|
|
58
|
+
readonly quantityAt: Date;
|
|
59
|
+
quantity: number;
|
|
60
|
+
readonly timeline: import("./schemas.cjs").components["schemas"]["SubscriptionAddonTimelineSegment"][];
|
|
61
|
+
readonly subscriptionId: string;
|
|
62
|
+
readonly rateCards: import("./schemas.cjs").components["schemas"]["SubscriptionAddonRateCard"][];
|
|
63
|
+
}[]>;
|
|
64
|
+
/**
|
|
65
|
+
* Get a subscription addon by id
|
|
66
|
+
* @param subscriptionId - The ID of the subscription
|
|
67
|
+
* @param subscriptionAddonId - The ID of the subscription addon
|
|
68
|
+
* @param options - Optional request options
|
|
69
|
+
* @returns The subscription addon
|
|
70
|
+
*/
|
|
71
|
+
get(subscriptionId: string, subscriptionAddonId: string, options?: RequestOptions): Promise<{
|
|
72
|
+
readonly id: string;
|
|
73
|
+
name: string;
|
|
74
|
+
description?: string;
|
|
75
|
+
metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
|
|
76
|
+
readonly createdAt: Date;
|
|
77
|
+
readonly updatedAt: Date;
|
|
78
|
+
readonly deletedAt?: Date;
|
|
79
|
+
readonly activeFrom: Date;
|
|
80
|
+
readonly activeTo?: Date;
|
|
81
|
+
addon: {
|
|
82
|
+
id: string;
|
|
83
|
+
readonly key: string;
|
|
84
|
+
readonly version: number;
|
|
85
|
+
readonly instanceType: import("./schemas.cjs").components["schemas"]["AddonInstanceType"];
|
|
86
|
+
};
|
|
87
|
+
readonly quantityAt: Date;
|
|
88
|
+
quantity: number;
|
|
89
|
+
readonly timeline: import("./schemas.cjs").components["schemas"]["SubscriptionAddonTimelineSegment"][];
|
|
90
|
+
readonly subscriptionId: string;
|
|
91
|
+
readonly rateCards: import("./schemas.cjs").components["schemas"]["SubscriptionAddonRateCard"][];
|
|
92
|
+
}>;
|
|
93
|
+
/**
|
|
94
|
+
* Updates a subscription addon
|
|
95
|
+
* @param subscriptionId - The ID of the subscription
|
|
96
|
+
* @param subscriptionAddonId - The ID of the subscription addon to update
|
|
97
|
+
* @param addon - The subscription addon data to update
|
|
98
|
+
* @param options - Optional request options
|
|
99
|
+
* @returns The updated subscription addon
|
|
100
|
+
*/
|
|
101
|
+
update(subscriptionId: string, subscriptionAddonId: string, addon: operations['updateSubscriptionAddon']['requestBody']['content']['application/json'], options?: RequestOptions): Promise<{
|
|
102
|
+
readonly id: string;
|
|
103
|
+
name: string;
|
|
104
|
+
description?: string;
|
|
105
|
+
metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
|
|
106
|
+
readonly createdAt: Date;
|
|
107
|
+
readonly updatedAt: Date;
|
|
108
|
+
readonly deletedAt?: Date;
|
|
109
|
+
readonly activeFrom: Date;
|
|
110
|
+
readonly activeTo?: Date;
|
|
111
|
+
addon: {
|
|
112
|
+
id: string;
|
|
113
|
+
readonly key: string;
|
|
114
|
+
readonly version: number;
|
|
115
|
+
readonly instanceType: import("./schemas.cjs").components["schemas"]["AddonInstanceType"];
|
|
116
|
+
};
|
|
117
|
+
readonly quantityAt: Date;
|
|
118
|
+
quantity: number;
|
|
119
|
+
readonly timeline: import("./schemas.cjs").components["schemas"]["SubscriptionAddonTimelineSegment"][];
|
|
120
|
+
readonly subscriptionId: string;
|
|
121
|
+
readonly rateCards: import("./schemas.cjs").components["schemas"]["SubscriptionAddonRateCard"][];
|
|
122
|
+
}>;
|
|
123
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription-addons.js","sourceRoot":"","sources":["../../../../src/client/subscription-addons.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAK9C,MAAa,kBAAkB;IACT;IAApB,YAAoB,MAA4C;QAA5C,WAAM,GAAN,MAAM,CAAsC;IAAG,CAAC;IAEpE;;;;;;OAMG;IACI,KAAK,CAAC,MAAM,CACjB,cAAsB,EACtB,KAA0F,EAC1F,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACjC,+CAA+C,EAC/C;YACE,IAAI,EAAE,KAAK;YACX,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,cAAc,EAAE,EAAE;YACpC,GAAG,OAAO;SACX,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,IAAI,CAAC,cAAsB,EAAE,OAAwB;QAChE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAChC,+CAA+C,EAC/C;YACE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,cAAc,EAAE,EAAE;YACpC,GAAG,OAAO;SACX,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,GAAG,CACd,cAAsB,EACtB,mBAA2B,EAC3B,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAChC,qEAAqE,EACrE;YACE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,mBAAmB,EAAE,cAAc,EAAE,EAAE;YACzD,GAAG,OAAO;SACX,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,MAAM,CACjB,cAAsB,EACtB,mBAA2B,EAC3B,KAA0F,EAC1F,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAClC,qEAAqE,EACrE;YACE,IAAI,EAAE,KAAK;YACX,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,mBAAmB,EAAE,cAAc,EAAE,EAAE;YACzD,GAAG,OAAO;SACX,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACF;AA7FD,gDA6FC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Subscriptions = void 0;
|
|
4
|
+
const utils_js_1 = require("./utils.cjs");
|
|
5
|
+
/**
|
|
6
|
+
* Subscriptions
|
|
7
|
+
*/
|
|
8
|
+
class Subscriptions {
|
|
9
|
+
client;
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create a subscription
|
|
15
|
+
* @param body - The subscription to create
|
|
16
|
+
* @param signal - An optional abort signal
|
|
17
|
+
* @returns The created subscription
|
|
18
|
+
*/
|
|
19
|
+
async create(body, options) {
|
|
20
|
+
const resp = await this.client.POST('/api/v1/subscriptions', {
|
|
21
|
+
body,
|
|
22
|
+
...options,
|
|
23
|
+
});
|
|
24
|
+
return (0, utils_js_1.transformResponse)(resp);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get a subscription
|
|
28
|
+
* @param id - The subscription ID
|
|
29
|
+
* @param signal - An optional abort signal
|
|
30
|
+
* @returns The subscription
|
|
31
|
+
*/
|
|
32
|
+
async get(id, options) {
|
|
33
|
+
const resp = await this.client.GET('/api/v1/subscriptions/{subscriptionId}', {
|
|
34
|
+
params: { path: { subscriptionId: id } },
|
|
35
|
+
...options,
|
|
36
|
+
});
|
|
37
|
+
return (0, utils_js_1.transformResponse)(resp);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Edit a subscription
|
|
41
|
+
* @param id - The subscription ID
|
|
42
|
+
* @param body - The subscription to edit
|
|
43
|
+
* @param signal - An optional abort signal
|
|
44
|
+
* @returns The edited subscription
|
|
45
|
+
*/
|
|
46
|
+
async edit(id, body, options) {
|
|
47
|
+
const resp = await this.client.PATCH('/api/v1/subscriptions/{subscriptionId}', {
|
|
48
|
+
body,
|
|
49
|
+
params: { path: { subscriptionId: id } },
|
|
50
|
+
...options,
|
|
51
|
+
});
|
|
52
|
+
return (0, utils_js_1.transformResponse)(resp);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Cancel a subscription
|
|
56
|
+
* @param id - The subscription ID
|
|
57
|
+
* @param body - The subscription to cancel
|
|
58
|
+
* @param signal - An optional abort signal
|
|
59
|
+
* @returns The canceled subscription
|
|
60
|
+
*/
|
|
61
|
+
async cancel(id, body, options) {
|
|
62
|
+
const resp = await this.client.POST('/api/v1/subscriptions/{subscriptionId}/cancel', {
|
|
63
|
+
body,
|
|
64
|
+
params: { path: { subscriptionId: id } },
|
|
65
|
+
...options,
|
|
66
|
+
});
|
|
67
|
+
return (0, utils_js_1.transformResponse)(resp);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Change a subscription
|
|
71
|
+
* @description Closes a running subscription and starts a new one according to the specification. Can be used for upgrades, downgrades, and plan changes.
|
|
72
|
+
* @param id - The subscription ID
|
|
73
|
+
* @param body - The subscription to change
|
|
74
|
+
* @param signal - An optional abort signal
|
|
75
|
+
* @returns The changed subscription
|
|
76
|
+
*/
|
|
77
|
+
async change(id, body, options) {
|
|
78
|
+
const resp = await this.client.POST('/api/v1/subscriptions/{subscriptionId}/change', {
|
|
79
|
+
body,
|
|
80
|
+
params: { path: { subscriptionId: id } },
|
|
81
|
+
...options,
|
|
82
|
+
});
|
|
83
|
+
return (0, utils_js_1.transformResponse)(resp);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Migrate a subscription
|
|
87
|
+
* @description Migrates the subscripiton to the provided version of the current plan.
|
|
88
|
+
* @param id - The subscription ID
|
|
89
|
+
* @param body - The subscription to migrate
|
|
90
|
+
* @param signal - An optional abort signal
|
|
91
|
+
* @returns The migrated subscription
|
|
92
|
+
*/
|
|
93
|
+
async migrate(id, body, options) {
|
|
94
|
+
const resp = await this.client.POST('/api/v1/subscriptions/{subscriptionId}/migrate', {
|
|
95
|
+
body,
|
|
96
|
+
params: { path: { subscriptionId: id } },
|
|
97
|
+
...options,
|
|
98
|
+
});
|
|
99
|
+
return (0, utils_js_1.transformResponse)(resp);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Unschedule a cancelation
|
|
103
|
+
* @param id - The subscription ID
|
|
104
|
+
* @param signal - An optional abort signal
|
|
105
|
+
* @returns The unscheduled subscription
|
|
106
|
+
*/
|
|
107
|
+
async unscheduleCancelation(id, options) {
|
|
108
|
+
const resp = await this.client.POST('/api/v1/subscriptions/{subscriptionId}/unschedule-cancelation', {
|
|
109
|
+
params: { path: { subscriptionId: id } },
|
|
110
|
+
...options,
|
|
111
|
+
});
|
|
112
|
+
return (0, utils_js_1.transformResponse)(resp);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Delete subscription
|
|
116
|
+
* @description Deletes a subscription. Only scheduled subscriptions can be deleted.
|
|
117
|
+
* @param subscriptionId - The ID of the subscription to delete
|
|
118
|
+
* @param options - Optional request options
|
|
119
|
+
* @returns void or standard error response structure
|
|
120
|
+
*/
|
|
121
|
+
async delete(subscriptionId, options) {
|
|
122
|
+
const resp = await this.client.DELETE('/api/v1/subscriptions/{subscriptionId}', {
|
|
123
|
+
params: {
|
|
124
|
+
path: { subscriptionId },
|
|
125
|
+
},
|
|
126
|
+
...options,
|
|
127
|
+
});
|
|
128
|
+
return (0, utils_js_1.transformResponse)(resp);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.Subscriptions = Subscriptions;
|
|
132
|
+
//# sourceMappingURL=subscriptions.js.map
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { RequestOptions } from './common.cjs';
|
|
2
|
+
import type { operations, paths, SubscriptionChange, SubscriptionCreate, SubscriptionEdit } from './schemas.cjs';
|
|
3
|
+
import type { Client } from 'openapi-fetch';
|
|
4
|
+
/**
|
|
5
|
+
* Subscriptions
|
|
6
|
+
*/
|
|
7
|
+
export declare class Subscriptions {
|
|
8
|
+
private readonly client;
|
|
9
|
+
constructor(client: Client<paths, `${string}/${string}`>);
|
|
10
|
+
/**
|
|
11
|
+
* Create a subscription
|
|
12
|
+
* @param body - The subscription to create
|
|
13
|
+
* @param signal - An optional abort signal
|
|
14
|
+
* @returns The created subscription
|
|
15
|
+
*/
|
|
16
|
+
create(body: SubscriptionCreate, options?: RequestOptions): Promise<{
|
|
17
|
+
readonly id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
|
|
21
|
+
readonly createdAt: Date;
|
|
22
|
+
readonly updatedAt: Date;
|
|
23
|
+
readonly deletedAt?: Date;
|
|
24
|
+
activeFrom: Date;
|
|
25
|
+
activeTo?: Date;
|
|
26
|
+
alignment?: import("./schemas.cjs").components["schemas"]["Alignment"];
|
|
27
|
+
readonly status: import("./schemas.cjs").components["schemas"]["SubscriptionStatus"];
|
|
28
|
+
customerId: string;
|
|
29
|
+
plan?: import("./schemas.cjs").components["schemas"]["PlanReference"];
|
|
30
|
+
currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
|
|
31
|
+
readonly billingCadence: string;
|
|
32
|
+
readonly proRatingConfig?: import("./schemas.cjs").components["schemas"]["ProRatingConfig"];
|
|
33
|
+
readonly billingAnchor: Date;
|
|
34
|
+
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Get a subscription
|
|
37
|
+
* @param id - The subscription ID
|
|
38
|
+
* @param signal - An optional abort signal
|
|
39
|
+
* @returns The subscription
|
|
40
|
+
*/
|
|
41
|
+
get(id: operations['getSubscription']['parameters']['path']['subscriptionId'], options?: RequestOptions): Promise<{
|
|
42
|
+
readonly id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
|
|
46
|
+
readonly createdAt: Date;
|
|
47
|
+
readonly updatedAt: Date;
|
|
48
|
+
readonly deletedAt?: Date;
|
|
49
|
+
activeFrom: Date;
|
|
50
|
+
activeTo?: Date;
|
|
51
|
+
readonly status: import("./schemas.cjs").components["schemas"]["SubscriptionStatus"];
|
|
52
|
+
customerId: string;
|
|
53
|
+
plan?: import("./schemas.cjs").components["schemas"]["PlanReference"];
|
|
54
|
+
currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
|
|
55
|
+
readonly billingCadence: string;
|
|
56
|
+
readonly proRatingConfig?: import("./schemas.cjs").components["schemas"]["ProRatingConfig"];
|
|
57
|
+
readonly billingAnchor: Date;
|
|
58
|
+
alignment?: import("./schemas.cjs").components["schemas"]["SubscriptionAlignment"];
|
|
59
|
+
phases: import("./schemas.cjs").components["schemas"]["SubscriptionPhaseExpanded"][];
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* Edit a subscription
|
|
63
|
+
* @param id - The subscription ID
|
|
64
|
+
* @param body - The subscription to edit
|
|
65
|
+
* @param signal - An optional abort signal
|
|
66
|
+
* @returns The edited subscription
|
|
67
|
+
*/
|
|
68
|
+
edit(id: operations['editSubscription']['parameters']['path']['subscriptionId'], body: SubscriptionEdit, options?: RequestOptions): Promise<{
|
|
69
|
+
readonly id: string;
|
|
70
|
+
name: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
|
|
73
|
+
readonly createdAt: Date;
|
|
74
|
+
readonly updatedAt: Date;
|
|
75
|
+
readonly deletedAt?: Date;
|
|
76
|
+
activeFrom: Date;
|
|
77
|
+
activeTo?: Date;
|
|
78
|
+
alignment?: import("./schemas.cjs").components["schemas"]["Alignment"];
|
|
79
|
+
readonly status: import("./schemas.cjs").components["schemas"]["SubscriptionStatus"];
|
|
80
|
+
customerId: string;
|
|
81
|
+
plan?: import("./schemas.cjs").components["schemas"]["PlanReference"];
|
|
82
|
+
currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
|
|
83
|
+
readonly billingCadence: string;
|
|
84
|
+
readonly proRatingConfig?: import("./schemas.cjs").components["schemas"]["ProRatingConfig"];
|
|
85
|
+
readonly billingAnchor: Date;
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
* Cancel a subscription
|
|
89
|
+
* @param id - The subscription ID
|
|
90
|
+
* @param body - The subscription to cancel
|
|
91
|
+
* @param signal - An optional abort signal
|
|
92
|
+
* @returns The canceled subscription
|
|
93
|
+
*/
|
|
94
|
+
cancel(id: operations['cancelSubscription']['parameters']['path']['subscriptionId'], body: operations['cancelSubscription']['requestBody']['content']['application/json'], options?: RequestOptions): Promise<{
|
|
95
|
+
readonly id: string;
|
|
96
|
+
name: string;
|
|
97
|
+
description?: string;
|
|
98
|
+
metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
|
|
99
|
+
readonly createdAt: Date;
|
|
100
|
+
readonly updatedAt: Date;
|
|
101
|
+
readonly deletedAt?: Date;
|
|
102
|
+
activeFrom: Date;
|
|
103
|
+
activeTo?: Date;
|
|
104
|
+
alignment?: import("./schemas.cjs").components["schemas"]["Alignment"];
|
|
105
|
+
readonly status: import("./schemas.cjs").components["schemas"]["SubscriptionStatus"];
|
|
106
|
+
customerId: string;
|
|
107
|
+
plan?: import("./schemas.cjs").components["schemas"]["PlanReference"];
|
|
108
|
+
currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
|
|
109
|
+
readonly billingCadence: string;
|
|
110
|
+
readonly proRatingConfig?: import("./schemas.cjs").components["schemas"]["ProRatingConfig"];
|
|
111
|
+
readonly billingAnchor: Date;
|
|
112
|
+
}>;
|
|
113
|
+
/**
|
|
114
|
+
* Change a subscription
|
|
115
|
+
* @description Closes a running subscription and starts a new one according to the specification. Can be used for upgrades, downgrades, and plan changes.
|
|
116
|
+
* @param id - The subscription ID
|
|
117
|
+
* @param body - The subscription to change
|
|
118
|
+
* @param signal - An optional abort signal
|
|
119
|
+
* @returns The changed subscription
|
|
120
|
+
*/
|
|
121
|
+
change(id: operations['changeSubscription']['parameters']['path']['subscriptionId'], body: SubscriptionChange, options?: RequestOptions): Promise<{
|
|
122
|
+
current: import("./schemas.cjs").components["schemas"]["Subscription"];
|
|
123
|
+
next: import("./schemas.cjs").components["schemas"]["SubscriptionExpanded"];
|
|
124
|
+
}>;
|
|
125
|
+
/**
|
|
126
|
+
* Migrate a subscription
|
|
127
|
+
* @description Migrates the subscripiton to the provided version of the current plan.
|
|
128
|
+
* @param id - The subscription ID
|
|
129
|
+
* @param body - The subscription to migrate
|
|
130
|
+
* @param signal - An optional abort signal
|
|
131
|
+
* @returns The migrated subscription
|
|
132
|
+
*/
|
|
133
|
+
migrate(id: operations['migrateSubscription']['parameters']['path']['subscriptionId'], body: operations['migrateSubscription']['requestBody']['content']['application/json'], options?: RequestOptions): Promise<{
|
|
134
|
+
current: import("./schemas.cjs").components["schemas"]["Subscription"];
|
|
135
|
+
next: import("./schemas.cjs").components["schemas"]["SubscriptionExpanded"];
|
|
136
|
+
}>;
|
|
137
|
+
/**
|
|
138
|
+
* Unschedule a cancelation
|
|
139
|
+
* @param id - The subscription ID
|
|
140
|
+
* @param signal - An optional abort signal
|
|
141
|
+
* @returns The unscheduled subscription
|
|
142
|
+
*/
|
|
143
|
+
unscheduleCancelation(id: operations['unscheduleCancelation']['parameters']['path']['subscriptionId'], options?: RequestOptions): Promise<{
|
|
144
|
+
readonly id: string;
|
|
145
|
+
name: string;
|
|
146
|
+
description?: string;
|
|
147
|
+
metadata?: import("./schemas.cjs").components["schemas"]["Metadata"] | null;
|
|
148
|
+
readonly createdAt: Date;
|
|
149
|
+
readonly updatedAt: Date;
|
|
150
|
+
readonly deletedAt?: Date;
|
|
151
|
+
activeFrom: Date;
|
|
152
|
+
activeTo?: Date;
|
|
153
|
+
alignment?: import("./schemas.cjs").components["schemas"]["Alignment"];
|
|
154
|
+
readonly status: import("./schemas.cjs").components["schemas"]["SubscriptionStatus"];
|
|
155
|
+
customerId: string;
|
|
156
|
+
plan?: import("./schemas.cjs").components["schemas"]["PlanReference"];
|
|
157
|
+
currency: import("./schemas.cjs").components["schemas"]["CurrencyCode"];
|
|
158
|
+
readonly billingCadence: string;
|
|
159
|
+
readonly proRatingConfig?: import("./schemas.cjs").components["schemas"]["ProRatingConfig"];
|
|
160
|
+
readonly billingAnchor: Date;
|
|
161
|
+
}>;
|
|
162
|
+
/**
|
|
163
|
+
* Delete subscription
|
|
164
|
+
* @description Deletes a subscription. Only scheduled subscriptions can be deleted.
|
|
165
|
+
* @param subscriptionId - The ID of the subscription to delete
|
|
166
|
+
* @param options - Optional request options
|
|
167
|
+
* @returns void or standard error response structure
|
|
168
|
+
*/
|
|
169
|
+
delete(subscriptionId: operations['deleteSubscription']['parameters']['path']['subscriptionId'], options?: RequestOptions): Promise<undefined>;
|
|
170
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../../../src/client/subscriptions.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAW9C;;GAEG;AACH,MAAa,aAAa;IACK;IAA7B,YAA6B,MAA4C;QAA5C,WAAM,GAAN,MAAM,CAAsC;IAAG,CAAC;IAE7E;;;;;OAKG;IACI,KAAK,CAAC,MAAM,CAAC,IAAwB,EAAE,OAAwB;QACpE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,EAAE;YAC3D,IAAI;YACJ,GAAG,OAAO;SACX,CAAC,CAAA;QAEF,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,GAAG,CACd,EAAyE,EACzE,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAChC,wCAAwC,EACxC;YACE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,EAAE;YACxC,GAAG,OAAO;SACX,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,IAAI,CACf,EAA0E,EAC1E,IAAsB,EACtB,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAClC,wCAAwC,EACxC;YACE,IAAI;YACJ,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,EAAE;YACxC,GAAG,OAAO;SACX,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,MAAM,CACjB,EAA4E,EAC5E,IAAoF,EACpF,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACjC,+CAA+C,EAC/C;YACE,IAAI;YACJ,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,EAAE;YACxC,GAAG,OAAO;SACX,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,MAAM,CACjB,EAA4E,EAC5E,IAAwB,EACxB,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACjC,+CAA+C,EAC/C;YACE,IAAI;YACJ,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,EAAE;YACxC,GAAG,OAAO;SACX,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,OAAO,CAClB,EAA6E,EAC7E,IAAqF,EACrF,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACjC,gDAAgD,EAChD;YACE,IAAI;YACJ,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,EAAE;YACxC,GAAG,OAAO;SACX,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,qBAAqB,CAChC,EAA+E,EAC/E,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CACjC,+DAA+D,EAC/D;YACE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,EAAE;YACxC,GAAG,OAAO;SACX,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,MAAM,CACjB,cAAwF,EACxF,OAAwB;QAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CACnC,wCAAwC,EACxC;YACE,MAAM,EAAE;gBACN,IAAI,EAAE,EAAE,cAAc,EAAE;aACzB;YACD,GAAG,OAAO;SACX,CACF,CAAA;QAED,OAAO,IAAA,4BAAiB,EAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACF;AArLD,sCAqLC"}
|