diff --git a/package.json b/package.json index fea95c9..8cc60aa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@internxt/sdk", - "version": "1.4.73", + "version": "1.4.74", "description": "An sdk for interacting with Internxt's services", "repository": { "type": "git", diff --git a/src/drive/storage/index.ts b/src/drive/storage/index.ts index 0084a23..63231ff 100644 --- a/src/drive/storage/index.ts +++ b/src/drive/storage/index.ts @@ -24,6 +24,8 @@ import { ReplaceFile, FetchPaginatedFilesContent, FetchPaginatedFoldersContent, + MoveFolderUuidPayload, + MoveFileUuidPayload, } from './types'; import { ApiSecurity, ApiUrl, AppDetails } from '../../shared'; import { headersWithToken, addResourcesTokenToHeaders } from '../../shared/headers'; @@ -80,6 +82,20 @@ export class Storage { ); } + /** + * Moves a specific folder to a new location + * @param payload + */ + public async moveFolderByUuid(payload: MoveFolderUuidPayload): Promise { + return this.client.patch( + `/folders/${payload.folderUuid}`, + { + destinationFolder: payload.destinationFolderUuid, + }, + this.headers(), + ); + } + /** * Updates the metadata of a folder * @param payload @@ -346,6 +362,20 @@ export class Storage { ); } + /** + * Moves a specific file to a new location + * @param payload + */ + public async moveFileByUuid(payload: MoveFileUuidPayload): Promise { + return this.client.patch( + `/files/${payload.fileUuid}`, + { + destinationFolder: payload.destinationFolderUuid, + }, + this.headers(), + ); + } + /** * Returns a list of the n most recent files * @param limit diff --git a/src/drive/storage/types.ts b/src/drive/storage/types.ts index 4ce8af1..c19e2d3 100644 --- a/src/drive/storage/types.ts +++ b/src/drive/storage/types.ts @@ -290,6 +290,11 @@ export interface MoveFolderPayload { destinationFolderId: number; } +export interface MoveFolderUuidPayload { + folderUuid: string; + destinationFolderUuid: string; +} + export interface MoveFolderResponse { item: DriveFolderData; destination: number; @@ -328,6 +333,11 @@ export interface MoveFilePayload { bucketId: string; } +export interface MoveFileUuidPayload { + fileUuid: string; + destinationFolderUuid: string; +} + export interface MoveFileResponse { item: DriveFileData; destination: number;