@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.
Files changed (156) hide show
  1. package/README.md +2 -0
  2. package/dist/commonjs/funcs/checkoutsCustomClientConfirm.d.ts +2 -1
  3. package/dist/commonjs/funcs/checkoutsCustomClientConfirm.d.ts.map +1 -1
  4. package/dist/commonjs/funcs/checkoutsCustomClientConfirm.js +3 -2
  5. package/dist/commonjs/funcs/checkoutsCustomClientConfirm.js.map +1 -1
  6. package/dist/commonjs/funcs/checkoutsCustomClientUpdate.d.ts +2 -1
  7. package/dist/commonjs/funcs/checkoutsCustomClientUpdate.d.ts.map +1 -1
  8. package/dist/commonjs/funcs/checkoutsCustomClientUpdate.js +3 -2
  9. package/dist/commonjs/funcs/checkoutsCustomClientUpdate.js.map +1 -1
  10. package/dist/commonjs/funcs/checkoutsCustomUpdate.d.ts +2 -1
  11. package/dist/commonjs/funcs/checkoutsCustomUpdate.d.ts.map +1 -1
  12. package/dist/commonjs/funcs/checkoutsCustomUpdate.js +3 -2
  13. package/dist/commonjs/funcs/checkoutsCustomUpdate.js.map +1 -1
  14. package/dist/commonjs/funcs/customerPortalDownloadablesGet.js +1 -1
  15. package/dist/commonjs/funcs/customerPortalDownloadablesGet.js.map +1 -1
  16. package/dist/commonjs/funcs/subscriptionsGet.d.ts +18 -0
  17. package/dist/commonjs/funcs/subscriptionsGet.d.ts.map +1 -0
  18. package/dist/commonjs/funcs/subscriptionsGet.js +108 -0
  19. package/dist/commonjs/funcs/subscriptionsGet.js.map +1 -0
  20. package/dist/commonjs/lib/config.d.ts +3 -3
  21. package/dist/commonjs/lib/config.js +3 -3
  22. package/dist/commonjs/models/components/oauth2client.js +2 -2
  23. package/dist/commonjs/models/components/oauth2client.js.map +1 -1
  24. package/dist/commonjs/models/components/oauth2clientconfiguration.js +2 -2
  25. package/dist/commonjs/models/components/oauth2clientconfiguration.js.map +1 -1
  26. package/dist/commonjs/models/components/oauth2clientconfigurationupdate.js +2 -2
  27. package/dist/commonjs/models/components/oauth2clientconfigurationupdate.js.map +1 -1
  28. package/dist/commonjs/models/components/organization.d.ts +3 -0
  29. package/dist/commonjs/models/components/organization.d.ts.map +1 -1
  30. package/dist/commonjs/models/components/organization.js +5 -0
  31. package/dist/commonjs/models/components/organization.js.map +1 -1
  32. package/dist/commonjs/models/components/organizationcreate.d.ts +3 -0
  33. package/dist/commonjs/models/components/organizationcreate.d.ts.map +1 -1
  34. package/dist/commonjs/models/components/organizationcreate.js +5 -0
  35. package/dist/commonjs/models/components/organizationcreate.js.map +1 -1
  36. package/dist/commonjs/models/components/organizationsubscriptionsettings.d.ts +34 -0
  37. package/dist/commonjs/models/components/organizationsubscriptionsettings.d.ts.map +1 -0
  38. package/dist/commonjs/models/components/organizationsubscriptionsettings.js +77 -0
  39. package/dist/commonjs/models/components/organizationsubscriptionsettings.js.map +1 -0
  40. package/dist/commonjs/models/components/organizationupdate.d.ts +3 -0
  41. package/dist/commonjs/models/components/organizationupdate.d.ts.map +1 -1
  42. package/dist/commonjs/models/components/organizationupdate.js +5 -0
  43. package/dist/commonjs/models/components/organizationupdate.js.map +1 -1
  44. package/dist/commonjs/models/components/scope.d.ts +6 -0
  45. package/dist/commonjs/models/components/scope.d.ts.map +1 -1
  46. package/dist/commonjs/models/components/scope.js +2 -0
  47. package/dist/commonjs/models/components/scope.js.map +1 -1
  48. package/dist/commonjs/models/components/subscriptionprorationbehavior.d.ts +28 -0
  49. package/dist/commonjs/models/components/subscriptionprorationbehavior.d.ts.map +1 -0
  50. package/dist/commonjs/models/components/subscriptionprorationbehavior.js +50 -0
  51. package/dist/commonjs/models/components/subscriptionprorationbehavior.js.map +1 -0
  52. package/dist/commonjs/models/components/subscriptionupdateprice.d.ts +6 -0
  53. package/dist/commonjs/models/components/subscriptionupdateprice.d.ts.map +1 -1
  54. package/dist/commonjs/models/components/subscriptionupdateprice.js +7 -0
  55. package/dist/commonjs/models/components/subscriptionupdateprice.js.map +1 -1
  56. package/dist/commonjs/models/errors/alreadyactivesubscriptionerror.d.ts +34 -0
  57. package/dist/commonjs/models/errors/alreadyactivesubscriptionerror.d.ts.map +1 -0
  58. package/dist/commonjs/models/errors/alreadyactivesubscriptionerror.js +70 -0
  59. package/dist/commonjs/models/errors/alreadyactivesubscriptionerror.js.map +1 -0
  60. package/dist/commonjs/models/operations/subscriptionsget.d.ts +32 -0
  61. package/dist/commonjs/models/operations/subscriptionsget.d.ts.map +1 -0
  62. package/dist/commonjs/models/operations/subscriptionsget.js +59 -0
  63. package/dist/commonjs/models/operations/subscriptionsget.js.map +1 -0
  64. package/dist/commonjs/sdk/subscriptions.d.ts +8 -0
  65. package/dist/commonjs/sdk/subscriptions.d.ts.map +1 -1
  66. package/dist/commonjs/sdk/subscriptions.js +10 -0
  67. package/dist/commonjs/sdk/subscriptions.js.map +1 -1
  68. package/dist/esm/funcs/checkoutsCustomClientConfirm.d.ts +2 -1
  69. package/dist/esm/funcs/checkoutsCustomClientConfirm.d.ts.map +1 -1
  70. package/dist/esm/funcs/checkoutsCustomClientConfirm.js +3 -2
  71. package/dist/esm/funcs/checkoutsCustomClientConfirm.js.map +1 -1
  72. package/dist/esm/funcs/checkoutsCustomClientUpdate.d.ts +2 -1
  73. package/dist/esm/funcs/checkoutsCustomClientUpdate.d.ts.map +1 -1
  74. package/dist/esm/funcs/checkoutsCustomClientUpdate.js +3 -2
  75. package/dist/esm/funcs/checkoutsCustomClientUpdate.js.map +1 -1
  76. package/dist/esm/funcs/checkoutsCustomUpdate.d.ts +2 -1
  77. package/dist/esm/funcs/checkoutsCustomUpdate.d.ts.map +1 -1
  78. package/dist/esm/funcs/checkoutsCustomUpdate.js +3 -2
  79. package/dist/esm/funcs/checkoutsCustomUpdate.js.map +1 -1
  80. package/dist/esm/funcs/customerPortalDownloadablesGet.js +1 -1
  81. package/dist/esm/funcs/customerPortalDownloadablesGet.js.map +1 -1
  82. package/dist/esm/funcs/subscriptionsGet.d.ts +18 -0
  83. package/dist/esm/funcs/subscriptionsGet.d.ts.map +1 -0
  84. package/dist/esm/funcs/subscriptionsGet.js +82 -0
  85. package/dist/esm/funcs/subscriptionsGet.js.map +1 -0
  86. package/dist/esm/lib/config.d.ts +3 -3
  87. package/dist/esm/lib/config.js +3 -3
  88. package/dist/esm/models/components/oauth2client.js +2 -2
  89. package/dist/esm/models/components/oauth2client.js.map +1 -1
  90. package/dist/esm/models/components/oauth2clientconfiguration.js +2 -2
  91. package/dist/esm/models/components/oauth2clientconfiguration.js.map +1 -1
  92. package/dist/esm/models/components/oauth2clientconfigurationupdate.js +2 -2
  93. package/dist/esm/models/components/oauth2clientconfigurationupdate.js.map +1 -1
  94. package/dist/esm/models/components/organization.d.ts +3 -0
  95. package/dist/esm/models/components/organization.d.ts.map +1 -1
  96. package/dist/esm/models/components/organization.js +5 -0
  97. package/dist/esm/models/components/organization.js.map +1 -1
  98. package/dist/esm/models/components/organizationcreate.d.ts +3 -0
  99. package/dist/esm/models/components/organizationcreate.d.ts.map +1 -1
  100. package/dist/esm/models/components/organizationcreate.js +5 -0
  101. package/dist/esm/models/components/organizationcreate.js.map +1 -1
  102. package/dist/esm/models/components/organizationsubscriptionsettings.d.ts +34 -0
  103. package/dist/esm/models/components/organizationsubscriptionsettings.d.ts.map +1 -0
  104. package/dist/esm/models/components/organizationsubscriptionsettings.js +49 -0
  105. package/dist/esm/models/components/organizationsubscriptionsettings.js.map +1 -0
  106. package/dist/esm/models/components/organizationupdate.d.ts +3 -0
  107. package/dist/esm/models/components/organizationupdate.d.ts.map +1 -1
  108. package/dist/esm/models/components/organizationupdate.js +5 -0
  109. package/dist/esm/models/components/organizationupdate.js.map +1 -1
  110. package/dist/esm/models/components/scope.d.ts +6 -0
  111. package/dist/esm/models/components/scope.d.ts.map +1 -1
  112. package/dist/esm/models/components/scope.js +2 -0
  113. package/dist/esm/models/components/scope.js.map +1 -1
  114. package/dist/esm/models/components/subscriptionprorationbehavior.d.ts +28 -0
  115. package/dist/esm/models/components/subscriptionprorationbehavior.d.ts.map +1 -0
  116. package/dist/esm/models/components/subscriptionprorationbehavior.js +24 -0
  117. package/dist/esm/models/components/subscriptionprorationbehavior.js.map +1 -0
  118. package/dist/esm/models/components/subscriptionupdateprice.d.ts +6 -0
  119. package/dist/esm/models/components/subscriptionupdateprice.d.ts.map +1 -1
  120. package/dist/esm/models/components/subscriptionupdateprice.js +7 -0
  121. package/dist/esm/models/components/subscriptionupdateprice.js.map +1 -1
  122. package/dist/esm/models/errors/alreadyactivesubscriptionerror.d.ts +34 -0
  123. package/dist/esm/models/errors/alreadyactivesubscriptionerror.d.ts.map +1 -0
  124. package/dist/esm/models/errors/alreadyactivesubscriptionerror.js +43 -0
  125. package/dist/esm/models/errors/alreadyactivesubscriptionerror.js.map +1 -0
  126. package/dist/esm/models/operations/subscriptionsget.d.ts +32 -0
  127. package/dist/esm/models/operations/subscriptionsget.d.ts.map +1 -0
  128. package/dist/esm/models/operations/subscriptionsget.js +31 -0
  129. package/dist/esm/models/operations/subscriptionsget.js.map +1 -0
  130. package/dist/esm/sdk/subscriptions.d.ts +8 -0
  131. package/dist/esm/sdk/subscriptions.d.ts.map +1 -1
  132. package/dist/esm/sdk/subscriptions.js +10 -0
  133. package/dist/esm/sdk/subscriptions.js.map +1 -1
  134. package/docs/sdks/custom/README.md +18 -15
  135. package/docs/sdks/subscriptions/README.md +79 -0
  136. package/jsr.json +1 -1
  137. package/package.json +1 -1
  138. package/src/funcs/checkoutsCustomClientConfirm.ts +8 -1
  139. package/src/funcs/checkoutsCustomClientUpdate.ts +8 -1
  140. package/src/funcs/checkoutsCustomUpdate.ts +8 -1
  141. package/src/funcs/customerPortalDownloadablesGet.ts +1 -1
  142. package/src/funcs/subscriptionsGet.ts +157 -0
  143. package/src/lib/config.ts +3 -3
  144. package/src/models/components/oauth2client.ts +2 -2
  145. package/src/models/components/oauth2clientconfiguration.ts +2 -2
  146. package/src/models/components/oauth2clientconfigurationupdate.ts +2 -2
  147. package/src/models/components/organization.ts +12 -0
  148. package/src/models/components/organizationcreate.ts +19 -0
  149. package/src/models/components/organizationsubscriptionsettings.ts +94 -0
  150. package/src/models/components/organizationupdate.ts +19 -0
  151. package/src/models/components/scope.ts +2 -0
  152. package/src/models/components/subscriptionprorationbehavior.ts +35 -0
  153. package/src/models/components/subscriptionupdateprice.ts +16 -0
  154. package/src/models/errors/alreadyactivesubscriptionerror.ts +77 -0
  155. package/src/models/operations/subscriptionsget.ts +69 -0
  156. 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
+ }
@@ -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
  *