Skip to content

Commit a86d7dc

Browse files
committed
update api schemas
1 parent 0dcc585 commit a86d7dc

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

.changeset/dry-emus-film.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@squarecloud/blob": patch
3+
---
4+
5+
Update API schemas

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/validation/schemas/create.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const createObjectSchema = z
1313
/** A string representing the prefix for the file. */
1414
prefix: nameLikeSchema.optional(),
1515
/** A number indicating the expiration period of the file, ranging from 1 to 365 days. */
16-
expire: z.number().min(1).max(365).optional(),
16+
expiresIn: z.number().min(1).max(365).optional(),
1717
/** Set to true if a security hash is required. */
1818
securityHash: z.boolean().optional(),
1919
/** Set to true if the file should be set for automatic download. */
@@ -25,10 +25,11 @@ export const createObjectSchema = z
2525
});
2626

2727
export const createObjectPayloadSchema = createObjectSchema.transform(
28-
({ file, securityHash, autoDownload, ...rest }) => ({
28+
({ file, securityHash, autoDownload, expiresIn, ...rest }) => ({
2929
file,
3030
params: {
3131
...rest,
32+
expire: expiresIn,
3233
security_hash: securityHash,
3334
auto_download: autoDownload,
3435
},

src/validation/schemas/list.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { z } from "zod";
22

33
export const listObjectSchema = z.object({
4-
name: z.string(),
4+
id: z.string(),
55
size: z.number(),
66
created_at: z.coerce.date(),
7-
expire_at: z.coerce.date().optional(),
7+
expires_at: z.coerce.date().optional(),
88
});
99

1010
export const listObjectsResponseSchema = z.object({

0 commit comments

Comments
 (0)