authentication_api.dart 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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/change-password' operation and returns the [Response].
  14. /// Parameters:
  15. ///
  16. /// * [ChangePasswordDto] changePasswordDto (required):
  17. Future<Response> changePasswordWithHttpInfo(ChangePasswordDto changePasswordDto,) async {
  18. // ignore: prefer_const_declarations
  19. final path = r'/auth/change-password';
  20. // ignore: prefer_final_locals
  21. Object? postBody = changePasswordDto;
  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. /// * [ChangePasswordDto] changePasswordDto (required):
  39. Future<UserResponseDto?> changePassword(ChangePasswordDto changePasswordDto,) async {
  40. final response = await changePasswordWithHttpInfo(changePasswordDto,);
  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), 'UserResponseDto',) as UserResponseDto;
  49. }
  50. return null;
  51. }
  52. /// Performs an HTTP 'GET /auth/devices' operation and returns the [Response].
  53. Future<Response> getAuthDevicesWithHttpInfo() async {
  54. // ignore: prefer_const_declarations
  55. final path = r'/auth/devices';
  56. // ignore: prefer_final_locals
  57. Object? postBody;
  58. final queryParams = <QueryParam>[];
  59. final headerParams = <String, String>{};
  60. final formParams = <String, String>{};
  61. const contentTypes = <String>[];
  62. return apiClient.invokeAPI(
  63. path,
  64. 'GET',
  65. queryParams,
  66. postBody,
  67. headerParams,
  68. formParams,
  69. contentTypes.isEmpty ? null : contentTypes.first,
  70. );
  71. }
  72. Future<List<AuthDeviceResponseDto>?> getAuthDevices() async {
  73. final response = await getAuthDevicesWithHttpInfo();
  74. if (response.statusCode >= HttpStatus.badRequest) {
  75. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  76. }
  77. // When a remote server returns no body with a status of 204, we shall not decode it.
  78. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  79. // FormatException when trying to decode an empty string.
  80. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  81. final responseBody = await _decodeBodyBytes(response);
  82. return (await apiClient.deserializeAsync(responseBody, 'List<AuthDeviceResponseDto>') as List)
  83. .cast<AuthDeviceResponseDto>()
  84. .toList();
  85. }
  86. return null;
  87. }
  88. /// Performs an HTTP 'POST /auth/login' operation and returns the [Response].
  89. /// Parameters:
  90. ///
  91. /// * [LoginCredentialDto] loginCredentialDto (required):
  92. Future<Response> loginWithHttpInfo(LoginCredentialDto loginCredentialDto,) async {
  93. // ignore: prefer_const_declarations
  94. final path = r'/auth/login';
  95. // ignore: prefer_final_locals
  96. Object? postBody = loginCredentialDto;
  97. final queryParams = <QueryParam>[];
  98. final headerParams = <String, String>{};
  99. final formParams = <String, String>{};
  100. const contentTypes = <String>['application/json'];
  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. /// Parameters:
  112. ///
  113. /// * [LoginCredentialDto] loginCredentialDto (required):
  114. Future<LoginResponseDto?> login(LoginCredentialDto loginCredentialDto,) async {
  115. final response = await loginWithHttpInfo(loginCredentialDto,);
  116. if (response.statusCode >= HttpStatus.badRequest) {
  117. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  118. }
  119. // When a remote server returns no body with a status of 204, we shall not decode it.
  120. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  121. // FormatException when trying to decode an empty string.
  122. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  123. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'LoginResponseDto',) as LoginResponseDto;
  124. }
  125. return null;
  126. }
  127. /// Performs an HTTP 'POST /auth/logout' operation and returns the [Response].
  128. Future<Response> logoutWithHttpInfo() async {
  129. // ignore: prefer_const_declarations
  130. final path = r'/auth/logout';
  131. // ignore: prefer_final_locals
  132. Object? postBody;
  133. final queryParams = <QueryParam>[];
  134. final headerParams = <String, String>{};
  135. final formParams = <String, String>{};
  136. const contentTypes = <String>[];
  137. return apiClient.invokeAPI(
  138. path,
  139. 'POST',
  140. queryParams,
  141. postBody,
  142. headerParams,
  143. formParams,
  144. contentTypes.isEmpty ? null : contentTypes.first,
  145. );
  146. }
  147. Future<LogoutResponseDto?> logout() async {
  148. final response = await logoutWithHttpInfo();
  149. if (response.statusCode >= HttpStatus.badRequest) {
  150. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  151. }
  152. // When a remote server returns no body with a status of 204, we shall not decode it.
  153. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  154. // FormatException when trying to decode an empty string.
  155. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  156. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'LogoutResponseDto',) as LogoutResponseDto;
  157. }
  158. return null;
  159. }
  160. /// Performs an HTTP 'DELETE /auth/devices/{id}' operation and returns the [Response].
  161. /// Parameters:
  162. ///
  163. /// * [String] id (required):
  164. Future<Response> logoutAuthDeviceWithHttpInfo(String id,) async {
  165. // ignore: prefer_const_declarations
  166. final path = r'/auth/devices/{id}'
  167. .replaceAll('{id}', id);
  168. // ignore: prefer_final_locals
  169. Object? postBody;
  170. final queryParams = <QueryParam>[];
  171. final headerParams = <String, String>{};
  172. final formParams = <String, String>{};
  173. const contentTypes = <String>[];
  174. return apiClient.invokeAPI(
  175. path,
  176. 'DELETE',
  177. queryParams,
  178. postBody,
  179. headerParams,
  180. formParams,
  181. contentTypes.isEmpty ? null : contentTypes.first,
  182. );
  183. }
  184. /// Parameters:
  185. ///
  186. /// * [String] id (required):
  187. Future<void> logoutAuthDevice(String id,) async {
  188. final response = await logoutAuthDeviceWithHttpInfo(id,);
  189. if (response.statusCode >= HttpStatus.badRequest) {
  190. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  191. }
  192. }
  193. /// Performs an HTTP 'DELETE /auth/devices' operation and returns the [Response].
  194. Future<Response> logoutAuthDevicesWithHttpInfo() async {
  195. // ignore: prefer_const_declarations
  196. final path = r'/auth/devices';
  197. // ignore: prefer_final_locals
  198. Object? postBody;
  199. final queryParams = <QueryParam>[];
  200. final headerParams = <String, String>{};
  201. final formParams = <String, String>{};
  202. const contentTypes = <String>[];
  203. return apiClient.invokeAPI(
  204. path,
  205. 'DELETE',
  206. queryParams,
  207. postBody,
  208. headerParams,
  209. formParams,
  210. contentTypes.isEmpty ? null : contentTypes.first,
  211. );
  212. }
  213. Future<void> logoutAuthDevices() async {
  214. final response = await logoutAuthDevicesWithHttpInfo();
  215. if (response.statusCode >= HttpStatus.badRequest) {
  216. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  217. }
  218. }
  219. /// Performs an HTTP 'POST /auth/admin-sign-up' operation and returns the [Response].
  220. /// Parameters:
  221. ///
  222. /// * [SignUpDto] signUpDto (required):
  223. Future<Response> signUpAdminWithHttpInfo(SignUpDto signUpDto,) async {
  224. // ignore: prefer_const_declarations
  225. final path = r'/auth/admin-sign-up';
  226. // ignore: prefer_final_locals
  227. Object? postBody = signUpDto;
  228. final queryParams = <QueryParam>[];
  229. final headerParams = <String, String>{};
  230. final formParams = <String, String>{};
  231. const contentTypes = <String>['application/json'];
  232. return apiClient.invokeAPI(
  233. path,
  234. 'POST',
  235. queryParams,
  236. postBody,
  237. headerParams,
  238. formParams,
  239. contentTypes.isEmpty ? null : contentTypes.first,
  240. );
  241. }
  242. /// Parameters:
  243. ///
  244. /// * [SignUpDto] signUpDto (required):
  245. Future<UserResponseDto?> signUpAdmin(SignUpDto signUpDto,) async {
  246. final response = await signUpAdminWithHttpInfo(signUpDto,);
  247. if (response.statusCode >= HttpStatus.badRequest) {
  248. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  249. }
  250. // When a remote server returns no body with a status of 204, we shall not decode it.
  251. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  252. // FormatException when trying to decode an empty string.
  253. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  254. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  255. }
  256. return null;
  257. }
  258. /// Performs an HTTP 'POST /auth/validateToken' operation and returns the [Response].
  259. Future<Response> validateAccessTokenWithHttpInfo() async {
  260. // ignore: prefer_const_declarations
  261. final path = r'/auth/validateToken';
  262. // ignore: prefer_final_locals
  263. Object? postBody;
  264. final queryParams = <QueryParam>[];
  265. final headerParams = <String, String>{};
  266. final formParams = <String, String>{};
  267. const contentTypes = <String>[];
  268. return apiClient.invokeAPI(
  269. path,
  270. 'POST',
  271. queryParams,
  272. postBody,
  273. headerParams,
  274. formParams,
  275. contentTypes.isEmpty ? null : contentTypes.first,
  276. );
  277. }
  278. Future<ValidateAccessTokenResponseDto?> validateAccessToken() async {
  279. final response = await validateAccessTokenWithHttpInfo();
  280. if (response.statusCode >= HttpStatus.badRequest) {
  281. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  282. }
  283. // When a remote server returns no body with a status of 204, we shall not decode it.
  284. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  285. // FormatException when trying to decode an empty string.
  286. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  287. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ValidateAccessTokenResponseDto',) as ValidateAccessTokenResponseDto;
  288. }
  289. return null;
  290. }
  291. }