authentication_api.dart 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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 AuthenticationApi {
  11. AuthenticationApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
  12. final ApiClient apiClient;
  13. /// Performs an HTTP 'POST /auth/admin-sign-up' operation and returns the [Response].
  14. /// Parameters:
  15. ///
  16. /// * [SignUpDto] signUpDto (required):
  17. Future<Response> adminSignUpWithHttpInfo(SignUpDto signUpDto,) async {
  18. // ignore: prefer_const_declarations
  19. final path = r'/auth/admin-sign-up';
  20. // ignore: prefer_final_locals
  21. Object? postBody = signUpDto;
  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. /// * [SignUpDto] signUpDto (required):
  39. Future<AdminSignupResponseDto?> adminSignUp(SignUpDto signUpDto,) async {
  40. final response = await adminSignUpWithHttpInfo(signUpDto,);
  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), 'AdminSignupResponseDto',) as AdminSignupResponseDto;
  49. }
  50. return null;
  51. }
  52. /// Performs an HTTP 'POST /auth/change-password' operation and returns the [Response].
  53. /// Parameters:
  54. ///
  55. /// * [ChangePasswordDto] changePasswordDto (required):
  56. Future<Response> changePasswordWithHttpInfo(ChangePasswordDto changePasswordDto,) async {
  57. // ignore: prefer_const_declarations
  58. final path = r'/auth/change-password';
  59. // ignore: prefer_final_locals
  60. Object? postBody = changePasswordDto;
  61. final queryParams = <QueryParam>[];
  62. final headerParams = <String, String>{};
  63. final formParams = <String, String>{};
  64. const contentTypes = <String>['application/json'];
  65. return apiClient.invokeAPI(
  66. path,
  67. 'POST',
  68. queryParams,
  69. postBody,
  70. headerParams,
  71. formParams,
  72. contentTypes.isEmpty ? null : contentTypes.first,
  73. );
  74. }
  75. /// Parameters:
  76. ///
  77. /// * [ChangePasswordDto] changePasswordDto (required):
  78. Future<UserResponseDto?> changePassword(ChangePasswordDto changePasswordDto,) async {
  79. final response = await changePasswordWithHttpInfo(changePasswordDto,);
  80. if (response.statusCode >= HttpStatus.badRequest) {
  81. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  82. }
  83. // When a remote server returns no body with a status of 204, we shall not decode it.
  84. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  85. // FormatException when trying to decode an empty string.
  86. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  87. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  88. }
  89. return null;
  90. }
  91. /// Performs an HTTP 'GET /auth/devices' operation and returns the [Response].
  92. Future<Response> getAuthDevicesWithHttpInfo() async {
  93. // ignore: prefer_const_declarations
  94. final path = r'/auth/devices';
  95. // ignore: prefer_final_locals
  96. Object? postBody;
  97. final queryParams = <QueryParam>[];
  98. final headerParams = <String, String>{};
  99. final formParams = <String, String>{};
  100. const contentTypes = <String>[];
  101. return apiClient.invokeAPI(
  102. path,
  103. 'GET',
  104. queryParams,
  105. postBody,
  106. headerParams,
  107. formParams,
  108. contentTypes.isEmpty ? null : contentTypes.first,
  109. );
  110. }
  111. Future<List<AuthDeviceResponseDto>?> getAuthDevices() async {
  112. final response = await getAuthDevicesWithHttpInfo();
  113. if (response.statusCode >= HttpStatus.badRequest) {
  114. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  115. }
  116. // When a remote server returns no body with a status of 204, we shall not decode it.
  117. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  118. // FormatException when trying to decode an empty string.
  119. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  120. final responseBody = await _decodeBodyBytes(response);
  121. return (await apiClient.deserializeAsync(responseBody, 'List<AuthDeviceResponseDto>') as List)
  122. .cast<AuthDeviceResponseDto>()
  123. .toList();
  124. }
  125. return null;
  126. }
  127. /// Performs an HTTP 'POST /auth/login' operation and returns the [Response].
  128. /// Parameters:
  129. ///
  130. /// * [LoginCredentialDto] loginCredentialDto (required):
  131. Future<Response> loginWithHttpInfo(LoginCredentialDto loginCredentialDto,) async {
  132. // ignore: prefer_const_declarations
  133. final path = r'/auth/login';
  134. // ignore: prefer_final_locals
  135. Object? postBody = loginCredentialDto;
  136. final queryParams = <QueryParam>[];
  137. final headerParams = <String, String>{};
  138. final formParams = <String, String>{};
  139. const contentTypes = <String>['application/json'];
  140. return apiClient.invokeAPI(
  141. path,
  142. 'POST',
  143. queryParams,
  144. postBody,
  145. headerParams,
  146. formParams,
  147. contentTypes.isEmpty ? null : contentTypes.first,
  148. );
  149. }
  150. /// Parameters:
  151. ///
  152. /// * [LoginCredentialDto] loginCredentialDto (required):
  153. Future<LoginResponseDto?> login(LoginCredentialDto loginCredentialDto,) async {
  154. final response = await loginWithHttpInfo(loginCredentialDto,);
  155. if (response.statusCode >= HttpStatus.badRequest) {
  156. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  157. }
  158. // When a remote server returns no body with a status of 204, we shall not decode it.
  159. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  160. // FormatException when trying to decode an empty string.
  161. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  162. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'LoginResponseDto',) as LoginResponseDto;
  163. }
  164. return null;
  165. }
  166. /// Performs an HTTP 'POST /auth/logout' operation and returns the [Response].
  167. Future<Response> logoutWithHttpInfo() async {
  168. // ignore: prefer_const_declarations
  169. final path = r'/auth/logout';
  170. // ignore: prefer_final_locals
  171. Object? postBody;
  172. final queryParams = <QueryParam>[];
  173. final headerParams = <String, String>{};
  174. final formParams = <String, String>{};
  175. const contentTypes = <String>[];
  176. return apiClient.invokeAPI(
  177. path,
  178. 'POST',
  179. queryParams,
  180. postBody,
  181. headerParams,
  182. formParams,
  183. contentTypes.isEmpty ? null : contentTypes.first,
  184. );
  185. }
  186. Future<LogoutResponseDto?> logout() async {
  187. final response = await logoutWithHttpInfo();
  188. if (response.statusCode >= HttpStatus.badRequest) {
  189. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  190. }
  191. // When a remote server returns no body with a status of 204, we shall not decode it.
  192. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  193. // FormatException when trying to decode an empty string.
  194. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  195. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'LogoutResponseDto',) as LogoutResponseDto;
  196. }
  197. return null;
  198. }
  199. /// Performs an HTTP 'DELETE /auth/devices/{id}' operation and returns the [Response].
  200. /// Parameters:
  201. ///
  202. /// * [String] id (required):
  203. Future<Response> logoutAuthDeviceWithHttpInfo(String id,) async {
  204. // ignore: prefer_const_declarations
  205. final path = r'/auth/devices/{id}'
  206. .replaceAll('{id}', id);
  207. // ignore: prefer_final_locals
  208. Object? postBody;
  209. final queryParams = <QueryParam>[];
  210. final headerParams = <String, String>{};
  211. final formParams = <String, String>{};
  212. const contentTypes = <String>[];
  213. return apiClient.invokeAPI(
  214. path,
  215. 'DELETE',
  216. queryParams,
  217. postBody,
  218. headerParams,
  219. formParams,
  220. contentTypes.isEmpty ? null : contentTypes.first,
  221. );
  222. }
  223. /// Parameters:
  224. ///
  225. /// * [String] id (required):
  226. Future<void> logoutAuthDevice(String id,) async {
  227. final response = await logoutAuthDeviceWithHttpInfo(id,);
  228. if (response.statusCode >= HttpStatus.badRequest) {
  229. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  230. }
  231. }
  232. /// Performs an HTTP 'POST /auth/validateToken' operation and returns the [Response].
  233. Future<Response> validateAccessTokenWithHttpInfo() async {
  234. // ignore: prefer_const_declarations
  235. final path = r'/auth/validateToken';
  236. // ignore: prefer_final_locals
  237. Object? postBody;
  238. final queryParams = <QueryParam>[];
  239. final headerParams = <String, String>{};
  240. final formParams = <String, String>{};
  241. const contentTypes = <String>[];
  242. return apiClient.invokeAPI(
  243. path,
  244. 'POST',
  245. queryParams,
  246. postBody,
  247. headerParams,
  248. formParams,
  249. contentTypes.isEmpty ? null : contentTypes.first,
  250. );
  251. }
  252. Future<ValidateAccessTokenResponseDto?> validateAccessToken() async {
  253. final response = await validateAccessTokenWithHttpInfo();
  254. if (response.statusCode >= HttpStatus.badRequest) {
  255. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  256. }
  257. // When a remote server returns no body with a status of 204, we shall not decode it.
  258. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  259. // FormatException when trying to decode an empty string.
  260. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  261. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ValidateAccessTokenResponseDto',) as ValidateAccessTokenResponseDto;
  262. }
  263. return null;
  264. }
  265. }