Use named arguments with download file

This commit is contained in:
Tiger Oakes
2020-09-26 14:50:10 -07:00
parent 1112548246
commit d1311d00ea
8 changed files with 42 additions and 20 deletions

View File

@@ -282,8 +282,14 @@ export class PostsService implements CanActivate {
return this.http.post<GetAllFilesResponse>(this.path + 'getAllFiles', {}, this.httpOptions);
}
downloadFileFromServer(fileName: string | string[], type: FileType, outputName: string = null, fullPathProvided: boolean = null, subscriptionName: boolean = null, subPlaylist: boolean = null,
uid = null, uuid: string = null, id = null) {
downloadFileFromServer(
fileName: string | string[], type: FileType,
options: {outputName?: string, fullPathProvided?: boolean, subscriptionName?: string, subPlaylist?: boolean, uid?: string, uuid?: string, id?: string} = {}
) {
const {outputName = null, fullPathProvided = null,
subscriptionName = null, subPlaylist = null,
uid = null, uuid = null, id = null} = options;
const body: DownloadFileRequest = {fileNames: fileName,
type: type,
zip_mode: Array.isArray(fileName),
@@ -291,11 +297,11 @@ export class PostsService implements CanActivate {
fullPathProvided: fullPathProvided,
subscriptionName: subscriptionName,
subPlaylist: subPlaylist,
uid: uid,
uuid: uuid,
id: id,
};
return this.http.post(this.path + 'downloadFile', body,
{responseType: 'blob', params: this.httpOptions.params});
return this.http.post(this.path + 'downloadFile', body, {responseType: 'blob', params: this.httpOptions.params});
}
uploadCookiesFile(fileFormData) {