o_auth_api.dart 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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 OAuthApi {
  11. OAuthApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
  12. final ApiClient apiClient;
  13. /// Performs an HTTP 'POST /oauth/callback' operation and returns the [Response].
  14. /// Parameters:
  15. ///
  16. /// * [OAuthCallbackDto] oAuthCallbackDto (required):
  17. Future<Response> callbackWithHttpInfo(OAuthCallbackDto oAuthCallbackDto,) async {
  18. // ignore: prefer_const_declarations
  19. final path = r'/oauth/callback';
  20. // ignore: prefer_final_locals
  21. Object? postBody = oAuthCallbackDto;
  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. /// * [OAuthCallbackDto] oAuthCallbackDto (required):
  39. Future<LoginResponseDto?> callback(OAuthCallbackDto oAuthCallbackDto,) async {
  40. final response = await callbackWithHttpInfo(oAuthCallbackDto,);
  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), 'LoginResponseDto',) as LoginResponseDto;
  49. }
  50. return null;
  51. }
  52. /// Performs an HTTP 'POST /oauth/config' operation and returns the [Response].
  53. /// Parameters:
  54. ///
  55. /// * [OAuthConfigDto] oAuthConfigDto (required):
  56. Future<Response> generateConfigWithHttpInfo(OAuthConfigDto oAuthConfigDto,) async {
  57. // ignore: prefer_const_declarations
  58. final path = r'/oauth/config';
  59. // ignore: prefer_final_locals
  60. Object? postBody = oAuthConfigDto;
  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. /// * [OAuthConfigDto] oAuthConfigDto (required):
  78. Future<OAuthConfigResponseDto?> generateConfig(OAuthConfigDto oAuthConfigDto,) async {
  79. final response = await generateConfigWithHttpInfo(oAuthConfigDto,);
  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), 'OAuthConfigResponseDto',) as OAuthConfigResponseDto;
  88. }
  89. return null;
  90. }
  91. /// Performs an HTTP 'POST /oauth/link' operation and returns the [Response].
  92. /// Parameters:
  93. ///
  94. /// * [OAuthCallbackDto] oAuthCallbackDto (required):
  95. Future<Response> linkWithHttpInfo(OAuthCallbackDto oAuthCallbackDto,) async {
  96. // ignore: prefer_const_declarations
  97. final path = r'/oauth/link';
  98. // ignore: prefer_final_locals
  99. Object? postBody = oAuthCallbackDto;
  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. /// * [OAuthCallbackDto] oAuthCallbackDto (required):
  117. Future<UserResponseDto?> link(OAuthCallbackDto oAuthCallbackDto,) async {
  118. final response = await linkWithHttpInfo(oAuthCallbackDto,);
  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), 'UserResponseDto',) as UserResponseDto;
  127. }
  128. return null;
  129. }
  130. /// Performs an HTTP 'GET /oauth/mobile-redirect' operation and returns the [Response].
  131. Future<Response> mobileRedirectWithHttpInfo() async {
  132. // ignore: prefer_const_declarations
  133. final path = r'/oauth/mobile-redirect';
  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. 'GET',
  143. queryParams,
  144. postBody,
  145. headerParams,
  146. formParams,
  147. contentTypes.isEmpty ? null : contentTypes.first,
  148. );
  149. }
  150. Future<void> mobileRedirect() async {
  151. final response = await mobileRedirectWithHttpInfo();
  152. if (response.statusCode >= HttpStatus.badRequest) {
  153. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  154. }
  155. }
  156. /// Performs an HTTP 'POST /oauth/unlink' operation and returns the [Response].
  157. Future<Response> unlinkWithHttpInfo() async {
  158. // ignore: prefer_const_declarations
  159. final path = r'/oauth/unlink';
  160. // ignore: prefer_final_locals
  161. Object? postBody;
  162. final queryParams = <QueryParam>[];
  163. final headerParams = <String, String>{};
  164. final formParams = <String, String>{};
  165. const contentTypes = <String>[];
  166. return apiClient.invokeAPI(
  167. path,
  168. 'POST',
  169. queryParams,
  170. postBody,
  171. headerParams,
  172. formParams,
  173. contentTypes.isEmpty ? null : contentTypes.first,
  174. );
  175. }
  176. Future<UserResponseDto?> unlink() async {
  177. final response = await unlinkWithHttpInfo();
  178. if (response.statusCode >= HttpStatus.badRequest) {
  179. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  180. }
  181. // When a remote server returns no body with a status of 204, we shall not decode it.
  182. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  183. // FormatException when trying to decode an empty string.
  184. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  185. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  186. }
  187. return null;
  188. }
  189. }