@crevio/sdk 0.4.11 → 0.4.12

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 (98) hide show
  1. package/README.md +7 -0
  2. package/dist/commonjs/funcs/legalPagesGet.d.ts +19 -0
  3. package/dist/commonjs/funcs/legalPagesGet.d.ts.map +1 -0
  4. package/dist/commonjs/funcs/legalPagesGet.js +124 -0
  5. package/dist/commonjs/funcs/legalPagesGet.js.map +1 -0
  6. package/dist/commonjs/funcs/legalPagesList.d.ts +19 -0
  7. package/dist/commonjs/funcs/legalPagesList.d.ts.map +1 -0
  8. package/dist/commonjs/funcs/legalPagesList.js +125 -0
  9. package/dist/commonjs/funcs/legalPagesList.js.map +1 -0
  10. package/dist/commonjs/lib/config.d.ts +2 -2
  11. package/dist/commonjs/lib/config.js +2 -2
  12. package/dist/commonjs/models/index.d.ts +2 -0
  13. package/dist/commonjs/models/index.d.ts.map +1 -1
  14. package/dist/commonjs/models/index.js +2 -0
  15. package/dist/commonjs/models/index.js.map +1 -1
  16. package/dist/commonjs/models/legalpage.d.ts +26 -0
  17. package/dist/commonjs/models/legalpage.d.ts.map +1 -0
  18. package/dist/commonjs/models/legalpage.js +72 -0
  19. package/dist/commonjs/models/legalpage.js.map +1 -0
  20. package/dist/commonjs/models/listresponselegalpage.d.ts +21 -0
  21. package/dist/commonjs/models/listresponselegalpage.d.ts.map +1 -0
  22. package/dist/commonjs/models/listresponselegalpage.js +64 -0
  23. package/dist/commonjs/models/listresponselegalpage.js.map +1 -0
  24. package/dist/commonjs/models/operations/getlegalpage.d.ts +15 -0
  25. package/dist/commonjs/models/operations/getlegalpage.d.ts.map +1 -0
  26. package/dist/commonjs/models/operations/getlegalpage.js +54 -0
  27. package/dist/commonjs/models/operations/getlegalpage.js.map +1 -0
  28. package/dist/commonjs/models/operations/index.d.ts +2 -0
  29. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  30. package/dist/commonjs/models/operations/index.js +2 -0
  31. package/dist/commonjs/models/operations/index.js.map +1 -1
  32. package/dist/commonjs/models/operations/listlegalpages.d.ts +45 -0
  33. package/dist/commonjs/models/operations/listlegalpages.d.ts.map +1 -0
  34. package/dist/commonjs/models/operations/listlegalpages.js +69 -0
  35. package/dist/commonjs/models/operations/listlegalpages.js.map +1 -0
  36. package/dist/commonjs/sdk/legalpages.d.ts +20 -0
  37. package/dist/commonjs/sdk/legalpages.d.ts.map +1 -0
  38. package/dist/commonjs/sdk/legalpages.js +32 -0
  39. package/dist/commonjs/sdk/legalpages.js.map +1 -0
  40. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  41. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  42. package/dist/commonjs/sdk/sdk.js +4 -0
  43. package/dist/commonjs/sdk/sdk.js.map +1 -1
  44. package/dist/esm/funcs/legalPagesGet.d.ts +19 -0
  45. package/dist/esm/funcs/legalPagesGet.d.ts.map +1 -0
  46. package/dist/esm/funcs/legalPagesGet.js +88 -0
  47. package/dist/esm/funcs/legalPagesGet.js.map +1 -0
  48. package/dist/esm/funcs/legalPagesList.d.ts +19 -0
  49. package/dist/esm/funcs/legalPagesList.d.ts.map +1 -0
  50. package/dist/esm/funcs/legalPagesList.js +89 -0
  51. package/dist/esm/funcs/legalPagesList.js.map +1 -0
  52. package/dist/esm/lib/config.d.ts +2 -2
  53. package/dist/esm/lib/config.js +2 -2
  54. package/dist/esm/models/index.d.ts +2 -0
  55. package/dist/esm/models/index.d.ts.map +1 -1
  56. package/dist/esm/models/index.js +2 -0
  57. package/dist/esm/models/index.js.map +1 -1
  58. package/dist/esm/models/legalpage.d.ts +26 -0
  59. package/dist/esm/models/legalpage.d.ts.map +1 -0
  60. package/dist/esm/models/legalpage.js +35 -0
  61. package/dist/esm/models/legalpage.js.map +1 -0
  62. package/dist/esm/models/listresponselegalpage.d.ts +21 -0
  63. package/dist/esm/models/listresponselegalpage.d.ts.map +1 -0
  64. package/dist/esm/models/listresponselegalpage.js +27 -0
  65. package/dist/esm/models/listresponselegalpage.js.map +1 -0
  66. package/dist/esm/models/operations/getlegalpage.d.ts +15 -0
  67. package/dist/esm/models/operations/getlegalpage.d.ts.map +1 -0
  68. package/dist/esm/models/operations/getlegalpage.js +17 -0
  69. package/dist/esm/models/operations/getlegalpage.js.map +1 -0
  70. package/dist/esm/models/operations/index.d.ts +2 -0
  71. package/dist/esm/models/operations/index.d.ts.map +1 -1
  72. package/dist/esm/models/operations/index.js +2 -0
  73. package/dist/esm/models/operations/index.js.map +1 -1
  74. package/dist/esm/models/operations/listlegalpages.d.ts +45 -0
  75. package/dist/esm/models/operations/listlegalpages.d.ts.map +1 -0
  76. package/dist/esm/models/operations/listlegalpages.js +32 -0
  77. package/dist/esm/models/operations/listlegalpages.js.map +1 -0
  78. package/dist/esm/sdk/legalpages.d.ts +20 -0
  79. package/dist/esm/sdk/legalpages.d.ts.map +1 -0
  80. package/dist/esm/sdk/legalpages.js +28 -0
  81. package/dist/esm/sdk/legalpages.js.map +1 -0
  82. package/dist/esm/sdk/sdk.d.ts +3 -0
  83. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  84. package/dist/esm/sdk/sdk.js +4 -0
  85. package/dist/esm/sdk/sdk.js.map +1 -1
  86. package/jsr.json +1 -1
  87. package/package.json +1 -1
  88. package/src/funcs/legalPagesGet.ts +176 -0
  89. package/src/funcs/legalPagesList.ts +179 -0
  90. package/src/lib/config.ts +2 -2
  91. package/src/models/index.ts +2 -0
  92. package/src/models/legalpage.ts +64 -0
  93. package/src/models/listresponselegalpage.ts +56 -0
  94. package/src/models/operations/getlegalpage.ts +39 -0
  95. package/src/models/operations/index.ts +2 -0
  96. package/src/models/operations/listlegalpages.ts +76 -0
  97. package/src/sdk/legalpages.ts +46 -0
  98. package/src/sdk/sdk.ts +6 -0
@@ -0,0 +1,176 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { CrevioCore } from "../core.js";
6
+ import { encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import { CrevioError } from "../models/errors/crevioerror.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
22
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as models from "../models/index.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Get legal page
31
+ *
32
+ * @remarks
33
+ * Returns a specific legal page by ID or slug
34
+ */
35
+ export function legalPagesGet(
36
+ client: CrevioCore,
37
+ request: operations.GetLegalPageRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ models.LegalPage,
42
+ | errors.ErrorT
43
+ | CrevioError
44
+ | ResponseValidationError
45
+ | ConnectionError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | InvalidRequestError
49
+ | UnexpectedClientError
50
+ | SDKValidationError
51
+ >
52
+ > {
53
+ return new APIPromise($do(
54
+ client,
55
+ request,
56
+ options,
57
+ ));
58
+ }
59
+
60
+ async function $do(
61
+ client: CrevioCore,
62
+ request: operations.GetLegalPageRequest,
63
+ options?: RequestOptions,
64
+ ): Promise<
65
+ [
66
+ Result<
67
+ models.LegalPage,
68
+ | errors.ErrorT
69
+ | CrevioError
70
+ | ResponseValidationError
71
+ | ConnectionError
72
+ | RequestAbortedError
73
+ | RequestTimeoutError
74
+ | InvalidRequestError
75
+ | UnexpectedClientError
76
+ | SDKValidationError
77
+ >,
78
+ APICall,
79
+ ]
80
+ > {
81
+ const parsed = safeParse(
82
+ request,
83
+ (value) => operations.GetLegalPageRequest$outboundSchema.parse(value),
84
+ "Input validation failed",
85
+ );
86
+ if (!parsed.ok) {
87
+ return [parsed, { status: "invalid" }];
88
+ }
89
+ const payload = parsed.value;
90
+ const body = null;
91
+
92
+ const pathParams = {
93
+ id_or_slug: encodeSimple("id_or_slug", payload.id_or_slug, {
94
+ explode: false,
95
+ charEncoding: "percent",
96
+ }),
97
+ };
98
+ const path = pathToFunc("/legal_pages/{id_or_slug}")(pathParams);
99
+
100
+ const headers = new Headers(compactMap({
101
+ Accept: "application/json",
102
+ }));
103
+
104
+ const secConfig = await extractSecurity(client._options.apiKey);
105
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
106
+ const requestSecurity = resolveGlobalSecurity(securityInput);
107
+
108
+ const context = {
109
+ options: client._options,
110
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
111
+ operationID: "getLegalPage",
112
+ oAuth2Scopes: null,
113
+
114
+ resolvedSecurity: requestSecurity,
115
+
116
+ securitySource: client._options.apiKey,
117
+ retryConfig: options?.retries
118
+ || client._options.retryConfig
119
+ || { strategy: "none" },
120
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
121
+ };
122
+
123
+ const requestRes = client._createRequest(context, {
124
+ security: requestSecurity,
125
+ method: "GET",
126
+ baseURL: options?.serverURL,
127
+ path: path,
128
+ headers: headers,
129
+ body: body,
130
+ userAgent: client._options.userAgent,
131
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
132
+ }, options);
133
+ if (!requestRes.ok) {
134
+ return [requestRes, { status: "invalid" }];
135
+ }
136
+ const req = requestRes.value;
137
+
138
+ const doResult = await client._do(req, {
139
+ context,
140
+ errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
141
+ retryConfig: context.retryConfig,
142
+ retryCodes: context.retryCodes,
143
+ });
144
+ if (!doResult.ok) {
145
+ return [doResult, { status: "request-error", request: req }];
146
+ }
147
+ const response = doResult.value;
148
+
149
+ const responseFields = {
150
+ HttpMeta: { Response: response, Request: req },
151
+ };
152
+
153
+ const [result] = await M.match<
154
+ models.LegalPage,
155
+ | errors.ErrorT
156
+ | CrevioError
157
+ | ResponseValidationError
158
+ | ConnectionError
159
+ | RequestAbortedError
160
+ | RequestTimeoutError
161
+ | InvalidRequestError
162
+ | UnexpectedClientError
163
+ | SDKValidationError
164
+ >(
165
+ M.json(200, models.LegalPage$inboundSchema),
166
+ M.jsonErr([400, 401, 403, 404], errors.ErrorT$inboundSchema),
167
+ M.jsonErr(500, errors.ErrorT$inboundSchema),
168
+ M.fail("4XX"),
169
+ M.fail("5XX"),
170
+ )(response, req, { extraFields: responseFields });
171
+ if (!result.ok) {
172
+ return [result, { status: "complete", request: req, response }];
173
+ }
174
+
175
+ return [result, { status: "complete", request: req, response }];
176
+ }
@@ -0,0 +1,179 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { CrevioCore } from "../core.js";
6
+ import { encodeFormQuery } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import { CrevioError } from "../models/errors/crevioerror.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
22
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as models from "../models/index.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * List legal pages
31
+ *
32
+ * @remarks
33
+ * Returns a list of legal pages (Terms of Service, Privacy Policy, Refund Policy)
34
+ */
35
+ export function legalPagesList(
36
+ client: CrevioCore,
37
+ request?: operations.ListLegalPagesRequest | undefined,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ models.ListResponseLegalPage,
42
+ | errors.ErrorT
43
+ | CrevioError
44
+ | ResponseValidationError
45
+ | ConnectionError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | InvalidRequestError
49
+ | UnexpectedClientError
50
+ | SDKValidationError
51
+ >
52
+ > {
53
+ return new APIPromise($do(
54
+ client,
55
+ request,
56
+ options,
57
+ ));
58
+ }
59
+
60
+ async function $do(
61
+ client: CrevioCore,
62
+ request?: operations.ListLegalPagesRequest | undefined,
63
+ options?: RequestOptions,
64
+ ): Promise<
65
+ [
66
+ Result<
67
+ models.ListResponseLegalPage,
68
+ | errors.ErrorT
69
+ | CrevioError
70
+ | ResponseValidationError
71
+ | ConnectionError
72
+ | RequestAbortedError
73
+ | RequestTimeoutError
74
+ | InvalidRequestError
75
+ | UnexpectedClientError
76
+ | SDKValidationError
77
+ >,
78
+ APICall,
79
+ ]
80
+ > {
81
+ const parsed = safeParse(
82
+ request,
83
+ (value) =>
84
+ operations.ListLegalPagesRequest$outboundSchema.optional().parse(value),
85
+ "Input validation failed",
86
+ );
87
+ if (!parsed.ok) {
88
+ return [parsed, { status: "invalid" }];
89
+ }
90
+ const payload = parsed.value;
91
+ const body = null;
92
+
93
+ const path = pathToFunc("/legal_pages")();
94
+
95
+ const query = encodeFormQuery({
96
+ "limit": payload?.limit,
97
+ "policy_type": payload?.policy_type,
98
+ "query": payload?.query,
99
+ "starting_after": payload?.starting_after,
100
+ });
101
+
102
+ const headers = new Headers(compactMap({
103
+ Accept: "application/json",
104
+ }));
105
+
106
+ const secConfig = await extractSecurity(client._options.apiKey);
107
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
108
+ const requestSecurity = resolveGlobalSecurity(securityInput);
109
+
110
+ const context = {
111
+ options: client._options,
112
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
113
+ operationID: "listLegalPages",
114
+ oAuth2Scopes: null,
115
+
116
+ resolvedSecurity: requestSecurity,
117
+
118
+ securitySource: client._options.apiKey,
119
+ retryConfig: options?.retries
120
+ || client._options.retryConfig
121
+ || { strategy: "none" },
122
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
123
+ };
124
+
125
+ const requestRes = client._createRequest(context, {
126
+ security: requestSecurity,
127
+ method: "GET",
128
+ baseURL: options?.serverURL,
129
+ path: path,
130
+ headers: headers,
131
+ query: query,
132
+ body: body,
133
+ userAgent: client._options.userAgent,
134
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
135
+ }, options);
136
+ if (!requestRes.ok) {
137
+ return [requestRes, { status: "invalid" }];
138
+ }
139
+ const req = requestRes.value;
140
+
141
+ const doResult = await client._do(req, {
142
+ context,
143
+ errorCodes: ["400", "401", "403", "4XX", "500", "5XX"],
144
+ retryConfig: context.retryConfig,
145
+ retryCodes: context.retryCodes,
146
+ });
147
+ if (!doResult.ok) {
148
+ return [doResult, { status: "request-error", request: req }];
149
+ }
150
+ const response = doResult.value;
151
+
152
+ const responseFields = {
153
+ HttpMeta: { Response: response, Request: req },
154
+ };
155
+
156
+ const [result] = await M.match<
157
+ models.ListResponseLegalPage,
158
+ | errors.ErrorT
159
+ | CrevioError
160
+ | ResponseValidationError
161
+ | ConnectionError
162
+ | RequestAbortedError
163
+ | RequestTimeoutError
164
+ | InvalidRequestError
165
+ | UnexpectedClientError
166
+ | SDKValidationError
167
+ >(
168
+ M.json(200, models.ListResponseLegalPage$inboundSchema),
169
+ M.jsonErr([400, 401, 403], errors.ErrorT$inboundSchema),
170
+ M.jsonErr(500, errors.ErrorT$inboundSchema),
171
+ M.fail("4XX"),
172
+ M.fail("5XX"),
173
+ )(response, req, { extraFields: responseFields });
174
+ if (!result.ok) {
175
+ return [result, { status: "complete", request: req, response }];
176
+ }
177
+
178
+ return [result, { status: "complete", request: req, response }];
179
+ }
package/src/lib/config.ts CHANGED
@@ -61,7 +61,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
61
61
  export const SDK_METADATA = {
62
62
  language: "typescript",
63
63
  openapiDocVersion: "1.0.0",
64
- sdkVersion: "0.4.11",
64
+ sdkVersion: "0.4.12",
65
65
  genVersion: "2.869.23",
66
- userAgent: "speakeasy-sdk/typescript 0.4.11 2.869.23 1.0.0 @crevio/sdk",
66
+ userAgent: "speakeasy-sdk/typescript 0.4.12 2.869.23 1.0.0 @crevio/sdk",
67
67
  } as const;
@@ -25,6 +25,7 @@ export * from "./file.js";
25
25
  export * from "./filecreateresponse.js";
26
26
  export * from "./invoice.js";
27
27
  export * from "./invoicerequest.js";
28
+ export * from "./legalpage.js";
28
29
  export * from "./listresponseblogpost.js";
29
30
  export * from "./listresponsecheckoutlink.js";
30
31
  export * from "./listresponsecustomer.js";
@@ -32,6 +33,7 @@ export * from "./listresponsediscount.js";
32
33
  export * from "./listresponseexperience.js";
33
34
  export * from "./listresponsefile.js";
34
35
  export * from "./listresponseinvoice.js";
36
+ export * from "./listresponselegalpage.js";
35
37
  export * from "./listresponseorder.js";
36
38
  export * from "./listresponsepricevariant.js";
37
39
  export * from "./listresponseproduct.js";
@@ -0,0 +1,64 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { safeParse } from "../lib/schemas.js";
8
+ import { ClosedEnum } from "../types/enums.js";
9
+ import { Result as SafeParseResult } from "../types/fp.js";
10
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
11
+
12
+ export const PolicyType = {
13
+ TermsOfService: "terms_of_service",
14
+ PrivacyPolicy: "privacy_policy",
15
+ RefundPolicy: "refund_policy",
16
+ } as const;
17
+ export type PolicyType = ClosedEnum<typeof PolicyType>;
18
+
19
+ export type LegalPage = {
20
+ object: string;
21
+ id: string;
22
+ title: string;
23
+ slug: string;
24
+ body: string;
25
+ policyType: PolicyType;
26
+ createdAt: Date;
27
+ updatedAt: Date;
28
+ };
29
+
30
+ /** @internal */
31
+ export const PolicyType$inboundSchema: z.ZodNativeEnum<typeof PolicyType> = z
32
+ .nativeEnum(PolicyType);
33
+
34
+ /** @internal */
35
+ export const LegalPage$inboundSchema: z.ZodType<
36
+ LegalPage,
37
+ z.ZodTypeDef,
38
+ unknown
39
+ > = z.object({
40
+ object: z.string(),
41
+ id: z.string(),
42
+ title: z.string(),
43
+ slug: z.string(),
44
+ body: z.string(),
45
+ policy_type: PolicyType$inboundSchema,
46
+ created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
47
+ updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
48
+ }).transform((v) => {
49
+ return remap$(v, {
50
+ "policy_type": "policyType",
51
+ "created_at": "createdAt",
52
+ "updated_at": "updatedAt",
53
+ });
54
+ });
55
+
56
+ export function legalPageFromJSON(
57
+ jsonString: string,
58
+ ): SafeParseResult<LegalPage, SDKValidationError> {
59
+ return safeParse(
60
+ jsonString,
61
+ (x) => LegalPage$inboundSchema.parse(JSON.parse(x)),
62
+ `Failed to parse 'LegalPage' from JSON`,
63
+ );
64
+ }
@@ -0,0 +1,56 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { safeParse } from "../lib/schemas.js";
8
+ import { ClosedEnum } from "../types/enums.js";
9
+ import { Result as SafeParseResult } from "../types/fp.js";
10
+ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
11
+ import { LegalPage, LegalPage$inboundSchema } from "./legalpage.js";
12
+
13
+ export const ListResponseLegalPageObject = {
14
+ List: "list",
15
+ } as const;
16
+ export type ListResponseLegalPageObject = ClosedEnum<
17
+ typeof ListResponseLegalPageObject
18
+ >;
19
+
20
+ export type ListResponseLegalPage = {
21
+ object: ListResponseLegalPageObject;
22
+ data: Array<LegalPage>;
23
+ hasMore: boolean;
24
+ url: string;
25
+ };
26
+
27
+ /** @internal */
28
+ export const ListResponseLegalPageObject$inboundSchema: z.ZodNativeEnum<
29
+ typeof ListResponseLegalPageObject
30
+ > = z.nativeEnum(ListResponseLegalPageObject);
31
+
32
+ /** @internal */
33
+ export const ListResponseLegalPage$inboundSchema: z.ZodType<
34
+ ListResponseLegalPage,
35
+ z.ZodTypeDef,
36
+ unknown
37
+ > = z.object({
38
+ object: ListResponseLegalPageObject$inboundSchema,
39
+ data: z.array(LegalPage$inboundSchema),
40
+ has_more: z.boolean(),
41
+ url: z.string(),
42
+ }).transform((v) => {
43
+ return remap$(v, {
44
+ "has_more": "hasMore",
45
+ });
46
+ });
47
+
48
+ export function listResponseLegalPageFromJSON(
49
+ jsonString: string,
50
+ ): SafeParseResult<ListResponseLegalPage, SDKValidationError> {
51
+ return safeParse(
52
+ jsonString,
53
+ (x) => ListResponseLegalPage$inboundSchema.parse(JSON.parse(x)),
54
+ `Failed to parse 'ListResponseLegalPage' from JSON`,
55
+ );
56
+ }
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+
8
+ export type GetLegalPageRequest = {
9
+ /**
10
+ * The resource prefix ID (e.g., "prod_abc123") or slug (e.g., "my-product")
11
+ */
12
+ idOrSlug: string;
13
+ };
14
+
15
+ /** @internal */
16
+ export type GetLegalPageRequest$Outbound = {
17
+ id_or_slug: string;
18
+ };
19
+
20
+ /** @internal */
21
+ export const GetLegalPageRequest$outboundSchema: z.ZodType<
22
+ GetLegalPageRequest$Outbound,
23
+ z.ZodTypeDef,
24
+ GetLegalPageRequest
25
+ > = z.object({
26
+ idOrSlug: z.string(),
27
+ }).transform((v) => {
28
+ return remap$(v, {
29
+ idOrSlug: "id_or_slug",
30
+ });
31
+ });
32
+
33
+ export function getLegalPageRequestToJSON(
34
+ getLegalPageRequest: GetLegalPageRequest,
35
+ ): string {
36
+ return JSON.stringify(
37
+ GetLegalPageRequest$outboundSchema.parse(getLegalPageRequest),
38
+ );
39
+ }
@@ -19,6 +19,7 @@ export * from "./getdiscount.js";
19
19
  export * from "./getexperience.js";
20
20
  export * from "./getfile.js";
21
21
  export * from "./getinvoice.js";
22
+ export * from "./getlegalpage.js";
22
23
  export * from "./getorder.js";
23
24
  export * from "./getorderitem.js";
24
25
  export * from "./getpricevariant.js";
@@ -33,6 +34,7 @@ export * from "./listdiscounts.js";
33
34
  export * from "./listexperiences.js";
34
35
  export * from "./listfiles.js";
35
36
  export * from "./listinvoices.js";
37
+ export * from "./listlegalpages.js";
36
38
  export * from "./listorders.js";
37
39
  export * from "./listpricevariants.js";
38
40
  export * from "./listproducts.js";
@@ -0,0 +1,76 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { ClosedEnum } from "../../types/enums.js";
8
+
9
+ /**
10
+ * Filter by policy type: terms_of_service, privacy_policy, refund_policy
11
+ */
12
+ export const PolicyType = {
13
+ TermsOfService: "terms_of_service",
14
+ PrivacyPolicy: "privacy_policy",
15
+ RefundPolicy: "refund_policy",
16
+ } as const;
17
+ /**
18
+ * Filter by policy type: terms_of_service, privacy_policy, refund_policy
19
+ */
20
+ export type PolicyType = ClosedEnum<typeof PolicyType>;
21
+
22
+ export type ListLegalPagesRequest = {
23
+ /**
24
+ * Filter by policy type: terms_of_service, privacy_policy, refund_policy
25
+ */
26
+ policyType?: PolicyType | undefined;
27
+ /**
28
+ * Search by title
29
+ */
30
+ query?: string | undefined;
31
+ /**
32
+ * Cursor for pagination — the ID of the last item in the previous page
33
+ */
34
+ startingAfter?: string | undefined;
35
+ /**
36
+ * Items per page
37
+ */
38
+ limit?: number | undefined;
39
+ };
40
+
41
+ /** @internal */
42
+ export const PolicyType$outboundSchema: z.ZodNativeEnum<typeof PolicyType> = z
43
+ .nativeEnum(PolicyType);
44
+
45
+ /** @internal */
46
+ export type ListLegalPagesRequest$Outbound = {
47
+ policy_type?: string | undefined;
48
+ query?: string | undefined;
49
+ starting_after?: string | undefined;
50
+ limit: number;
51
+ };
52
+
53
+ /** @internal */
54
+ export const ListLegalPagesRequest$outboundSchema: z.ZodType<
55
+ ListLegalPagesRequest$Outbound,
56
+ z.ZodTypeDef,
57
+ ListLegalPagesRequest
58
+ > = z.object({
59
+ policyType: PolicyType$outboundSchema.optional(),
60
+ query: z.string().optional(),
61
+ startingAfter: z.string().optional(),
62
+ limit: z.number().int().default(20),
63
+ }).transform((v) => {
64
+ return remap$(v, {
65
+ policyType: "policy_type",
66
+ startingAfter: "starting_after",
67
+ });
68
+ });
69
+
70
+ export function listLegalPagesRequestToJSON(
71
+ listLegalPagesRequest: ListLegalPagesRequest,
72
+ ): string {
73
+ return JSON.stringify(
74
+ ListLegalPagesRequest$outboundSchema.parse(listLegalPagesRequest),
75
+ );
76
+ }
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { legalPagesGet } from "../funcs/legalPagesGet.js";
6
+ import { legalPagesList } from "../funcs/legalPagesList.js";
7
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
8
+ import * as models from "../models/index.js";
9
+ import * as operations from "../models/operations/index.js";
10
+ import { unwrapAsync } from "../types/fp.js";
11
+
12
+ export class LegalPages extends ClientSDK {
13
+ /**
14
+ * List legal pages
15
+ *
16
+ * @remarks
17
+ * Returns a list of legal pages (Terms of Service, Privacy Policy, Refund Policy)
18
+ */
19
+ async list(
20
+ request?: operations.ListLegalPagesRequest | undefined,
21
+ options?: RequestOptions,
22
+ ): Promise<models.ListResponseLegalPage> {
23
+ return unwrapAsync(legalPagesList(
24
+ this,
25
+ request,
26
+ options,
27
+ ));
28
+ }
29
+
30
+ /**
31
+ * Get legal page
32
+ *
33
+ * @remarks
34
+ * Returns a specific legal page by ID or slug
35
+ */
36
+ async get(
37
+ request: operations.GetLegalPageRequest,
38
+ options?: RequestOptions,
39
+ ): Promise<models.LegalPage> {
40
+ return unwrapAsync(legalPagesGet(
41
+ this,
42
+ request,
43
+ options,
44
+ ));
45
+ }
46
+ }
package/src/sdk/sdk.ts CHANGED
@@ -13,6 +13,7 @@ import { Discounts } from "./discounts.js";
13
13
  import { Experiences } from "./experiences.js";
14
14
  import { Files } from "./files.js";
15
15
  import { Invoices } from "./invoices.js";
16
+ import { LegalPages } from "./legalpages.js";
16
17
  import { Me } from "./me.js";
17
18
  import { OrderItems } from "./orderitems.js";
18
19
  import { Orders } from "./orders.js";
@@ -89,6 +90,11 @@ export class Crevio extends ClientSDK {
89
90
  return (this._blogPosts ??= new BlogPosts(this._options));
90
91
  }
91
92
 
93
+ private _legalPages?: LegalPages;
94
+ get legalPages(): LegalPages {
95
+ return (this._legalPages ??= new LegalPages(this._options));
96
+ }
97
+
92
98
  private _webhookEndpoints?: WebhookEndpoints;
93
99
  get webhookEndpoints(): WebhookEndpoints {
94
100
  return (this._webhookEndpoints ??= new WebhookEndpoints(this._options));