1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-10 23:22:22 +02:00

refactor(server): jobs (#2023)

* refactor: job to domain

* chore: regenerate open api

* chore: tests

* fix: missing breaks

* fix: get asset with missing exif data

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Jason Rasmussen
2023-03-20 11:55:28 -04:00
committed by GitHub
parent db6b14361d
commit 386eef046d
68 changed files with 1355 additions and 907 deletions

View File

@@ -51,8 +51,8 @@ doc/GetAssetCountByTimeBucketDto.md
doc/JobApi.md
doc/JobCommand.md
doc/JobCommandDto.md
doc/JobCounts.md
doc/JobId.md
doc/JobCountsDto.md
doc/JobName.md
doc/LoginCredentialDto.md
doc/LoginResponseDto.md
doc/LogoutResponseDto.md
@@ -168,8 +168,8 @@ lib/model/get_asset_by_time_bucket_dto.dart
lib/model/get_asset_count_by_time_bucket_dto.dart
lib/model/job_command.dart
lib/model/job_command_dto.dart
lib/model/job_counts.dart
lib/model/job_id.dart
lib/model/job_counts_dto.dart
lib/model/job_name.dart
lib/model/login_credential_dto.dart
lib/model/login_response_dto.dart
lib/model/logout_response_dto.dart
@@ -262,8 +262,8 @@ test/get_asset_count_by_time_bucket_dto_test.dart
test/job_api_test.dart
test/job_command_dto_test.dart
test/job_command_test.dart
test/job_counts_test.dart
test/job_id_test.dart
test/job_counts_dto_test.dart
test/job_name_test.dart
test/login_credential_dto_test.dart
test/login_response_dto_test.dart
test/logout_response_dto_test.dart

View File

@@ -198,8 +198,8 @@ Class | Method | HTTP request | Description
- [GetAssetCountByTimeBucketDto](doc//GetAssetCountByTimeBucketDto.md)
- [JobCommand](doc//JobCommand.md)
- [JobCommandDto](doc//JobCommandDto.md)
- [JobCounts](doc//JobCounts.md)
- [JobId](doc//JobId.md)
- [JobCountsDto](doc//JobCountsDto.md)
- [JobName](doc//JobName.md)
- [LoginCredentialDto](doc//LoginCredentialDto.md)
- [LoginResponseDto](doc//LoginResponseDto.md)
- [LogoutResponseDto](doc//LogoutResponseDto.md)

View File

@@ -8,11 +8,14 @@ import 'package:openapi/api.dart';
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**thumbnailGeneration** | [**JobCounts**](JobCounts.md) | |
**metadataExtraction** | [**JobCounts**](JobCounts.md) | |
**videoConversion** | [**JobCounts**](JobCounts.md) | |
**machineLearning** | [**JobCounts**](JobCounts.md) | |
**storageTemplateMigration** | [**JobCounts**](JobCounts.md) | |
**thumbnailGenerationQueue** | [**JobCountsDto**](JobCountsDto.md) | |
**metadataExtractionQueue** | [**JobCountsDto**](JobCountsDto.md) | |
**videoConversionQueue** | [**JobCountsDto**](JobCountsDto.md) | |
**objectTaggingQueue** | [**JobCountsDto**](JobCountsDto.md) | |
**clipEncodingQueue** | [**JobCountsDto**](JobCountsDto.md) | |
**storageTemplateMigrationQueue** | [**JobCountsDto**](JobCountsDto.md) | |
**backgroundTaskQueue** | [**JobCountsDto**](JobCountsDto.md) | |
**searchQueue** | [**JobCountsDto**](JobCountsDto.md) | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -63,7 +63,7 @@ This endpoint does not need any parameter.
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **sendJobCommand**
> num sendJobCommand(jobId, jobCommandDto)
> sendJobCommand(jobId, jobCommandDto)
@@ -84,12 +84,11 @@ import 'package:openapi/api.dart';
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
final api_instance = JobApi();
final jobId = ; // JobId |
final jobId = ; // JobName |
final jobCommandDto = JobCommandDto(); // JobCommandDto |
try {
final result = api_instance.sendJobCommand(jobId, jobCommandDto);
print(result);
api_instance.sendJobCommand(jobId, jobCommandDto);
} catch (e) {
print('Exception when calling JobApi->sendJobCommand: $e\n');
}
@@ -99,12 +98,12 @@ try {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**jobId** | [**JobId**](.md)| |
**jobId** | [**JobName**](.md)| |
**jobCommandDto** | [**JobCommandDto**](JobCommandDto.md)| |
### Return type
**num**
void (empty response body)
### Authorization
@@ -113,7 +112,7 @@ Name | Type | Description | Notes
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@@ -9,7 +9,7 @@ import 'package:openapi/api.dart';
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**command** | [**JobCommand**](JobCommand.md) | |
**includeAllAssets** | **bool** | |
**force** | **bool** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -1,4 +1,4 @@
# openapi.model.JobCounts
# openapi.model.JobCountsDto
## Load the model package
```dart

View File

@@ -1,4 +1,4 @@
# openapi.model.JobId
# openapi.model.JobName
## Load the model package
```dart

View File

@@ -84,8 +84,8 @@ part 'model/get_asset_by_time_bucket_dto.dart';
part 'model/get_asset_count_by_time_bucket_dto.dart';
part 'model/job_command.dart';
part 'model/job_command_dto.dart';
part 'model/job_counts.dart';
part 'model/job_id.dart';
part 'model/job_counts_dto.dart';
part 'model/job_name.dart';
part 'model/login_credential_dto.dart';
part 'model/login_response_dto.dart';
part 'model/logout_response_dto.dart';

View File

@@ -66,10 +66,10 @@ class JobApi {
///
/// Parameters:
///
/// * [JobId] jobId (required):
/// * [JobName] jobId (required):
///
/// * [JobCommandDto] jobCommandDto (required):
Future<Response> sendJobCommandWithHttpInfo(JobId jobId, JobCommandDto jobCommandDto,) async {
Future<Response> sendJobCommandWithHttpInfo(JobName jobId, JobCommandDto jobCommandDto,) async {
// ignore: prefer_const_declarations
final path = r'/jobs/{jobId}'
.replaceAll('{jobId}', jobId.toString());
@@ -99,21 +99,13 @@ class JobApi {
///
/// Parameters:
///
/// * [JobId] jobId (required):
/// * [JobName] jobId (required):
///
/// * [JobCommandDto] jobCommandDto (required):
Future<num?> sendJobCommand(JobId jobId, JobCommandDto jobCommandDto,) async {
Future<void> sendJobCommand(JobName jobId, JobCommandDto jobCommandDto,) async {
final response = await sendJobCommandWithHttpInfo(jobId, jobCommandDto,);
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), 'num',) as num;
}
return null;
}
}

View File

@@ -276,10 +276,10 @@ class ApiClient {
return JobCommandTypeTransformer().decode(value);
case 'JobCommandDto':
return JobCommandDto.fromJson(value);
case 'JobCounts':
return JobCounts.fromJson(value);
case 'JobId':
return JobIdTypeTransformer().decode(value);
case 'JobCountsDto':
return JobCountsDto.fromJson(value);
case 'JobName':
return JobNameTypeTransformer().decode(value);
case 'LoginCredentialDto':
return LoginCredentialDto.fromJson(value);
case 'LoginResponseDto':

View File

@@ -67,8 +67,8 @@ String parameterToString(dynamic value) {
if (value is JobCommand) {
return JobCommandTypeTransformer().encode(value).toString();
}
if (value is JobId) {
return JobIdTypeTransformer().encode(value).toString();
if (value is JobName) {
return JobNameTypeTransformer().encode(value).toString();
}
if (value is SharedLinkType) {
return SharedLinkTypeTypeTransformer().encode(value).toString();

View File

@@ -13,50 +13,68 @@ part of openapi.api;
class AllJobStatusResponseDto {
/// Returns a new [AllJobStatusResponseDto] instance.
AllJobStatusResponseDto({
required this.thumbnailGeneration,
required this.metadataExtraction,
required this.videoConversion,
required this.machineLearning,
required this.storageTemplateMigration,
required this.thumbnailGenerationQueue,
required this.metadataExtractionQueue,
required this.videoConversionQueue,
required this.objectTaggingQueue,
required this.clipEncodingQueue,
required this.storageTemplateMigrationQueue,
required this.backgroundTaskQueue,
required this.searchQueue,
});
JobCounts thumbnailGeneration;
JobCountsDto thumbnailGenerationQueue;
JobCounts metadataExtraction;
JobCountsDto metadataExtractionQueue;
JobCounts videoConversion;
JobCountsDto videoConversionQueue;
JobCounts machineLearning;
JobCountsDto objectTaggingQueue;
JobCounts storageTemplateMigration;
JobCountsDto clipEncodingQueue;
JobCountsDto storageTemplateMigrationQueue;
JobCountsDto backgroundTaskQueue;
JobCountsDto searchQueue;
@override
bool operator ==(Object other) => identical(this, other) || other is AllJobStatusResponseDto &&
other.thumbnailGeneration == thumbnailGeneration &&
other.metadataExtraction == metadataExtraction &&
other.videoConversion == videoConversion &&
other.machineLearning == machineLearning &&
other.storageTemplateMigration == storageTemplateMigration;
other.thumbnailGenerationQueue == thumbnailGenerationQueue &&
other.metadataExtractionQueue == metadataExtractionQueue &&
other.videoConversionQueue == videoConversionQueue &&
other.objectTaggingQueue == objectTaggingQueue &&
other.clipEncodingQueue == clipEncodingQueue &&
other.storageTemplateMigrationQueue == storageTemplateMigrationQueue &&
other.backgroundTaskQueue == backgroundTaskQueue &&
other.searchQueue == searchQueue;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(thumbnailGeneration.hashCode) +
(metadataExtraction.hashCode) +
(videoConversion.hashCode) +
(machineLearning.hashCode) +
(storageTemplateMigration.hashCode);
(thumbnailGenerationQueue.hashCode) +
(metadataExtractionQueue.hashCode) +
(videoConversionQueue.hashCode) +
(objectTaggingQueue.hashCode) +
(clipEncodingQueue.hashCode) +
(storageTemplateMigrationQueue.hashCode) +
(backgroundTaskQueue.hashCode) +
(searchQueue.hashCode);
@override
String toString() => 'AllJobStatusResponseDto[thumbnailGeneration=$thumbnailGeneration, metadataExtraction=$metadataExtraction, videoConversion=$videoConversion, machineLearning=$machineLearning, storageTemplateMigration=$storageTemplateMigration]';
String toString() => 'AllJobStatusResponseDto[thumbnailGenerationQueue=$thumbnailGenerationQueue, metadataExtractionQueue=$metadataExtractionQueue, videoConversionQueue=$videoConversionQueue, objectTaggingQueue=$objectTaggingQueue, clipEncodingQueue=$clipEncodingQueue, storageTemplateMigrationQueue=$storageTemplateMigrationQueue, backgroundTaskQueue=$backgroundTaskQueue, searchQueue=$searchQueue]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'thumbnail-generation'] = this.thumbnailGeneration;
json[r'metadata-extraction'] = this.metadataExtraction;
json[r'video-conversion'] = this.videoConversion;
json[r'machine-learning'] = this.machineLearning;
json[r'storage-template-migration'] = this.storageTemplateMigration;
json[r'thumbnail-generation-queue'] = this.thumbnailGenerationQueue;
json[r'metadata-extraction-queue'] = this.metadataExtractionQueue;
json[r'video-conversion-queue'] = this.videoConversionQueue;
json[r'object-tagging-queue'] = this.objectTaggingQueue;
json[r'clip-encoding-queue'] = this.clipEncodingQueue;
json[r'storage-template-migration-queue'] = this.storageTemplateMigrationQueue;
json[r'background-task-queue'] = this.backgroundTaskQueue;
json[r'search-queue'] = this.searchQueue;
return json;
}
@@ -79,11 +97,14 @@ class AllJobStatusResponseDto {
}());
return AllJobStatusResponseDto(
thumbnailGeneration: JobCounts.fromJson(json[r'thumbnail-generation'])!,
metadataExtraction: JobCounts.fromJson(json[r'metadata-extraction'])!,
videoConversion: JobCounts.fromJson(json[r'video-conversion'])!,
machineLearning: JobCounts.fromJson(json[r'machine-learning'])!,
storageTemplateMigration: JobCounts.fromJson(json[r'storage-template-migration'])!,
thumbnailGenerationQueue: JobCountsDto.fromJson(json[r'thumbnail-generation-queue'])!,
metadataExtractionQueue: JobCountsDto.fromJson(json[r'metadata-extraction-queue'])!,
videoConversionQueue: JobCountsDto.fromJson(json[r'video-conversion-queue'])!,
objectTaggingQueue: JobCountsDto.fromJson(json[r'object-tagging-queue'])!,
clipEncodingQueue: JobCountsDto.fromJson(json[r'clip-encoding-queue'])!,
storageTemplateMigrationQueue: JobCountsDto.fromJson(json[r'storage-template-migration-queue'])!,
backgroundTaskQueue: JobCountsDto.fromJson(json[r'background-task-queue'])!,
searchQueue: JobCountsDto.fromJson(json[r'search-queue'])!,
);
}
return null;
@@ -133,11 +154,14 @@ class AllJobStatusResponseDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'thumbnail-generation',
'metadata-extraction',
'video-conversion',
'machine-learning',
'storage-template-migration',
'thumbnail-generation-queue',
'metadata-extraction-queue',
'video-conversion-queue',
'object-tagging-queue',
'clip-encoding-queue',
'storage-template-migration-queue',
'background-task-queue',
'search-queue',
};
}

View File

@@ -24,12 +24,14 @@ class JobCommand {
String toJson() => value;
static const start = JobCommand._(r'start');
static const stop = JobCommand._(r'stop');
static const pause = JobCommand._(r'pause');
static const empty = JobCommand._(r'empty');
/// List of all possible values in this [enum][JobCommand].
static const values = <JobCommand>[
start,
stop,
pause,
empty,
];
static JobCommand? fromJson(dynamic value) => JobCommandTypeTransformer().decode(value);
@@ -69,7 +71,8 @@ class JobCommandTypeTransformer {
if (data != null) {
switch (data.toString()) {
case r'start': return JobCommand.start;
case r'stop': return JobCommand.stop;
case r'pause': return JobCommand.pause;
case r'empty': return JobCommand.empty;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');

View File

@@ -14,31 +14,31 @@ class JobCommandDto {
/// Returns a new [JobCommandDto] instance.
JobCommandDto({
required this.command,
required this.includeAllAssets,
required this.force,
});
JobCommand command;
bool includeAllAssets;
bool force;
@override
bool operator ==(Object other) => identical(this, other) || other is JobCommandDto &&
other.command == command &&
other.includeAllAssets == includeAllAssets;
other.force == force;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(command.hashCode) +
(includeAllAssets.hashCode);
(force.hashCode);
@override
String toString() => 'JobCommandDto[command=$command, includeAllAssets=$includeAllAssets]';
String toString() => 'JobCommandDto[command=$command, force=$force]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'command'] = this.command;
json[r'includeAllAssets'] = this.includeAllAssets;
json[r'force'] = this.force;
return json;
}
@@ -62,7 +62,7 @@ class JobCommandDto {
return JobCommandDto(
command: JobCommand.fromJson(json[r'command'])!,
includeAllAssets: mapValueOfType<bool>(json, r'includeAllAssets')!,
force: mapValueOfType<bool>(json, r'force')!,
);
}
return null;
@@ -113,7 +113,7 @@ class JobCommandDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'command',
'includeAllAssets',
'force',
};
}

View File

@@ -10,9 +10,9 @@
part of openapi.api;
class JobCounts {
/// Returns a new [JobCounts] instance.
JobCounts({
class JobCountsDto {
/// Returns a new [JobCountsDto] instance.
JobCountsDto({
required this.active,
required this.completed,
required this.failed,
@@ -31,7 +31,7 @@ class JobCounts {
int waiting;
@override
bool operator ==(Object other) => identical(this, other) || other is JobCounts &&
bool operator ==(Object other) => identical(this, other) || other is JobCountsDto &&
other.active == active &&
other.completed == completed &&
other.failed == failed &&
@@ -48,7 +48,7 @@ class JobCounts {
(waiting.hashCode);
@override
String toString() => 'JobCounts[active=$active, completed=$completed, failed=$failed, delayed=$delayed, waiting=$waiting]';
String toString() => 'JobCountsDto[active=$active, completed=$completed, failed=$failed, delayed=$delayed, waiting=$waiting]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@@ -60,10 +60,10 @@ class JobCounts {
return json;
}
/// Returns a new [JobCounts] instance and imports its values from
/// Returns a new [JobCountsDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static JobCounts? fromJson(dynamic value) {
static JobCountsDto? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
@@ -72,13 +72,13 @@ class JobCounts {
// Note 2: this code is stripped in release mode!
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "JobCounts[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "JobCounts[$key]" has a null value in JSON.');
assert(json.containsKey(key), 'Required key "JobCountsDto[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "JobCountsDto[$key]" has a null value in JSON.');
});
return true;
}());
return JobCounts(
return JobCountsDto(
active: mapValueOfType<int>(json, r'active')!,
completed: mapValueOfType<int>(json, r'completed')!,
failed: mapValueOfType<int>(json, r'failed')!,
@@ -89,11 +89,11 @@ class JobCounts {
return null;
}
static List<JobCounts>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <JobCounts>[];
static List<JobCountsDto>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <JobCountsDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = JobCounts.fromJson(row);
final value = JobCountsDto.fromJson(row);
if (value != null) {
result.add(value);
}
@@ -102,12 +102,12 @@ class JobCounts {
return result.toList(growable: growable);
}
static Map<String, JobCounts> mapFromJson(dynamic json) {
final map = <String, JobCounts>{};
static Map<String, JobCountsDto> mapFromJson(dynamic json) {
final map = <String, JobCountsDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = JobCounts.fromJson(entry.value);
final value = JobCountsDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
@@ -116,13 +116,13 @@ class JobCounts {
return map;
}
// maps a json object with a list of JobCounts-objects as value to a dart map
static Map<String, List<JobCounts>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<JobCounts>>{};
// maps a json object with a list of JobCountsDto-objects as value to a dart map
static Map<String, List<JobCountsDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<JobCountsDto>>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = JobCounts.listFromJson(entry.value, growable: growable,);
final value = JobCountsDto.listFromJson(entry.value, growable: growable,);
if (value != null) {
map[entry.key] = value;
}

View File

@@ -1,94 +0,0 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.12
// 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 JobId {
/// Instantiate a new enum with the provided [value].
const JobId._(this.value);
/// The underlying value of this enum member.
final String value;
@override
String toString() => value;
String toJson() => value;
static const thumbnailGeneration = JobId._(r'thumbnail-generation');
static const metadataExtraction = JobId._(r'metadata-extraction');
static const videoConversion = JobId._(r'video-conversion');
static const machineLearning = JobId._(r'machine-learning');
static const storageTemplateMigration = JobId._(r'storage-template-migration');
/// List of all possible values in this [enum][JobId].
static const values = <JobId>[
thumbnailGeneration,
metadataExtraction,
videoConversion,
machineLearning,
storageTemplateMigration,
];
static JobId? fromJson(dynamic value) => JobIdTypeTransformer().decode(value);
static List<JobId>? listFromJson(dynamic json, {bool growable = false,}) {
final result = <JobId>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = JobId.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
}
/// Transformation class that can [encode] an instance of [JobId] to String,
/// and [decode] dynamic data back to [JobId].
class JobIdTypeTransformer {
factory JobIdTypeTransformer() => _instance ??= const JobIdTypeTransformer._();
const JobIdTypeTransformer._();
String encode(JobId data) => data.value;
/// Decodes a [dynamic value][data] to a JobId.
///
/// 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.
JobId? decode(dynamic data, {bool allowNull = true}) {
if (data != null) {
switch (data.toString()) {
case r'thumbnail-generation': return JobId.thumbnailGeneration;
case r'metadata-extraction': return JobId.metadataExtraction;
case r'video-conversion': return JobId.videoConversion;
case r'machine-learning': return JobId.machineLearning;
case r'storage-template-migration': return JobId.storageTemplateMigration;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');
}
}
}
return null;
}
/// Singleton [JobIdTypeTransformer] instance.
static JobIdTypeTransformer? _instance;
}

103
mobile/openapi/lib/model/job_name.dart generated Normal file
View File

@@ -0,0 +1,103 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.12
// 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 thumbnailGenerationQueue = JobName._(r'thumbnail-generation-queue');
static const metadataExtractionQueue = JobName._(r'metadata-extraction-queue');
static const videoConversionQueue = JobName._(r'video-conversion-queue');
static const objectTaggingQueue = JobName._(r'object-tagging-queue');
static const clipEncodingQueue = JobName._(r'clip-encoding-queue');
static const backgroundTaskQueue = JobName._(r'background-task-queue');
static const storageTemplateMigrationQueue = JobName._(r'storage-template-migration-queue');
static const searchQueue = JobName._(r'search-queue');
/// List of all possible values in this [enum][JobName].
static const values = <JobName>[
thumbnailGenerationQueue,
metadataExtractionQueue,
videoConversionQueue,
objectTaggingQueue,
clipEncodingQueue,
backgroundTaskQueue,
storageTemplateMigrationQueue,
searchQueue,
];
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.toString()) {
case r'thumbnail-generation-queue': return JobName.thumbnailGenerationQueue;
case r'metadata-extraction-queue': return JobName.metadataExtractionQueue;
case r'video-conversion-queue': return JobName.videoConversionQueue;
case r'object-tagging-queue': return JobName.objectTaggingQueue;
case r'clip-encoding-queue': return JobName.clipEncodingQueue;
case r'background-task-queue': return JobName.backgroundTaskQueue;
case r'storage-template-migration-queue': return JobName.storageTemplateMigrationQueue;
case r'search-queue': return JobName.searchQueue;
default:
if (!allowNull) {
throw ArgumentError('Unknown enum value to decode: $data');
}
}
}
return null;
}
/// Singleton [JobNameTypeTransformer] instance.
static JobNameTypeTransformer? _instance;
}

View File

@@ -16,28 +16,43 @@ void main() {
// final instance = AllJobStatusResponseDto();
group('test AllJobStatusResponseDto', () {
// JobCounts thumbnailGeneration
test('to test the property `thumbnailGeneration`', () async {
// JobCountsDto thumbnailGenerationQueue
test('to test the property `thumbnailGenerationQueue`', () async {
// TODO
});
// JobCounts metadataExtraction
test('to test the property `metadataExtraction`', () async {
// JobCountsDto metadataExtractionQueue
test('to test the property `metadataExtractionQueue`', () async {
// TODO
});
// JobCounts videoConversion
test('to test the property `videoConversion`', () async {
// JobCountsDto videoConversionQueue
test('to test the property `videoConversionQueue`', () async {
// TODO
});
// JobCounts machineLearning
test('to test the property `machineLearning`', () async {
// JobCountsDto objectTaggingQueue
test('to test the property `objectTaggingQueue`', () async {
// TODO
});
// JobCounts storageTemplateMigration
test('to test the property `storageTemplateMigration`', () async {
// JobCountsDto clipEncodingQueue
test('to test the property `clipEncodingQueue`', () async {
// TODO
});
// JobCountsDto storageTemplateMigrationQueue
test('to test the property `storageTemplateMigrationQueue`', () async {
// TODO
});
// JobCountsDto backgroundTaskQueue
test('to test the property `backgroundTaskQueue`', () async {
// TODO
});
// JobCountsDto searchQueue
test('to test the property `searchQueue`', () async {
// TODO
});

View File

@@ -26,7 +26,7 @@ void main() {
//
//
//Future<num> sendJobCommand(JobId jobId, JobCommandDto jobCommandDto) async
//Future sendJobCommand(JobName jobId, JobCommandDto jobCommandDto) async
test('test sendJobCommand', () async {
// TODO
});

View File

@@ -21,8 +21,8 @@ void main() {
// TODO
});
// bool includeAllAssets
test('to test the property `includeAllAssets`', () async {
// bool force
test('to test the property `force`', () async {
// TODO
});

View File

@@ -11,11 +11,11 @@
import 'package:openapi/api.dart';
import 'package:test/test.dart';
// tests for JobCounts
// tests for JobCountsDto
void main() {
// final instance = JobCounts();
// final instance = JobCountsDto();
group('test JobCounts', () {
group('test JobCountsDto', () {
// int active
test('to test the property `active`', () async {
// TODO

View File

@@ -11,10 +11,10 @@
import 'package:openapi/api.dart';
import 'package:test/test.dart';
// tests for JobId
// tests for JobName
void main() {
group('test JobId', () {
group('test JobName', () {
});