@crevio/sdk 0.4.2 → 0.4.7
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/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/account.d.ts +7 -0
- package/dist/commonjs/models/account.d.ts.map +1 -1
- package/dist/commonjs/models/account.js +15 -0
- package/dist/commonjs/models/account.js.map +1 -1
- package/dist/commonjs/models/blogpost.d.ts +1 -1
- package/dist/commonjs/models/blogpost.d.ts.map +1 -1
- package/dist/commonjs/models/blogpost.js +1 -1
- package/dist/commonjs/models/blogpost.js.map +1 -1
- package/dist/commonjs/models/index.d.ts +3 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +3 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/mediagalleryitem.d.ts +12 -0
- package/dist/commonjs/models/mediagalleryitem.d.ts.map +1 -0
- package/dist/commonjs/models/mediagalleryitem.js +52 -0
- package/dist/commonjs/models/mediagalleryitem.js.map +1 -0
- package/dist/commonjs/models/pricevariant.d.ts +6 -1
- package/dist/commonjs/models/pricevariant.d.ts.map +1 -1
- package/dist/commonjs/models/pricevariant.js +10 -2
- package/dist/commonjs/models/pricevariant.js.map +1 -1
- package/dist/commonjs/models/product.d.ts +22 -0
- package/dist/commonjs/models/product.d.ts.map +1 -1
- package/dist/commonjs/models/product.js +28 -1
- package/dist/commonjs/models/product.js.map +1 -1
- package/dist/commonjs/models/review.d.ts +1 -0
- package/dist/commonjs/models/review.d.ts.map +1 -1
- package/dist/commonjs/models/review.js +2 -0
- package/dist/commonjs/models/review.js.map +1 -1
- package/dist/commonjs/models/seo.d.ts +11 -0
- package/dist/commonjs/models/seo.d.ts.map +1 -0
- package/dist/commonjs/models/seo.js +52 -0
- package/dist/commonjs/models/seo.js.map +1 -0
- package/dist/commonjs/models/sociallink.d.ts +29 -0
- package/dist/commonjs/models/sociallink.d.ts.map +1 -0
- package/dist/commonjs/models/sociallink.js +68 -0
- package/dist/commonjs/models/sociallink.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/account.d.ts +7 -0
- package/dist/esm/models/account.d.ts.map +1 -1
- package/dist/esm/models/account.js +15 -0
- package/dist/esm/models/account.js.map +1 -1
- package/dist/esm/models/blogpost.d.ts +1 -1
- package/dist/esm/models/blogpost.d.ts.map +1 -1
- package/dist/esm/models/blogpost.js +1 -1
- package/dist/esm/models/blogpost.js.map +1 -1
- package/dist/esm/models/index.d.ts +3 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +3 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/mediagalleryitem.d.ts +12 -0
- package/dist/esm/models/mediagalleryitem.d.ts.map +1 -0
- package/dist/esm/models/mediagalleryitem.js +15 -0
- package/dist/esm/models/mediagalleryitem.js.map +1 -0
- package/dist/esm/models/pricevariant.d.ts +6 -1
- package/dist/esm/models/pricevariant.d.ts.map +1 -1
- package/dist/esm/models/pricevariant.js +10 -2
- package/dist/esm/models/pricevariant.js.map +1 -1
- package/dist/esm/models/product.d.ts +22 -0
- package/dist/esm/models/product.d.ts.map +1 -1
- package/dist/esm/models/product.js +26 -0
- package/dist/esm/models/product.js.map +1 -1
- package/dist/esm/models/review.d.ts +1 -0
- package/dist/esm/models/review.d.ts.map +1 -1
- package/dist/esm/models/review.js +2 -0
- package/dist/esm/models/review.js.map +1 -1
- package/dist/esm/models/seo.d.ts +11 -0
- package/dist/esm/models/seo.d.ts.map +1 -0
- package/dist/esm/models/seo.js +15 -0
- package/dist/esm/models/seo.js.map +1 -0
- package/dist/esm/models/sociallink.d.ts +29 -0
- package/dist/esm/models/sociallink.d.ts.map +1 -0
- package/dist/esm/models/sociallink.js +31 -0
- package/dist/esm/models/sociallink.js.map +1 -0
- package/jsr.json +1 -1
- package/package.json +2 -1
- package/src/lib/config.ts +2 -2
- package/src/models/account.ts +21 -0
- package/src/models/blogpost.ts +2 -2
- package/src/models/index.ts +3 -0
- package/src/models/mediagalleryitem.ts +35 -0
- package/src/models/pricevariant.ts +16 -3
- package/src/models/product.ts +65 -0
- package/src/models/review.ts +3 -0
- package/src/models/seo.ts +30 -0
- package/src/models/sociallink.ts +54 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import * as z from "zod/v3";
|
|
5
|
+
import { safeParse } from "../lib/schemas.js";
|
|
6
|
+
export const Platform = {
|
|
7
|
+
Facebook: "facebook",
|
|
8
|
+
Twitter: "twitter",
|
|
9
|
+
Instagram: "instagram",
|
|
10
|
+
Linkedin: "linkedin",
|
|
11
|
+
Youtube: "youtube",
|
|
12
|
+
Tiktok: "tiktok",
|
|
13
|
+
Pinterest: "pinterest",
|
|
14
|
+
Discord: "discord",
|
|
15
|
+
Twitch: "twitch",
|
|
16
|
+
Telegram: "telegram",
|
|
17
|
+
Email: "email",
|
|
18
|
+
Url: "url",
|
|
19
|
+
};
|
|
20
|
+
/** @internal */
|
|
21
|
+
export const Platform$inboundSchema = z
|
|
22
|
+
.nativeEnum(Platform);
|
|
23
|
+
/** @internal */
|
|
24
|
+
export const SocialLink$inboundSchema = z.object({
|
|
25
|
+
platform: Platform$inboundSchema,
|
|
26
|
+
url: z.string(),
|
|
27
|
+
});
|
|
28
|
+
export function socialLinkFromJSON(jsonString) {
|
|
29
|
+
return safeParse(jsonString, (x) => SocialLink$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SocialLink' from JSON`);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=sociallink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sociallink.js","sourceRoot":"","sources":["../../../src/models/sociallink.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAK9C,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;CACF,CAAC;AAQX,gBAAgB;AAChB,MAAM,CAAC,MAAM,sBAAsB,GAAqC,CAAC;KACtE,UAAU,CAAC,QAAQ,CAAC,CAAC;AAExB,gBAAgB;AAChB,MAAM,CAAC,MAAM,wBAAwB,GAIjC,CAAC,CAAC,MAAM,CAAC;IACX,QAAQ,EAAE,sBAAsB;IAChC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;CAChB,CAAC,CAAC;AAEH,MAAM,UAAU,kBAAkB,CAChC,UAAkB;IAElB,OAAO,SAAS,CACd,UAAU,EACV,CAAC,CAAC,EAAE,EAAE,CAAC,wBAAwB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACpD,wCAAwC,CACzC,CAAC;AACJ,CAAC"}
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crevio/sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"author": "Crevio",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"tshy": {
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"lint": "eslint --cache --max-warnings=0 src",
|
|
24
24
|
"build": "tshy",
|
|
25
25
|
"prepublishOnly": "npm run build",
|
|
26
|
+
"generate": "speakeasy run && speakeasy overlay apply -s ../crevio-app/docs/developer/api-reference/openapi.json -o .speakeasy/out.codeSamples.yaml --out ../crevio-app/docs/developer/api-reference/openapi-combined.json && mv ../crevio-app/docs/developer/api-reference/openapi-combined.json ../crevio-app/docs/developer/api-reference/openapi.json",
|
|
26
27
|
"prebuild": "rm -rf .tshy-build .tshy && find . -name '.DS_Store' -type f -delete 2>/dev/null || true"
|
|
27
28
|
},
|
|
28
29
|
"peerDependencies": {},
|
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.
|
|
64
|
+
sdkVersion: "0.4.7",
|
|
65
65
|
genVersion: "2.865.2",
|
|
66
|
-
userAgent: "speakeasy-sdk/typescript 0.4.
|
|
66
|
+
userAgent: "speakeasy-sdk/typescript 0.4.7 2.865.2 1.0.0 @crevio/sdk",
|
|
67
67
|
} as const;
|
package/src/models/account.ts
CHANGED
|
@@ -3,15 +3,23 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
6
7
|
import { safeParse } from "../lib/schemas.js";
|
|
7
8
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
8
9
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
import { SocialLink, SocialLink$inboundSchema } from "./sociallink.js";
|
|
9
11
|
|
|
10
12
|
export type Account = {
|
|
11
13
|
id: string;
|
|
12
14
|
object: string;
|
|
13
15
|
name: string;
|
|
14
16
|
subdomain: string | null;
|
|
17
|
+
domain: string | null;
|
|
18
|
+
displayCurrency: string;
|
|
19
|
+
supportEmail: string | null;
|
|
20
|
+
avatarUrl: string | null;
|
|
21
|
+
description: string | null;
|
|
22
|
+
socialLinks: Array<SocialLink>;
|
|
15
23
|
};
|
|
16
24
|
|
|
17
25
|
/** @internal */
|
|
@@ -21,6 +29,19 @@ export const Account$inboundSchema: z.ZodType<Account, z.ZodTypeDef, unknown> =
|
|
|
21
29
|
object: z.string(),
|
|
22
30
|
name: z.string(),
|
|
23
31
|
subdomain: z.nullable(z.string()),
|
|
32
|
+
domain: z.nullable(z.string()),
|
|
33
|
+
display_currency: z.string(),
|
|
34
|
+
support_email: z.nullable(z.string()),
|
|
35
|
+
avatar_url: z.nullable(z.string()),
|
|
36
|
+
description: z.nullable(z.string()),
|
|
37
|
+
social_links: z.array(SocialLink$inboundSchema),
|
|
38
|
+
}).transform((v) => {
|
|
39
|
+
return remap$(v, {
|
|
40
|
+
"display_currency": "displayCurrency",
|
|
41
|
+
"support_email": "supportEmail",
|
|
42
|
+
"avatar_url": "avatarUrl",
|
|
43
|
+
"social_links": "socialLinks",
|
|
44
|
+
});
|
|
24
45
|
});
|
|
25
46
|
|
|
26
47
|
export function accountFromJSON(
|
package/src/models/blogpost.ts
CHANGED
|
@@ -29,7 +29,7 @@ export type BlogPost = {
|
|
|
29
29
|
createdAt: Date;
|
|
30
30
|
updatedAt: Date;
|
|
31
31
|
url: string;
|
|
32
|
-
category
|
|
32
|
+
category: string | null;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
/** @internal */
|
|
@@ -56,7 +56,7 @@ export const BlogPost$inboundSchema: z.ZodType<
|
|
|
56
56
|
created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
57
57
|
updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
58
58
|
url: z.string(),
|
|
59
|
-
category: z.
|
|
59
|
+
category: z.nullable(z.string()),
|
|
60
60
|
}).transform((v) => {
|
|
61
61
|
return remap$(v, {
|
|
62
62
|
"published_at": "publishedAt",
|
package/src/models/index.ts
CHANGED
|
@@ -39,6 +39,7 @@ export * from "./listresponsereview.js";
|
|
|
39
39
|
export * from "./listresponsesubscription.js";
|
|
40
40
|
export * from "./listresponsewebhookendpoint.js";
|
|
41
41
|
export * from "./me.js";
|
|
42
|
+
export * from "./mediagalleryitem.js";
|
|
42
43
|
export * from "./order.js";
|
|
43
44
|
export * from "./orderitem.js";
|
|
44
45
|
export * from "./pricevariant.js";
|
|
@@ -48,6 +49,8 @@ export * from "./product.js";
|
|
|
48
49
|
export * from "./productrequest.js";
|
|
49
50
|
export * from "./review.js";
|
|
50
51
|
export * from "./security.js";
|
|
52
|
+
export * from "./seo.js";
|
|
53
|
+
export * from "./sociallink.js";
|
|
51
54
|
export * from "./subscription.js";
|
|
52
55
|
export * from "./webhookendpoint.js";
|
|
53
56
|
export * from "./webhookendpointrequest.js";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
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 MediaGalleryItem = {
|
|
11
|
+
id: string;
|
|
12
|
+
type: string;
|
|
13
|
+
url: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const MediaGalleryItem$inboundSchema: z.ZodType<
|
|
18
|
+
MediaGalleryItem,
|
|
19
|
+
z.ZodTypeDef,
|
|
20
|
+
unknown
|
|
21
|
+
> = z.object({
|
|
22
|
+
id: z.string(),
|
|
23
|
+
type: z.string(),
|
|
24
|
+
url: z.string(),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export function mediaGalleryItemFromJSON(
|
|
28
|
+
jsonString: string,
|
|
29
|
+
): SafeParseResult<MediaGalleryItem, SDKValidationError> {
|
|
30
|
+
return safeParse(
|
|
31
|
+
jsonString,
|
|
32
|
+
(x) => MediaGalleryItem$inboundSchema.parse(JSON.parse(x)),
|
|
33
|
+
`Failed to parse 'MediaGalleryItem' from JSON`,
|
|
34
|
+
);
|
|
35
|
+
}
|
|
@@ -52,8 +52,13 @@ export type PriceVariant = {
|
|
|
52
52
|
createdAt: Date;
|
|
53
53
|
updatedAt: Date;
|
|
54
54
|
currency: string | null;
|
|
55
|
+
discountedFromAmount: number | null;
|
|
56
|
+
minimumAmount: number | null;
|
|
57
|
+
maximumAmount: number | null;
|
|
58
|
+
presetAmount: number | null;
|
|
59
|
+
waitlist: boolean;
|
|
60
|
+
benefits?: Array<string> | undefined;
|
|
55
61
|
product: string;
|
|
56
|
-
x402Amount: string;
|
|
57
62
|
};
|
|
58
63
|
|
|
59
64
|
/** @internal */
|
|
@@ -94,8 +99,13 @@ export const PriceVariant$inboundSchema: z.ZodType<
|
|
|
94
99
|
created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
95
100
|
updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
96
101
|
currency: z.nullable(z.string()),
|
|
102
|
+
discounted_from_amount: z.nullable(z.number().int()),
|
|
103
|
+
minimum_amount: z.nullable(z.number().int()),
|
|
104
|
+
maximum_amount: z.nullable(z.number().int()),
|
|
105
|
+
preset_amount: z.nullable(z.number().int()),
|
|
106
|
+
waitlist: z.boolean(),
|
|
107
|
+
benefits: z.array(z.string()).optional(),
|
|
97
108
|
product: z.string(),
|
|
98
|
-
x402_amount: z.string(),
|
|
99
109
|
}).transform((v) => {
|
|
100
110
|
return remap$(v, {
|
|
101
111
|
"amount_type": "amountType",
|
|
@@ -107,7 +117,10 @@ export const PriceVariant$inboundSchema: z.ZodType<
|
|
|
107
117
|
"quantity_available": "quantityAvailable",
|
|
108
118
|
"created_at": "createdAt",
|
|
109
119
|
"updated_at": "updatedAt",
|
|
110
|
-
"
|
|
120
|
+
"discounted_from_amount": "discountedFromAmount",
|
|
121
|
+
"minimum_amount": "minimumAmount",
|
|
122
|
+
"maximum_amount": "maximumAmount",
|
|
123
|
+
"preset_amount": "presetAmount",
|
|
111
124
|
});
|
|
112
125
|
});
|
|
113
126
|
|
package/src/models/product.ts
CHANGED
|
@@ -8,8 +8,13 @@ import { safeParse } from "../lib/schemas.js";
|
|
|
8
8
|
import { ClosedEnum } from "../types/enums.js";
|
|
9
9
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
10
10
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
11
|
+
import {
|
|
12
|
+
MediaGalleryItem,
|
|
13
|
+
MediaGalleryItem$inboundSchema,
|
|
14
|
+
} from "./mediagalleryitem.js";
|
|
11
15
|
import { PriceVariant, PriceVariant$inboundSchema } from "./pricevariant.js";
|
|
12
16
|
import { Review, Review$inboundSchema } from "./review.js";
|
|
17
|
+
import { Seo, Seo$inboundSchema } from "./seo.js";
|
|
13
18
|
|
|
14
19
|
export const ProductStatus = {
|
|
15
20
|
Draft: "draft",
|
|
@@ -18,6 +23,11 @@ export const ProductStatus = {
|
|
|
18
23
|
} as const;
|
|
19
24
|
export type ProductStatus = ClosedEnum<typeof ProductStatus>;
|
|
20
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Prefix ID by default, full object when expanded
|
|
28
|
+
*/
|
|
29
|
+
export type SeoUnion = Seo | string;
|
|
30
|
+
|
|
21
31
|
export type Product = {
|
|
22
32
|
id: string;
|
|
23
33
|
object: string;
|
|
@@ -27,7 +37,20 @@ export type Product = {
|
|
|
27
37
|
description: string;
|
|
28
38
|
createdAt: Date;
|
|
29
39
|
updatedAt: Date;
|
|
40
|
+
bodyHtml: string;
|
|
41
|
+
buttonCta: string | null;
|
|
30
42
|
url: string;
|
|
43
|
+
availableFrom: Date | null;
|
|
44
|
+
availableUntil: Date | null;
|
|
45
|
+
publishedAt: Date | null;
|
|
46
|
+
reviewsCount: number;
|
|
47
|
+
averageRating: number | null;
|
|
48
|
+
totalSold: number;
|
|
49
|
+
/**
|
|
50
|
+
* Prefix ID by default, full object when expanded
|
|
51
|
+
*/
|
|
52
|
+
seo?: Seo | string | null | undefined;
|
|
53
|
+
mediaGallery: Array<MediaGalleryItem>;
|
|
31
54
|
priceVariants: Array<PriceVariant>;
|
|
32
55
|
reviews?: Array<Review> | undefined;
|
|
33
56
|
};
|
|
@@ -37,6 +60,23 @@ export const ProductStatus$inboundSchema: z.ZodNativeEnum<
|
|
|
37
60
|
typeof ProductStatus
|
|
38
61
|
> = z.nativeEnum(ProductStatus);
|
|
39
62
|
|
|
63
|
+
/** @internal */
|
|
64
|
+
export const SeoUnion$inboundSchema: z.ZodType<
|
|
65
|
+
SeoUnion,
|
|
66
|
+
z.ZodTypeDef,
|
|
67
|
+
unknown
|
|
68
|
+
> = z.union([Seo$inboundSchema, z.string()]);
|
|
69
|
+
|
|
70
|
+
export function seoUnionFromJSON(
|
|
71
|
+
jsonString: string,
|
|
72
|
+
): SafeParseResult<SeoUnion, SDKValidationError> {
|
|
73
|
+
return safeParse(
|
|
74
|
+
jsonString,
|
|
75
|
+
(x) => SeoUnion$inboundSchema.parse(JSON.parse(x)),
|
|
76
|
+
`Failed to parse 'SeoUnion' from JSON`,
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
40
80
|
/** @internal */
|
|
41
81
|
export const Product$inboundSchema: z.ZodType<Product, z.ZodTypeDef, unknown> =
|
|
42
82
|
z.object({
|
|
@@ -52,13 +92,38 @@ export const Product$inboundSchema: z.ZodType<Product, z.ZodTypeDef, unknown> =
|
|
|
52
92
|
updated_at: z.string().datetime({ offset: true }).transform(v =>
|
|
53
93
|
new Date(v)
|
|
54
94
|
),
|
|
95
|
+
body_html: z.string(),
|
|
96
|
+
button_cta: z.nullable(z.string()),
|
|
55
97
|
url: z.string(),
|
|
98
|
+
available_from: z.nullable(
|
|
99
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
100
|
+
),
|
|
101
|
+
available_until: z.nullable(
|
|
102
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
103
|
+
),
|
|
104
|
+
published_at: z.nullable(
|
|
105
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
106
|
+
),
|
|
107
|
+
reviews_count: z.number().int(),
|
|
108
|
+
average_rating: z.nullable(z.number()),
|
|
109
|
+
total_sold: z.number().int(),
|
|
110
|
+
seo: z.nullable(z.union([Seo$inboundSchema, z.string()])).optional(),
|
|
111
|
+
media_gallery: z.array(MediaGalleryItem$inboundSchema),
|
|
56
112
|
price_variants: z.array(PriceVariant$inboundSchema),
|
|
57
113
|
reviews: z.array(Review$inboundSchema).optional(),
|
|
58
114
|
}).transform((v) => {
|
|
59
115
|
return remap$(v, {
|
|
60
116
|
"created_at": "createdAt",
|
|
61
117
|
"updated_at": "updatedAt",
|
|
118
|
+
"body_html": "bodyHtml",
|
|
119
|
+
"button_cta": "buttonCta",
|
|
120
|
+
"available_from": "availableFrom",
|
|
121
|
+
"available_until": "availableUntil",
|
|
122
|
+
"published_at": "publishedAt",
|
|
123
|
+
"reviews_count": "reviewsCount",
|
|
124
|
+
"average_rating": "averageRating",
|
|
125
|
+
"total_sold": "totalSold",
|
|
126
|
+
"media_gallery": "mediaGallery",
|
|
62
127
|
"price_variants": "priceVariants",
|
|
63
128
|
});
|
|
64
129
|
});
|
package/src/models/review.ts
CHANGED
|
@@ -15,6 +15,7 @@ export type Review = {
|
|
|
15
15
|
customerName: string | null;
|
|
16
16
|
content: string | null;
|
|
17
17
|
createdAt: Date;
|
|
18
|
+
customerImageUrl: string | null;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
/** @internal */
|
|
@@ -28,10 +29,12 @@ export const Review$inboundSchema: z.ZodType<Review, z.ZodTypeDef, unknown> = z
|
|
|
28
29
|
created_at: z.string().datetime({ offset: true }).transform(v =>
|
|
29
30
|
new Date(v)
|
|
30
31
|
),
|
|
32
|
+
customer_image_url: z.nullable(z.string()),
|
|
31
33
|
}).transform((v) => {
|
|
32
34
|
return remap$(v, {
|
|
33
35
|
"customer_name": "customerName",
|
|
34
36
|
"created_at": "createdAt",
|
|
37
|
+
"customer_image_url": "customerImageUrl",
|
|
35
38
|
});
|
|
36
39
|
});
|
|
37
40
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
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 Seo = {
|
|
11
|
+
title: string | null;
|
|
12
|
+
description: string | null;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/** @internal */
|
|
16
|
+
export const Seo$inboundSchema: z.ZodType<Seo, z.ZodTypeDef, unknown> = z
|
|
17
|
+
.object({
|
|
18
|
+
title: z.nullable(z.string()),
|
|
19
|
+
description: z.nullable(z.string()),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export function seoFromJSON(
|
|
23
|
+
jsonString: string,
|
|
24
|
+
): SafeParseResult<Seo, SDKValidationError> {
|
|
25
|
+
return safeParse(
|
|
26
|
+
jsonString,
|
|
27
|
+
(x) => Seo$inboundSchema.parse(JSON.parse(x)),
|
|
28
|
+
`Failed to parse 'Seo' from JSON`,
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export const Platform = {
|
|
12
|
+
Facebook: "facebook",
|
|
13
|
+
Twitter: "twitter",
|
|
14
|
+
Instagram: "instagram",
|
|
15
|
+
Linkedin: "linkedin",
|
|
16
|
+
Youtube: "youtube",
|
|
17
|
+
Tiktok: "tiktok",
|
|
18
|
+
Pinterest: "pinterest",
|
|
19
|
+
Discord: "discord",
|
|
20
|
+
Twitch: "twitch",
|
|
21
|
+
Telegram: "telegram",
|
|
22
|
+
Email: "email",
|
|
23
|
+
Url: "url",
|
|
24
|
+
} as const;
|
|
25
|
+
export type Platform = ClosedEnum<typeof Platform>;
|
|
26
|
+
|
|
27
|
+
export type SocialLink = {
|
|
28
|
+
platform: Platform;
|
|
29
|
+
url: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** @internal */
|
|
33
|
+
export const Platform$inboundSchema: z.ZodNativeEnum<typeof Platform> = z
|
|
34
|
+
.nativeEnum(Platform);
|
|
35
|
+
|
|
36
|
+
/** @internal */
|
|
37
|
+
export const SocialLink$inboundSchema: z.ZodType<
|
|
38
|
+
SocialLink,
|
|
39
|
+
z.ZodTypeDef,
|
|
40
|
+
unknown
|
|
41
|
+
> = z.object({
|
|
42
|
+
platform: Platform$inboundSchema,
|
|
43
|
+
url: z.string(),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export function socialLinkFromJSON(
|
|
47
|
+
jsonString: string,
|
|
48
|
+
): SafeParseResult<SocialLink, SDKValidationError> {
|
|
49
|
+
return safeParse(
|
|
50
|
+
jsonString,
|
|
51
|
+
(x) => SocialLink$inboundSchema.parse(JSON.parse(x)),
|
|
52
|
+
`Failed to parse 'SocialLink' from JSON`,
|
|
53
|
+
);
|
|
54
|
+
}
|