export const SOURCE_DESTINATION_EQUAL_ERROR_MESSAGE = 'Source and destination cannot be the same';
export class CollectionService extends TrashableResourceService<CollectionResource> {
- constructor(serverApi: AxiosInstance, private webdavClient: WebDAV, private authService: AuthService, actions: ApiActions) {
+ constructor(serverApi: AxiosInstance, private keepWebdavClient: WebDAV, private authService: AuthService, actions: ApiActions) {
super(serverApi, "collections", actions, [
'fileCount',
'fileSizeTotal',
}
async files(uuid: string) {
- const request = await this.webdavClient.propfind(`c=${uuid}`);
+ const request = await this.keepWebdavClient.propfind(`c=${uuid}`);
if (request.responseXML != null) {
return extractFilesData(request.responseXML);
}
}
extendFileURL = (file: CollectionDirectory | CollectionFile) => {
- const baseUrl = this.webdavClient.getBaseUrl().endsWith('/')
- ? this.webdavClient.getBaseUrl().slice(0, -1)
- : this.webdavClient.getBaseUrl();
+ const baseUrl = this.keepWebdavClient.getBaseUrl().endsWith('/')
+ ? this.keepWebdavClient.getBaseUrl().slice(0, -1)
+ : this.keepWebdavClient.getBaseUrl();
const apiToken = this.authService.getApiToken();
const encodedApiToken = apiToken ? encodeURI(apiToken) : '';
const userApiToken = `/t=${encodedApiToken}/`;
}
async getFileContents(file: CollectionFile) {
- return (await this.webdavClient.get(`c=${file.id}`)).response;
+ return (await this.keepWebdavClient.get(`c=${file.id}`)).response;
}
private async uploadFile(collectionUuid: string, file: File, fileId: number, onProgress: UploadProgress = () => { return; }, targetLocation: string = '') {
onProgress(fileId, e.loaded, e.total, Date.now());
},
};
- return this.webdavClient.upload(fileURL, [file], requestConfig);
+ return this.keepWebdavClient.upload(fileURL, [file], requestConfig);
}
deleteFiles(collectionUuid: string, files: string[], showErrors?: boolean) {