user_api.dart 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  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 UserApi {
  11. UserApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
  12. final ApiClient apiClient;
  13. /// Performs an HTTP 'POST /user/profile-image' operation and returns the [Response].
  14. /// Parameters:
  15. ///
  16. /// * [MultipartFile] file (required):
  17. Future<Response> createProfileImageWithHttpInfo(MultipartFile file,) async {
  18. // ignore: prefer_const_declarations
  19. final path = r'/user/profile-image';
  20. // ignore: prefer_final_locals
  21. Object? postBody;
  22. final queryParams = <QueryParam>[];
  23. final headerParams = <String, String>{};
  24. final formParams = <String, String>{};
  25. const contentTypes = <String>['multipart/form-data'];
  26. bool hasFields = false;
  27. final mp = MultipartRequest('POST', Uri.parse(path));
  28. if (file != null) {
  29. hasFields = true;
  30. mp.fields[r'file'] = file.field;
  31. mp.files.add(file);
  32. }
  33. if (hasFields) {
  34. postBody = mp;
  35. }
  36. return apiClient.invokeAPI(
  37. path,
  38. 'POST',
  39. queryParams,
  40. postBody,
  41. headerParams,
  42. formParams,
  43. contentTypes.isEmpty ? null : contentTypes.first,
  44. );
  45. }
  46. /// Parameters:
  47. ///
  48. /// * [MultipartFile] file (required):
  49. Future<CreateProfileImageResponseDto?> createProfileImage(MultipartFile file,) async {
  50. final response = await createProfileImageWithHttpInfo(file,);
  51. if (response.statusCode >= HttpStatus.badRequest) {
  52. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  53. }
  54. // When a remote server returns no body with a status of 204, we shall not decode it.
  55. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  56. // FormatException when trying to decode an empty string.
  57. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  58. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'CreateProfileImageResponseDto',) as CreateProfileImageResponseDto;
  59. }
  60. return null;
  61. }
  62. /// Performs an HTTP 'POST /user' operation and returns the [Response].
  63. /// Parameters:
  64. ///
  65. /// * [CreateUserDto] createUserDto (required):
  66. Future<Response> createUserWithHttpInfo(CreateUserDto createUserDto,) async {
  67. // ignore: prefer_const_declarations
  68. final path = r'/user';
  69. // ignore: prefer_final_locals
  70. Object? postBody = createUserDto;
  71. final queryParams = <QueryParam>[];
  72. final headerParams = <String, String>{};
  73. final formParams = <String, String>{};
  74. const contentTypes = <String>['application/json'];
  75. return apiClient.invokeAPI(
  76. path,
  77. 'POST',
  78. queryParams,
  79. postBody,
  80. headerParams,
  81. formParams,
  82. contentTypes.isEmpty ? null : contentTypes.first,
  83. );
  84. }
  85. /// Parameters:
  86. ///
  87. /// * [CreateUserDto] createUserDto (required):
  88. Future<UserResponseDto?> createUser(CreateUserDto createUserDto,) async {
  89. final response = await createUserWithHttpInfo(createUserDto,);
  90. if (response.statusCode >= HttpStatus.badRequest) {
  91. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  92. }
  93. // When a remote server returns no body with a status of 204, we shall not decode it.
  94. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  95. // FormatException when trying to decode an empty string.
  96. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  97. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  98. }
  99. return null;
  100. }
  101. /// Performs an HTTP 'DELETE /user/profile-image' operation and returns the [Response].
  102. Future<Response> deleteProfileImageWithHttpInfo() async {
  103. // ignore: prefer_const_declarations
  104. final path = r'/user/profile-image';
  105. // ignore: prefer_final_locals
  106. Object? postBody;
  107. final queryParams = <QueryParam>[];
  108. final headerParams = <String, String>{};
  109. final formParams = <String, String>{};
  110. const contentTypes = <String>[];
  111. return apiClient.invokeAPI(
  112. path,
  113. 'DELETE',
  114. queryParams,
  115. postBody,
  116. headerParams,
  117. formParams,
  118. contentTypes.isEmpty ? null : contentTypes.first,
  119. );
  120. }
  121. Future<void> deleteProfileImage() async {
  122. final response = await deleteProfileImageWithHttpInfo();
  123. if (response.statusCode >= HttpStatus.badRequest) {
  124. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  125. }
  126. }
  127. /// Performs an HTTP 'DELETE /user/{id}' operation and returns the [Response].
  128. /// Parameters:
  129. ///
  130. /// * [String] id (required):
  131. Future<Response> deleteUserWithHttpInfo(String id,) async {
  132. // ignore: prefer_const_declarations
  133. final path = r'/user/{id}'
  134. .replaceAll('{id}', id);
  135. // ignore: prefer_final_locals
  136. Object? postBody;
  137. final queryParams = <QueryParam>[];
  138. final headerParams = <String, String>{};
  139. final formParams = <String, String>{};
  140. const contentTypes = <String>[];
  141. return apiClient.invokeAPI(
  142. path,
  143. 'DELETE',
  144. queryParams,
  145. postBody,
  146. headerParams,
  147. formParams,
  148. contentTypes.isEmpty ? null : contentTypes.first,
  149. );
  150. }
  151. /// Parameters:
  152. ///
  153. /// * [String] id (required):
  154. Future<UserResponseDto?> deleteUser(String id,) async {
  155. final response = await deleteUserWithHttpInfo(id,);
  156. if (response.statusCode >= HttpStatus.badRequest) {
  157. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  158. }
  159. // When a remote server returns no body with a status of 204, we shall not decode it.
  160. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  161. // FormatException when trying to decode an empty string.
  162. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  163. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  164. }
  165. return null;
  166. }
  167. /// Performs an HTTP 'GET /user' operation and returns the [Response].
  168. /// Parameters:
  169. ///
  170. /// * [bool] isAll (required):
  171. Future<Response> getAllUsersWithHttpInfo(bool isAll,) async {
  172. // ignore: prefer_const_declarations
  173. final path = r'/user';
  174. // ignore: prefer_final_locals
  175. Object? postBody;
  176. final queryParams = <QueryParam>[];
  177. final headerParams = <String, String>{};
  178. final formParams = <String, String>{};
  179. queryParams.addAll(_queryParams('', 'isAll', isAll));
  180. const contentTypes = <String>[];
  181. return apiClient.invokeAPI(
  182. path,
  183. 'GET',
  184. queryParams,
  185. postBody,
  186. headerParams,
  187. formParams,
  188. contentTypes.isEmpty ? null : contentTypes.first,
  189. );
  190. }
  191. /// Parameters:
  192. ///
  193. /// * [bool] isAll (required):
  194. Future<List<UserResponseDto>?> getAllUsers(bool isAll,) async {
  195. final response = await getAllUsersWithHttpInfo(isAll,);
  196. if (response.statusCode >= HttpStatus.badRequest) {
  197. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  198. }
  199. // When a remote server returns no body with a status of 204, we shall not decode it.
  200. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  201. // FormatException when trying to decode an empty string.
  202. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  203. final responseBody = await _decodeBodyBytes(response);
  204. return (await apiClient.deserializeAsync(responseBody, 'List<UserResponseDto>') as List)
  205. .cast<UserResponseDto>()
  206. .toList();
  207. }
  208. return null;
  209. }
  210. /// Performs an HTTP 'GET /user/me' operation and returns the [Response].
  211. Future<Response> getMyUserInfoWithHttpInfo() async {
  212. // ignore: prefer_const_declarations
  213. final path = r'/user/me';
  214. // ignore: prefer_final_locals
  215. Object? postBody;
  216. final queryParams = <QueryParam>[];
  217. final headerParams = <String, String>{};
  218. final formParams = <String, String>{};
  219. const contentTypes = <String>[];
  220. return apiClient.invokeAPI(
  221. path,
  222. 'GET',
  223. queryParams,
  224. postBody,
  225. headerParams,
  226. formParams,
  227. contentTypes.isEmpty ? null : contentTypes.first,
  228. );
  229. }
  230. Future<UserResponseDto?> getMyUserInfo() async {
  231. final response = await getMyUserInfoWithHttpInfo();
  232. if (response.statusCode >= HttpStatus.badRequest) {
  233. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  234. }
  235. // When a remote server returns no body with a status of 204, we shall not decode it.
  236. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  237. // FormatException when trying to decode an empty string.
  238. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  239. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  240. }
  241. return null;
  242. }
  243. /// Performs an HTTP 'GET /user/profile-image/{id}' operation and returns the [Response].
  244. /// Parameters:
  245. ///
  246. /// * [String] id (required):
  247. Future<Response> getProfileImageWithHttpInfo(String id,) async {
  248. // ignore: prefer_const_declarations
  249. final path = r'/user/profile-image/{id}'
  250. .replaceAll('{id}', id);
  251. // ignore: prefer_final_locals
  252. Object? postBody;
  253. final queryParams = <QueryParam>[];
  254. final headerParams = <String, String>{};
  255. final formParams = <String, String>{};
  256. const contentTypes = <String>[];
  257. return apiClient.invokeAPI(
  258. path,
  259. 'GET',
  260. queryParams,
  261. postBody,
  262. headerParams,
  263. formParams,
  264. contentTypes.isEmpty ? null : contentTypes.first,
  265. );
  266. }
  267. /// Parameters:
  268. ///
  269. /// * [String] id (required):
  270. Future<Object?> getProfileImage(String id,) async {
  271. final response = await getProfileImageWithHttpInfo(id,);
  272. if (response.statusCode >= HttpStatus.badRequest) {
  273. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  274. }
  275. // When a remote server returns no body with a status of 204, we shall not decode it.
  276. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  277. // FormatException when trying to decode an empty string.
  278. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  279. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Object',) as Object;
  280. }
  281. return null;
  282. }
  283. /// Performs an HTTP 'GET /user/info/{id}' operation and returns the [Response].
  284. /// Parameters:
  285. ///
  286. /// * [String] id (required):
  287. Future<Response> getUserByIdWithHttpInfo(String id,) async {
  288. // ignore: prefer_const_declarations
  289. final path = r'/user/info/{id}'
  290. .replaceAll('{id}', id);
  291. // ignore: prefer_final_locals
  292. Object? postBody;
  293. final queryParams = <QueryParam>[];
  294. final headerParams = <String, String>{};
  295. final formParams = <String, String>{};
  296. const contentTypes = <String>[];
  297. return apiClient.invokeAPI(
  298. path,
  299. 'GET',
  300. queryParams,
  301. postBody,
  302. headerParams,
  303. formParams,
  304. contentTypes.isEmpty ? null : contentTypes.first,
  305. );
  306. }
  307. /// Parameters:
  308. ///
  309. /// * [String] id (required):
  310. Future<UserResponseDto?> getUserById(String id,) async {
  311. final response = await getUserByIdWithHttpInfo(id,);
  312. if (response.statusCode >= HttpStatus.badRequest) {
  313. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  314. }
  315. // When a remote server returns no body with a status of 204, we shall not decode it.
  316. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  317. // FormatException when trying to decode an empty string.
  318. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  319. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  320. }
  321. return null;
  322. }
  323. /// Performs an HTTP 'POST /user/{id}/restore' operation and returns the [Response].
  324. /// Parameters:
  325. ///
  326. /// * [String] id (required):
  327. Future<Response> restoreUserWithHttpInfo(String id,) async {
  328. // ignore: prefer_const_declarations
  329. final path = r'/user/{id}/restore'
  330. .replaceAll('{id}', id);
  331. // ignore: prefer_final_locals
  332. Object? postBody;
  333. final queryParams = <QueryParam>[];
  334. final headerParams = <String, String>{};
  335. final formParams = <String, String>{};
  336. const contentTypes = <String>[];
  337. return apiClient.invokeAPI(
  338. path,
  339. 'POST',
  340. queryParams,
  341. postBody,
  342. headerParams,
  343. formParams,
  344. contentTypes.isEmpty ? null : contentTypes.first,
  345. );
  346. }
  347. /// Parameters:
  348. ///
  349. /// * [String] id (required):
  350. Future<UserResponseDto?> restoreUser(String id,) async {
  351. final response = await restoreUserWithHttpInfo(id,);
  352. if (response.statusCode >= HttpStatus.badRequest) {
  353. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  354. }
  355. // When a remote server returns no body with a status of 204, we shall not decode it.
  356. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  357. // FormatException when trying to decode an empty string.
  358. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  359. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  360. }
  361. return null;
  362. }
  363. /// Performs an HTTP 'PUT /user' operation and returns the [Response].
  364. /// Parameters:
  365. ///
  366. /// * [UpdateUserDto] updateUserDto (required):
  367. Future<Response> updateUserWithHttpInfo(UpdateUserDto updateUserDto,) async {
  368. // ignore: prefer_const_declarations
  369. final path = r'/user';
  370. // ignore: prefer_final_locals
  371. Object? postBody = updateUserDto;
  372. final queryParams = <QueryParam>[];
  373. final headerParams = <String, String>{};
  374. final formParams = <String, String>{};
  375. const contentTypes = <String>['application/json'];
  376. return apiClient.invokeAPI(
  377. path,
  378. 'PUT',
  379. queryParams,
  380. postBody,
  381. headerParams,
  382. formParams,
  383. contentTypes.isEmpty ? null : contentTypes.first,
  384. );
  385. }
  386. /// Parameters:
  387. ///
  388. /// * [UpdateUserDto] updateUserDto (required):
  389. Future<UserResponseDto?> updateUser(UpdateUserDto updateUserDto,) async {
  390. final response = await updateUserWithHttpInfo(updateUserDto,);
  391. if (response.statusCode >= HttpStatus.badRequest) {
  392. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  393. }
  394. // When a remote server returns no body with a status of 204, we shall not decode it.
  395. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  396. // FormatException when trying to decode an empty string.
  397. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  398. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  399. }
  400. return null;
  401. }
  402. }