Skip to content

Commit

Permalink
Added getFolderAncestors call
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramon Candel authored and Ramon Candel committed Nov 7, 2023
1 parent c93b4d3 commit b7ed580
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
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.56",
"version": "1.4.57",
"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 @@ -19,6 +19,7 @@ import {
FetchPaginatedFolderContentResponse,
FileMeta,
SearchResultData,
FolderAncestor,
} from './types';
import { ApiSecurity, ApiUrl, AppDetails } from '../../shared';
import { headersWithToken, addResourcesTokenToHeaders } from '../../shared/headers';
Expand Down Expand Up @@ -362,4 +363,14 @@ export class Storage {
private headers() {
return headersWithToken(this.appDetails.clientName, this.appDetails.clientVersion, this.apiSecurity.token);
}

/**
* Gets the ancestors of a given folder UUID
*
* @param {string} folderUUID - UUID of the folder.
* @returns {Promise<FolderAncestor[]>}
*/
public getFolderAncestors(uuid: string): Promise<FolderAncestor[]> {
return this.client.get<FolderAncestor[]>(`folders/${uuid}/ancestors`, this.headers());
}
}
22 changes: 22 additions & 0 deletions src/drive/storage/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,25 @@ export interface SearchResult {
export interface SearchResultData {
data: [SearchResult];
}


export interface FolderAncestor {
bucket: null | string;
createdAt: string;
deleted: boolean;
deletedAt: null | string;
encryptVersion: null | string;
id: number;
name: string;
parent: null | string;
parentId: number;
plainName: string;
removed: boolean;
removedAt: null | string;
size: number;
type: string;
updatedAt: string;
user: null | string;
userId: number;
uuid: string;
}

0 comments on commit b7ed580

Please sign in to comment.