Skip to content

Commit

Permalink
feat: add endpoint to decline invitations
Browse files Browse the repository at this point in the history
And the endpoint to update the role has also been updated.
  • Loading branch information
masterprog-cmd committed Sep 4, 2023
1 parent 92441ce commit 7fc089b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 7 additions & 4 deletions src/drive/share/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,13 @@ export class Share {
* Update the role of a user on a folder.
*
* @param {UpdateUserRolePayload} options - The options for updating the user's role on the folder.
* @param {string} options.folderUUID - The unique identifier of the folder.
* @param {string} options.roleId - The identifier of the role to assign to the user.
* @param {string} options.sharedWith - The unique identifier of the user to whom we will update the role.
* @param {string} options.newRoleId - The new role Id.
* @returns {Promise<UpdateRoleFolderResponse>} A promise that resolves when the user's role is updated.
*/
public updateUserRole({ folderUUID, roleId, newRoleId }: UpdateUserRolePayload): Promise<UpdateUserRoleResponse> {
public updateUserRole({ sharedWith, newRoleId }: UpdateUserRolePayload): Promise<UpdateUserRoleResponse> {
return this.client.put(
`sharings/${folderUUID}/roles/${roleId}`,
`sharings/${sharedWith}/roles`,
{
roleId: newRoleId,
},
Expand Down Expand Up @@ -410,6 +409,10 @@ export class Share {
);
}

public declineSharedFolderInvite(invitationId: string): Promise<void> {
return this.client.delete(`sharings/invites/${invitationId}`, this.headers());
}

/**
* Fetches roles for sharing items.
*
Expand Down
3 changes: 1 addition & 2 deletions src/drive/share/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ export type GrantSharePrivilegesToUserResponse = { message: string };
export type UpdateUserRoleResponse = { message: string };

export type UpdateUserRolePayload = {
folderUUID: string;
roleId: string;
sharedWith: string;
newRoleId: string;
};

Expand Down

0 comments on commit 7fc089b

Please sign in to comment.