@polar-sh/sdk 0.22.0 → 0.22.2
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/README.md +2 -0
- package/dist/commonjs/funcs/checkoutsCustomClientConfirm.d.ts +2 -1
- package/dist/commonjs/funcs/checkoutsCustomClientConfirm.d.ts.map +1 -1
- package/dist/commonjs/funcs/checkoutsCustomClientConfirm.js +3 -2
- package/dist/commonjs/funcs/checkoutsCustomClientConfirm.js.map +1 -1
- package/dist/commonjs/funcs/checkoutsCustomClientUpdate.d.ts +2 -1
- package/dist/commonjs/funcs/checkoutsCustomClientUpdate.d.ts.map +1 -1
- package/dist/commonjs/funcs/checkoutsCustomClientUpdate.js +3 -2
- package/dist/commonjs/funcs/checkoutsCustomClientUpdate.js.map +1 -1
- package/dist/commonjs/funcs/checkoutsCustomUpdate.d.ts +2 -1
- package/dist/commonjs/funcs/checkoutsCustomUpdate.d.ts.map +1 -1
- package/dist/commonjs/funcs/checkoutsCustomUpdate.js +3 -2
- package/dist/commonjs/funcs/checkoutsCustomUpdate.js.map +1 -1
- package/dist/commonjs/funcs/customerPortalDownloadablesGet.js +1 -1
- package/dist/commonjs/funcs/customerPortalDownloadablesGet.js.map +1 -1
- package/dist/commonjs/funcs/subscriptionsGet.d.ts +18 -0
- package/dist/commonjs/funcs/subscriptionsGet.d.ts.map +1 -0
- package/dist/commonjs/funcs/subscriptionsGet.js +108 -0
- package/dist/commonjs/funcs/subscriptionsGet.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/models/components/oauth2client.js +2 -2
- package/dist/commonjs/models/components/oauth2client.js.map +1 -1
- package/dist/commonjs/models/components/oauth2clientconfiguration.js +2 -2
- package/dist/commonjs/models/components/oauth2clientconfiguration.js.map +1 -1
- package/dist/commonjs/models/components/oauth2clientconfigurationupdate.js +2 -2
- package/dist/commonjs/models/components/oauth2clientconfigurationupdate.js.map +1 -1
- package/dist/commonjs/models/components/organization.d.ts +3 -0
- package/dist/commonjs/models/components/organization.d.ts.map +1 -1
- package/dist/commonjs/models/components/organization.js +5 -0
- package/dist/commonjs/models/components/organization.js.map +1 -1
- package/dist/commonjs/models/components/organizationcreate.d.ts +3 -0
- package/dist/commonjs/models/components/organizationcreate.d.ts.map +1 -1
- package/dist/commonjs/models/components/organizationcreate.js +5 -0
- package/dist/commonjs/models/components/organizationcreate.js.map +1 -1
- package/dist/commonjs/models/components/organizationsubscriptionsettings.d.ts +34 -0
- package/dist/commonjs/models/components/organizationsubscriptionsettings.d.ts.map +1 -0
- package/dist/commonjs/models/components/organizationsubscriptionsettings.js +77 -0
- package/dist/commonjs/models/components/organizationsubscriptionsettings.js.map +1 -0
- package/dist/commonjs/models/components/organizationupdate.d.ts +3 -0
- package/dist/commonjs/models/components/organizationupdate.d.ts.map +1 -1
- package/dist/commonjs/models/components/organizationupdate.js +5 -0
- package/dist/commonjs/models/components/organizationupdate.js.map +1 -1
- package/dist/commonjs/models/components/scope.d.ts +6 -0
- package/dist/commonjs/models/components/scope.d.ts.map +1 -1
- package/dist/commonjs/models/components/scope.js +2 -0
- package/dist/commonjs/models/components/scope.js.map +1 -1
- package/dist/commonjs/models/components/subscriptionprorationbehavior.d.ts +28 -0
- package/dist/commonjs/models/components/subscriptionprorationbehavior.d.ts.map +1 -0
- package/dist/commonjs/models/components/subscriptionprorationbehavior.js +50 -0
- package/dist/commonjs/models/components/subscriptionprorationbehavior.js.map +1 -0
- package/dist/commonjs/models/components/subscriptionupdateprice.d.ts +6 -0
- package/dist/commonjs/models/components/subscriptionupdateprice.d.ts.map +1 -1
- package/dist/commonjs/models/components/subscriptionupdateprice.js +7 -0
- package/dist/commonjs/models/components/subscriptionupdateprice.js.map +1 -1
- package/dist/commonjs/models/errors/alreadyactivesubscriptionerror.d.ts +34 -0
- package/dist/commonjs/models/errors/alreadyactivesubscriptionerror.d.ts.map +1 -0
- package/dist/commonjs/models/errors/alreadyactivesubscriptionerror.js +70 -0
- package/dist/commonjs/models/errors/alreadyactivesubscriptionerror.js.map +1 -0
- package/dist/commonjs/models/operations/subscriptionsget.d.ts +32 -0
- package/dist/commonjs/models/operations/subscriptionsget.d.ts.map +1 -0
- package/dist/commonjs/models/operations/subscriptionsget.js +59 -0
- package/dist/commonjs/models/operations/subscriptionsget.js.map +1 -0
- package/dist/commonjs/sdk/subscriptions.d.ts +8 -0
- package/dist/commonjs/sdk/subscriptions.d.ts.map +1 -1
- package/dist/commonjs/sdk/subscriptions.js +10 -0
- package/dist/commonjs/sdk/subscriptions.js.map +1 -1
- package/dist/esm/funcs/checkoutsCustomClientConfirm.d.ts +2 -1
- package/dist/esm/funcs/checkoutsCustomClientConfirm.d.ts.map +1 -1
- package/dist/esm/funcs/checkoutsCustomClientConfirm.js +3 -2
- package/dist/esm/funcs/checkoutsCustomClientConfirm.js.map +1 -1
- package/dist/esm/funcs/checkoutsCustomClientUpdate.d.ts +2 -1
- package/dist/esm/funcs/checkoutsCustomClientUpdate.d.ts.map +1 -1
- package/dist/esm/funcs/checkoutsCustomClientUpdate.js +3 -2
- package/dist/esm/funcs/checkoutsCustomClientUpdate.js.map +1 -1
- package/dist/esm/funcs/checkoutsCustomUpdate.d.ts +2 -1
- package/dist/esm/funcs/checkoutsCustomUpdate.d.ts.map +1 -1
- package/dist/esm/funcs/checkoutsCustomUpdate.js +3 -2
- package/dist/esm/funcs/checkoutsCustomUpdate.js.map +1 -1
- package/dist/esm/funcs/customerPortalDownloadablesGet.js +1 -1
- package/dist/esm/funcs/customerPortalDownloadablesGet.js.map +1 -1
- package/dist/esm/funcs/subscriptionsGet.d.ts +18 -0
- package/dist/esm/funcs/subscriptionsGet.d.ts.map +1 -0
- package/dist/esm/funcs/subscriptionsGet.js +82 -0
- package/dist/esm/funcs/subscriptionsGet.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/models/components/oauth2client.js +2 -2
- package/dist/esm/models/components/oauth2client.js.map +1 -1
- package/dist/esm/models/components/oauth2clientconfiguration.js +2 -2
- package/dist/esm/models/components/oauth2clientconfiguration.js.map +1 -1
- package/dist/esm/models/components/oauth2clientconfigurationupdate.js +2 -2
- package/dist/esm/models/components/oauth2clientconfigurationupdate.js.map +1 -1
- package/dist/esm/models/components/organization.d.ts +3 -0
- package/dist/esm/models/components/organization.d.ts.map +1 -1
- package/dist/esm/models/components/organization.js +5 -0
- package/dist/esm/models/components/organization.js.map +1 -1
- package/dist/esm/models/components/organizationcreate.d.ts +3 -0
- package/dist/esm/models/components/organizationcreate.d.ts.map +1 -1
- package/dist/esm/models/components/organizationcreate.js +5 -0
- package/dist/esm/models/components/organizationcreate.js.map +1 -1
- package/dist/esm/models/components/organizationsubscriptionsettings.d.ts +34 -0
- package/dist/esm/models/components/organizationsubscriptionsettings.d.ts.map +1 -0
- package/dist/esm/models/components/organizationsubscriptionsettings.js +49 -0
- package/dist/esm/models/components/organizationsubscriptionsettings.js.map +1 -0
- package/dist/esm/models/components/organizationupdate.d.ts +3 -0
- package/dist/esm/models/components/organizationupdate.d.ts.map +1 -1
- package/dist/esm/models/components/organizationupdate.js +5 -0
- package/dist/esm/models/components/organizationupdate.js.map +1 -1
- package/dist/esm/models/components/scope.d.ts +6 -0
- package/dist/esm/models/components/scope.d.ts.map +1 -1
- package/dist/esm/models/components/scope.js +2 -0
- package/dist/esm/models/components/scope.js.map +1 -1
- package/dist/esm/models/components/subscriptionprorationbehavior.d.ts +28 -0
- package/dist/esm/models/components/subscriptionprorationbehavior.d.ts.map +1 -0
- package/dist/esm/models/components/subscriptionprorationbehavior.js +24 -0
- package/dist/esm/models/components/subscriptionprorationbehavior.js.map +1 -0
- package/dist/esm/models/components/subscriptionupdateprice.d.ts +6 -0
- package/dist/esm/models/components/subscriptionupdateprice.d.ts.map +1 -1
- package/dist/esm/models/components/subscriptionupdateprice.js +7 -0
- package/dist/esm/models/components/subscriptionupdateprice.js.map +1 -1
- package/dist/esm/models/errors/alreadyactivesubscriptionerror.d.ts +34 -0
- package/dist/esm/models/errors/alreadyactivesubscriptionerror.d.ts.map +1 -0
- package/dist/esm/models/errors/alreadyactivesubscriptionerror.js +43 -0
- package/dist/esm/models/errors/alreadyactivesubscriptionerror.js.map +1 -0
- package/dist/esm/models/operations/subscriptionsget.d.ts +32 -0
- package/dist/esm/models/operations/subscriptionsget.d.ts.map +1 -0
- package/dist/esm/models/operations/subscriptionsget.js +31 -0
- package/dist/esm/models/operations/subscriptionsget.js.map +1 -0
- package/dist/esm/sdk/subscriptions.d.ts +8 -0
- package/dist/esm/sdk/subscriptions.d.ts.map +1 -1
- package/dist/esm/sdk/subscriptions.js +10 -0
- package/dist/esm/sdk/subscriptions.js.map +1 -1
- package/docs/sdks/custom/README.md +18 -15
- package/docs/sdks/subscriptions/README.md +79 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/checkoutsCustomClientConfirm.ts +8 -1
- package/src/funcs/checkoutsCustomClientUpdate.ts +8 -1
- package/src/funcs/checkoutsCustomUpdate.ts +8 -1
- package/src/funcs/customerPortalDownloadablesGet.ts +1 -1
- package/src/funcs/subscriptionsGet.ts +157 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/oauth2client.ts +2 -2
- package/src/models/components/oauth2clientconfiguration.ts +2 -2
- package/src/models/components/oauth2clientconfigurationupdate.ts +2 -2
- package/src/models/components/organization.ts +12 -0
- package/src/models/components/organizationcreate.ts +19 -0
- package/src/models/components/organizationsubscriptionsettings.ts +94 -0
- package/src/models/components/organizationupdate.ts +19 -0
- package/src/models/components/scope.ts +2 -0
- package/src/models/components/subscriptionprorationbehavior.ts +35 -0
- package/src/models/components/subscriptionupdateprice.ts +16 -0
- package/src/models/errors/alreadyactivesubscriptionerror.ts +77 -0
- package/src/models/operations/subscriptionsget.ts +69 -0
- package/src/sdk/subscriptions.ts +19 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
|
|
7
|
+
export type AlreadyActiveSubscriptionErrorData = {
|
|
8
|
+
error: "AlreadyActiveSubscriptionError";
|
|
9
|
+
detail: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export class AlreadyActiveSubscriptionError extends Error {
|
|
13
|
+
error: "AlreadyActiveSubscriptionError";
|
|
14
|
+
detail: string;
|
|
15
|
+
|
|
16
|
+
/** The original data that was passed to this error instance. */
|
|
17
|
+
data$: AlreadyActiveSubscriptionErrorData;
|
|
18
|
+
|
|
19
|
+
constructor(err: AlreadyActiveSubscriptionErrorData) {
|
|
20
|
+
const message = "message" in err && typeof err.message === "string"
|
|
21
|
+
? err.message
|
|
22
|
+
: `API error occurred: ${JSON.stringify(err)}`;
|
|
23
|
+
super(message);
|
|
24
|
+
this.data$ = err;
|
|
25
|
+
|
|
26
|
+
this.error = err.error;
|
|
27
|
+
this.detail = err.detail;
|
|
28
|
+
|
|
29
|
+
this.name = "AlreadyActiveSubscriptionError";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** @internal */
|
|
34
|
+
export const AlreadyActiveSubscriptionError$inboundSchema: z.ZodType<
|
|
35
|
+
AlreadyActiveSubscriptionError,
|
|
36
|
+
z.ZodTypeDef,
|
|
37
|
+
unknown
|
|
38
|
+
> = z.object({
|
|
39
|
+
error: z.literal("AlreadyActiveSubscriptionError"),
|
|
40
|
+
detail: z.string(),
|
|
41
|
+
})
|
|
42
|
+
.transform((v) => {
|
|
43
|
+
return new AlreadyActiveSubscriptionError(v);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
/** @internal */
|
|
47
|
+
export type AlreadyActiveSubscriptionError$Outbound = {
|
|
48
|
+
error: "AlreadyActiveSubscriptionError";
|
|
49
|
+
detail: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** @internal */
|
|
53
|
+
export const AlreadyActiveSubscriptionError$outboundSchema: z.ZodType<
|
|
54
|
+
AlreadyActiveSubscriptionError$Outbound,
|
|
55
|
+
z.ZodTypeDef,
|
|
56
|
+
AlreadyActiveSubscriptionError
|
|
57
|
+
> = z.instanceof(AlreadyActiveSubscriptionError)
|
|
58
|
+
.transform(v => v.data$)
|
|
59
|
+
.pipe(z.object({
|
|
60
|
+
error: z.literal("AlreadyActiveSubscriptionError").default(
|
|
61
|
+
"AlreadyActiveSubscriptionError" as const,
|
|
62
|
+
),
|
|
63
|
+
detail: z.string(),
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @internal
|
|
68
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
69
|
+
*/
|
|
70
|
+
export namespace AlreadyActiveSubscriptionError$ {
|
|
71
|
+
/** @deprecated use `AlreadyActiveSubscriptionError$inboundSchema` instead. */
|
|
72
|
+
export const inboundSchema = AlreadyActiveSubscriptionError$inboundSchema;
|
|
73
|
+
/** @deprecated use `AlreadyActiveSubscriptionError$outboundSchema` instead. */
|
|
74
|
+
export const outboundSchema = AlreadyActiveSubscriptionError$outboundSchema;
|
|
75
|
+
/** @deprecated use `AlreadyActiveSubscriptionError$Outbound` instead. */
|
|
76
|
+
export type Outbound = AlreadyActiveSubscriptionError$Outbound;
|
|
77
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type SubscriptionsGetRequest = {
|
|
11
|
+
/**
|
|
12
|
+
* The subscription ID.
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const SubscriptionsGetRequest$inboundSchema: z.ZodType<
|
|
19
|
+
SubscriptionsGetRequest,
|
|
20
|
+
z.ZodTypeDef,
|
|
21
|
+
unknown
|
|
22
|
+
> = z.object({
|
|
23
|
+
id: z.string(),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/** @internal */
|
|
27
|
+
export type SubscriptionsGetRequest$Outbound = {
|
|
28
|
+
id: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** @internal */
|
|
32
|
+
export const SubscriptionsGetRequest$outboundSchema: z.ZodType<
|
|
33
|
+
SubscriptionsGetRequest$Outbound,
|
|
34
|
+
z.ZodTypeDef,
|
|
35
|
+
SubscriptionsGetRequest
|
|
36
|
+
> = z.object({
|
|
37
|
+
id: z.string(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
43
|
+
*/
|
|
44
|
+
export namespace SubscriptionsGetRequest$ {
|
|
45
|
+
/** @deprecated use `SubscriptionsGetRequest$inboundSchema` instead. */
|
|
46
|
+
export const inboundSchema = SubscriptionsGetRequest$inboundSchema;
|
|
47
|
+
/** @deprecated use `SubscriptionsGetRequest$outboundSchema` instead. */
|
|
48
|
+
export const outboundSchema = SubscriptionsGetRequest$outboundSchema;
|
|
49
|
+
/** @deprecated use `SubscriptionsGetRequest$Outbound` instead. */
|
|
50
|
+
export type Outbound = SubscriptionsGetRequest$Outbound;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function subscriptionsGetRequestToJSON(
|
|
54
|
+
subscriptionsGetRequest: SubscriptionsGetRequest,
|
|
55
|
+
): string {
|
|
56
|
+
return JSON.stringify(
|
|
57
|
+
SubscriptionsGetRequest$outboundSchema.parse(subscriptionsGetRequest),
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function subscriptionsGetRequestFromJSON(
|
|
62
|
+
jsonString: string,
|
|
63
|
+
): SafeParseResult<SubscriptionsGetRequest, SDKValidationError> {
|
|
64
|
+
return safeParse(
|
|
65
|
+
jsonString,
|
|
66
|
+
(x) => SubscriptionsGetRequest$inboundSchema.parse(JSON.parse(x)),
|
|
67
|
+
`Failed to parse 'SubscriptionsGetRequest' from JSON`,
|
|
68
|
+
);
|
|
69
|
+
}
|
package/src/sdk/subscriptions.ts
CHANGED
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { subscriptionsExport } from "../funcs/subscriptionsExport.js";
|
|
6
|
+
import { subscriptionsGet } from "../funcs/subscriptionsGet.js";
|
|
6
7
|
import { subscriptionsList } from "../funcs/subscriptionsList.js";
|
|
7
8
|
import { subscriptionsRevoke } from "../funcs/subscriptionsRevoke.js";
|
|
8
9
|
import { subscriptionsUpdate } from "../funcs/subscriptionsUpdate.js";
|
|
9
10
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
10
11
|
import { Subscription } from "../models/components/subscription.js";
|
|
11
12
|
import { SubscriptionsExportRequest } from "../models/operations/subscriptionsexport.js";
|
|
13
|
+
import { SubscriptionsGetRequest } from "../models/operations/subscriptionsget.js";
|
|
12
14
|
import {
|
|
13
15
|
SubscriptionsListRequest,
|
|
14
16
|
SubscriptionsListResponse,
|
|
@@ -53,6 +55,23 @@ export class Subscriptions extends ClientSDK {
|
|
|
53
55
|
));
|
|
54
56
|
}
|
|
55
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Get Subscription
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* Get a subscription by ID.
|
|
63
|
+
*/
|
|
64
|
+
async get(
|
|
65
|
+
request: SubscriptionsGetRequest,
|
|
66
|
+
options?: RequestOptions,
|
|
67
|
+
): Promise<Subscription> {
|
|
68
|
+
return unwrapAsync(subscriptionsGet(
|
|
69
|
+
this,
|
|
70
|
+
request,
|
|
71
|
+
options,
|
|
72
|
+
));
|
|
73
|
+
}
|
|
74
|
+
|
|
56
75
|
/**
|
|
57
76
|
* Update Subscription
|
|
58
77
|
*
|