api_key_api.dart 7.6 KB

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