From f0fd007589d7eb823dc58c4dc3e54d9a2e6e6b28 Mon Sep 17 00:00:00 2001 From: Win Cheng Date: Fri, 12 Sep 2025 20:02:17 -0700 Subject: [PATCH 1/3] update file storage to use multiform --- src/store/file.ts | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/store/file.ts b/src/store/file.ts index b9c1de3..2365795 100644 --- a/src/store/file.ts +++ b/src/store/file.ts @@ -1,24 +1,16 @@ import { BaseResponse } from "../../types"; import { respToFileChoice } from "../helpers"; import { RequestClient } from "../request"; +import { createFileUploadFormData } from "../utils"; import { FileUploadParams, FileUploadResponse } from "./interfaces/file"; export class File { constructor(private readonly client: RequestClient) {} upload = async (file: Blob | Buffer, params?: FileUploadParams): Promise => { - return await this.client.fetchJSS( - `/v1/store/file`, - "POST", - file, - { - key: params?.key, - overwrite: params?.overwrite, - temp_public_url: params?.temp_public_url, - }, - params?.content_type && { - "Content-Type": params.content_type, - } - ); + const formData = createFileUploadFormData(file, params); + + console.log("FORM DATA HERE", formData); + return await this.client.fetchJSS(`/v1/store/file`, "POST", formData); }; retrieve = async (key: string) => { From 6125388fe4d1ba2b7021f729bc2b067fc1d52e1b Mon Sep 17 00:00:00 2001 From: Win Cheng Date: Fri, 12 Sep 2025 20:04:10 -0700 Subject: [PATCH 2/3] updaate --- src/store/file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/file.ts b/src/store/file.ts index 2365795..a98bdd2 100644 --- a/src/store/file.ts +++ b/src/store/file.ts @@ -9,7 +9,7 @@ export class File { upload = async (file: Blob | Buffer, params?: FileUploadParams): Promise => { const formData = createFileUploadFormData(file, params); - console.log("FORM DATA HERE", formData); + return await this.client.fetchJSS(`/v1/store/file`, "POST", formData); }; From ea07b3fbd5538bcef1ddd04f98c68619da7e691c Mon Sep 17 00:00:00 2001 From: Win Cheng Date: Fri, 12 Sep 2025 20:10:39 -0700 Subject: [PATCH 3/3] lintinf --- src/store/file.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/store/file.ts b/src/store/file.ts index a98bdd2..282e364 100644 --- a/src/store/file.ts +++ b/src/store/file.ts @@ -9,7 +9,6 @@ export class File { upload = async (file: Blob | Buffer, params?: FileUploadParams): Promise => { const formData = createFileUploadFormData(file, params); - return await this.client.fetchJSS(`/v1/store/file`, "POST", formData); };