user_api.dart 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  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 'GET /user' operation and returns the [Response].
  102. /// Parameters:
  103. ///
  104. /// * [bool] isAll (required):
  105. Future<Response> getAllUsersWithHttpInfo(bool isAll,) async {
  106. // ignore: prefer_const_declarations
  107. final path = r'/user';
  108. // ignore: prefer_final_locals
  109. Object? postBody;
  110. final queryParams = <QueryParam>[];
  111. final headerParams = <String, String>{};
  112. final formParams = <String, String>{};
  113. queryParams.addAll(_queryParams('', 'isAll', isAll));
  114. const contentTypes = <String>[];
  115. return apiClient.invokeAPI(
  116. path,
  117. 'GET',
  118. queryParams,
  119. postBody,
  120. headerParams,
  121. formParams,
  122. contentTypes.isEmpty ? null : contentTypes.first,
  123. );
  124. }
  125. /// Parameters:
  126. ///
  127. /// * [bool] isAll (required):
  128. Future<List<UserResponseDto>?> getAllUsers(bool isAll,) async {
  129. final response = await getAllUsersWithHttpInfo(isAll,);
  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. final responseBody = await _decodeBodyBytes(response);
  138. return (await apiClient.deserializeAsync(responseBody, 'List<UserResponseDto>') as List)
  139. .cast<UserResponseDto>()
  140. .toList();
  141. }
  142. return null;
  143. }
  144. /// Performs an HTTP 'GET /user/me' operation and returns the [Response].
  145. Future<Response> getMyUserInfoWithHttpInfo() async {
  146. // ignore: prefer_const_declarations
  147. final path = r'/user/me';
  148. // ignore: prefer_final_locals
  149. Object? postBody;
  150. final queryParams = <QueryParam>[];
  151. final headerParams = <String, String>{};
  152. final formParams = <String, String>{};
  153. const contentTypes = <String>[];
  154. return apiClient.invokeAPI(
  155. path,
  156. 'GET',
  157. queryParams,
  158. postBody,
  159. headerParams,
  160. formParams,
  161. contentTypes.isEmpty ? null : contentTypes.first,
  162. );
  163. }
  164. Future<UserResponseDto?> getMyUserInfo() async {
  165. final response = await getMyUserInfoWithHttpInfo();
  166. if (response.statusCode >= HttpStatus.badRequest) {
  167. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  168. }
  169. // When a remote server returns no body with a status of 204, we shall not decode it.
  170. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  171. // FormatException when trying to decode an empty string.
  172. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  173. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  174. }
  175. return null;
  176. }
  177. /// Performs an HTTP 'GET /user/profile-image/{userId}' operation and returns the [Response].
  178. /// Parameters:
  179. ///
  180. /// * [String] userId (required):
  181. Future<Response> getProfileImageWithHttpInfo(String userId,) async {
  182. // ignore: prefer_const_declarations
  183. final path = r'/user/profile-image/{userId}'
  184. .replaceAll('{userId}', userId);
  185. // ignore: prefer_final_locals
  186. Object? postBody;
  187. final queryParams = <QueryParam>[];
  188. final headerParams = <String, String>{};
  189. final formParams = <String, String>{};
  190. const contentTypes = <String>[];
  191. return apiClient.invokeAPI(
  192. path,
  193. 'GET',
  194. queryParams,
  195. postBody,
  196. headerParams,
  197. formParams,
  198. contentTypes.isEmpty ? null : contentTypes.first,
  199. );
  200. }
  201. /// Parameters:
  202. ///
  203. /// * [String] userId (required):
  204. Future<Object?> getProfileImage(String userId,) async {
  205. final response = await getProfileImageWithHttpInfo(userId,);
  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), 'Object',) as Object;
  214. }
  215. return null;
  216. }
  217. /// Performs an HTTP 'GET /user/{userId}' operation and returns the [Response].
  218. /// Parameters:
  219. ///
  220. /// * [String] userId (required):
  221. Future<Response> getUserByIdWithHttpInfo(String userId,) async {
  222. // ignore: prefer_const_declarations
  223. final path = r'/user/{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<UserResponseDto?> getUserById(String userId,) async {
  245. final response = await getUserByIdWithHttpInfo(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), 'UserResponseDto',) as UserResponseDto;
  254. }
  255. return null;
  256. }
  257. /// Performs an HTTP 'GET /user/count' operation and returns the [Response].
  258. Future<Response> getUserCountWithHttpInfo() async {
  259. // ignore: prefer_const_declarations
  260. final path = r'/user/count';
  261. // ignore: prefer_final_locals
  262. Object? postBody;
  263. final queryParams = <QueryParam>[];
  264. final headerParams = <String, String>{};
  265. final formParams = <String, String>{};
  266. const contentTypes = <String>[];
  267. return apiClient.invokeAPI(
  268. path,
  269. 'GET',
  270. queryParams,
  271. postBody,
  272. headerParams,
  273. formParams,
  274. contentTypes.isEmpty ? null : contentTypes.first,
  275. );
  276. }
  277. Future<UserCountResponseDto?> getUserCount() async {
  278. final response = await getUserCountWithHttpInfo();
  279. if (response.statusCode >= HttpStatus.badRequest) {
  280. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  281. }
  282. // When a remote server returns no body with a status of 204, we shall not decode it.
  283. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  284. // FormatException when trying to decode an empty string.
  285. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  286. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserCountResponseDto',) as UserCountResponseDto;
  287. }
  288. return null;
  289. }
  290. /// Performs an HTTP 'PUT /user' operation and returns the [Response].
  291. /// Parameters:
  292. ///
  293. /// * [UpdateUserDto] updateUserDto (required):
  294. Future<Response> updateUserWithHttpInfo(UpdateUserDto updateUserDto,) async {
  295. // ignore: prefer_const_declarations
  296. final path = r'/user';
  297. // ignore: prefer_final_locals
  298. Object? postBody = updateUserDto;
  299. final queryParams = <QueryParam>[];
  300. final headerParams = <String, String>{};
  301. final formParams = <String, String>{};
  302. const contentTypes = <String>['application/json'];
  303. return apiClient.invokeAPI(
  304. path,
  305. 'PUT',
  306. queryParams,
  307. postBody,
  308. headerParams,
  309. formParams,
  310. contentTypes.isEmpty ? null : contentTypes.first,
  311. );
  312. }
  313. /// Parameters:
  314. ///
  315. /// * [UpdateUserDto] updateUserDto (required):
  316. Future<UserResponseDto?> updateUser(UpdateUserDto updateUserDto,) async {
  317. final response = await updateUserWithHttpInfo(updateUserDto,);
  318. if (response.statusCode >= HttpStatus.badRequest) {
  319. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  320. }
  321. // When a remote server returns no body with a status of 204, we shall not decode it.
  322. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  323. // FormatException when trying to decode an empty string.
  324. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  325. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'UserResponseDto',) as UserResponseDto;
  326. }
  327. return null;
  328. }
  329. }