@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,70 @@
|
|
|
1
|
+
import type { RequestOptions } from './common.js';
|
|
2
|
+
import type { operations, paths, SubjectUpsert } from './schemas.js';
|
|
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,72 @@
|
|
|
1
|
+
import { transformResponse } from './utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Subjects
|
|
4
|
+
* @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..
|
|
5
|
+
*/
|
|
6
|
+
export class Subjects {
|
|
7
|
+
client;
|
|
8
|
+
constructor(client) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
}
|
|
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
|
+
async upsert(subjects, options) {
|
|
20
|
+
const resp = await this.client.POST('/api/v1/subjects', {
|
|
21
|
+
body: Array.isArray(subjects) ? subjects : [subjects],
|
|
22
|
+
...options,
|
|
23
|
+
});
|
|
24
|
+
return transformResponse(resp);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get a subject by ID or key
|
|
28
|
+
* @param idOrKey - The ID or key of the subject
|
|
29
|
+
* @param signal - An optional abort signal
|
|
30
|
+
* @returns The subject
|
|
31
|
+
*/
|
|
32
|
+
async get(idOrKey, options) {
|
|
33
|
+
const resp = await this.client.GET('/api/v1/subjects/{subjectIdOrKey}', {
|
|
34
|
+
params: {
|
|
35
|
+
path: {
|
|
36
|
+
subjectIdOrKey: idOrKey,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
...options,
|
|
40
|
+
});
|
|
41
|
+
return transformResponse(resp);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* List subjects
|
|
45
|
+
* @param signal - An optional abort signal
|
|
46
|
+
* @returns The subjects
|
|
47
|
+
*/
|
|
48
|
+
async list(options) {
|
|
49
|
+
const resp = await this.client.GET('/api/v1/subjects', {
|
|
50
|
+
...options,
|
|
51
|
+
});
|
|
52
|
+
return transformResponse(resp);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Delete a subject by ID or key
|
|
56
|
+
* @param idOrKey - The ID or key of the subject
|
|
57
|
+
* @param signal - An optional abort signal
|
|
58
|
+
* @returns The deleted subject
|
|
59
|
+
*/
|
|
60
|
+
async delete(idOrKey, options) {
|
|
61
|
+
const resp = await this.client.DELETE('/api/v1/subjects/{subjectIdOrKey}', {
|
|
62
|
+
params: {
|
|
63
|
+
path: {
|
|
64
|
+
subjectIdOrKey: idOrKey,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
...options,
|
|
68
|
+
});
|
|
69
|
+
return transformResponse(resp);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=subjects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subjects.js","sourceRoot":"","sources":["../../../src/client/subjects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAK9C;;;GAGG;AACH,MAAM,OAAO,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,iBAAiB,CAAC,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,iBAAiB,CAAC,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,iBAAiB,CAAC,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,iBAAiB,CAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { RequestOptions } from './common.js';
|
|
2
|
+
import type { operations, paths } from './schemas.js';
|
|
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.js").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.js").components["schemas"]["AddonInstanceType"];
|
|
29
|
+
};
|
|
30
|
+
readonly quantityAt: Date;
|
|
31
|
+
quantity: number;
|
|
32
|
+
readonly timeline: import("./schemas.js").components["schemas"]["SubscriptionAddonTimelineSegment"][];
|
|
33
|
+
readonly subscriptionId: string;
|
|
34
|
+
readonly rateCards: import("./schemas.js").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.js").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.js").components["schemas"]["AddonInstanceType"];
|
|
57
|
+
};
|
|
58
|
+
readonly quantityAt: Date;
|
|
59
|
+
quantity: number;
|
|
60
|
+
readonly timeline: import("./schemas.js").components["schemas"]["SubscriptionAddonTimelineSegment"][];
|
|
61
|
+
readonly subscriptionId: string;
|
|
62
|
+
readonly rateCards: import("./schemas.js").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.js").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.js").components["schemas"]["AddonInstanceType"];
|
|
86
|
+
};
|
|
87
|
+
readonly quantityAt: Date;
|
|
88
|
+
quantity: number;
|
|
89
|
+
readonly timeline: import("./schemas.js").components["schemas"]["SubscriptionAddonTimelineSegment"][];
|
|
90
|
+
readonly subscriptionId: string;
|
|
91
|
+
readonly rateCards: import("./schemas.js").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.js").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.js").components["schemas"]["AddonInstanceType"];
|
|
116
|
+
};
|
|
117
|
+
readonly quantityAt: Date;
|
|
118
|
+
quantity: number;
|
|
119
|
+
readonly timeline: import("./schemas.js").components["schemas"]["SubscriptionAddonTimelineSegment"][];
|
|
120
|
+
readonly subscriptionId: string;
|
|
121
|
+
readonly rateCards: import("./schemas.js").components["schemas"]["SubscriptionAddonRateCard"][];
|
|
122
|
+
}>;
|
|
123
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { transformResponse } from './utils.js';
|
|
2
|
+
export class SubscriptionAddons {
|
|
3
|
+
client;
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
}
|
|
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
|
+
async create(subscriptionId, addon, options) {
|
|
15
|
+
const resp = await this.client.POST('/api/v1/subscriptions/{subscriptionId}/addons', {
|
|
16
|
+
body: addon,
|
|
17
|
+
params: { path: { subscriptionId } },
|
|
18
|
+
...options,
|
|
19
|
+
});
|
|
20
|
+
return transformResponse(resp);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* List all addons of a subscription
|
|
24
|
+
* @param subscriptionId - The ID of the subscription
|
|
25
|
+
* @param options - Optional request options
|
|
26
|
+
* @returns A list of subscription addons
|
|
27
|
+
*/
|
|
28
|
+
async list(subscriptionId, options) {
|
|
29
|
+
const resp = await this.client.GET('/api/v1/subscriptions/{subscriptionId}/addons', {
|
|
30
|
+
params: { path: { subscriptionId } },
|
|
31
|
+
...options,
|
|
32
|
+
});
|
|
33
|
+
return transformResponse(resp);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get a subscription addon by id
|
|
37
|
+
* @param subscriptionId - The ID of the subscription
|
|
38
|
+
* @param subscriptionAddonId - The ID of the subscription addon
|
|
39
|
+
* @param options - Optional request options
|
|
40
|
+
* @returns The subscription addon
|
|
41
|
+
*/
|
|
42
|
+
async get(subscriptionId, subscriptionAddonId, options) {
|
|
43
|
+
const resp = await this.client.GET('/api/v1/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}', {
|
|
44
|
+
params: { path: { subscriptionAddonId, subscriptionId } },
|
|
45
|
+
...options,
|
|
46
|
+
});
|
|
47
|
+
return transformResponse(resp);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Updates a subscription addon
|
|
51
|
+
* @param subscriptionId - The ID of the subscription
|
|
52
|
+
* @param subscriptionAddonId - The ID of the subscription addon to update
|
|
53
|
+
* @param addon - The subscription addon data to update
|
|
54
|
+
* @param options - Optional request options
|
|
55
|
+
* @returns The updated subscription addon
|
|
56
|
+
*/
|
|
57
|
+
async update(subscriptionId, subscriptionAddonId, addon, options) {
|
|
58
|
+
const resp = await this.client.PATCH('/api/v1/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}', {
|
|
59
|
+
body: addon,
|
|
60
|
+
params: { path: { subscriptionAddonId, subscriptionId } },
|
|
61
|
+
...options,
|
|
62
|
+
});
|
|
63
|
+
return transformResponse(resp);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=subscription-addons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription-addons.js","sourceRoot":"","sources":["../../../src/client/subscription-addons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAK9C,MAAM,OAAO,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,iBAAiB,CAAC,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,iBAAiB,CAAC,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,iBAAiB,CAAC,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,iBAAiB,CAAC,IAAI,CAAC,CAAA;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { RequestOptions } from './common.js';
|
|
2
|
+
import type { operations, paths, SubscriptionChange, SubscriptionCreate, SubscriptionEdit } from './schemas.js';
|
|
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.js").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.js").components["schemas"]["Alignment"];
|
|
27
|
+
readonly status: import("./schemas.js").components["schemas"]["SubscriptionStatus"];
|
|
28
|
+
customerId: string;
|
|
29
|
+
plan?: import("./schemas.js").components["schemas"]["PlanReference"];
|
|
30
|
+
currency: import("./schemas.js").components["schemas"]["CurrencyCode"];
|
|
31
|
+
readonly billingCadence: string;
|
|
32
|
+
readonly proRatingConfig?: import("./schemas.js").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.js").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.js").components["schemas"]["SubscriptionStatus"];
|
|
52
|
+
customerId: string;
|
|
53
|
+
plan?: import("./schemas.js").components["schemas"]["PlanReference"];
|
|
54
|
+
currency: import("./schemas.js").components["schemas"]["CurrencyCode"];
|
|
55
|
+
readonly billingCadence: string;
|
|
56
|
+
readonly proRatingConfig?: import("./schemas.js").components["schemas"]["ProRatingConfig"];
|
|
57
|
+
readonly billingAnchor: Date;
|
|
58
|
+
alignment?: import("./schemas.js").components["schemas"]["SubscriptionAlignment"];
|
|
59
|
+
phases: import("./schemas.js").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.js").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.js").components["schemas"]["Alignment"];
|
|
79
|
+
readonly status: import("./schemas.js").components["schemas"]["SubscriptionStatus"];
|
|
80
|
+
customerId: string;
|
|
81
|
+
plan?: import("./schemas.js").components["schemas"]["PlanReference"];
|
|
82
|
+
currency: import("./schemas.js").components["schemas"]["CurrencyCode"];
|
|
83
|
+
readonly billingCadence: string;
|
|
84
|
+
readonly proRatingConfig?: import("./schemas.js").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.js").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.js").components["schemas"]["Alignment"];
|
|
105
|
+
readonly status: import("./schemas.js").components["schemas"]["SubscriptionStatus"];
|
|
106
|
+
customerId: string;
|
|
107
|
+
plan?: import("./schemas.js").components["schemas"]["PlanReference"];
|
|
108
|
+
currency: import("./schemas.js").components["schemas"]["CurrencyCode"];
|
|
109
|
+
readonly billingCadence: string;
|
|
110
|
+
readonly proRatingConfig?: import("./schemas.js").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.js").components["schemas"]["Subscription"];
|
|
123
|
+
next: import("./schemas.js").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.js").components["schemas"]["Subscription"];
|
|
135
|
+
next: import("./schemas.js").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.js").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.js").components["schemas"]["Alignment"];
|
|
154
|
+
readonly status: import("./schemas.js").components["schemas"]["SubscriptionStatus"];
|
|
155
|
+
customerId: string;
|
|
156
|
+
plan?: import("./schemas.js").components["schemas"]["PlanReference"];
|
|
157
|
+
currency: import("./schemas.js").components["schemas"]["CurrencyCode"];
|
|
158
|
+
readonly billingCadence: string;
|
|
159
|
+
readonly proRatingConfig?: import("./schemas.js").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,128 @@
|
|
|
1
|
+
import { transformResponse } from './utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Subscriptions
|
|
4
|
+
*/
|
|
5
|
+
export class Subscriptions {
|
|
6
|
+
client;
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.client = client;
|
|
9
|
+
}
|
|
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
|
+
async create(body, options) {
|
|
17
|
+
const resp = await this.client.POST('/api/v1/subscriptions', {
|
|
18
|
+
body,
|
|
19
|
+
...options,
|
|
20
|
+
});
|
|
21
|
+
return transformResponse(resp);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get a subscription
|
|
25
|
+
* @param id - The subscription ID
|
|
26
|
+
* @param signal - An optional abort signal
|
|
27
|
+
* @returns The subscription
|
|
28
|
+
*/
|
|
29
|
+
async get(id, options) {
|
|
30
|
+
const resp = await this.client.GET('/api/v1/subscriptions/{subscriptionId}', {
|
|
31
|
+
params: { path: { subscriptionId: id } },
|
|
32
|
+
...options,
|
|
33
|
+
});
|
|
34
|
+
return transformResponse(resp);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Edit a subscription
|
|
38
|
+
* @param id - The subscription ID
|
|
39
|
+
* @param body - The subscription to edit
|
|
40
|
+
* @param signal - An optional abort signal
|
|
41
|
+
* @returns The edited subscription
|
|
42
|
+
*/
|
|
43
|
+
async edit(id, body, options) {
|
|
44
|
+
const resp = await this.client.PATCH('/api/v1/subscriptions/{subscriptionId}', {
|
|
45
|
+
body,
|
|
46
|
+
params: { path: { subscriptionId: id } },
|
|
47
|
+
...options,
|
|
48
|
+
});
|
|
49
|
+
return transformResponse(resp);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Cancel a subscription
|
|
53
|
+
* @param id - The subscription ID
|
|
54
|
+
* @param body - The subscription to cancel
|
|
55
|
+
* @param signal - An optional abort signal
|
|
56
|
+
* @returns The canceled subscription
|
|
57
|
+
*/
|
|
58
|
+
async cancel(id, body, options) {
|
|
59
|
+
const resp = await this.client.POST('/api/v1/subscriptions/{subscriptionId}/cancel', {
|
|
60
|
+
body,
|
|
61
|
+
params: { path: { subscriptionId: id } },
|
|
62
|
+
...options,
|
|
63
|
+
});
|
|
64
|
+
return transformResponse(resp);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Change a subscription
|
|
68
|
+
* @description Closes a running subscription and starts a new one according to the specification. Can be used for upgrades, downgrades, and plan changes.
|
|
69
|
+
* @param id - The subscription ID
|
|
70
|
+
* @param body - The subscription to change
|
|
71
|
+
* @param signal - An optional abort signal
|
|
72
|
+
* @returns The changed subscription
|
|
73
|
+
*/
|
|
74
|
+
async change(id, body, options) {
|
|
75
|
+
const resp = await this.client.POST('/api/v1/subscriptions/{subscriptionId}/change', {
|
|
76
|
+
body,
|
|
77
|
+
params: { path: { subscriptionId: id } },
|
|
78
|
+
...options,
|
|
79
|
+
});
|
|
80
|
+
return transformResponse(resp);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Migrate a subscription
|
|
84
|
+
* @description Migrates the subscripiton to the provided version of the current plan.
|
|
85
|
+
* @param id - The subscription ID
|
|
86
|
+
* @param body - The subscription to migrate
|
|
87
|
+
* @param signal - An optional abort signal
|
|
88
|
+
* @returns The migrated subscription
|
|
89
|
+
*/
|
|
90
|
+
async migrate(id, body, options) {
|
|
91
|
+
const resp = await this.client.POST('/api/v1/subscriptions/{subscriptionId}/migrate', {
|
|
92
|
+
body,
|
|
93
|
+
params: { path: { subscriptionId: id } },
|
|
94
|
+
...options,
|
|
95
|
+
});
|
|
96
|
+
return transformResponse(resp);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Unschedule a cancelation
|
|
100
|
+
* @param id - The subscription ID
|
|
101
|
+
* @param signal - An optional abort signal
|
|
102
|
+
* @returns The unscheduled subscription
|
|
103
|
+
*/
|
|
104
|
+
async unscheduleCancelation(id, options) {
|
|
105
|
+
const resp = await this.client.POST('/api/v1/subscriptions/{subscriptionId}/unschedule-cancelation', {
|
|
106
|
+
params: { path: { subscriptionId: id } },
|
|
107
|
+
...options,
|
|
108
|
+
});
|
|
109
|
+
return transformResponse(resp);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Delete subscription
|
|
113
|
+
* @description Deletes a subscription. Only scheduled subscriptions can be deleted.
|
|
114
|
+
* @param subscriptionId - The ID of the subscription to delete
|
|
115
|
+
* @param options - Optional request options
|
|
116
|
+
* @returns void or standard error response structure
|
|
117
|
+
*/
|
|
118
|
+
async delete(subscriptionId, options) {
|
|
119
|
+
const resp = await this.client.DELETE('/api/v1/subscriptions/{subscriptionId}', {
|
|
120
|
+
params: {
|
|
121
|
+
path: { subscriptionId },
|
|
122
|
+
},
|
|
123
|
+
...options,
|
|
124
|
+
});
|
|
125
|
+
return transformResponse(resp);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=subscriptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../../src/client/subscriptions.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FetchResponse, ParseAsResponse } from 'openapi-fetch';
|
|
2
|
+
import type { MediaType, ResponseObjectMap, SuccessResponse } from 'openapi-typescript-helpers';
|
|
3
|
+
/**
|
|
4
|
+
* Transform a response from the API
|
|
5
|
+
* @param resp - The response to transform
|
|
6
|
+
* @throws HTTPError if the response is an error
|
|
7
|
+
* @returns The transformed response
|
|
8
|
+
*/
|
|
9
|
+
export declare function transformResponse<T extends Record<string | number, any>, Options, Media extends MediaType>(resp: FetchResponse<T, Options, Media>): ParseAsResponse<SuccessResponse<ResponseObjectMap<T>, Media>, Options> | never;
|
|
10
|
+
export declare function isIsoDateString(value: unknown): value is string;
|
|
11
|
+
export declare function decodeDates<T>(data: T): T;
|
|
12
|
+
export declare function encodeDates<T>(data: T): T;
|