Skip to content
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,7 +1,7 @@
{
"name": "@internxt/sdk",
"author": "Internxt <hello@internxt.com>",
"version": "1.23.3",
"version": "1.24.0",
"description": "An sdk for interacting with Internxt's services",
"repository": {
"type": "git",
Expand Down
24 changes: 15 additions & 9 deletions src/drive/storage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
CheckDuplicatedFilesPayload,
CheckDuplicatedFilesResponse,
CheckDuplicatedFolderPayload,
CheckDuplicatedFoldersResponse,
CreateFolderByUuidPayload,
CreateFolderPayload,
CreateFolderResponse,
Expand All @@ -24,6 +23,9 @@ import {
FetchFolderContentResponse,
FetchFolderFilesCursorResponse,
FetchFolderFoldersCursorResponse,
FetchExistentFoldersResponse,
FetchFolderByPathResponse,
FetchFolderMetaResponse,
FetchFoldersSyncResponse,
FetchLimitResponse,
FetchPaginatedFilesContent,
Expand Down Expand Up @@ -831,16 +833,20 @@ export class Storage {
* Gets the meta of a given folder UUID
*
* @param {string} folderUUID - UUID of the folder.
* @returns {Promise<FolderMeta>}
* @returns {Promise<FetchFolderMetaResponse>}
*/
public getFolderMeta(uuid: string, workspacesToken?: string, resourcesToken?: string): Promise<FolderMeta> {
public getFolderMeta(
uuid: string,
workspacesToken?: string,
resourcesToken?: string,
): Promise<FetchFolderMetaResponse> {
const customHeaders = workspacesToken
? {
'x-internxt-workspace': workspacesToken,
}
: undefined;

return this.client.get<FolderMeta>(
return this.client.get<FetchFolderMetaResponse>(
`folders/${uuid}/meta`,
addResourcesTokenToHeaders(this.headers(customHeaders), resourcesToken),
);
Expand Down Expand Up @@ -928,12 +934,12 @@ export class Storage {
* Checks if the given folders names already exist in the given folder
*
* @param {CheckDuplicatedFolderPayload} payload - Payload containing the folder UUID and the list of folders to check.
* @return {Promise<CheckDuplicatedFoldersResponse>} - Promise that contains the duplicated folders in a list.
* @return {Promise<FetchExistentFoldersResponse>} - Promise that contains the duplicated folders in a list.
*/
public checkDuplicatedFolders({
folderUuid,
folderNamesList,
}: CheckDuplicatedFolderPayload): Promise<CheckDuplicatedFoldersResponse> {
}: CheckDuplicatedFolderPayload): Promise<FetchExistentFoldersResponse> {
return this.client.post(
`/folders/content/${folderUuid}/folders/existence`,
{
Expand All @@ -947,11 +953,11 @@ export class Storage {
* Gets the folder meta from a given path (e.g. "/folder1/folder2")
*
* @param {string} folderPath - The path of the folder.
* @returns {Promise<FolderMeta>} A promise that resolves the folder on that path.
* @returns {Promise<FetchFolderByPathResponse>} A promise that resolves the folder on that path.
*/
public getFolderByPath(folderPath: string): Promise<FolderMeta> {
public getFolderByPath(folderPath: string): Promise<FetchFolderByPathResponse> {
const query = new URLSearchParams({ path: folderPath });
return this.client.get<FolderMeta>(`folders/meta?${query}`, this.headers());
return this.client.get<FetchFolderByPathResponse>(`folders/meta?${query}`, this.headers());
}

/**
Expand Down
9 changes: 9 additions & 0 deletions src/drive/storage/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,15 @@ export type FetchFolderFilesCursorResponse =
export type FetchFolderFoldersCursorResponse =
paths['/folders/v2/content/{uuid}/folders']['get']['responses']['200']['content']['application/json'];

export type FetchFolderMetaResponse =
paths['/folders/{uuid}/meta']['get']['responses']['200']['content']['application/json'];

export type FetchFolderByPathResponse =
paths['/folders/meta']['get']['responses']['200']['content']['application/json'];

export type FetchExistentFoldersResponse =
paths['/folders/content/{uuid}/folders/existence']['post']['responses']['200']['content']['application/json'];

export type FilesSyncQuery = NonNullable<paths['/files/sync']['get']['parameters']['query']>;

export type FoldersSyncQuery = NonNullable<paths['/folders/sync']['get']['parameters']['query']>;
Expand Down
Loading