feat: create job with data dto

This commit is contained in:
izzy
2026-01-12 12:32:55 +00:00
parent d4ad523eb3
commit b49ee6d90d
11 changed files with 323 additions and 3 deletions
+2
View File
@@ -210,6 +210,7 @@ Class | Method | HTTP request | Description
*QueuesApi* | [**getQueue**](doc//QueuesApi.md#getqueue) | **GET** /queues/{name} | Retrieve a queue
*QueuesApi* | [**getQueueJobs**](doc//QueuesApi.md#getqueuejobs) | **GET** /queues/{name}/jobs | Retrieve queue jobs
*QueuesApi* | [**getQueues**](doc//QueuesApi.md#getqueues) | **GET** /queues | List all queues
*QueuesApi* | [**queueJob**](doc//QueuesApi.md#queuejob) | **POST** /queues/job | Create a manual job
*QueuesApi* | [**updateQueue**](doc//QueuesApi.md#updatequeue) | **PUT** /queues/{name} | Update a queue
*SearchApi* | [**getAssetsByCity**](doc//SearchApi.md#getassetsbycity) | **GET** /search/cities | Retrieve assets by city
*SearchApi* | [**getExploreData**](doc//SearchApi.md#getexploredata) | **GET** /search/explore | Retrieve explore data
@@ -495,6 +496,7 @@ Class | Method | HTTP request | Description
- [QueueCommand](doc//QueueCommand.md)
- [QueueCommandDto](doc//QueueCommandDto.md)
- [QueueDeleteDto](doc//QueueDeleteDto.md)
- [QueueJobCreateDto](doc//QueueJobCreateDto.md)
- [QueueJobResponseDto](doc//QueueJobResponseDto.md)
- [QueueJobStatus](doc//QueueJobStatus.md)
- [QueueName](doc//QueueName.md)
+1
View File
@@ -241,6 +241,7 @@ part 'model/purchase_update.dart';
part 'model/queue_command.dart';
part 'model/queue_command_dto.dart';
part 'model/queue_delete_dto.dart';
part 'model/queue_job_create_dto.dart';
part 'model/queue_job_response_dto.dart';
part 'model/queue_job_status.dart';
part 'model/queue_name.dart';
+48
View File
@@ -245,6 +245,54 @@ class QueuesApi {
return null;
}
/// Create a manual job
///
/// Run a specific job. Most jobs are queued automatically, but this endpoint allows for manual creation of a handful of jobs, including various cleanup tasks, as well as creating a new database backup.
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [QueueJobCreateDto] queueJobCreateDto (required):
Future<Response> queueJobWithHttpInfo(QueueJobCreateDto queueJobCreateDto,) async {
// ignore: prefer_const_declarations
final apiPath = r'/queues/job';
// ignore: prefer_final_locals
Object? postBody = queueJobCreateDto;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
apiPath,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Create a manual job
///
/// Run a specific job. Most jobs are queued automatically, but this endpoint allows for manual creation of a handful of jobs, including various cleanup tasks, as well as creating a new database backup.
///
/// Parameters:
///
/// * [QueueJobCreateDto] queueJobCreateDto (required):
Future<void> queueJob(QueueJobCreateDto queueJobCreateDto,) async {
final response = await queueJobWithHttpInfo(queueJobCreateDto,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
/// Update a queue
///
/// Change the paused status of a specific queue.
+2
View File
@@ -530,6 +530,8 @@ class ApiClient {
return QueueCommandDto.fromJson(value);
case 'QueueDeleteDto':
return QueueDeleteDto.fromJson(value);
case 'QueueJobCreateDto':
return QueueJobCreateDto.fromJson(value);
case 'QueueJobResponseDto':
return QueueJobResponseDto.fromJson(value);
case 'QueueJobStatus':
+99
View File
@@ -0,0 +1,99 @@
//
// 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 QueueJobCreateDto {
/// Returns a new [QueueJobCreateDto] instance.
QueueJobCreateDto({
required this.job,
});
Object job;
@override
bool operator ==(Object other) => identical(this, other) || other is QueueJobCreateDto &&
other.job == job;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(job.hashCode);
@override
String toString() => 'QueueJobCreateDto[job=$job]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'job'] = this.job;
return json;
}
/// Returns a new [QueueJobCreateDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static QueueJobCreateDto? fromJson(dynamic value) {
upgradeDto(value, "QueueJobCreateDto");
if (value is Map) {
final json = value.cast<String, dynamic>();
return QueueJobCreateDto(
job: mapValueOfType<Object>(json, r'job')!,
);
}
return null;
}
static List<QueueJobCreateDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <QueueJobCreateDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = QueueJobCreateDto.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, QueueJobCreateDto> mapFromJson(dynamic json) {
final map = <String, QueueJobCreateDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = QueueJobCreateDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of QueueJobCreateDto-objects as value to a dart map
static Map<String, List<QueueJobCreateDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<QueueJobCreateDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = QueueJobCreateDto.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'job',
};
}