api_key_api.dart 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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 APIKeyApi {
  11. APIKeyApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
  12. final ApiClient apiClient;
  13. /// Performs an HTTP 'POST /api-key' operation and returns the [Response].
  14. /// Parameters:
  15. ///
  16. /// * [APIKeyCreateDto] aPIKeyCreateDto (required):
  17. Future<Response> createKeyWithHttpInfo(APIKeyCreateDto aPIKeyCreateDto,) async {
  18. // ignore: prefer_const_declarations
  19. final path = r'/api-key';
  20. // ignore: prefer_final_locals
  21. Object? postBody = aPIKeyCreateDto;
  22. final queryParams = <QueryParam>[];
  23. final headerParams = <String, String>{};
  24. final formParams = <String, String>{};
  25. const contentTypes = <String>['application/json'];
  26. return apiClient.invokeAPI(
  27. path,
  28. 'POST',
  29. queryParams,
  30. postBody,
  31. headerParams,
  32. formParams,
  33. contentTypes.isEmpty ? null : contentTypes.first,
  34. );
  35. }
  36. /// Parameters:
  37. ///
  38. /// * [APIKeyCreateDto] aPIKeyCreateDto (required):
  39. Future<APIKeyCreateResponseDto?> createKey(APIKeyCreateDto aPIKeyCreateDto,) async {
  40. final response = await createKeyWithHttpInfo(aPIKeyCreateDto,);
  41. if (response.statusCode >= HttpStatus.badRequest) {
  42. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  43. }
  44. // When a remote server returns no body with a status of 204, we shall not decode it.
  45. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  46. // FormatException when trying to decode an empty string.
  47. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  48. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'APIKeyCreateResponseDto',) as APIKeyCreateResponseDto;
  49. }
  50. return null;
  51. }
  52. /// Performs an HTTP 'DELETE /api-key/{id}' operation and returns the [Response].
  53. /// Parameters:
  54. ///
  55. /// * [String] id (required):
  56. Future<Response> deleteKeyWithHttpInfo(String id,) async {
  57. // ignore: prefer_const_declarations
  58. final path = r'/api-key/{id}'
  59. .replaceAll('{id}', id);
  60. // ignore: prefer_final_locals
  61. Object? postBody;
  62. final queryParams = <QueryParam>[];
  63. final headerParams = <String, String>{};
  64. final formParams = <String, String>{};
  65. const contentTypes = <String>[];
  66. return apiClient.invokeAPI(
  67. path,
  68. 'DELETE',
  69. queryParams,
  70. postBody,
  71. headerParams,
  72. formParams,
  73. contentTypes.isEmpty ? null : contentTypes.first,
  74. );
  75. }
  76. /// Parameters:
  77. ///
  78. /// * [String] id (required):
  79. Future<void> deleteKey(String id,) async {
  80. final response = await deleteKeyWithHttpInfo(id,);
  81. if (response.statusCode >= HttpStatus.badRequest) {
  82. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  83. }
  84. }
  85. /// Performs an HTTP 'GET /api-key/{id}' operation and returns the [Response].
  86. /// Parameters:
  87. ///
  88. /// * [String] id (required):
  89. Future<Response> getKeyWithHttpInfo(String id,) async {
  90. // ignore: prefer_const_declarations
  91. final path = r'/api-key/{id}'
  92. .replaceAll('{id}', id);
  93. // ignore: prefer_final_locals
  94. Object? postBody;
  95. final queryParams = <QueryParam>[];
  96. final headerParams = <String, String>{};
  97. final formParams = <String, String>{};
  98. const contentTypes = <String>[];
  99. return apiClient.invokeAPI(
  100. path,
  101. 'GET',
  102. queryParams,
  103. postBody,
  104. headerParams,
  105. formParams,
  106. contentTypes.isEmpty ? null : contentTypes.first,
  107. );
  108. }
  109. /// Parameters:
  110. ///
  111. /// * [String] id (required):
  112. Future<APIKeyResponseDto?> getKey(String id,) async {
  113. final response = await getKeyWithHttpInfo(id,);
  114. if (response.statusCode >= HttpStatus.badRequest) {
  115. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  116. }
  117. // When a remote server returns no body with a status of 204, we shall not decode it.
  118. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  119. // FormatException when trying to decode an empty string.
  120. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  121. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'APIKeyResponseDto',) as APIKeyResponseDto;
  122. }
  123. return null;
  124. }
  125. /// Performs an HTTP 'GET /api-key' operation and returns the [Response].
  126. Future<Response> getKeysWithHttpInfo() async {
  127. // ignore: prefer_const_declarations
  128. final path = r'/api-key';
  129. // ignore: prefer_final_locals
  130. Object? postBody;
  131. final queryParams = <QueryParam>[];
  132. final headerParams = <String, String>{};
  133. final formParams = <String, String>{};
  134. const contentTypes = <String>[];
  135. return apiClient.invokeAPI(
  136. path,
  137. 'GET',
  138. queryParams,
  139. postBody,
  140. headerParams,
  141. formParams,
  142. contentTypes.isEmpty ? null : contentTypes.first,
  143. );
  144. }
  145. Future<List<APIKeyResponseDto>?> getKeys() async {
  146. final response = await getKeysWithHttpInfo();
  147. if (response.statusCode >= HttpStatus.badRequest) {
  148. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  149. }
  150. // When a remote server returns no body with a status of 204, we shall not decode it.
  151. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  152. // FormatException when trying to decode an empty string.
  153. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  154. final responseBody = await _decodeBodyBytes(response);
  155. return (await apiClient.deserializeAsync(responseBody, 'List<APIKeyResponseDto>') as List)
  156. .cast<APIKeyResponseDto>()
  157. .toList();
  158. }
  159. return null;
  160. }
  161. /// Performs an HTTP 'PUT /api-key/{id}' operation and returns the [Response].
  162. /// Parameters:
  163. ///
  164. /// * [String] id (required):
  165. ///
  166. /// * [APIKeyUpdateDto] aPIKeyUpdateDto (required):
  167. Future<Response> updateKeyWithHttpInfo(String id, APIKeyUpdateDto aPIKeyUpdateDto,) async {
  168. // ignore: prefer_const_declarations
  169. final path = r'/api-key/{id}'
  170. .replaceAll('{id}', id);
  171. // ignore: prefer_final_locals
  172. Object? postBody = aPIKeyUpdateDto;
  173. final queryParams = <QueryParam>[];
  174. final headerParams = <String, String>{};
  175. final formParams = <String, String>{};
  176. const contentTypes = <String>['application/json'];
  177. return apiClient.invokeAPI(
  178. path,
  179. 'PUT',
  180. queryParams,
  181. postBody,
  182. headerParams,
  183. formParams,
  184. contentTypes.isEmpty ? null : contentTypes.first,
  185. );
  186. }
  187. /// Parameters:
  188. ///
  189. /// * [String] id (required):
  190. ///
  191. /// * [APIKeyUpdateDto] aPIKeyUpdateDto (required):
  192. Future<APIKeyResponseDto?> updateKey(String id, APIKeyUpdateDto aPIKeyUpdateDto,) async {
  193. final response = await updateKeyWithHttpInfo(id, aPIKeyUpdateDto,);
  194. if (response.statusCode >= HttpStatus.badRequest) {
  195. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  196. }
  197. // When a remote server returns no body with a status of 204, we shall not decode it.
  198. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  199. // FormatException when trying to decode an empty string.
  200. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  201. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'APIKeyResponseDto',) as APIKeyResponseDto;
  202. }
  203. return null;
  204. }
  205. }