authentication_api.dart 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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. ///
  14. ///
  15. /// Note: This method returns the HTTP [Response].
  16. ///
  17. /// Parameters:
  18. ///
  19. /// * [SignUpDto] signUpDto (required):
  20. Future<Response> adminSignUpWithHttpInfo(SignUpDto signUpDto,) async {
  21. // ignore: prefer_const_declarations
  22. final path = r'/auth/admin-sign-up';
  23. // ignore: prefer_final_locals
  24. Object? postBody = signUpDto;
  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. /// * [SignUpDto] signUpDto (required):
  44. Future<AdminSignupResponseDto?> adminSignUp(SignUpDto signUpDto,) async {
  45. final response = await adminSignUpWithHttpInfo(signUpDto,);
  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), 'AdminSignupResponseDto',) as AdminSignupResponseDto;
  54. }
  55. return null;
  56. }
  57. ///
  58. ///
  59. /// Note: This method returns the HTTP [Response].
  60. ///
  61. /// Parameters:
  62. ///
  63. /// * [ChangePasswordDto] changePasswordDto (required):
  64. Future<Response> changePasswordWithHttpInfo(ChangePasswordDto changePasswordDto,) async {
  65. // ignore: prefer_const_declarations
  66. final path = r'/auth/change-password';
  67. // ignore: prefer_final_locals
  68. Object? postBody = changePasswordDto;
  69. final queryParams = <QueryParam>[];
  70. final headerParams = <String, String>{};
  71. final formParams = <String, String>{};
  72. const contentTypes = <String>['application/json'];
  73. return apiClient.invokeAPI(
  74. path,
  75. 'POST',
  76. queryParams,
  77. postBody,
  78. headerParams,
  79. formParams,
  80. contentTypes.isEmpty ? null : contentTypes.first,
  81. );
  82. }
  83. ///
  84. ///
  85. /// Parameters:
  86. ///
  87. /// * [ChangePasswordDto] changePasswordDto (required):
  88. Future<UserResponseDto?> changePassword(ChangePasswordDto changePasswordDto,) async {
  89. final response = await changePasswordWithHttpInfo(changePasswordDto,);
  90. if (response.statusCode >= HttpStatus.badRequest) {
  91. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  92. }
  93. // When a remote server returns no body with a status of 204, we shall not decode it.
  94. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  95. // FormatException when trying to decode an empty string.
  96. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  97. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  98. }
  99. return null;
  100. }
  101. ///
  102. ///
  103. /// Note: This method returns the HTTP [Response].
  104. ///
  105. /// Parameters:
  106. ///
  107. /// * [LoginCredentialDto] loginCredentialDto (required):
  108. Future<Response> loginWithHttpInfo(LoginCredentialDto loginCredentialDto,) async {
  109. // ignore: prefer_const_declarations
  110. final path = r'/auth/login';
  111. // ignore: prefer_final_locals
  112. Object? postBody = loginCredentialDto;
  113. final queryParams = <QueryParam>[];
  114. final headerParams = <String, String>{};
  115. final formParams = <String, String>{};
  116. const contentTypes = <String>['application/json'];
  117. return apiClient.invokeAPI(
  118. path,
  119. 'POST',
  120. queryParams,
  121. postBody,
  122. headerParams,
  123. formParams,
  124. contentTypes.isEmpty ? null : contentTypes.first,
  125. );
  126. }
  127. ///
  128. ///
  129. /// Parameters:
  130. ///
  131. /// * [LoginCredentialDto] loginCredentialDto (required):
  132. Future<LoginResponseDto?> login(LoginCredentialDto loginCredentialDto,) async {
  133. final response = await loginWithHttpInfo(loginCredentialDto,);
  134. if (response.statusCode >= HttpStatus.badRequest) {
  135. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  136. }
  137. // When a remote server returns no body with a status of 204, we shall not decode it.
  138. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  139. // FormatException when trying to decode an empty string.
  140. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  141. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'LoginResponseDto',) as LoginResponseDto;
  142. }
  143. return null;
  144. }
  145. ///
  146. ///
  147. /// Note: This method returns the HTTP [Response].
  148. Future<Response> logoutWithHttpInfo() async {
  149. // ignore: prefer_const_declarations
  150. final path = r'/auth/logout';
  151. // ignore: prefer_final_locals
  152. Object? postBody;
  153. final queryParams = <QueryParam>[];
  154. final headerParams = <String, String>{};
  155. final formParams = <String, String>{};
  156. const contentTypes = <String>[];
  157. return apiClient.invokeAPI(
  158. path,
  159. 'POST',
  160. queryParams,
  161. postBody,
  162. headerParams,
  163. formParams,
  164. contentTypes.isEmpty ? null : contentTypes.first,
  165. );
  166. }
  167. ///
  168. Future<LogoutResponseDto?> logout() async {
  169. final response = await logoutWithHttpInfo();
  170. if (response.statusCode >= HttpStatus.badRequest) {
  171. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  172. }
  173. // When a remote server returns no body with a status of 204, we shall not decode it.
  174. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  175. // FormatException when trying to decode an empty string.
  176. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  177. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'LogoutResponseDto',) as LogoutResponseDto;
  178. }
  179. return null;
  180. }
  181. ///
  182. ///
  183. /// Note: This method returns the HTTP [Response].
  184. Future<Response> validateAccessTokenWithHttpInfo() async {
  185. // ignore: prefer_const_declarations
  186. final path = r'/auth/validateToken';
  187. // ignore: prefer_final_locals
  188. Object? postBody;
  189. final queryParams = <QueryParam>[];
  190. final headerParams = <String, String>{};
  191. final formParams = <String, String>{};
  192. const contentTypes = <String>[];
  193. return apiClient.invokeAPI(
  194. path,
  195. 'POST',
  196. queryParams,
  197. postBody,
  198. headerParams,
  199. formParams,
  200. contentTypes.isEmpty ? null : contentTypes.first,
  201. );
  202. }
  203. ///
  204. Future<ValidateAccessTokenResponseDto?> validateAccessToken() async {
  205. final response = await validateAccessTokenWithHttpInfo();
  206. if (response.statusCode >= HttpStatus.badRequest) {
  207. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  208. }
  209. // When a remote server returns no body with a status of 204, we shall not decode it.
  210. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  211. // FormatException when trying to decode an empty string.
  212. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  213. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ValidateAccessTokenResponseDto',) as ValidateAccessTokenResponseDto;
  214. }
  215. return null;
  216. }
  217. }