mirror of
https://github.com/immich-app/immich.git
synced 2025-12-19 09:13:14 +03:00
refactor(server): download endpoints (#6653)
* refactor(server): download controller * chore: open api * chore: fix mobile references
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user