job_api.dart 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. //
  2. // AUTO-GENERATED FILE, DO NOT MODIFY!
  3. //
  4. // @dart=2.12
  5. // ignore_for_file: unused_element, unused_import
  6. // ignore_for_file: always_put_required_named_parameters_first
  7. // ignore_for_file: constant_identifier_names
  8. // ignore_for_file: lines_longer_than_80_chars
  9. part of openapi.api;
  10. class JobApi {
  11. JobApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
  12. final ApiClient apiClient;
  13. /// Performs an HTTP 'GET /jobs' operation and returns the [Response].
  14. Future<Response> getAllJobsStatusWithHttpInfo() async {
  15. // ignore: prefer_const_declarations
  16. final path = r'/jobs';
  17. // ignore: prefer_final_locals
  18. Object? postBody;
  19. final queryParams = <QueryParam>[];
  20. final headerParams = <String, String>{};
  21. final formParams = <String, String>{};
  22. const contentTypes = <String>[];
  23. return apiClient.invokeAPI(
  24. path,
  25. 'GET',
  26. queryParams,
  27. postBody,
  28. headerParams,
  29. formParams,
  30. contentTypes.isEmpty ? null : contentTypes.first,
  31. );
  32. }
  33. Future<AllJobStatusResponseDto?> getAllJobsStatus() async {
  34. final response = await getAllJobsStatusWithHttpInfo();
  35. if (response.statusCode >= HttpStatus.badRequest) {
  36. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  37. }
  38. // When a remote server returns no body with a status of 204, we shall not decode it.
  39. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  40. // FormatException when trying to decode an empty string.
  41. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  42. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AllJobStatusResponseDto',) as AllJobStatusResponseDto;
  43. }
  44. return null;
  45. }
  46. /// Performs an HTTP 'PUT /jobs/{jobId}' operation and returns the [Response].
  47. /// Parameters:
  48. ///
  49. /// * [JobName] jobId (required):
  50. ///
  51. /// * [JobCommandDto] jobCommandDto (required):
  52. Future<Response> sendJobCommandWithHttpInfo(JobName jobId, JobCommandDto jobCommandDto,) async {
  53. // ignore: prefer_const_declarations
  54. final path = r'/jobs/{jobId}'
  55. .replaceAll('{jobId}', jobId.toString());
  56. // ignore: prefer_final_locals
  57. Object? postBody = jobCommandDto;
  58. final queryParams = <QueryParam>[];
  59. final headerParams = <String, String>{};
  60. final formParams = <String, String>{};
  61. const contentTypes = <String>['application/json'];
  62. return apiClient.invokeAPI(
  63. path,
  64. 'PUT',
  65. queryParams,
  66. postBody,
  67. headerParams,
  68. formParams,
  69. contentTypes.isEmpty ? null : contentTypes.first,
  70. );
  71. }
  72. /// Parameters:
  73. ///
  74. /// * [JobName] jobId (required):
  75. ///
  76. /// * [JobCommandDto] jobCommandDto (required):
  77. Future<JobStatusDto?> sendJobCommand(JobName jobId, JobCommandDto jobCommandDto,) async {
  78. final response = await sendJobCommandWithHttpInfo(jobId, jobCommandDto,);
  79. if (response.statusCode >= HttpStatus.badRequest) {
  80. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  81. }
  82. // When a remote server returns no body with a status of 204, we shall not decode it.
  83. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  84. // FormatException when trying to decode an empty string.
  85. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  86. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'JobStatusDto',) as JobStatusDto;
  87. }
  88. return null;
  89. }
  90. }