Skip to content

Commit 4029c7d

Browse files
authored
Merge pull request #240 from import-ai/refactor/resources
refactor(files): update interface
2 parents 35e75ef + ddbf1f8 commit 4029c7d

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/interface.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,12 @@ export interface Application extends IBase {
275275
attrs?: ApplicationAttrs;
276276
}
277277

278-
export interface FileInfo {
278+
export interface UploadFileInfo {
279279
id: string;
280280
post_url: string;
281281
post_fields: [string, string][];
282282
}
283+
284+
export interface DownloadFileInfo {
285+
url: string;
286+
}

src/lib/download-file.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FileInfo } from '@/interface';
1+
import { DownloadFileInfo } from '@/interface';
22

33
import { http } from './request';
44

@@ -8,7 +8,7 @@ export async function downloadFile(
88
originalName: string
99
) {
1010
try {
11-
const fileInfo: FileInfo = await http.get(
11+
const fileInfo: DownloadFileInfo = await http.get(
1212
`/namespaces/${namespaceId}/resources/${resourceId}/file`,
1313
{ mute: true }
1414
);

src/lib/upload-files.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FileInfo, IResourceData } from '@/interface';
1+
import { IResourceData, UploadFileInfo } from '@/interface';
22
import { http } from '@/lib/request';
33

44
export interface UploadProgress {
@@ -13,7 +13,7 @@ async function uploadFile(
1313
parentId: string,
1414
file: File
1515
): Promise<IResourceData> {
16-
let fileInfo: FileInfo;
16+
let fileInfo: UploadFileInfo;
1717
try {
1818
fileInfo = await http.post(
1919
`/namespaces/${namespaceId}/resources/files`,

0 commit comments

Comments
 (0)