o_auth_api.dart 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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> finishOAuthWithHttpInfo(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?> finishOAuth(OAuthCallbackDto oAuthCallbackDto,) async {
  40. final response = await finishOAuthWithHttpInfo(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. /// @deprecated use feature flags and /oauth/authorize
  53. ///
  54. /// Note: This method returns the HTTP [Response].
  55. ///
  56. /// Parameters:
  57. ///
  58. /// * [OAuthConfigDto] oAuthConfigDto (required):
  59. Future<Response> generateOAuthConfigWithHttpInfo(OAuthConfigDto oAuthConfigDto,) async {
  60. // ignore: prefer_const_declarations
  61. final path = r'/oauth/config';
  62. // ignore: prefer_final_locals
  63. Object? postBody = oAuthConfigDto;
  64. final queryParams = <QueryParam>[];
  65. final headerParams = <String, String>{};
  66. final formParams = <String, String>{};
  67. const contentTypes = <String>['application/json'];
  68. return apiClient.invokeAPI(
  69. path,
  70. 'POST',
  71. queryParams,
  72. postBody,
  73. headerParams,
  74. formParams,
  75. contentTypes.isEmpty ? null : contentTypes.first,
  76. );
  77. }
  78. /// @deprecated use feature flags and /oauth/authorize
  79. ///
  80. /// Parameters:
  81. ///
  82. /// * [OAuthConfigDto] oAuthConfigDto (required):
  83. Future<OAuthConfigResponseDto?> generateOAuthConfig(OAuthConfigDto oAuthConfigDto,) async {
  84. final response = await generateOAuthConfigWithHttpInfo(oAuthConfigDto,);
  85. if (response.statusCode >= HttpStatus.badRequest) {
  86. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  87. }
  88. // When a remote server returns no body with a status of 204, we shall not decode it.
  89. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  90. // FormatException when trying to decode an empty string.
  91. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  92. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OAuthConfigResponseDto',) as OAuthConfigResponseDto;
  93. }
  94. return null;
  95. }
  96. /// Performs an HTTP 'POST /oauth/link' operation and returns the [Response].
  97. /// Parameters:
  98. ///
  99. /// * [OAuthCallbackDto] oAuthCallbackDto (required):
  100. Future<Response> linkOAuthAccountWithHttpInfo(OAuthCallbackDto oAuthCallbackDto,) async {
  101. // ignore: prefer_const_declarations
  102. final path = r'/oauth/link';
  103. // ignore: prefer_final_locals
  104. Object? postBody = oAuthCallbackDto;
  105. final queryParams = <QueryParam>[];
  106. final headerParams = <String, String>{};
  107. final formParams = <String, String>{};
  108. const contentTypes = <String>['application/json'];
  109. return apiClient.invokeAPI(
  110. path,
  111. 'POST',
  112. queryParams,
  113. postBody,
  114. headerParams,
  115. formParams,
  116. contentTypes.isEmpty ? null : contentTypes.first,
  117. );
  118. }
  119. /// Parameters:
  120. ///
  121. /// * [OAuthCallbackDto] oAuthCallbackDto (required):
  122. Future<UserResponseDto?> linkOAuthAccount(OAuthCallbackDto oAuthCallbackDto,) async {
  123. final response = await linkOAuthAccountWithHttpInfo(oAuthCallbackDto,);
  124. if (response.statusCode >= HttpStatus.badRequest) {
  125. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  126. }
  127. // When a remote server returns no body with a status of 204, we shall not decode it.
  128. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  129. // FormatException when trying to decode an empty string.
  130. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  131. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  132. }
  133. return null;
  134. }
  135. /// Performs an HTTP 'GET /oauth/mobile-redirect' operation and returns the [Response].
  136. Future<Response> redirectOAuthToMobileWithHttpInfo() async {
  137. // ignore: prefer_const_declarations
  138. final path = r'/oauth/mobile-redirect';
  139. // ignore: prefer_final_locals
  140. Object? postBody;
  141. final queryParams = <QueryParam>[];
  142. final headerParams = <String, String>{};
  143. final formParams = <String, String>{};
  144. const contentTypes = <String>[];
  145. return apiClient.invokeAPI(
  146. path,
  147. 'GET',
  148. queryParams,
  149. postBody,
  150. headerParams,
  151. formParams,
  152. contentTypes.isEmpty ? null : contentTypes.first,
  153. );
  154. }
  155. Future<void> redirectOAuthToMobile() async {
  156. final response = await redirectOAuthToMobileWithHttpInfo();
  157. if (response.statusCode >= HttpStatus.badRequest) {
  158. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  159. }
  160. }
  161. /// Performs an HTTP 'POST /oauth/authorize' operation and returns the [Response].
  162. /// Parameters:
  163. ///
  164. /// * [OAuthConfigDto] oAuthConfigDto (required):
  165. Future<Response> startOAuthWithHttpInfo(OAuthConfigDto oAuthConfigDto,) async {
  166. // ignore: prefer_const_declarations
  167. final path = r'/oauth/authorize';
  168. // ignore: prefer_final_locals
  169. Object? postBody = oAuthConfigDto;
  170. final queryParams = <QueryParam>[];
  171. final headerParams = <String, String>{};
  172. final formParams = <String, String>{};
  173. const contentTypes = <String>['application/json'];
  174. return apiClient.invokeAPI(
  175. path,
  176. 'POST',
  177. queryParams,
  178. postBody,
  179. headerParams,
  180. formParams,
  181. contentTypes.isEmpty ? null : contentTypes.first,
  182. );
  183. }
  184. /// Parameters:
  185. ///
  186. /// * [OAuthConfigDto] oAuthConfigDto (required):
  187. Future<OAuthAuthorizeResponseDto?> startOAuth(OAuthConfigDto oAuthConfigDto,) async {
  188. final response = await startOAuthWithHttpInfo(oAuthConfigDto,);
  189. if (response.statusCode >= HttpStatus.badRequest) {
  190. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  191. }
  192. // When a remote server returns no body with a status of 204, we shall not decode it.
  193. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  194. // FormatException when trying to decode an empty string.
  195. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  196. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'OAuthAuthorizeResponseDto',) as OAuthAuthorizeResponseDto;
  197. }
  198. return null;
  199. }
  200. /// Performs an HTTP 'POST /oauth/unlink' operation and returns the [Response].
  201. Future<Response> unlinkOAuthAccountWithHttpInfo() async {
  202. // ignore: prefer_const_declarations
  203. final path = r'/oauth/unlink';
  204. // ignore: prefer_final_locals
  205. Object? postBody;
  206. final queryParams = <QueryParam>[];
  207. final headerParams = <String, String>{};
  208. final formParams = <String, String>{};
  209. const contentTypes = <String>[];
  210. return apiClient.invokeAPI(
  211. path,
  212. 'POST',
  213. queryParams,
  214. postBody,
  215. headerParams,
  216. formParams,
  217. contentTypes.isEmpty ? null : contentTypes.first,
  218. );
  219. }
  220. Future<UserResponseDto?> unlinkOAuthAccount() async {
  221. final response = await unlinkOAuthAccountWithHttpInfo();
  222. if (response.statusCode >= HttpStatus.badRequest) {
  223. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  224. }
  225. // When a remote server returns no body with a status of 204, we shall not decode it.
  226. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  227. // FormatException when trying to decode an empty string.
  228. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  229. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  230. }
  231. return null;
  232. }
  233. }