Added requestThumbnailUrls to imaging repository

To move the `imagingModel` configuration into the repository.
This commit is contained in:
leekelleher
2024-05-22 23:41:56 +01:00
parent 78043ac727
commit 0c71aa1678

View File

@@ -1,7 +1,8 @@
import type { UmbImagingModel } from './types.js';
import { UmbImagingServerDataSource } from './imaging.server.data.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
import { ImageCropModeModel } from '@umbraco-cms/backoffice/external/backend-api';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import type { UmbApi } from '@umbraco-cms/backoffice/extension-api';
export class UmbImagingRepository extends UmbControllerBase implements UmbApi {
@@ -25,4 +26,17 @@ export class UmbImagingRepository extends UmbControllerBase implements UmbApi {
const error: any = _error;
return { data, error };
}
/**
* Requests the thumbnail URLs for the given uniques
* @param {Array<string>} uniques
* @param {number} height
* @param {number} width
* @returns {*}
* @memberof UmbImagingRepository
*/
async requestThumbnailUrls(uniques: Array<string>, height: number, width: number) {
const imagingModel = { height: height, width: width, mode: ImageCropModeModel.MIN };
return await this.requestResizedItems(uniques, imagingModel);
}
}