authentication_api.dart 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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 'POST /auth/login' operation and returns the [Response].
  92. /// Parameters:
  93. ///
  94. /// * [LoginCredentialDto] loginCredentialDto (required):
  95. Future<Response> loginWithHttpInfo(LoginCredentialDto loginCredentialDto,) async {
  96. // ignore: prefer_const_declarations
  97. final path = r'/auth/login';
  98. // ignore: prefer_final_locals
  99. Object? postBody = loginCredentialDto;
  100. final queryParams = <QueryParam>[];
  101. final headerParams = <String, String>{};
  102. final formParams = <String, String>{};
  103. const contentTypes = <String>['application/json'];
  104. return apiClient.invokeAPI(
  105. path,
  106. 'POST',
  107. queryParams,
  108. postBody,
  109. headerParams,
  110. formParams,
  111. contentTypes.isEmpty ? null : contentTypes.first,
  112. );
  113. }
  114. /// Parameters:
  115. ///
  116. /// * [LoginCredentialDto] loginCredentialDto (required):
  117. Future<LoginResponseDto?> login(LoginCredentialDto loginCredentialDto,) async {
  118. final response = await loginWithHttpInfo(loginCredentialDto,);
  119. if (response.statusCode >= HttpStatus.badRequest) {
  120. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  121. }
  122. // When a remote server returns no body with a status of 204, we shall not decode it.
  123. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  124. // FormatException when trying to decode an empty string.
  125. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  126. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'LoginResponseDto',) as LoginResponseDto;
  127. }
  128. return null;
  129. }
  130. /// Performs an HTTP 'POST /auth/logout' operation and returns the [Response].
  131. Future<Response> logoutWithHttpInfo() async {
  132. // ignore: prefer_const_declarations
  133. final path = r'/auth/logout';
  134. // ignore: prefer_final_locals
  135. Object? postBody;
  136. final queryParams = <QueryParam>[];
  137. final headerParams = <String, String>{};
  138. final formParams = <String, String>{};
  139. const contentTypes = <String>[];
  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. Future<LogoutResponseDto?> logout() async {
  151. final response = await logoutWithHttpInfo();
  152. if (response.statusCode >= HttpStatus.badRequest) {
  153. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  154. }
  155. // When a remote server returns no body with a status of 204, we shall not decode it.
  156. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  157. // FormatException when trying to decode an empty string.
  158. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  159. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'LogoutResponseDto',) as LogoutResponseDto;
  160. }
  161. return null;
  162. }
  163. /// Performs an HTTP 'POST /auth/validateToken' operation and returns the [Response].
  164. Future<Response> validateAccessTokenWithHttpInfo() async {
  165. // ignore: prefer_const_declarations
  166. final path = r'/auth/validateToken';
  167. // ignore: prefer_final_locals
  168. Object? postBody;
  169. final queryParams = <QueryParam>[];
  170. final headerParams = <String, String>{};
  171. final formParams = <String, String>{};
  172. const contentTypes = <String>[];
  173. return apiClient.invokeAPI(
  174. path,
  175. 'POST',
  176. queryParams,
  177. postBody,
  178. headerParams,
  179. formParams,
  180. contentTypes.isEmpty ? null : contentTypes.first,
  181. );
  182. }
  183. Future<ValidateAccessTokenResponseDto?> validateAccessToken() async {
  184. final response = await validateAccessTokenWithHttpInfo();
  185. if (response.statusCode >= HttpStatus.badRequest) {
  186. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  187. }
  188. // When a remote server returns no body with a status of 204, we shall not decode it.
  189. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  190. // FormatException when trying to decode an empty string.
  191. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  192. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ValidateAccessTokenResponseDto',) as ValidateAccessTokenResponseDto;
  193. }
  194. return null;
  195. }
  196. }