o_auth_api.dart 9.1 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/authorize' operation and returns the [Response].
  14. /// Parameters:
  15. ///
  16. /// * [OAuthConfigDto] oAuthConfigDto (required):
  17. Future<Response> authorizeOAuthWithHttpInfo(OAuthConfigDto oAuthConfigDto,) async {
  18. // ignore: prefer_const_declarations
  19. final path = r'/oauth/authorize';
  20. // ignore: prefer_final_locals
  21. Object? postBody = oAuthConfigDto;
  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. /// * [OAuthConfigDto] oAuthConfigDto (required):
  39. Future<OAuthAuthorizeResponseDto?> authorizeOAuth(OAuthConfigDto oAuthConfigDto,) async {
  40. final response = await authorizeOAuthWithHttpInfo(oAuthConfigDto,);
  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), 'OAuthAuthorizeResponseDto',) as OAuthAuthorizeResponseDto;
  49. }
  50. return null;
  51. }
  52. /// Performs an HTTP 'POST /oauth/callback' operation and returns the [Response].
  53. /// Parameters:
  54. ///
  55. /// * [OAuthCallbackDto] oAuthCallbackDto (required):
  56. Future<Response> callbackWithHttpInfo(OAuthCallbackDto oAuthCallbackDto,) async {
  57. // ignore: prefer_const_declarations
  58. final path = r'/oauth/callback';
  59. // ignore: prefer_final_locals
  60. Object? postBody = oAuthCallbackDto;
  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. /// * [OAuthCallbackDto] oAuthCallbackDto (required):
  78. Future<LoginResponseDto?> callback(OAuthCallbackDto oAuthCallbackDto,) async {
  79. final response = await callbackWithHttpInfo(oAuthCallbackDto,);
  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. /// @deprecated use feature flags and /oauth/authorize
  92. ///
  93. /// Note: This method returns the HTTP [Response].
  94. ///
  95. /// Parameters:
  96. ///
  97. /// * [OAuthConfigDto] oAuthConfigDto (required):
  98. Future<Response> generateConfigWithHttpInfo(OAuthConfigDto oAuthConfigDto,) async {
  99. // ignore: prefer_const_declarations
  100. final path = r'/oauth/config';
  101. // ignore: prefer_final_locals
  102. Object? postBody = oAuthConfigDto;
  103. final queryParams = <QueryParam>[];
  104. final headerParams = <String, String>{};
  105. final formParams = <String, String>{};
  106. const contentTypes = <String>['application/json'];
  107. return apiClient.invokeAPI(
  108. path,
  109. 'POST',
  110. queryParams,
  111. postBody,
  112. headerParams,
  113. formParams,
  114. contentTypes.isEmpty ? null : contentTypes.first,
  115. );
  116. }
  117. /// @deprecated use feature flags and /oauth/authorize
  118. ///
  119. /// Parameters:
  120. ///
  121. /// * [OAuthConfigDto] oAuthConfigDto (required):
  122. Future<OAuthConfigResponseDto?> generateConfig(OAuthConfigDto oAuthConfigDto,) async {
  123. final response = await generateConfigWithHttpInfo(oAuthConfigDto,);
  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), 'OAuthConfigResponseDto',) as OAuthConfigResponseDto;
  132. }
  133. return null;
  134. }
  135. /// Performs an HTTP 'POST /oauth/link' operation and returns the [Response].
  136. /// Parameters:
  137. ///
  138. /// * [OAuthCallbackDto] oAuthCallbackDto (required):
  139. Future<Response> linkWithHttpInfo(OAuthCallbackDto oAuthCallbackDto,) async {
  140. // ignore: prefer_const_declarations
  141. final path = r'/oauth/link';
  142. // ignore: prefer_final_locals
  143. Object? postBody = oAuthCallbackDto;
  144. final queryParams = <QueryParam>[];
  145. final headerParams = <String, String>{};
  146. final formParams = <String, String>{};
  147. const contentTypes = <String>['application/json'];
  148. return apiClient.invokeAPI(
  149. path,
  150. 'POST',
  151. queryParams,
  152. postBody,
  153. headerParams,
  154. formParams,
  155. contentTypes.isEmpty ? null : contentTypes.first,
  156. );
  157. }
  158. /// Parameters:
  159. ///
  160. /// * [OAuthCallbackDto] oAuthCallbackDto (required):
  161. Future<UserResponseDto?> link(OAuthCallbackDto oAuthCallbackDto,) async {
  162. final response = await linkWithHttpInfo(oAuthCallbackDto,);
  163. if (response.statusCode >= HttpStatus.badRequest) {
  164. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  165. }
  166. // When a remote server returns no body with a status of 204, we shall not decode it.
  167. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  168. // FormatException when trying to decode an empty string.
  169. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  170. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  171. }
  172. return null;
  173. }
  174. /// Performs an HTTP 'GET /oauth/mobile-redirect' operation and returns the [Response].
  175. Future<Response> mobileRedirectWithHttpInfo() async {
  176. // ignore: prefer_const_declarations
  177. final path = r'/oauth/mobile-redirect';
  178. // ignore: prefer_final_locals
  179. Object? postBody;
  180. final queryParams = <QueryParam>[];
  181. final headerParams = <String, String>{};
  182. final formParams = <String, String>{};
  183. const contentTypes = <String>[];
  184. return apiClient.invokeAPI(
  185. path,
  186. 'GET',
  187. queryParams,
  188. postBody,
  189. headerParams,
  190. formParams,
  191. contentTypes.isEmpty ? null : contentTypes.first,
  192. );
  193. }
  194. Future<void> mobileRedirect() async {
  195. final response = await mobileRedirectWithHttpInfo();
  196. if (response.statusCode >= HttpStatus.badRequest) {
  197. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  198. }
  199. }
  200. /// Performs an HTTP 'POST /oauth/unlink' operation and returns the [Response].
  201. Future<Response> unlinkWithHttpInfo() 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?> unlink() async {
  221. final response = await unlinkWithHttpInfo();
  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. }