Skip to content

Commit

Permalink
feat(nextcloud): Add deletePermanently method
Browse files Browse the repository at this point in the history
  • Loading branch information
cballevre committed Jul 18, 2024
1 parent 83da9e3 commit 98f9c33
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/cozy-stack-client/src/NextcloudFilesCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,25 @@ class NextcloudFilesCollection extends DocumentCollection {
throw new FetchError(resp, resp.json())
}

/**
* Deletes a file permanently from the Nextcloud server.
*
* @param {Object} file - The file object to be deleted.
* @returns {Promise<Response>} - A promise that resolves to the response from the server.
* @throws {FetchError} - If the server returns an error response.
*/
async deletePermanently(file) {
const resp = await this.stackClient.fetch(
'DELETE',
`/remote/nextcloud/${file.cozyMetadata.sourceAccount}${encodePath(
file.path
)}`
)
if (resp.status === 204) {
return resp
}
throw new FetchError(resp, resp.json())
}
}

export { NextcloudFilesCollection, NEXTCLOUD_FILES_DOCTYPE }

0 comments on commit 98f9c33

Please sign in to comment.