user_api.dart 16 KB

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