feat(server): improve API specification (#1853)

This commit is contained in:
Michel Heusschen 2023-02-24 17:01:10 +01:00 committed by GitHub
parent da9b9c8c69
commit 9323cc76d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 1690 additions and 396 deletions

View file

@ -93,6 +93,7 @@ describe('AlbumCard component', () => {
expect(apiMock.assetApi.getAssetThumbnail).toHaveBeenCalledWith(
'thumbnailIdOne',
ThumbnailFormat.Jpeg,
undefined,
{ responseType: 'blob' }
);
expect(createObjectURLMock).toHaveBeenCalledWith(thumbnailBlob);

View file

@ -34,9 +34,14 @@
return;
}
const { data } = await api.assetApi.getAssetThumbnail(thubmnailId, ThumbnailFormat.Jpeg, {
responseType: 'blob'
});
const { data } = await api.assetApi.getAssetThumbnail(
thubmnailId,
ThumbnailFormat.Jpeg,
undefined,
{
responseType: 'blob'
}
);
if (data instanceof Blob) {
return URL.createObjectURL(data);

View file

@ -170,11 +170,7 @@
{
assetIds: assets.map((a) => a.id)
},
{
params: {
key: sharedLink?.key
}
}
sharedLink?.key
);
if (data.album) {
@ -269,10 +265,8 @@
const { data, status, headers } = await api.albumApi.downloadArchive(
album.id,
skip || undefined,
sharedLink?.key,
{
params: {
key: sharedLink?.key
},
responseType: 'blob',
onDownloadProgress: function (progressEvent) {
const request = this as XMLHttpRequest;

View file

@ -145,8 +145,7 @@
$downloadAssets[imageFileName] = 0;
const { data, status } = await api.assetApi.downloadFile(assetId, {
params: { key },
const { data, status } = await api.assetApi.downloadFile(assetId, key, {
responseType: 'blob',
onDownloadProgress: (progressEvent) => {
if (progressEvent.lengthComputable) {

View file

@ -26,10 +26,7 @@
const loadAssetData = async () => {
try {
const { data } = await api.assetApi.serveFile(asset.id, false, true, {
params: {
key: publicSharedKey
},
const { data } = await api.assetApi.serveFile(asset.id, false, true, publicSharedKey, {
responseType: 'blob'
});

View file

@ -54,11 +54,7 @@
{
assetIds
},
{
params: {
key: sharedLink?.key
}
}
sharedLink?.key
);
notificationController.show({
@ -76,11 +72,7 @@
{
assetIds: assets.filter((a) => !selectedAssets.has(a)).map((a) => a.id)
},
{
params: {
key: sharedLink?.key
}
}
sharedLink?.key
);
assets = assets.filter((a) => !selectedAssets.has(a));

View file

@ -11,9 +11,14 @@
return noThumbnailUrl;
}
const { data } = await api.assetApi.getAssetThumbnail(thubmnailId, ThumbnailFormat.Webp, {
responseType: 'blob'
});
const { data } = await api.assetApi.getAssetThumbnail(
thubmnailId,
ThumbnailFormat.Webp,
undefined,
{
responseType: 'blob'
}
);
if (data instanceof Blob) {
return URL.createObjectURL(data);
}