asset_api.dart 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820
  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 'POST /asset/time-bucket' operation and returns the [Response].
  255. /// Parameters:
  256. ///
  257. /// * [GetAssetByTimeBucketDto] getAssetByTimeBucketDto (required):
  258. Future<Response> getAssetByTimeBucketWithHttpInfo(GetAssetByTimeBucketDto getAssetByTimeBucketDto,) async {
  259. // ignore: prefer_const_declarations
  260. final path = r'/asset/time-bucket';
  261. // ignore: prefer_final_locals
  262. Object? postBody = getAssetByTimeBucketDto;
  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. 'POST',
  270. queryParams,
  271. postBody,
  272. headerParams,
  273. formParams,
  274. contentTypes.isEmpty ? null : contentTypes.first,
  275. );
  276. }
  277. /// Parameters:
  278. ///
  279. /// * [GetAssetByTimeBucketDto] getAssetByTimeBucketDto (required):
  280. Future<List<AssetResponseDto>?> getAssetByTimeBucket(GetAssetByTimeBucketDto getAssetByTimeBucketDto,) async {
  281. final response = await getAssetByTimeBucketWithHttpInfo(getAssetByTimeBucketDto,);
  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. final responseBody = await _decodeBodyBytes(response);
  290. return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
  291. .cast<AssetResponseDto>()
  292. .toList();
  293. }
  294. return null;
  295. }
  296. /// Performs an HTTP 'POST /asset/count-by-time-bucket' operation and returns the [Response].
  297. /// Parameters:
  298. ///
  299. /// * [GetAssetCountByTimeBucketDto] getAssetCountByTimeBucketDto (required):
  300. Future<Response> getAssetCountByTimeBucketWithHttpInfo(GetAssetCountByTimeBucketDto getAssetCountByTimeBucketDto,) async {
  301. // ignore: prefer_const_declarations
  302. final path = r'/asset/count-by-time-bucket';
  303. // ignore: prefer_final_locals
  304. Object? postBody = getAssetCountByTimeBucketDto;
  305. final queryParams = <QueryParam>[];
  306. final headerParams = <String, String>{};
  307. final formParams = <String, String>{};
  308. const contentTypes = <String>['application/json'];
  309. return apiClient.invokeAPI(
  310. path,
  311. 'POST',
  312. queryParams,
  313. postBody,
  314. headerParams,
  315. formParams,
  316. contentTypes.isEmpty ? null : contentTypes.first,
  317. );
  318. }
  319. /// Parameters:
  320. ///
  321. /// * [GetAssetCountByTimeBucketDto] getAssetCountByTimeBucketDto (required):
  322. Future<AssetCountByTimeBucketResponseDto?> getAssetCountByTimeBucket(GetAssetCountByTimeBucketDto getAssetCountByTimeBucketDto,) async {
  323. final response = await getAssetCountByTimeBucketWithHttpInfo(getAssetCountByTimeBucketDto,);
  324. if (response.statusCode >= HttpStatus.badRequest) {
  325. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  326. }
  327. // When a remote server returns no body with a status of 204, we shall not decode it.
  328. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  329. // FormatException when trying to decode an empty string.
  330. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  331. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetCountByTimeBucketResponseDto',) as AssetCountByTimeBucketResponseDto;
  332. }
  333. return null;
  334. }
  335. /// Performs an HTTP 'GET /asset/search-terms' operation and returns the [Response].
  336. Future<Response> getAssetSearchTermsWithHttpInfo() async {
  337. // ignore: prefer_const_declarations
  338. final path = r'/asset/search-terms';
  339. // ignore: prefer_final_locals
  340. Object? postBody;
  341. final queryParams = <QueryParam>[];
  342. final headerParams = <String, String>{};
  343. final formParams = <String, String>{};
  344. const contentTypes = <String>[];
  345. return apiClient.invokeAPI(
  346. path,
  347. 'GET',
  348. queryParams,
  349. postBody,
  350. headerParams,
  351. formParams,
  352. contentTypes.isEmpty ? null : contentTypes.first,
  353. );
  354. }
  355. Future<List<String>?> getAssetSearchTerms() async {
  356. final response = await getAssetSearchTermsWithHttpInfo();
  357. if (response.statusCode >= HttpStatus.badRequest) {
  358. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  359. }
  360. // When a remote server returns no body with a status of 204, we shall not decode it.
  361. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  362. // FormatException when trying to decode an empty string.
  363. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  364. final responseBody = await _decodeBodyBytes(response);
  365. return (await apiClient.deserializeAsync(responseBody, 'List<String>') as List)
  366. .cast<String>()
  367. .toList();
  368. }
  369. return null;
  370. }
  371. /// Performs an HTTP 'GET /asset/thumbnail/{assetId}' operation and returns the [Response].
  372. /// Parameters:
  373. ///
  374. /// * [String] assetId (required):
  375. ///
  376. /// * [ThumbnailFormat] format:
  377. Future<Response> getAssetThumbnailWithHttpInfo(String assetId, { ThumbnailFormat? format, }) async {
  378. // ignore: prefer_const_declarations
  379. final path = r'/asset/thumbnail/{assetId}'
  380. .replaceAll('{assetId}', assetId);
  381. // ignore: prefer_final_locals
  382. Object? postBody;
  383. final queryParams = <QueryParam>[];
  384. final headerParams = <String, String>{};
  385. final formParams = <String, String>{};
  386. if (format != null) {
  387. queryParams.addAll(_queryParams('', 'format', format));
  388. }
  389. const contentTypes = <String>[];
  390. return apiClient.invokeAPI(
  391. path,
  392. 'GET',
  393. queryParams,
  394. postBody,
  395. headerParams,
  396. formParams,
  397. contentTypes.isEmpty ? null : contentTypes.first,
  398. );
  399. }
  400. /// Parameters:
  401. ///
  402. /// * [String] assetId (required):
  403. ///
  404. /// * [ThumbnailFormat] format:
  405. Future<Object?> getAssetThumbnail(String assetId, { ThumbnailFormat? format, }) async {
  406. final response = await getAssetThumbnailWithHttpInfo(assetId, format: format, );
  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), 'Object',) as Object;
  415. }
  416. return null;
  417. }
  418. /// Performs an HTTP 'GET /asset/curated-locations' operation and returns the [Response].
  419. Future<Response> getCuratedLocationsWithHttpInfo() async {
  420. // ignore: prefer_const_declarations
  421. final path = r'/asset/curated-locations';
  422. // ignore: prefer_final_locals
  423. Object? postBody;
  424. final queryParams = <QueryParam>[];
  425. final headerParams = <String, String>{};
  426. final formParams = <String, String>{};
  427. const contentTypes = <String>[];
  428. return apiClient.invokeAPI(
  429. path,
  430. 'GET',
  431. queryParams,
  432. postBody,
  433. headerParams,
  434. formParams,
  435. contentTypes.isEmpty ? null : contentTypes.first,
  436. );
  437. }
  438. Future<List<CuratedLocationsResponseDto>?> getCuratedLocations() async {
  439. final response = await getCuratedLocationsWithHttpInfo();
  440. if (response.statusCode >= HttpStatus.badRequest) {
  441. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  442. }
  443. // When a remote server returns no body with a status of 204, we shall not decode it.
  444. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  445. // FormatException when trying to decode an empty string.
  446. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  447. final responseBody = await _decodeBodyBytes(response);
  448. return (await apiClient.deserializeAsync(responseBody, 'List<CuratedLocationsResponseDto>') as List)
  449. .cast<CuratedLocationsResponseDto>()
  450. .toList();
  451. }
  452. return null;
  453. }
  454. /// Performs an HTTP 'GET /asset/curated-objects' operation and returns the [Response].
  455. Future<Response> getCuratedObjectsWithHttpInfo() async {
  456. // ignore: prefer_const_declarations
  457. final path = r'/asset/curated-objects';
  458. // ignore: prefer_final_locals
  459. Object? postBody;
  460. final queryParams = <QueryParam>[];
  461. final headerParams = <String, String>{};
  462. final formParams = <String, String>{};
  463. const contentTypes = <String>[];
  464. return apiClient.invokeAPI(
  465. path,
  466. 'GET',
  467. queryParams,
  468. postBody,
  469. headerParams,
  470. formParams,
  471. contentTypes.isEmpty ? null : contentTypes.first,
  472. );
  473. }
  474. Future<List<CuratedObjectsResponseDto>?> getCuratedObjects() async {
  475. final response = await getCuratedObjectsWithHttpInfo();
  476. if (response.statusCode >= HttpStatus.badRequest) {
  477. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  478. }
  479. // When a remote server returns no body with a status of 204, we shall not decode it.
  480. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  481. // FormatException when trying to decode an empty string.
  482. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  483. final responseBody = await _decodeBodyBytes(response);
  484. return (await apiClient.deserializeAsync(responseBody, 'List<CuratedObjectsResponseDto>') as List)
  485. .cast<CuratedObjectsResponseDto>()
  486. .toList();
  487. }
  488. return null;
  489. }
  490. ///
  491. ///
  492. /// Get all asset of a device that are in the database, ID only.
  493. ///
  494. /// Note: This method returns the HTTP [Response].
  495. ///
  496. /// Parameters:
  497. ///
  498. /// * [String] deviceId (required):
  499. Future<Response> getUserAssetsByDeviceIdWithHttpInfo(String deviceId,) async {
  500. // ignore: prefer_const_declarations
  501. final path = r'/asset/{deviceId}'
  502. .replaceAll('{deviceId}', deviceId);
  503. // ignore: prefer_final_locals
  504. Object? postBody;
  505. final queryParams = <QueryParam>[];
  506. final headerParams = <String, String>{};
  507. final formParams = <String, String>{};
  508. const contentTypes = <String>[];
  509. return apiClient.invokeAPI(
  510. path,
  511. 'GET',
  512. queryParams,
  513. postBody,
  514. headerParams,
  515. formParams,
  516. contentTypes.isEmpty ? null : contentTypes.first,
  517. );
  518. }
  519. ///
  520. ///
  521. /// Get all asset of a device that are in the database, ID only.
  522. ///
  523. /// Parameters:
  524. ///
  525. /// * [String] deviceId (required):
  526. Future<List<String>?> getUserAssetsByDeviceId(String deviceId,) async {
  527. final response = await getUserAssetsByDeviceIdWithHttpInfo(deviceId,);
  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<String>') as List)
  537. .cast<String>()
  538. .toList();
  539. }
  540. return null;
  541. }
  542. /// Performs an HTTP 'POST /asset/search' operation and returns the [Response].
  543. /// Parameters:
  544. ///
  545. /// * [SearchAssetDto] searchAssetDto (required):
  546. Future<Response> searchAssetWithHttpInfo(SearchAssetDto searchAssetDto,) async {
  547. // ignore: prefer_const_declarations
  548. final path = r'/asset/search';
  549. // ignore: prefer_final_locals
  550. Object? postBody = searchAssetDto;
  551. final queryParams = <QueryParam>[];
  552. final headerParams = <String, String>{};
  553. final formParams = <String, String>{};
  554. const contentTypes = <String>['application/json'];
  555. return apiClient.invokeAPI(
  556. path,
  557. 'POST',
  558. queryParams,
  559. postBody,
  560. headerParams,
  561. formParams,
  562. contentTypes.isEmpty ? null : contentTypes.first,
  563. );
  564. }
  565. /// Parameters:
  566. ///
  567. /// * [SearchAssetDto] searchAssetDto (required):
  568. Future<List<AssetResponseDto>?> searchAsset(SearchAssetDto searchAssetDto,) async {
  569. final response = await searchAssetWithHttpInfo(searchAssetDto,);
  570. if (response.statusCode >= HttpStatus.badRequest) {
  571. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  572. }
  573. // When a remote server returns no body with a status of 204, we shall not decode it.
  574. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  575. // FormatException when trying to decode an empty string.
  576. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  577. final responseBody = await _decodeBodyBytes(response);
  578. return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
  579. .cast<AssetResponseDto>()
  580. .toList();
  581. }
  582. return null;
  583. }
  584. /// Performs an HTTP 'GET /asset/file' operation and returns the [Response].
  585. /// Parameters:
  586. ///
  587. /// * [String] aid (required):
  588. ///
  589. /// * [String] did (required):
  590. ///
  591. /// * [bool] isThumb:
  592. ///
  593. /// * [bool] isWeb:
  594. Future<Response> serveFileWithHttpInfo(String aid, String did, { bool? isThumb, bool? isWeb, }) async {
  595. // ignore: prefer_const_declarations
  596. final path = r'/asset/file';
  597. // ignore: prefer_final_locals
  598. Object? postBody;
  599. final queryParams = <QueryParam>[];
  600. final headerParams = <String, String>{};
  601. final formParams = <String, String>{};
  602. queryParams.addAll(_queryParams('', 'aid', aid));
  603. queryParams.addAll(_queryParams('', 'did', did));
  604. if (isThumb != null) {
  605. queryParams.addAll(_queryParams('', 'isThumb', isThumb));
  606. }
  607. if (isWeb != null) {
  608. queryParams.addAll(_queryParams('', 'isWeb', isWeb));
  609. }
  610. const contentTypes = <String>[];
  611. return apiClient.invokeAPI(
  612. path,
  613. 'GET',
  614. queryParams,
  615. postBody,
  616. headerParams,
  617. formParams,
  618. contentTypes.isEmpty ? null : contentTypes.first,
  619. );
  620. }
  621. /// Parameters:
  622. ///
  623. /// * [String] aid (required):
  624. ///
  625. /// * [String] did (required):
  626. ///
  627. /// * [bool] isThumb:
  628. ///
  629. /// * [bool] isWeb:
  630. Future<Object?> serveFile(String aid, String did, { bool? isThumb, bool? isWeb, }) async {
  631. final response = await serveFileWithHttpInfo(aid, did, isThumb: isThumb, isWeb: isWeb, );
  632. if (response.statusCode >= HttpStatus.badRequest) {
  633. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  634. }
  635. // When a remote server returns no body with a status of 204, we shall not decode it.
  636. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  637. // FormatException when trying to decode an empty string.
  638. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  639. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Object',) as Object;
  640. }
  641. return null;
  642. }
  643. /// Performs an HTTP 'POST /asset/upload' operation and returns the [Response].
  644. /// Parameters:
  645. ///
  646. /// * [MultipartFile] assetData (required):
  647. Future<Response> uploadFileWithHttpInfo(MultipartFile assetData,) async {
  648. // ignore: prefer_const_declarations
  649. final path = r'/asset/upload';
  650. // ignore: prefer_final_locals
  651. Object? postBody;
  652. final queryParams = <QueryParam>[];
  653. final headerParams = <String, String>{};
  654. final formParams = <String, String>{};
  655. const contentTypes = <String>['multipart/form-data'];
  656. bool hasFields = false;
  657. final mp = MultipartRequest('POST', Uri.parse(path));
  658. if (assetData != null) {
  659. hasFields = true;
  660. mp.fields[r'assetData'] = assetData.field;
  661. mp.files.add(assetData);
  662. }
  663. if (hasFields) {
  664. postBody = mp;
  665. }
  666. return apiClient.invokeAPI(
  667. path,
  668. 'POST',
  669. queryParams,
  670. postBody,
  671. headerParams,
  672. formParams,
  673. contentTypes.isEmpty ? null : contentTypes.first,
  674. );
  675. }
  676. /// Parameters:
  677. ///
  678. /// * [MultipartFile] assetData (required):
  679. Future<AssetFileUploadResponseDto?> uploadFile(MultipartFile assetData,) async {
  680. final response = await uploadFileWithHttpInfo(assetData,);
  681. if (response.statusCode >= HttpStatus.badRequest) {
  682. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  683. }
  684. // When a remote server returns no body with a status of 204, we shall not decode it.
  685. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  686. // FormatException when trying to decode an empty string.
  687. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  688. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetFileUploadResponseDto',) as AssetFileUploadResponseDto;
  689. }
  690. return null;
  691. }
  692. }