authentication_api.dart 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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/login' operation and returns the [Response].
  53. /// Parameters:
  54. ///
  55. /// * [LoginCredentialDto] loginCredentialDto (required):
  56. Future<Response> loginWithHttpInfo(LoginCredentialDto loginCredentialDto,) async {
  57. // ignore: prefer_const_declarations
  58. final path = r'/auth/login';
  59. // ignore: prefer_final_locals
  60. Object? postBody = loginCredentialDto;
  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. /// * [LoginCredentialDto] loginCredentialDto (required):
  78. Future<LoginResponseDto?> login(LoginCredentialDto loginCredentialDto,) async {
  79. final response = await loginWithHttpInfo(loginCredentialDto,);
  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), 'LoginResponseDto',) as LoginResponseDto;
  88. }
  89. return null;
  90. }
  91. /// Performs an HTTP 'POST /auth/logout' operation and returns the [Response].
  92. Future<Response> logoutWithHttpInfo() async {
  93. // ignore: prefer_const_declarations
  94. final path = r'/auth/logout';
  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. 'POST',
  104. queryParams,
  105. postBody,
  106. headerParams,
  107. formParams,
  108. contentTypes.isEmpty ? null : contentTypes.first,
  109. );
  110. }
  111. Future<LogoutResponseDto?> logout() async {
  112. final response = await logoutWithHttpInfo();
  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. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'LogoutResponseDto',) as LogoutResponseDto;
  121. }
  122. return null;
  123. }
  124. /// Performs an HTTP 'POST /auth/validateToken' operation and returns the [Response].
  125. Future<Response> validateAccessTokenWithHttpInfo() async {
  126. // ignore: prefer_const_declarations
  127. final path = r'/auth/validateToken';
  128. // ignore: prefer_final_locals
  129. Object? postBody;
  130. final queryParams = <QueryParam>[];
  131. final headerParams = <String, String>{};
  132. final formParams = <String, String>{};
  133. const contentTypes = <String>[];
  134. return apiClient.invokeAPI(
  135. path,
  136. 'POST',
  137. queryParams,
  138. postBody,
  139. headerParams,
  140. formParams,
  141. contentTypes.isEmpty ? null : contentTypes.first,
  142. );
  143. }
  144. Future<ValidateAccessTokenResponseDto?> validateAccessToken() async {
  145. final response = await validateAccessTokenWithHttpInfo();
  146. if (response.statusCode >= HttpStatus.badRequest) {
  147. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  148. }
  149. // When a remote server returns no body with a status of 204, we shall not decode it.
  150. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  151. // FormatException when trying to decode an empty string.
  152. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  153. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ValidateAccessTokenResponseDto',) as ValidateAccessTokenResponseDto;
  154. }
  155. return null;
  156. }
  157. }