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

[_]: Added update name of items with uuid #215

Merged
merged 1 commit into from
Jul 5, 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.90",
"version": "1.4.91",
"description": "An sdk for interacting with Internxt's services",
"repository": {
"type": "git",
Expand Down
43 changes: 43 additions & 0 deletions src/drive/storage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,29 @@ export class Storage {
);
}

/**
* Updates the name of a folder with the given UUID.
*
* @param {Object} payload - The payload containing the folder UUID and the new name.
* @param {string} payload.folderUuid - The UUID of the folder to update.
* @param {string} payload.name - The new name for the folder.
* @param {Token} [resourcesToken] - An optional token for authentication.
* @return {Promise<void>} A promise that resolves when the folder name is successfully updated.
*/
public updateFolderNameWithUUID(
payload: { folderUuid: string; name: string },
resourcesToken?: Token,
): Promise<void> {
const { folderUuid, name } = payload;
return this.client.put(
`/folders/${folderUuid}/meta`,
{
plainName: name,
},
addResourcesTokenToHeaders(this.headers(), resourcesToken),
);
}

/**
* Fetches & returns the contents of a specific folder
* @param folderId
Expand Down Expand Up @@ -414,6 +437,26 @@ export class Storage {
);
}

/**
* Updates the name of a file with the given UUID.
*
* @param {Object} payload - The payload containing the UUID and new name of the file.
* @param {string} payload.fileUuid - The UUID of the file.
* @param {string} payload.name - The new name of the file.
* @param {string} [resourcesToken] - The token for accessing resources.
* @return {Promise<void>} - A Promise that resolves when the file name is successfully updated.
*/
public updateFileNameWithUUID(payload: { fileUuid: string; name: string }, resourcesToken?: Token): Promise<void> {
const { fileUuid, name } = payload;
return this.client.put(
`/files/${fileUuid}/meta`,
{
plainName: name,
},
addResourcesTokenToHeaders(this.headers(), resourcesToken),
);
}

/**
* Deletes a specific file entry
* @param payload
Expand Down
Loading