asset_api.dart 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  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 AssetApi {
  11. AssetApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
  12. final ApiClient apiClient;
  13. ///
  14. ///
  15. /// Check duplicated asset before uploading - for Web upload used
  16. ///
  17. /// Note: This method returns the HTTP [Response].
  18. ///
  19. /// Parameters:
  20. ///
  21. /// * [CheckDuplicateAssetDto] checkDuplicateAssetDto (required):
  22. Future<Response> checkDuplicateAssetWithHttpInfo(CheckDuplicateAssetDto checkDuplicateAssetDto,) async {
  23. // ignore: prefer_const_declarations
  24. final path = r'/asset/check';
  25. // ignore: prefer_final_locals
  26. Object? postBody = checkDuplicateAssetDto;
  27. final queryParams = <QueryParam>[];
  28. final headerParams = <String, String>{};
  29. final formParams = <String, String>{};
  30. const contentTypes = <String>['application/json'];
  31. return apiClient.invokeAPI(
  32. path,
  33. 'POST',
  34. queryParams,
  35. postBody,
  36. headerParams,
  37. formParams,
  38. contentTypes.isEmpty ? null : contentTypes.first,
  39. );
  40. }
  41. ///
  42. ///
  43. /// Check duplicated asset before uploading - for Web upload used
  44. ///
  45. /// Parameters:
  46. ///
  47. /// * [CheckDuplicateAssetDto] checkDuplicateAssetDto (required):
  48. Future<CheckDuplicateAssetResponseDto?> checkDuplicateAsset(CheckDuplicateAssetDto checkDuplicateAssetDto,) async {
  49. final response = await checkDuplicateAssetWithHttpInfo(checkDuplicateAssetDto,);
  50. if (response.statusCode >= HttpStatus.badRequest) {
  51. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  52. }
  53. // When a remote server returns no body with a status of 204, we shall not decode it.
  54. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  55. // FormatException when trying to decode an empty string.
  56. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  57. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'CheckDuplicateAssetResponseDto',) as CheckDuplicateAssetResponseDto;
  58. }
  59. return null;
  60. }
  61. /// Performs an HTTP 'DELETE /asset' operation and returns the [Response].
  62. /// Parameters:
  63. ///
  64. /// * [DeleteAssetDto] deleteAssetDto (required):
  65. Future<Response> deleteAssetWithHttpInfo(DeleteAssetDto deleteAssetDto,) async {
  66. // ignore: prefer_const_declarations
  67. final path = r'/asset';
  68. // ignore: prefer_final_locals
  69. Object? postBody = deleteAssetDto;
  70. final queryParams = <QueryParam>[];
  71. final headerParams = <String, String>{};
  72. final formParams = <String, String>{};
  73. const contentTypes = <String>['application/json'];
  74. return apiClient.invokeAPI(
  75. path,
  76. 'DELETE',
  77. queryParams,
  78. postBody,
  79. headerParams,
  80. formParams,
  81. contentTypes.isEmpty ? null : contentTypes.first,
  82. );
  83. }
  84. /// Parameters:
  85. ///
  86. /// * [DeleteAssetDto] deleteAssetDto (required):
  87. Future<List<DeleteAssetResponseDto>?> deleteAsset(DeleteAssetDto deleteAssetDto,) async {
  88. final response = await deleteAssetWithHttpInfo(deleteAssetDto,);
  89. if (response.statusCode >= HttpStatus.badRequest) {
  90. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  91. }
  92. // When a remote server returns no body with a status of 204, we shall not decode it.
  93. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  94. // FormatException when trying to decode an empty string.
  95. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  96. final responseBody = await _decodeBodyBytes(response);
  97. return (await apiClient.deserializeAsync(responseBody, 'List<DeleteAssetResponseDto>') as List)
  98. .cast<DeleteAssetResponseDto>()
  99. .toList();
  100. }
  101. return null;
  102. }
  103. /// Performs an HTTP 'GET /asset/download' operation and returns the [Response].
  104. /// Parameters:
  105. ///
  106. /// * [String] aid (required):
  107. ///
  108. /// * [String] did (required):
  109. ///
  110. /// * [bool] isThumb:
  111. ///
  112. /// * [bool] isWeb:
  113. Future<Response> downloadFileWithHttpInfo(String aid, String did, { bool? isThumb, bool? isWeb, }) async {
  114. // ignore: prefer_const_declarations
  115. final path = r'/asset/download';
  116. // ignore: prefer_final_locals
  117. Object? postBody;
  118. final queryParams = <QueryParam>[];
  119. final headerParams = <String, String>{};
  120. final formParams = <String, String>{};
  121. queryParams.addAll(_queryParams('', 'aid', aid));
  122. queryParams.addAll(_queryParams('', 'did', did));
  123. if (isThumb != null) {
  124. queryParams.addAll(_queryParams('', 'isThumb', isThumb));
  125. }
  126. if (isWeb != null) {
  127. queryParams.addAll(_queryParams('', 'isWeb', isWeb));
  128. }
  129. const contentTypes = <String>[];
  130. return apiClient.invokeAPI(
  131. path,
  132. 'GET',
  133. queryParams,
  134. postBody,
  135. headerParams,
  136. formParams,
  137. contentTypes.isEmpty ? null : contentTypes.first,
  138. );
  139. }
  140. /// Parameters:
  141. ///
  142. /// * [String] aid (required):
  143. ///
  144. /// * [String] did (required):
  145. ///
  146. /// * [bool] isThumb:
  147. ///
  148. /// * [bool] isWeb:
  149. Future<Object?> downloadFile(String aid, String did, { bool? isThumb, bool? isWeb, }) async {
  150. final response = await downloadFileWithHttpInfo(aid, did, isThumb: isThumb, isWeb: isWeb, );
  151. if (response.statusCode >= HttpStatus.badRequest) {
  152. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  153. }
  154. // When a remote server returns no body with a status of 204, we shall not decode it.
  155. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  156. // FormatException when trying to decode an empty string.
  157. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  158. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Object',) as Object;
  159. }
  160. return null;
  161. }
  162. ///
  163. ///
  164. /// Get all AssetEntity belong to the user
  165. ///
  166. /// Note: This method returns the HTTP [Response].
  167. Future<Response> getAllAssetsWithHttpInfo() async {
  168. // ignore: prefer_const_declarations
  169. final path = r'/asset';
  170. // ignore: prefer_final_locals
  171. Object? postBody;
  172. final queryParams = <QueryParam>[];
  173. final headerParams = <String, String>{};
  174. final formParams = <String, String>{};
  175. const contentTypes = <String>[];
  176. return apiClient.invokeAPI(
  177. path,
  178. 'GET',
  179. queryParams,
  180. postBody,
  181. headerParams,
  182. formParams,
  183. contentTypes.isEmpty ? null : contentTypes.first,
  184. );
  185. }
  186. ///
  187. ///
  188. /// Get all AssetEntity belong to the user
  189. Future<List<AssetResponseDto>?> getAllAssets() async {
  190. final response = await getAllAssetsWithHttpInfo();
  191. if (response.statusCode >= HttpStatus.badRequest) {
  192. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  193. }
  194. // When a remote server returns no body with a status of 204, we shall not decode it.
  195. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  196. // FormatException when trying to decode an empty string.
  197. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  198. final responseBody = await _decodeBodyBytes(response);
  199. return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
  200. .cast<AssetResponseDto>()
  201. .toList();
  202. }
  203. return null;
  204. }
  205. ///
  206. ///
  207. /// Get a single asset's information
  208. ///
  209. /// Note: This method returns the HTTP [Response].
  210. ///
  211. /// Parameters:
  212. ///
  213. /// * [String] assetId (required):
  214. Future<Response> getAssetByIdWithHttpInfo(String assetId,) async {
  215. // ignore: prefer_const_declarations
  216. final path = r'/asset/assetById/{assetId}'
  217. .replaceAll('{assetId}', assetId);
  218. // ignore: prefer_final_locals
  219. Object? postBody;
  220. final queryParams = <QueryParam>[];
  221. final headerParams = <String, String>{};
  222. final formParams = <String, String>{};
  223. const contentTypes = <String>[];
  224. return apiClient.invokeAPI(
  225. path,
  226. 'GET',
  227. queryParams,
  228. postBody,
  229. headerParams,
  230. formParams,
  231. contentTypes.isEmpty ? null : contentTypes.first,
  232. );
  233. }
  234. ///
  235. ///
  236. /// Get a single asset's information
  237. ///
  238. /// Parameters:
  239. ///
  240. /// * [String] assetId (required):
  241. Future<AssetResponseDto?> getAssetById(String assetId,) async {
  242. final response = await getAssetByIdWithHttpInfo(assetId,);
  243. if (response.statusCode >= HttpStatus.badRequest) {
  244. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  245. }
  246. // When a remote server returns no body with a status of 204, we shall not decode it.
  247. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  248. // FormatException when trying to decode an empty string.
  249. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  250. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetResponseDto',) as AssetResponseDto;
  251. }
  252. return null;
  253. }
  254. /// Performs an HTTP 'GET /asset/count-by-date' operation and returns the [Response].
  255. /// Parameters:
  256. ///
  257. /// * [GetAssetCountByTimeGroupDto] getAssetCountByTimeGroupDto (required):
  258. Future<Response> getAssetCountByTimeGroupWithHttpInfo(GetAssetCountByTimeGroupDto getAssetCountByTimeGroupDto,) async {
  259. // ignore: prefer_const_declarations
  260. final path = r'/asset/count-by-date';
  261. // ignore: prefer_final_locals
  262. Object? postBody = getAssetCountByTimeGroupDto;
  263. final queryParams = <QueryParam>[];
  264. final headerParams = <String, String>{};
  265. final formParams = <String, String>{};
  266. const contentTypes = <String>['application/json'];
  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. /// Parameters:
  278. ///
  279. /// * [GetAssetCountByTimeGroupDto] getAssetCountByTimeGroupDto (required):
  280. Future<AssetCountByTimeGroupResponseDto?> getAssetCountByTimeGroup(GetAssetCountByTimeGroupDto getAssetCountByTimeGroupDto,) async {
  281. final response = await getAssetCountByTimeGroupWithHttpInfo(getAssetCountByTimeGroupDto,);
  282. if (response.statusCode >= HttpStatus.badRequest) {
  283. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  284. }
  285. // When a remote server returns no body with a status of 204, we shall not decode it.
  286. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  287. // FormatException when trying to decode an empty string.
  288. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  289. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetCountByTimeGroupResponseDto',) as AssetCountByTimeGroupResponseDto;
  290. }
  291. return null;
  292. }
  293. /// Performs an HTTP 'GET /asset/search-terms' operation and returns the [Response].
  294. Future<Response> getAssetSearchTermsWithHttpInfo() async {
  295. // ignore: prefer_const_declarations
  296. final path = r'/asset/search-terms';
  297. // ignore: prefer_final_locals
  298. Object? postBody;
  299. final queryParams = <QueryParam>[];
  300. final headerParams = <String, String>{};
  301. final formParams = <String, String>{};
  302. const contentTypes = <String>[];
  303. return apiClient.invokeAPI(
  304. path,
  305. 'GET',
  306. queryParams,
  307. postBody,
  308. headerParams,
  309. formParams,
  310. contentTypes.isEmpty ? null : contentTypes.first,
  311. );
  312. }
  313. Future<List<String>?> getAssetSearchTerms() async {
  314. final response = await getAssetSearchTermsWithHttpInfo();
  315. if (response.statusCode >= HttpStatus.badRequest) {
  316. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  317. }
  318. // When a remote server returns no body with a status of 204, we shall not decode it.
  319. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  320. // FormatException when trying to decode an empty string.
  321. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  322. final responseBody = await _decodeBodyBytes(response);
  323. return (await apiClient.deserializeAsync(responseBody, 'List<String>') as List)
  324. .cast<String>()
  325. .toList();
  326. }
  327. return null;
  328. }
  329. /// Performs an HTTP 'GET /asset/thumbnail/{assetId}' operation and returns the [Response].
  330. /// Parameters:
  331. ///
  332. /// * [String] assetId (required):
  333. ///
  334. /// * [ThumbnailFormat] format:
  335. Future<Response> getAssetThumbnailWithHttpInfo(String assetId, { ThumbnailFormat? format, }) async {
  336. // ignore: prefer_const_declarations
  337. final path = r'/asset/thumbnail/{assetId}'
  338. .replaceAll('{assetId}', assetId);
  339. // ignore: prefer_final_locals
  340. Object? postBody;
  341. final queryParams = <QueryParam>[];
  342. final headerParams = <String, String>{};
  343. final formParams = <String, String>{};
  344. if (format != null) {
  345. queryParams.addAll(_queryParams('', 'format', format));
  346. }
  347. const contentTypes = <String>[];
  348. return apiClient.invokeAPI(
  349. path,
  350. 'GET',
  351. queryParams,
  352. postBody,
  353. headerParams,
  354. formParams,
  355. contentTypes.isEmpty ? null : contentTypes.first,
  356. );
  357. }
  358. /// Parameters:
  359. ///
  360. /// * [String] assetId (required):
  361. ///
  362. /// * [ThumbnailFormat] format:
  363. Future<Object?> getAssetThumbnail(String assetId, { ThumbnailFormat? format, }) async {
  364. final response = await getAssetThumbnailWithHttpInfo(assetId, format: format, );
  365. if (response.statusCode >= HttpStatus.badRequest) {
  366. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  367. }
  368. // When a remote server returns no body with a status of 204, we shall not decode it.
  369. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  370. // FormatException when trying to decode an empty string.
  371. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  372. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Object',) as Object;
  373. }
  374. return null;
  375. }
  376. /// Performs an HTTP 'GET /asset/curated-locations' operation and returns the [Response].
  377. Future<Response> getCuratedLocationsWithHttpInfo() async {
  378. // ignore: prefer_const_declarations
  379. final path = r'/asset/curated-locations';
  380. // ignore: prefer_final_locals
  381. Object? postBody;
  382. final queryParams = <QueryParam>[];
  383. final headerParams = <String, String>{};
  384. final formParams = <String, String>{};
  385. const contentTypes = <String>[];
  386. return apiClient.invokeAPI(
  387. path,
  388. 'GET',
  389. queryParams,
  390. postBody,
  391. headerParams,
  392. formParams,
  393. contentTypes.isEmpty ? null : contentTypes.first,
  394. );
  395. }
  396. Future<List<CuratedLocationsResponseDto>?> getCuratedLocations() async {
  397. final response = await getCuratedLocationsWithHttpInfo();
  398. if (response.statusCode >= HttpStatus.badRequest) {
  399. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  400. }
  401. // When a remote server returns no body with a status of 204, we shall not decode it.
  402. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  403. // FormatException when trying to decode an empty string.
  404. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  405. final responseBody = await _decodeBodyBytes(response);
  406. return (await apiClient.deserializeAsync(responseBody, 'List<CuratedLocationsResponseDto>') as List)
  407. .cast<CuratedLocationsResponseDto>()
  408. .toList();
  409. }
  410. return null;
  411. }
  412. /// Performs an HTTP 'GET /asset/curated-objects' operation and returns the [Response].
  413. Future<Response> getCuratedObjectsWithHttpInfo() async {
  414. // ignore: prefer_const_declarations
  415. final path = r'/asset/curated-objects';
  416. // ignore: prefer_final_locals
  417. Object? postBody;
  418. final queryParams = <QueryParam>[];
  419. final headerParams = <String, String>{};
  420. final formParams = <String, String>{};
  421. const contentTypes = <String>[];
  422. return apiClient.invokeAPI(
  423. path,
  424. 'GET',
  425. queryParams,
  426. postBody,
  427. headerParams,
  428. formParams,
  429. contentTypes.isEmpty ? null : contentTypes.first,
  430. );
  431. }
  432. Future<List<CuratedObjectsResponseDto>?> getCuratedObjects() async {
  433. final response = await getCuratedObjectsWithHttpInfo();
  434. if (response.statusCode >= HttpStatus.badRequest) {
  435. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  436. }
  437. // When a remote server returns no body with a status of 204, we shall not decode it.
  438. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  439. // FormatException when trying to decode an empty string.
  440. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  441. final responseBody = await _decodeBodyBytes(response);
  442. return (await apiClient.deserializeAsync(responseBody, 'List<CuratedObjectsResponseDto>') as List)
  443. .cast<CuratedObjectsResponseDto>()
  444. .toList();
  445. }
  446. return null;
  447. }
  448. ///
  449. ///
  450. /// Get all asset of a device that are in the database, ID only.
  451. ///
  452. /// Note: This method returns the HTTP [Response].
  453. ///
  454. /// Parameters:
  455. ///
  456. /// * [String] deviceId (required):
  457. Future<Response> getUserAssetsByDeviceIdWithHttpInfo(String deviceId,) async {
  458. // ignore: prefer_const_declarations
  459. final path = r'/asset/{deviceId}'
  460. .replaceAll('{deviceId}', deviceId);
  461. // ignore: prefer_final_locals
  462. Object? postBody;
  463. final queryParams = <QueryParam>[];
  464. final headerParams = <String, String>{};
  465. final formParams = <String, String>{};
  466. const contentTypes = <String>[];
  467. return apiClient.invokeAPI(
  468. path,
  469. 'GET',
  470. queryParams,
  471. postBody,
  472. headerParams,
  473. formParams,
  474. contentTypes.isEmpty ? null : contentTypes.first,
  475. );
  476. }
  477. ///
  478. ///
  479. /// Get all asset of a device that are in the database, ID only.
  480. ///
  481. /// Parameters:
  482. ///
  483. /// * [String] deviceId (required):
  484. Future<List<String>?> getUserAssetsByDeviceId(String deviceId,) async {
  485. final response = await getUserAssetsByDeviceIdWithHttpInfo(deviceId,);
  486. if (response.statusCode >= HttpStatus.badRequest) {
  487. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  488. }
  489. // When a remote server returns no body with a status of 204, we shall not decode it.
  490. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  491. // FormatException when trying to decode an empty string.
  492. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  493. final responseBody = await _decodeBodyBytes(response);
  494. return (await apiClient.deserializeAsync(responseBody, 'List<String>') as List)
  495. .cast<String>()
  496. .toList();
  497. }
  498. return null;
  499. }
  500. /// Performs an HTTP 'POST /asset/search' operation and returns the [Response].
  501. /// Parameters:
  502. ///
  503. /// * [SearchAssetDto] searchAssetDto (required):
  504. Future<Response> searchAssetWithHttpInfo(SearchAssetDto searchAssetDto,) async {
  505. // ignore: prefer_const_declarations
  506. final path = r'/asset/search';
  507. // ignore: prefer_final_locals
  508. Object? postBody = searchAssetDto;
  509. final queryParams = <QueryParam>[];
  510. final headerParams = <String, String>{};
  511. final formParams = <String, String>{};
  512. const contentTypes = <String>['application/json'];
  513. return apiClient.invokeAPI(
  514. path,
  515. 'POST',
  516. queryParams,
  517. postBody,
  518. headerParams,
  519. formParams,
  520. contentTypes.isEmpty ? null : contentTypes.first,
  521. );
  522. }
  523. /// Parameters:
  524. ///
  525. /// * [SearchAssetDto] searchAssetDto (required):
  526. Future<List<AssetResponseDto>?> searchAsset(SearchAssetDto searchAssetDto,) async {
  527. final response = await searchAssetWithHttpInfo(searchAssetDto,);
  528. if (response.statusCode >= HttpStatus.badRequest) {
  529. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  530. }
  531. // When a remote server returns no body with a status of 204, we shall not decode it.
  532. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  533. // FormatException when trying to decode an empty string.
  534. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  535. final responseBody = await _decodeBodyBytes(response);
  536. return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
  537. .cast<AssetResponseDto>()
  538. .toList();
  539. }
  540. return null;
  541. }
  542. /// Performs an HTTP 'GET /asset/file' operation and returns the [Response].
  543. /// Parameters:
  544. ///
  545. /// * [String] aid (required):
  546. ///
  547. /// * [String] did (required):
  548. ///
  549. /// * [bool] isThumb:
  550. ///
  551. /// * [bool] isWeb:
  552. Future<Response> serveFileWithHttpInfo(String aid, String did, { bool? isThumb, bool? isWeb, }) async {
  553. // ignore: prefer_const_declarations
  554. final path = r'/asset/file';
  555. // ignore: prefer_final_locals
  556. Object? postBody;
  557. final queryParams = <QueryParam>[];
  558. final headerParams = <String, String>{};
  559. final formParams = <String, String>{};
  560. queryParams.addAll(_queryParams('', 'aid', aid));
  561. queryParams.addAll(_queryParams('', 'did', did));
  562. if (isThumb != null) {
  563. queryParams.addAll(_queryParams('', 'isThumb', isThumb));
  564. }
  565. if (isWeb != null) {
  566. queryParams.addAll(_queryParams('', 'isWeb', isWeb));
  567. }
  568. const contentTypes = <String>[];
  569. return apiClient.invokeAPI(
  570. path,
  571. 'GET',
  572. queryParams,
  573. postBody,
  574. headerParams,
  575. formParams,
  576. contentTypes.isEmpty ? null : contentTypes.first,
  577. );
  578. }
  579. /// Parameters:
  580. ///
  581. /// * [String] aid (required):
  582. ///
  583. /// * [String] did (required):
  584. ///
  585. /// * [bool] isThumb:
  586. ///
  587. /// * [bool] isWeb:
  588. Future<Object?> serveFile(String aid, String did, { bool? isThumb, bool? isWeb, }) async {
  589. final response = await serveFileWithHttpInfo(aid, did, isThumb: isThumb, isWeb: isWeb, );
  590. if (response.statusCode >= HttpStatus.badRequest) {
  591. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  592. }
  593. // When a remote server returns no body with a status of 204, we shall not decode it.
  594. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  595. // FormatException when trying to decode an empty string.
  596. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  597. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Object',) as Object;
  598. }
  599. return null;
  600. }
  601. /// Performs an HTTP 'POST /asset/upload' operation and returns the [Response].
  602. /// Parameters:
  603. ///
  604. /// * [MultipartFile] assetData (required):
  605. Future<Response> uploadFileWithHttpInfo(MultipartFile assetData,) async {
  606. // ignore: prefer_const_declarations
  607. final path = r'/asset/upload';
  608. // ignore: prefer_final_locals
  609. Object? postBody;
  610. final queryParams = <QueryParam>[];
  611. final headerParams = <String, String>{};
  612. final formParams = <String, String>{};
  613. const contentTypes = <String>['multipart/form-data'];
  614. bool hasFields = false;
  615. final mp = MultipartRequest('POST', Uri.parse(path));
  616. if (assetData != null) {
  617. hasFields = true;
  618. mp.fields[r'assetData'] = assetData.field;
  619. mp.files.add(assetData);
  620. }
  621. if (hasFields) {
  622. postBody = mp;
  623. }
  624. return apiClient.invokeAPI(
  625. path,
  626. 'POST',
  627. queryParams,
  628. postBody,
  629. headerParams,
  630. formParams,
  631. contentTypes.isEmpty ? null : contentTypes.first,
  632. );
  633. }
  634. /// Parameters:
  635. ///
  636. /// * [MultipartFile] assetData (required):
  637. Future<AssetFileUploadResponseDto?> uploadFile(MultipartFile assetData,) async {
  638. final response = await uploadFileWithHttpInfo(assetData,);
  639. if (response.statusCode >= HttpStatus.badRequest) {
  640. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  641. }
  642. // When a remote server returns no body with a status of 204, we shall not decode it.
  643. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  644. // FormatException when trying to decode an empty string.
  645. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  646. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetFileUploadResponseDto',) as AssetFileUploadResponseDto;
  647. }
  648. return null;
  649. }
  650. }