user_api.dart 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  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/{userId}' operation and returns the [Response].
  102. /// Parameters:
  103. ///
  104. /// * [String] userId (required):
  105. Future<Response> deleteUserWithHttpInfo(String userId,) async {
  106. // ignore: prefer_const_declarations
  107. final path = r'/user/{userId}'
  108. .replaceAll('{userId}', userId);
  109. // ignore: prefer_final_locals
  110. Object? postBody;
  111. final queryParams = <QueryParam>[];
  112. final headerParams = <String, String>{};
  113. final formParams = <String, String>{};
  114. const contentTypes = <String>[];
  115. return apiClient.invokeAPI(
  116. path,
  117. 'DELETE',
  118. queryParams,
  119. postBody,
  120. headerParams,
  121. formParams,
  122. contentTypes.isEmpty ? null : contentTypes.first,
  123. );
  124. }
  125. /// Parameters:
  126. ///
  127. /// * [String] userId (required):
  128. Future<UserResponseDto?> deleteUser(String userId,) async {
  129. final response = await deleteUserWithHttpInfo(userId,);
  130. if (response.statusCode >= HttpStatus.badRequest) {
  131. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  132. }
  133. // When a remote server returns no body with a status of 204, we shall not decode it.
  134. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  135. // FormatException when trying to decode an empty string.
  136. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  137. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  138. }
  139. return null;
  140. }
  141. /// Performs an HTTP 'GET /user' operation and returns the [Response].
  142. /// Parameters:
  143. ///
  144. /// * [bool] isAll (required):
  145. Future<Response> getAllUsersWithHttpInfo(bool isAll,) async {
  146. // ignore: prefer_const_declarations
  147. final path = r'/user';
  148. // ignore: prefer_final_locals
  149. Object? postBody;
  150. final queryParams = <QueryParam>[];
  151. final headerParams = <String, String>{};
  152. final formParams = <String, String>{};
  153. queryParams.addAll(_queryParams('', 'isAll', isAll));
  154. const contentTypes = <String>[];
  155. return apiClient.invokeAPI(
  156. path,
  157. 'GET',
  158. queryParams,
  159. postBody,
  160. headerParams,
  161. formParams,
  162. contentTypes.isEmpty ? null : contentTypes.first,
  163. );
  164. }
  165. /// Parameters:
  166. ///
  167. /// * [bool] isAll (required):
  168. Future<List<UserResponseDto>?> getAllUsers(bool isAll,) async {
  169. final response = await getAllUsersWithHttpInfo(isAll,);
  170. if (response.statusCode >= HttpStatus.badRequest) {
  171. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  172. }
  173. // When a remote server returns no body with a status of 204, we shall not decode it.
  174. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  175. // FormatException when trying to decode an empty string.
  176. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  177. final responseBody = await _decodeBodyBytes(response);
  178. return (await apiClient.deserializeAsync(responseBody, 'List<UserResponseDto>') as List)
  179. .cast<UserResponseDto>()
  180. .toList();
  181. }
  182. return null;
  183. }
  184. /// Performs an HTTP 'GET /user/me' operation and returns the [Response].
  185. Future<Response> getMyUserInfoWithHttpInfo() async {
  186. // ignore: prefer_const_declarations
  187. final path = r'/user/me';
  188. // ignore: prefer_final_locals
  189. Object? postBody;
  190. final queryParams = <QueryParam>[];
  191. final headerParams = <String, String>{};
  192. final formParams = <String, String>{};
  193. const contentTypes = <String>[];
  194. return apiClient.invokeAPI(
  195. path,
  196. 'GET',
  197. queryParams,
  198. postBody,
  199. headerParams,
  200. formParams,
  201. contentTypes.isEmpty ? null : contentTypes.first,
  202. );
  203. }
  204. Future<UserResponseDto?> getMyUserInfo() async {
  205. final response = await getMyUserInfoWithHttpInfo();
  206. if (response.statusCode >= HttpStatus.badRequest) {
  207. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  208. }
  209. // When a remote server returns no body with a status of 204, we shall not decode it.
  210. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  211. // FormatException when trying to decode an empty string.
  212. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  213. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  214. }
  215. return null;
  216. }
  217. /// Performs an HTTP 'GET /user/profile-image/{userId}' operation and returns the [Response].
  218. /// Parameters:
  219. ///
  220. /// * [String] userId (required):
  221. Future<Response> getProfileImageWithHttpInfo(String userId,) async {
  222. // ignore: prefer_const_declarations
  223. final path = r'/user/profile-image/{userId}'
  224. .replaceAll('{userId}', userId);
  225. // ignore: prefer_final_locals
  226. Object? postBody;
  227. final queryParams = <QueryParam>[];
  228. final headerParams = <String, String>{};
  229. final formParams = <String, String>{};
  230. const contentTypes = <String>[];
  231. return apiClient.invokeAPI(
  232. path,
  233. 'GET',
  234. queryParams,
  235. postBody,
  236. headerParams,
  237. formParams,
  238. contentTypes.isEmpty ? null : contentTypes.first,
  239. );
  240. }
  241. /// Parameters:
  242. ///
  243. /// * [String] userId (required):
  244. Future<Object?> getProfileImage(String userId,) async {
  245. final response = await getProfileImageWithHttpInfo(userId,);
  246. if (response.statusCode >= HttpStatus.badRequest) {
  247. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  248. }
  249. // When a remote server returns no body with a status of 204, we shall not decode it.
  250. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  251. // FormatException when trying to decode an empty string.
  252. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  253. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Object',) as Object;
  254. }
  255. return null;
  256. }
  257. /// Performs an HTTP 'GET /user/info/{userId}' operation and returns the [Response].
  258. /// Parameters:
  259. ///
  260. /// * [String] userId (required):
  261. Future<Response> getUserByIdWithHttpInfo(String userId,) async {
  262. // ignore: prefer_const_declarations
  263. final path = r'/user/info/{userId}'
  264. .replaceAll('{userId}', userId);
  265. // ignore: prefer_final_locals
  266. Object? postBody;
  267. final queryParams = <QueryParam>[];
  268. final headerParams = <String, String>{};
  269. final formParams = <String, String>{};
  270. const contentTypes = <String>[];
  271. return apiClient.invokeAPI(
  272. path,
  273. 'GET',
  274. queryParams,
  275. postBody,
  276. headerParams,
  277. formParams,
  278. contentTypes.isEmpty ? null : contentTypes.first,
  279. );
  280. }
  281. /// Parameters:
  282. ///
  283. /// * [String] userId (required):
  284. Future<UserResponseDto?> getUserById(String userId,) async {
  285. final response = await getUserByIdWithHttpInfo(userId,);
  286. if (response.statusCode >= HttpStatus.badRequest) {
  287. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  288. }
  289. // When a remote server returns no body with a status of 204, we shall not decode it.
  290. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  291. // FormatException when trying to decode an empty string.
  292. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  293. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  294. }
  295. return null;
  296. }
  297. /// Performs an HTTP 'GET /user/count' operation and returns the [Response].
  298. /// Parameters:
  299. ///
  300. /// * [bool] admin:
  301. Future<Response> getUserCountWithHttpInfo({ bool? admin, }) async {
  302. // ignore: prefer_const_declarations
  303. final path = r'/user/count';
  304. // ignore: prefer_final_locals
  305. Object? postBody;
  306. final queryParams = <QueryParam>[];
  307. final headerParams = <String, String>{};
  308. final formParams = <String, String>{};
  309. if (admin != null) {
  310. queryParams.addAll(_queryParams('', 'admin', admin));
  311. }
  312. const contentTypes = <String>[];
  313. return apiClient.invokeAPI(
  314. path,
  315. 'GET',
  316. queryParams,
  317. postBody,
  318. headerParams,
  319. formParams,
  320. contentTypes.isEmpty ? null : contentTypes.first,
  321. );
  322. }
  323. /// Parameters:
  324. ///
  325. /// * [bool] admin:
  326. Future<UserCountResponseDto?> getUserCount({ bool? admin, }) async {
  327. final response = await getUserCountWithHttpInfo( admin: admin, );
  328. if (response.statusCode >= HttpStatus.badRequest) {
  329. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  330. }
  331. // When a remote server returns no body with a status of 204, we shall not decode it.
  332. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  333. // FormatException when trying to decode an empty string.
  334. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  335. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserCountResponseDto',) as UserCountResponseDto;
  336. }
  337. return null;
  338. }
  339. /// Performs an HTTP 'POST /user/{userId}/restore' operation and returns the [Response].
  340. /// Parameters:
  341. ///
  342. /// * [String] userId (required):
  343. Future<Response> restoreUserWithHttpInfo(String userId,) async {
  344. // ignore: prefer_const_declarations
  345. final path = r'/user/{userId}/restore'
  346. .replaceAll('{userId}', userId);
  347. // ignore: prefer_final_locals
  348. Object? postBody;
  349. final queryParams = <QueryParam>[];
  350. final headerParams = <String, String>{};
  351. final formParams = <String, String>{};
  352. const contentTypes = <String>[];
  353. return apiClient.invokeAPI(
  354. path,
  355. 'POST',
  356. queryParams,
  357. postBody,
  358. headerParams,
  359. formParams,
  360. contentTypes.isEmpty ? null : contentTypes.first,
  361. );
  362. }
  363. /// Parameters:
  364. ///
  365. /// * [String] userId (required):
  366. Future<UserResponseDto?> restoreUser(String userId,) async {
  367. final response = await restoreUserWithHttpInfo(userId,);
  368. if (response.statusCode >= HttpStatus.badRequest) {
  369. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  370. }
  371. // When a remote server returns no body with a status of 204, we shall not decode it.
  372. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  373. // FormatException when trying to decode an empty string.
  374. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  375. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  376. }
  377. return null;
  378. }
  379. /// Performs an HTTP 'PUT /user' operation and returns the [Response].
  380. /// Parameters:
  381. ///
  382. /// * [UpdateUserDto] updateUserDto (required):
  383. Future<Response> updateUserWithHttpInfo(UpdateUserDto updateUserDto,) async {
  384. // ignore: prefer_const_declarations
  385. final path = r'/user';
  386. // ignore: prefer_final_locals
  387. Object? postBody = updateUserDto;
  388. final queryParams = <QueryParam>[];
  389. final headerParams = <String, String>{};
  390. final formParams = <String, String>{};
  391. const contentTypes = <String>['application/json'];
  392. return apiClient.invokeAPI(
  393. path,
  394. 'PUT',
  395. queryParams,
  396. postBody,
  397. headerParams,
  398. formParams,
  399. contentTypes.isEmpty ? null : contentTypes.first,
  400. );
  401. }
  402. /// Parameters:
  403. ///
  404. /// * [UpdateUserDto] updateUserDto (required):
  405. Future<UserResponseDto?> updateUser(UpdateUserDto updateUserDto,) async {
  406. final response = await updateUserWithHttpInfo(updateUserDto,);
  407. if (response.statusCode >= HttpStatus.badRequest) {
  408. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  409. }
  410. // When a remote server returns no body with a status of 204, we shall not decode it.
  411. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  412. // FormatException when trying to decode an empty string.
  413. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  414. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  415. }
  416. return null;
  417. }
  418. }