refactor(server): download endpoints (#6653)

* refactor(server): download controller

* chore: open api

* chore: fix mobile references
This commit is contained in:
Jason Rasmussen
2024-01-26 09:19:13 -05:00
committed by GitHub
parent de47a6a330
commit 7ea55c7236
29 changed files with 1420 additions and 388 deletions

View File

@@ -7,6 +7,7 @@ import {
AssetJobName,
AuditApi,
AuthenticationApi,
DownloadApi,
FaceApi,
JobApi,
JobName,
@@ -29,6 +30,7 @@ import type { ApiParams } from './types';
class ImmichApi {
public activityApi: ActivityApi;
public albumApi: AlbumApi;
public downloadApi: DownloadApi;
public libraryApi: LibraryApi;
public assetApi: AssetApi;
public auditApi: AuditApi;
@@ -58,6 +60,7 @@ class ImmichApi {
this.activityApi = new ActivityApi(this.config);
this.albumApi = new AlbumApi(this.config);
this.auditApi = new AuditApi(this.config);
this.downloadApi = new DownloadApi(this.config);
this.libraryApi = new LibraryApi(this.config);
this.assetApi = new AssetApi(this.config);
this.authenticationApi = new AuthenticationApi(this.config);

View File

@@ -47,7 +47,7 @@ export const downloadArchive = async (fileName: string, options: DownloadInfoDto
let downloadInfo: DownloadResponseDto | null = null;
try {
const { data } = await api.assetApi.getDownloadInfo({ downloadInfoDto: options, key: api.getKey() });
const { data } = await api.downloadApi.getDownloadInfo({ downloadInfoDto: options, key: api.getKey() });
downloadInfo = data;
} catch (error) {
handleError(error, 'Unable to download files');
@@ -71,7 +71,7 @@ export const downloadArchive = async (fileName: string, options: DownloadInfoDto
downloadManager.add(downloadKey, archive.size, abort);
try {
const { data } = await api.assetApi.downloadArchive(
const { data } = await api.downloadApi.downloadArchive(
{ assetIdsDto: { assetIds: archive.assetIds }, key: api.getKey() },
{
responseType: 'blob',
@@ -121,7 +121,7 @@ export const downloadFile = async (asset: AssetResponseDto) => {
const abort = new AbortController();
downloadManager.add(downloadKey, size, abort);
const { data } = await api.assetApi.downloadFile(
const { data } = await api.downloadApi.downloadFile(
{ id, key: api.getKey() },
{
responseType: 'blob',