Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[_]: feature/Added getFolderTree call #217

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@internxt/sdk",
"version": "1.4.93",
"version": "1.4.94",
"description": "An sdk for interacting with Internxt's services",
"repository": {
"type": "git",
Expand Down
11 changes: 11 additions & 0 deletions src/drive/storage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
FileMeta,
FolderAncestor,
FolderMeta,
FolderTreeResponse,
MoveFilePayload,
MoveFileResponse,
MoveFileUuidPayload,
Expand Down Expand Up @@ -643,4 +644,14 @@ export class Storage {
this.headers(),
);
}

/**
* Retrieves the folder tree based on the UUID.
*
* @param {string} uuid - The UUID of the folder.
* @return {Promise<FolderTreeResponse>} The promise containing the folder tree response.
*/
public getFolderTree(uuid: string): Promise<FolderTreeResponse> {
return this.client.get(`/folders/${uuid}/tree`, this.headers());
}
}
24 changes: 24 additions & 0 deletions src/drive/storage/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,3 +448,27 @@ export interface ReplaceFile {
fileId: string;
size: number;
}

export interface FolderTree {
id: number;
bucket: string | null;
children: FolderTree[];
encrypt_version: string;
files: DriveFileData[];
name: string;
plainName: string;
parentId: number;
userId: number;
uuid: string;
parentUuid: string;
createdAt: string;
updatedAt: string;
size: number;
type: string;
deleted: boolean;
removed: boolean;
}

export interface FolderTreeResponse {
tree: FolderTree;
}
Loading