mirror of https://github.com/immich-app/immich.git
feat: queues (#24142)
parent
66ae07ee39
commit
104fa09f69
@ -0,0 +1,308 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.18
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
|
||||
class QueuesApi {
|
||||
QueuesApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
|
||||
|
||||
final ApiClient apiClient;
|
||||
|
||||
/// Empty a queue
|
||||
///
|
||||
/// Removes all jobs from the specified queue.
|
||||
///
|
||||
/// Note: This method returns the HTTP [Response].
|
||||
///
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [QueueName] name (required):
|
||||
///
|
||||
/// * [QueueDeleteDto] queueDeleteDto (required):
|
||||
Future<Response> emptyQueueWithHttpInfo(QueueName name, QueueDeleteDto queueDeleteDto,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final apiPath = r'/queues/{name}/jobs'
|
||||
.replaceAll('{name}', name.toString());
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody = queueDeleteDto;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
apiPath,
|
||||
'DELETE',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
/// Empty a queue
|
||||
///
|
||||
/// Removes all jobs from the specified queue.
|
||||
///
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [QueueName] name (required):
|
||||
///
|
||||
/// * [QueueDeleteDto] queueDeleteDto (required):
|
||||
Future<void> emptyQueue(QueueName name, QueueDeleteDto queueDeleteDto,) async {
|
||||
final response = await emptyQueueWithHttpInfo(name, queueDeleteDto,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
}
|
||||
|
||||
/// Retrieve a queue
|
||||
///
|
||||
/// Retrieves a specific queue by its name.
|
||||
///
|
||||
/// Note: This method returns the HTTP [Response].
|
||||
///
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [QueueName] name (required):
|
||||
Future<Response> getQueueWithHttpInfo(QueueName name,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final apiPath = r'/queues/{name}'
|
||||
.replaceAll('{name}', name.toString());
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
apiPath,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
/// Retrieve a queue
|
||||
///
|
||||
/// Retrieves a specific queue by its name.
|
||||
///
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [QueueName] name (required):
|
||||
Future<QueueResponseDto?> getQueue(QueueName name,) async {
|
||||
final response = await getQueueWithHttpInfo(name,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
// When a remote server returns no body with a status of 204, we shall not decode it.
|
||||
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'QueueResponseDto',) as QueueResponseDto;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Retrieve queue jobs
|
||||
///
|
||||
/// Retrieves a list of queue jobs from the specified queue.
|
||||
///
|
||||
/// Note: This method returns the HTTP [Response].
|
||||
///
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [QueueName] name (required):
|
||||
///
|
||||
/// * [List<QueueJobStatus>] status:
|
||||
Future<Response> getQueueJobsWithHttpInfo(QueueName name, { List<QueueJobStatus>? status, }) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final apiPath = r'/queues/{name}/jobs'
|
||||
.replaceAll('{name}', name.toString());
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
if (status != null) {
|
||||
queryParams.addAll(_queryParams('multi', 'status', status));
|
||||
}
|
||||
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
apiPath,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
/// Retrieve queue jobs
|
||||
///
|
||||
/// Retrieves a list of queue jobs from the specified queue.
|
||||
///
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [QueueName] name (required):
|
||||
///
|
||||
/// * [List<QueueJobStatus>] status:
|
||||
Future<List<QueueJobResponseDto>?> getQueueJobs(QueueName name, { List<QueueJobStatus>? status, }) async {
|
||||
final response = await getQueueJobsWithHttpInfo(name, status: status, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
// When a remote server returns no body with a status of 204, we shall not decode it.
|
||||
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
|
||||
final responseBody = await _decodeBodyBytes(response);
|
||||
return (await apiClient.deserializeAsync(responseBody, 'List<QueueJobResponseDto>') as List)
|
||||
.cast<QueueJobResponseDto>()
|
||||
.toList(growable: false);
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// List all queues
|
||||
///
|
||||
/// Retrieves a list of queues.
|
||||
///
|
||||
/// Note: This method returns the HTTP [Response].
|
||||
Future<Response> getQueuesWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
final apiPath = r'/queues';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
apiPath,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
/// List all queues
|
||||
///
|
||||
/// Retrieves a list of queues.
|
||||
Future<List<QueueResponseDto>?> getQueues() async {
|
||||
final response = await getQueuesWithHttpInfo();
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
// When a remote server returns no body with a status of 204, we shall not decode it.
|
||||
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
|
||||
final responseBody = await _decodeBodyBytes(response);
|
||||
return (await apiClient.deserializeAsync(responseBody, 'List<QueueResponseDto>') as List)
|
||||
.cast<QueueResponseDto>()
|
||||
.toList(growable: false);
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Update a queue
|
||||
///
|
||||
/// Change the paused status of a specific queue.
|
||||
///
|
||||
/// Note: This method returns the HTTP [Response].
|
||||
///
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [QueueName] name (required):
|
||||
///
|
||||
/// * [QueueUpdateDto] queueUpdateDto (required):
|
||||
Future<Response> updateQueueWithHttpInfo(QueueName name, QueueUpdateDto queueUpdateDto,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final apiPath = r'/queues/{name}'
|
||||
.replaceAll('{name}', name.toString());
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody = queueUpdateDto;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
apiPath,
|
||||
'PUT',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
/// Update a queue
|
||||
///
|
||||
/// Change the paused status of a specific queue.
|
||||
///
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [QueueName] name (required):
|
||||
///
|
||||
/// * [QueueUpdateDto] queueUpdateDto (required):
|
||||
Future<QueueResponseDto?> updateQueue(QueueName name, QueueUpdateDto queueUpdateDto,) async {
|
||||
final response = await updateQueueWithHttpInfo(name, queueUpdateDto,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
// When a remote server returns no body with a status of 204, we shall not decode it.
|
||||
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'QueueResponseDto',) as QueueResponseDto;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,244 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.18
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
|
||||
class JobName {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const JobName._(this.value);
|
||||
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
static const assetDelete = JobName._(r'AssetDelete');
|
||||
static const assetDeleteCheck = JobName._(r'AssetDeleteCheck');
|
||||
static const assetDetectFacesQueueAll = JobName._(r'AssetDetectFacesQueueAll');
|
||||
static const assetDetectFaces = JobName._(r'AssetDetectFaces');
|
||||
static const assetDetectDuplicatesQueueAll = JobName._(r'AssetDetectDuplicatesQueueAll');
|
||||
static const assetDetectDuplicates = JobName._(r'AssetDetectDuplicates');
|
||||
static const assetEncodeVideoQueueAll = JobName._(r'AssetEncodeVideoQueueAll');
|
||||
static const assetEncodeVideo = JobName._(r'AssetEncodeVideo');
|
||||
static const assetEmptyTrash = JobName._(r'AssetEmptyTrash');
|
||||
static const assetExtractMetadataQueueAll = JobName._(r'AssetExtractMetadataQueueAll');
|
||||
static const assetExtractMetadata = JobName._(r'AssetExtractMetadata');
|
||||
static const assetFileMigration = JobName._(r'AssetFileMigration');
|
||||
static const assetGenerateThumbnailsQueueAll = JobName._(r'AssetGenerateThumbnailsQueueAll');
|
||||
static const assetGenerateThumbnails = JobName._(r'AssetGenerateThumbnails');
|
||||
static const auditLogCleanup = JobName._(r'AuditLogCleanup');
|
||||
static const auditTableCleanup = JobName._(r'AuditTableCleanup');
|
||||
static const databaseBackup = JobName._(r'DatabaseBackup');
|
||||
static const facialRecognitionQueueAll = JobName._(r'FacialRecognitionQueueAll');
|
||||
static const facialRecognition = JobName._(r'FacialRecognition');
|
||||
static const fileDelete = JobName._(r'FileDelete');
|
||||
static const fileMigrationQueueAll = JobName._(r'FileMigrationQueueAll');
|
||||
static const libraryDeleteCheck = JobName._(r'LibraryDeleteCheck');
|
||||
static const libraryDelete = JobName._(r'LibraryDelete');
|
||||
static const libraryRemoveAsset = JobName._(r'LibraryRemoveAsset');
|
||||
static const libraryScanAssetsQueueAll = JobName._(r'LibraryScanAssetsQueueAll');
|
||||
static const librarySyncAssets = JobName._(r'LibrarySyncAssets');
|
||||
static const librarySyncFilesQueueAll = JobName._(r'LibrarySyncFilesQueueAll');
|
||||
static const librarySyncFiles = JobName._(r'LibrarySyncFiles');
|
||||
static const libraryScanQueueAll = JobName._(r'LibraryScanQueueAll');
|
||||
static const memoryCleanup = JobName._(r'MemoryCleanup');
|
||||
static const memoryGenerate = JobName._(r'MemoryGenerate');
|
||||
static const notificationsCleanup = JobName._(r'NotificationsCleanup');
|
||||
static const notifyUserSignup = JobName._(r'NotifyUserSignup');
|
||||
static const notifyAlbumInvite = JobName._(r'NotifyAlbumInvite');
|
||||
static const notifyAlbumUpdate = JobName._(r'NotifyAlbumUpdate');
|
||||
static const userDelete = JobName._(r'UserDelete');
|
||||
static const userDeleteCheck = JobName._(r'UserDeleteCheck');
|
||||
static const userSyncUsage = JobName._(r'UserSyncUsage');
|
||||
static const personCleanup = JobName._(r'PersonCleanup');
|
||||
static const personFileMigration = JobName._(r'PersonFileMigration');
|
||||
static const personGenerateThumbnail = JobName._(r'PersonGenerateThumbnail');
|
||||
static const sessionCleanup = JobName._(r'SessionCleanup');
|
||||
static const sendMail = JobName._(r'SendMail');
|
||||
static const sidecarQueueAll = JobName._(r'SidecarQueueAll');
|
||||
static const sidecarCheck = JobName._(r'SidecarCheck');
|
||||
static const sidecarWrite = JobName._(r'SidecarWrite');
|
||||
static const smartSearchQueueAll = JobName._(r'SmartSearchQueueAll');
|
||||
static const smartSearch = JobName._(r'SmartSearch');
|
||||
static const storageTemplateMigration = JobName._(r'StorageTemplateMigration');
|
||||
static const storageTemplateMigrationSingle = JobName._(r'StorageTemplateMigrationSingle');
|
||||
static const tagCleanup = JobName._(r'TagCleanup');
|
||||
static const versionCheck = JobName._(r'VersionCheck');
|
||||
static const ocrQueueAll = JobName._(r'OcrQueueAll');
|
||||
static const ocr = JobName._(r'Ocr');
|
||||
static const workflowRun = JobName._(r'WorkflowRun');
|
||||
|
||||
/// List of all possible values in this [enum][JobName].
|
||||
static const values = <JobName>[
|
||||
assetDelete,
|
||||
assetDeleteCheck,
|
||||
assetDetectFacesQueueAll,
|
||||
assetDetectFaces,
|
||||
assetDetectDuplicatesQueueAll,
|
||||
assetDetectDuplicates,
|
||||
assetEncodeVideoQueueAll,
|
||||
assetEncodeVideo,
|
||||
assetEmptyTrash,
|
||||
assetExtractMetadataQueueAll,
|
||||
assetExtractMetadata,
|
||||
assetFileMigration,
|
||||
assetGenerateThumbnailsQueueAll,
|
||||
assetGenerateThumbnails,
|
||||
auditLogCleanup,
|
||||
auditTableCleanup,
|
||||
databaseBackup,
|
||||
facialRecognitionQueueAll,
|
||||
facialRecognition,
|
||||
fileDelete,
|
||||
fileMigrationQueueAll,
|
||||
libraryDeleteCheck,
|
||||
libraryDelete,
|
||||
libraryRemoveAsset,
|
||||
libraryScanAssetsQueueAll,
|
||||
librarySyncAssets,
|
||||
librarySyncFilesQueueAll,
|
||||
librarySyncFiles,
|
||||
libraryScanQueueAll,
|
||||
memoryCleanup,
|
||||
memoryGenerate,
|
||||
notificationsCleanup,
|
||||
notifyUserSignup,
|
||||
notifyAlbumInvite,
|
||||
notifyAlbumUpdate,
|
||||
userDelete,
|
||||
userDeleteCheck,
|
||||
userSyncUsage,
|
||||
personCleanup,
|
||||
personFileMigration,
|
||||
personGenerateThumbnail,
|
||||
sessionCleanup,
|
||||
sendMail,
|
||||
sidecarQueueAll,
|
||||
sidecarCheck,
|
||||
sidecarWrite,
|
||||
smartSearchQueueAll,
|
||||
smartSearch,
|
||||
storageTemplateMigration,
|
||||
storageTemplateMigrationSingle,
|
||||
tagCleanup,
|
||||
versionCheck,
|
||||
ocrQueueAll,
|
||||
ocr,
|
||||
workflowRun,
|
||||
];
|
||||
|
||||
static JobName? fromJson(dynamic value) => JobNameTypeTransformer().decode(value);
|
||||
|
||||
static List<JobName> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <JobName>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = JobName.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [JobName] to String,
|
||||
/// and [decode] dynamic data back to [JobName].
|
||||
class JobNameTypeTransformer {
|
||||
factory JobNameTypeTransformer() => _instance ??= const JobNameTypeTransformer._();
|
||||
|
||||
const JobNameTypeTransformer._();
|
||||
|
||||
String encode(JobName data) => data.value;
|
||||
|
||||
/// Decodes a [dynamic value][data] to a JobName.
|
||||
///
|
||||
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
|
||||
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
|
||||
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
|
||||
///
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
JobName? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case r'AssetDelete': return JobName.assetDelete;
|
||||
case r'AssetDeleteCheck': return JobName.assetDeleteCheck;
|
||||
case r'AssetDetectFacesQueueAll': return JobName.assetDetectFacesQueueAll;
|
||||
case r'AssetDetectFaces': return JobName.assetDetectFaces;
|
||||
case r'AssetDetectDuplicatesQueueAll': return JobName.assetDetectDuplicatesQueueAll;
|
||||
case r'AssetDetectDuplicates': return JobName.assetDetectDuplicates;
|
||||
case r'AssetEncodeVideoQueueAll': return JobName.assetEncodeVideoQueueAll;
|
||||
case r'AssetEncodeVideo': return JobName.assetEncodeVideo;
|
||||
case r'AssetEmptyTrash': return JobName.assetEmptyTrash;
|
||||
case r'AssetExtractMetadataQueueAll': return JobName.assetExtractMetadataQueueAll;
|
||||
case r'AssetExtractMetadata': return JobName.assetExtractMetadata;
|
||||
case r'AssetFileMigration': return JobName.assetFileMigration;
|
||||
case r'AssetGenerateThumbnailsQueueAll': return JobName.assetGenerateThumbnailsQueueAll;
|
||||
case r'AssetGenerateThumbnails': return JobName.assetGenerateThumbnails;
|
||||
case r'AuditLogCleanup': return JobName.auditLogCleanup;
|
||||
case r'AuditTableCleanup': return JobName.auditTableCleanup;
|
||||
case r'DatabaseBackup': return JobName.databaseBackup;
|
||||
case r'FacialRecognitionQueueAll': return JobName.facialRecognitionQueueAll;
|
||||
case r'FacialRecognition': return JobName.facialRecognition;
|
||||
case r'FileDelete': return JobName.fileDelete;
|
||||
case r'FileMigrationQueueAll': return JobName.fileMigrationQueueAll;
|
||||
case r'LibraryDeleteCheck': return JobName.libraryDeleteCheck;
|
||||
case r'LibraryDelete': return JobName.libraryDelete;
|
||||
case r'LibraryRemoveAsset': return JobName.libraryRemoveAsset;
|
||||
case r'LibraryScanAssetsQueueAll': return JobName.libraryScanAssetsQueueAll;
|
||||
case r'LibrarySyncAssets': return JobName.librarySyncAssets;
|
||||
case r'LibrarySyncFilesQueueAll': return JobName.librarySyncFilesQueueAll;
|
||||
case r'LibrarySyncFiles': return JobName.librarySyncFiles;
|
||||
case r'LibraryScanQueueAll': return JobName.libraryScanQueueAll;
|
||||
case r'MemoryCleanup': return JobName.memoryCleanup;
|
||||
case r'MemoryGenerate': return JobName.memoryGenerate;
|
||||
case r'NotificationsCleanup': return JobName.notificationsCleanup;
|
||||
case r'NotifyUserSignup': return JobName.notifyUserSignup;
|
||||
case r'NotifyAlbumInvite': return JobName.notifyAlbumInvite;
|
||||
case r'NotifyAlbumUpdate': return JobName.notifyAlbumUpdate;
|
||||
case r'UserDelete': return JobName.userDelete;
|
||||
case r'UserDeleteCheck': return JobName.userDeleteCheck;
|
||||
case r'UserSyncUsage': return JobName.userSyncUsage;
|
||||
case r'PersonCleanup': return JobName.personCleanup;
|
||||
case r'PersonFileMigration': return JobName.personFileMigration;
|
||||
case r'PersonGenerateThumbnail': return JobName.personGenerateThumbnail;
|
||||
case r'SessionCleanup': return JobName.sessionCleanup;
|
||||
case r'SendMail': return JobName.sendMail;
|
||||
case r'SidecarQueueAll': return JobName.sidecarQueueAll;
|
||||
case r'SidecarCheck': return JobName.sidecarCheck;
|
||||
case r'SidecarWrite': return JobName.sidecarWrite;
|
||||
case r'SmartSearchQueueAll': return JobName.smartSearchQueueAll;
|
||||
case r'SmartSearch': return JobName.smartSearch;
|
||||
case r'StorageTemplateMigration': return JobName.storageTemplateMigration;
|
||||
case r'StorageTemplateMigrationSingle': return JobName.storageTemplateMigrationSingle;
|
||||
case r'TagCleanup': return JobName.tagCleanup;
|
||||
case r'VersionCheck': return JobName.versionCheck;
|
||||
case r'OcrQueueAll': return JobName.ocrQueueAll;
|
||||
case r'Ocr': return JobName.ocr;
|
||||
case r'WorkflowRun': return JobName.workflowRun;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Singleton [JobNameTypeTransformer] instance.
|
||||
static JobNameTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
@ -0,0 +1,109 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.18
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class QueueDeleteDto {
|
||||
/// Returns a new [QueueDeleteDto] instance.
|
||||
QueueDeleteDto({
|
||||
this.failed,
|
||||
});
|
||||
|
||||
/// If true, will also remove failed jobs from the queue.
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
/// does not include a default value (using the "default:" property), however, the generated
|
||||
/// source code must fall back to having a nullable type.
|
||||
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||
///
|
||||
bool? failed;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is QueueDeleteDto &&
|
||||
other.failed == failed;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(failed == null ? 0 : failed!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'QueueDeleteDto[failed=$failed]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (this.failed != null) {
|
||||
json[r'failed'] = this.failed;
|
||||
} else {
|
||||
// json[r'failed'] = null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [QueueDeleteDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static QueueDeleteDto? fromJson(dynamic value) {
|
||||
upgradeDto(value, "QueueDeleteDto");
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return QueueDeleteDto(
|
||||
failed: mapValueOfType<bool>(json, r'failed'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<QueueDeleteDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <QueueDeleteDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = QueueDeleteDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, QueueDeleteDto> mapFromJson(dynamic json) {
|
||||
final map = <String, QueueDeleteDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = QueueDeleteDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of QueueDeleteDto-objects as value to a dart map
|
||||
static Map<String, List<QueueDeleteDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<QueueDeleteDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = QueueDeleteDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
};
|
||||
}
|
||||
|
||||
@ -0,0 +1,132 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.18
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class QueueJobResponseDto {
|
||||
/// Returns a new [QueueJobResponseDto] instance.
|
||||
QueueJobResponseDto({
|
||||
required this.data,
|
||||
this.id,
|
||||
required this.name,
|
||||
required this.timestamp,
|
||||
});
|
||||
|
||||
Object data;
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
/// does not include a default value (using the "default:" property), however, the generated
|
||||
/// source code must fall back to having a nullable type.
|
||||
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||
///
|
||||
String? id;
|
||||
|
||||
JobName name;
|
||||
|
||||
int timestamp;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is QueueJobResponseDto &&
|
||||
other.data == data &&
|
||||
other.id == id &&
|
||||
other.name == name &&
|
||||
other.timestamp == timestamp;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(data.hashCode) +
|
||||
(id == null ? 0 : id!.hashCode) +
|
||||
(name.hashCode) +
|
||||
(timestamp.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'QueueJobResponseDto[data=$data, id=$id, name=$name, timestamp=$timestamp]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'data'] = this.data;
|
||||
if (this.id != null) {
|
||||
json[r'id'] = this.id;
|
||||
} else {
|
||||
// json[r'id'] = null;
|
||||
}
|
||||
json[r'name'] = this.name;
|
||||
json[r'timestamp'] = this.timestamp;
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [QueueJobResponseDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static QueueJobResponseDto? fromJson(dynamic value) {
|
||||
upgradeDto(value, "QueueJobResponseDto");
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return QueueJobResponseDto(
|
||||
data: mapValueOfType<Object>(json, r'data')!,
|
||||
id: mapValueOfType<String>(json, r'id'),
|
||||
name: JobName.fromJson(json[r'name'])!,
|
||||
timestamp: mapValueOfType<int>(json, r'timestamp')!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<QueueJobResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <QueueJobResponseDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = QueueJobResponseDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, QueueJobResponseDto> mapFromJson(dynamic json) {
|
||||
final map = <String, QueueJobResponseDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = QueueJobResponseDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of QueueJobResponseDto-objects as value to a dart map
|
||||
static Map<String, List<QueueJobResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<QueueJobResponseDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = QueueJobResponseDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'data',
|
||||
'name',
|
||||
'timestamp',
|
||||
};
|
||||
}
|
||||
|
||||
@ -0,0 +1,97 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.18
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
|
||||
class QueueJobStatus {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const QueueJobStatus._(this.value);
|
||||
|
||||
/// The underlying value of this enum member.
|
||||
final String value;
|
||||
|
||||
@override
|
||||
String toString() => value;
|
||||
|
||||
String toJson() => value;
|
||||
|
||||
static const active = QueueJobStatus._(r'active');
|
||||
static const failed = QueueJobStatus._(r'failed');
|
||||
static const completed = QueueJobStatus._(r'completed');
|
||||
static const delayed = QueueJobStatus._(r'delayed');
|
||||
static const waiting = QueueJobStatus._(r'waiting');
|
||||
static const paused = QueueJobStatus._(r'paused');
|
||||
|
||||
/// List of all possible values in this [enum][QueueJobStatus].
|
||||
static const values = <QueueJobStatus>[
|
||||
active,
|
||||
failed,
|
||||
completed,
|
||||
delayed,
|
||||
waiting,
|
||||
paused,
|
||||
];
|
||||
|
||||
static QueueJobStatus? fromJson(dynamic value) => QueueJobStatusTypeTransformer().decode(value);
|
||||
|
||||
static List<QueueJobStatus> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <QueueJobStatus>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = QueueJobStatus.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [QueueJobStatus] to String,
|
||||
/// and [decode] dynamic data back to [QueueJobStatus].
|
||||
class QueueJobStatusTypeTransformer {
|
||||
factory QueueJobStatusTypeTransformer() => _instance ??= const QueueJobStatusTypeTransformer._();
|
||||
|
||||
const QueueJobStatusTypeTransformer._();
|
||||
|
||||
String encode(QueueJobStatus data) => data.value;
|
||||
|
||||
/// Decodes a [dynamic value][data] to a QueueJobStatus.
|
||||
///
|
||||
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
|
||||
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
|
||||
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
|
||||
///
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
QueueJobStatus? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case r'active': return QueueJobStatus.active;
|
||||
case r'failed': return QueueJobStatus.failed;
|
||||
case r'completed': return QueueJobStatus.completed;
|
||||
case r'delayed': return QueueJobStatus.delayed;
|
||||
case r'waiting': return QueueJobStatus.waiting;
|
||||
case r'paused': return QueueJobStatus.paused;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Singleton [QueueJobStatusTypeTransformer] instance.
|
||||
static QueueJobStatusTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
@ -0,0 +1,107 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.18
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class QueueResponseLegacyDto {
|
||||
/// Returns a new [QueueResponseLegacyDto] instance.
|
||||
QueueResponseLegacyDto({
|
||||
required this.jobCounts,
|
||||
required this.queueStatus,
|
||||
});
|
||||
|
||||
QueueStatisticsDto jobCounts;
|
||||
|
||||
QueueStatusLegacyDto queueStatus;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is QueueResponseLegacyDto &&
|
||||
other.jobCounts == jobCounts &&
|
||||
other.queueStatus == queueStatus;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(jobCounts.hashCode) +
|
||||
(queueStatus.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'QueueResponseLegacyDto[jobCounts=$jobCounts, queueStatus=$queueStatus]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'jobCounts'] = this.jobCounts;
|
||||
json[r'queueStatus'] = this.queueStatus;
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [QueueResponseLegacyDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static QueueResponseLegacyDto? fromJson(dynamic value) {
|
||||
upgradeDto(value, "QueueResponseLegacyDto");
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return QueueResponseLegacyDto(
|
||||
jobCounts: QueueStatisticsDto.fromJson(json[r'jobCounts'])!,
|
||||
queueStatus: QueueStatusLegacyDto.fromJson(json[r'queueStatus'])!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<QueueResponseLegacyDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <QueueResponseLegacyDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = QueueResponseLegacyDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, QueueResponseLegacyDto> mapFromJson(dynamic json) {
|
||||
final map = <String, QueueResponseLegacyDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = QueueResponseLegacyDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of QueueResponseLegacyDto-objects as value to a dart map
|
||||
static Map<String, List<QueueResponseLegacyDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<QueueResponseLegacyDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = QueueResponseLegacyDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'jobCounts',
|
||||
'queueStatus',
|
||||
};
|
||||
}
|
||||
|
||||
@ -0,0 +1,108 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.18
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class QueueUpdateDto {
|
||||
/// Returns a new [QueueUpdateDto] instance.
|
||||
QueueUpdateDto({
|
||||
this.isPaused,
|
||||
});
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
/// does not include a default value (using the "default:" property), however, the generated
|
||||
/// source code must fall back to having a nullable type.
|
||||
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||
///
|
||||
bool? isPaused;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is QueueUpdateDto &&
|
||||
other.isPaused == isPaused;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(isPaused == null ? 0 : isPaused!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'QueueUpdateDto[isPaused=$isPaused]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (this.isPaused != null) {
|
||||
json[r'isPaused'] = this.isPaused;
|
||||
} else {
|
||||
// json[r'isPaused'] = null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [QueueUpdateDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static QueueUpdateDto? fromJson(dynamic value) {
|
||||
upgradeDto(value, "QueueUpdateDto");
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return QueueUpdateDto(
|
||||
isPaused: mapValueOfType<bool>(json, r'isPaused'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<QueueUpdateDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <QueueUpdateDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = QueueUpdateDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, QueueUpdateDto> mapFromJson(dynamic json) {
|
||||
final map = <String, QueueUpdateDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = QueueUpdateDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of QueueUpdateDto-objects as value to a dart map
|
||||
static Map<String, List<QueueUpdateDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<QueueUpdateDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = QueueUpdateDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
};
|
||||
}
|
||||
|
||||
@ -0,0 +1,85 @@
|
||||
import { Body, Controller, Delete, Get, HttpCode, HttpStatus, Param, Put, Query } from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { Endpoint, HistoryBuilder } from 'src/decorators';
|
||||
import { AuthDto } from 'src/dtos/auth.dto';
|
||||
import {
|
||||
QueueDeleteDto,
|
||||
QueueJobResponseDto,
|
||||
QueueJobSearchDto,
|
||||
QueueNameParamDto,
|
||||
QueueResponseDto,
|
||||
QueueUpdateDto,
|
||||
} from 'src/dtos/queue.dto';
|
||||
import { ApiTag, Permission } from 'src/enum';
|
||||
import { Auth, Authenticated } from 'src/middleware/auth.guard';
|
||||
import { QueueService } from 'src/services/queue.service';
|
||||
|
||||
@ApiTags(ApiTag.Queues)
|
||||
@Controller('queues')
|
||||
export class QueueController {
|
||||
constructor(private service: QueueService) {}
|
||||
|
||||
@Get()
|
||||
@Authenticated({ permission: Permission.QueueRead, admin: true })
|
||||
@Endpoint({
|
||||
summary: 'List all queues',
|
||||
description: 'Retrieves a list of queues.',
|
||||
history: new HistoryBuilder().added('v2.4.0').alpha('v2.4.0'),
|
||||
})
|
||||
getQueues(@Auth() auth: AuthDto): Promise<QueueResponseDto[]> {
|
||||
return this.service.getAll(auth);
|
||||
}
|
||||
|
||||
@Get(':name')
|
||||
@Authenticated({ permission: Permission.QueueRead, admin: true })
|
||||
@Endpoint({
|
||||
summary: 'Retrieve a queue',
|
||||
description: 'Retrieves a specific queue by its name.',
|
||||
history: new HistoryBuilder().added('v2.4.0').alpha('v2.4.0'),
|
||||
})
|
||||
getQueue(@Auth() auth: AuthDto, @Param() { name }: QueueNameParamDto): Promise<QueueResponseDto> {
|
||||
return this.service.get(auth, name);
|
||||
}
|
||||
|
||||
@Put(':name')
|
||||
@Authenticated({ permission: Permission.QueueUpdate, admin: true })
|
||||
@Endpoint({
|
||||
summary: 'Update a queue',
|
||||
description: 'Change the paused status of a specific queue.',
|
||||
history: new HistoryBuilder().added('v2.4.0').alpha('v2.4.0'),
|
||||
})
|
||||
updateQueue(
|
||||
@Auth() auth: AuthDto,
|
||||
@Param() { name }: QueueNameParamDto,
|
||||
@Body() dto: QueueUpdateDto,
|
||||
): Promise<QueueResponseDto> {
|
||||
return this.service.update(auth, name, dto);
|
||||
}
|
||||
|
||||
@Get(':name/jobs')
|
||||
@Authenticated({ permission: Permission.QueueJobRead, admin: true })
|
||||
@Endpoint({
|
||||
summary: 'Retrieve queue jobs',
|
||||
description: 'Retrieves a list of queue jobs from the specified queue.',
|
||||
history: new HistoryBuilder().added('v2.4.0').alpha('v2.4.0'),
|
||||
})
|
||||
getQueueJobs(
|
||||
@Auth() auth: AuthDto,
|
||||
@Param() { name }: QueueNameParamDto,
|
||||
@Query() dto: QueueJobSearchDto,
|
||||
): Promise<QueueJobResponseDto[]> {
|
||||
return this.service.searchJobs(auth, name, dto);
|
||||
}
|
||||
|
||||
@Delete(':name/jobs')
|
||||
@Authenticated({ permission: Permission.QueueJobDelete, admin: true })
|
||||
@HttpCode(HttpStatus.NO_CONTENT)
|
||||
@Endpoint({
|
||||
summary: 'Empty a queue',
|
||||
description: 'Removes all jobs from the specified queue.',
|
||||
history: new HistoryBuilder().added('v2.4.0').alpha('v2.4.0'),
|
||||
})
|
||||
emptyQueue(@Auth() auth: AuthDto, @Param() { name }: QueueNameParamDto, @Body() dto: QueueDeleteDto): Promise<void> {
|
||||
return this.service.emptyQueue(auth, name, dto);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { QueueResponseDto, QueueStatisticsDto } from 'src/dtos/queue.dto';
|
||||
import { QueueName } from 'src/enum';
|
||||
|
||||
export class QueueStatusLegacyDto {
|
||||
isActive!: boolean;
|
||||
isPaused!: boolean;
|
||||
}
|
||||
|
||||
export class QueueResponseLegacyDto {
|
||||
@ApiProperty({ type: QueueStatusLegacyDto })
|
||||
queueStatus!: QueueStatusLegacyDto;
|
||||
|
||||
@ApiProperty({ type: QueueStatisticsDto })
|
||||
jobCounts!: QueueStatisticsDto;
|
||||
}
|
||||
|
||||
export class QueuesResponseLegacyDto implements Record<QueueName, QueueResponseLegacyDto> {
|
||||
@ApiProperty({ type: QueueResponseLegacyDto })
|
||||
[QueueName.ThumbnailGeneration]!: QueueResponseLegacyDto;
|
||||
|
||||
@ApiProperty({ type: QueueResponseLegacyDto })
|
||||
[QueueName.MetadataExtraction]!: QueueResponseLegacyDto;
|
||||
|
||||
@ApiProperty({ type: QueueResponseLegacyDto })
|
||||
[QueueName.VideoConversion]!: QueueResponseLegacyDto;
|
||||
|
||||
@ApiProperty({ type: QueueResponseLegacyDto })
|
||||
[QueueName.SmartSearch]!: QueueResponseLegacyDto;
|
||||
|
||||
@ApiProperty({ type: QueueResponseLegacyDto })
|
||||
[QueueName.StorageTemplateMigration]!: QueueResponseLegacyDto;
|
||||
|
||||
@ApiProperty({ type: QueueResponseLegacyDto })
|
||||
[QueueName.Migration]!: QueueResponseLegacyDto;
|
||||
|
||||
@ApiProperty({ type: QueueResponseLegacyDto })
|
||||
[QueueName.BackgroundTask]!: QueueResponseLegacyDto;
|
||||
|
||||
@ApiProperty({ type: QueueResponseLegacyDto })
|
||||
[QueueName.Search]!: QueueResponseLegacyDto;
|
||||
|
||||
@ApiProperty({ type: QueueResponseLegacyDto })
|
||||
[QueueName.DuplicateDetection]!: QueueResponseLegacyDto;
|
||||
|
||||
@ApiProperty({ type: QueueResponseLegacyDto })
|
||||
[QueueName.FaceDetection]!: QueueResponseLegacyDto;
|
||||
|
||||
@ApiProperty({ type: QueueResponseLegacyDto })
|
||||
[QueueName.FacialRecognition]!: QueueResponseLegacyDto;
|
||||
|
||||
@ApiProperty({ type: QueueResponseLegacyDto })
|
||||
[QueueName.Sidecar]!: QueueResponseLegacyDto;
|
||||
|
||||
@ApiProperty({ type: QueueResponseLegacyDto })
|
||||
[QueueName.Library]!: QueueResponseLegacyDto;
|
||||
|
||||
@ApiProperty({ type: QueueResponseLegacyDto })
|
||||
[QueueName.Notification]!: QueueResponseLegacyDto;
|
||||
|
||||
@ApiProperty({ type: QueueResponseLegacyDto })
|
||||
[QueueName.BackupDatabase]!: QueueResponseLegacyDto;
|
||||
|
||||
@ApiProperty({ type: QueueResponseLegacyDto })
|
||||
[QueueName.Ocr]!: QueueResponseLegacyDto;
|
||||
|
||||
@ApiProperty({ type: QueueResponseLegacyDto })
|
||||
[QueueName.Workflow]!: QueueResponseLegacyDto;
|
||||
}
|
||||
|
||||
export const mapQueueLegacy = (response: QueueResponseDto): QueueResponseLegacyDto => {
|
||||
return {
|
||||
queueStatus: {
|
||||
isPaused: response.isPaused,
|
||||
isActive: response.statistics.active > 0,
|
||||
},
|
||||
jobCounts: response.statistics,
|
||||
};
|
||||
};
|
||||
|
||||
export const mapQueuesLegacy = (responses: QueueResponseDto[]): QueuesResponseLegacyDto => {
|
||||
const legacy = new QueuesResponseLegacyDto();
|
||||
|
||||
for (const response of responses) {
|
||||
legacy[response.name] = mapQueueLegacy(response);
|
||||
}
|
||||
|
||||
return legacy;
|
||||
};
|
||||
Loading…
Reference in New Issue