asset_api.dart 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917
  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. ///
  62. ///
  63. /// Checks if multiple assets exist on the server and returns all existing - used by background backup
  64. ///
  65. /// Note: This method returns the HTTP [Response].
  66. ///
  67. /// Parameters:
  68. ///
  69. /// * [CheckExistingAssetsDto] checkExistingAssetsDto (required):
  70. Future<Response> checkExistingAssetsWithHttpInfo(CheckExistingAssetsDto checkExistingAssetsDto,) async {
  71. // ignore: prefer_const_declarations
  72. final path = r'/asset/exist';
  73. // ignore: prefer_final_locals
  74. Object? postBody = checkExistingAssetsDto;
  75. final queryParams = <QueryParam>[];
  76. final headerParams = <String, String>{};
  77. final formParams = <String, String>{};
  78. const contentTypes = <String>['application/json'];
  79. return apiClient.invokeAPI(
  80. path,
  81. 'POST',
  82. queryParams,
  83. postBody,
  84. headerParams,
  85. formParams,
  86. contentTypes.isEmpty ? null : contentTypes.first,
  87. );
  88. }
  89. ///
  90. ///
  91. /// Checks if multiple assets exist on the server and returns all existing - used by background backup
  92. ///
  93. /// Parameters:
  94. ///
  95. /// * [CheckExistingAssetsDto] checkExistingAssetsDto (required):
  96. Future<CheckExistingAssetsResponseDto?> checkExistingAssets(CheckExistingAssetsDto checkExistingAssetsDto,) async {
  97. final response = await checkExistingAssetsWithHttpInfo(checkExistingAssetsDto,);
  98. if (response.statusCode >= HttpStatus.badRequest) {
  99. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  100. }
  101. // When a remote server returns no body with a status of 204, we shall not decode it.
  102. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  103. // FormatException when trying to decode an empty string.
  104. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  105. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'CheckExistingAssetsResponseDto',) as CheckExistingAssetsResponseDto;
  106. }
  107. return null;
  108. }
  109. /// Performs an HTTP 'DELETE /asset' operation and returns the [Response].
  110. /// Parameters:
  111. ///
  112. /// * [DeleteAssetDto] deleteAssetDto (required):
  113. Future<Response> deleteAssetWithHttpInfo(DeleteAssetDto deleteAssetDto,) async {
  114. // ignore: prefer_const_declarations
  115. final path = r'/asset';
  116. // ignore: prefer_final_locals
  117. Object? postBody = deleteAssetDto;
  118. final queryParams = <QueryParam>[];
  119. final headerParams = <String, String>{};
  120. final formParams = <String, String>{};
  121. const contentTypes = <String>['application/json'];
  122. return apiClient.invokeAPI(
  123. path,
  124. 'DELETE',
  125. queryParams,
  126. postBody,
  127. headerParams,
  128. formParams,
  129. contentTypes.isEmpty ? null : contentTypes.first,
  130. );
  131. }
  132. /// Parameters:
  133. ///
  134. /// * [DeleteAssetDto] deleteAssetDto (required):
  135. Future<List<DeleteAssetResponseDto>?> deleteAsset(DeleteAssetDto deleteAssetDto,) async {
  136. final response = await deleteAssetWithHttpInfo(deleteAssetDto,);
  137. if (response.statusCode >= HttpStatus.badRequest) {
  138. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  139. }
  140. // When a remote server returns no body with a status of 204, we shall not decode it.
  141. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  142. // FormatException when trying to decode an empty string.
  143. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  144. final responseBody = await _decodeBodyBytes(response);
  145. return (await apiClient.deserializeAsync(responseBody, 'List<DeleteAssetResponseDto>') as List)
  146. .cast<DeleteAssetResponseDto>()
  147. .toList();
  148. }
  149. return null;
  150. }
  151. /// Performs an HTTP 'GET /asset/download' operation and returns the [Response].
  152. /// Parameters:
  153. ///
  154. /// * [String] aid (required):
  155. ///
  156. /// * [String] did (required):
  157. ///
  158. /// * [bool] isThumb:
  159. ///
  160. /// * [bool] isWeb:
  161. Future<Response> downloadFileWithHttpInfo(String aid, String did, { bool? isThumb, bool? isWeb, }) async {
  162. // ignore: prefer_const_declarations
  163. final path = r'/asset/download';
  164. // ignore: prefer_final_locals
  165. Object? postBody;
  166. final queryParams = <QueryParam>[];
  167. final headerParams = <String, String>{};
  168. final formParams = <String, String>{};
  169. queryParams.addAll(_queryParams('', 'aid', aid));
  170. queryParams.addAll(_queryParams('', 'did', did));
  171. if (isThumb != null) {
  172. queryParams.addAll(_queryParams('', 'isThumb', isThumb));
  173. }
  174. if (isWeb != null) {
  175. queryParams.addAll(_queryParams('', 'isWeb', isWeb));
  176. }
  177. const contentTypes = <String>[];
  178. return apiClient.invokeAPI(
  179. path,
  180. 'GET',
  181. queryParams,
  182. postBody,
  183. headerParams,
  184. formParams,
  185. contentTypes.isEmpty ? null : contentTypes.first,
  186. );
  187. }
  188. /// Parameters:
  189. ///
  190. /// * [String] aid (required):
  191. ///
  192. /// * [String] did (required):
  193. ///
  194. /// * [bool] isThumb:
  195. ///
  196. /// * [bool] isWeb:
  197. Future<Object?> downloadFile(String aid, String did, { bool? isThumb, bool? isWeb, }) async {
  198. final response = await downloadFileWithHttpInfo(aid, did, isThumb: isThumb, isWeb: isWeb, );
  199. if (response.statusCode >= HttpStatus.badRequest) {
  200. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  201. }
  202. // When a remote server returns no body with a status of 204, we shall not decode it.
  203. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  204. // FormatException when trying to decode an empty string.
  205. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  206. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Object',) as Object;
  207. }
  208. return null;
  209. }
  210. ///
  211. ///
  212. /// Get all AssetEntity belong to the user
  213. ///
  214. /// Note: This method returns the HTTP [Response].
  215. Future<Response> getAllAssetsWithHttpInfo() async {
  216. // ignore: prefer_const_declarations
  217. final path = r'/asset';
  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 all AssetEntity belong to the user
  237. Future<List<AssetResponseDto>?> getAllAssets() async {
  238. final response = await getAllAssetsWithHttpInfo();
  239. if (response.statusCode >= HttpStatus.badRequest) {
  240. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  241. }
  242. // When a remote server returns no body with a status of 204, we shall not decode it.
  243. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  244. // FormatException when trying to decode an empty string.
  245. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  246. final responseBody = await _decodeBodyBytes(response);
  247. return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
  248. .cast<AssetResponseDto>()
  249. .toList();
  250. }
  251. return null;
  252. }
  253. ///
  254. ///
  255. /// Get a single asset's information
  256. ///
  257. /// Note: This method returns the HTTP [Response].
  258. ///
  259. /// Parameters:
  260. ///
  261. /// * [String] assetId (required):
  262. Future<Response> getAssetByIdWithHttpInfo(String assetId,) async {
  263. // ignore: prefer_const_declarations
  264. final path = r'/asset/assetById/{assetId}'
  265. .replaceAll('{assetId}', assetId);
  266. // ignore: prefer_final_locals
  267. Object? postBody;
  268. final queryParams = <QueryParam>[];
  269. final headerParams = <String, String>{};
  270. final formParams = <String, String>{};
  271. const contentTypes = <String>[];
  272. return apiClient.invokeAPI(
  273. path,
  274. 'GET',
  275. queryParams,
  276. postBody,
  277. headerParams,
  278. formParams,
  279. contentTypes.isEmpty ? null : contentTypes.first,
  280. );
  281. }
  282. ///
  283. ///
  284. /// Get a single asset's information
  285. ///
  286. /// Parameters:
  287. ///
  288. /// * [String] assetId (required):
  289. Future<AssetResponseDto?> getAssetById(String assetId,) async {
  290. final response = await getAssetByIdWithHttpInfo(assetId,);
  291. if (response.statusCode >= HttpStatus.badRequest) {
  292. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  293. }
  294. // When a remote server returns no body with a status of 204, we shall not decode it.
  295. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  296. // FormatException when trying to decode an empty string.
  297. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  298. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetResponseDto',) as AssetResponseDto;
  299. }
  300. return null;
  301. }
  302. /// Performs an HTTP 'POST /asset/time-bucket' operation and returns the [Response].
  303. /// Parameters:
  304. ///
  305. /// * [GetAssetByTimeBucketDto] getAssetByTimeBucketDto (required):
  306. Future<Response> getAssetByTimeBucketWithHttpInfo(GetAssetByTimeBucketDto getAssetByTimeBucketDto,) async {
  307. // ignore: prefer_const_declarations
  308. final path = r'/asset/time-bucket';
  309. // ignore: prefer_final_locals
  310. Object? postBody = getAssetByTimeBucketDto;
  311. final queryParams = <QueryParam>[];
  312. final headerParams = <String, String>{};
  313. final formParams = <String, String>{};
  314. const contentTypes = <String>['application/json'];
  315. return apiClient.invokeAPI(
  316. path,
  317. 'POST',
  318. queryParams,
  319. postBody,
  320. headerParams,
  321. formParams,
  322. contentTypes.isEmpty ? null : contentTypes.first,
  323. );
  324. }
  325. /// Parameters:
  326. ///
  327. /// * [GetAssetByTimeBucketDto] getAssetByTimeBucketDto (required):
  328. Future<List<AssetResponseDto>?> getAssetByTimeBucket(GetAssetByTimeBucketDto getAssetByTimeBucketDto,) async {
  329. final response = await getAssetByTimeBucketWithHttpInfo(getAssetByTimeBucketDto,);
  330. if (response.statusCode >= HttpStatus.badRequest) {
  331. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  332. }
  333. // When a remote server returns no body with a status of 204, we shall not decode it.
  334. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  335. // FormatException when trying to decode an empty string.
  336. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  337. final responseBody = await _decodeBodyBytes(response);
  338. return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
  339. .cast<AssetResponseDto>()
  340. .toList();
  341. }
  342. return null;
  343. }
  344. /// Performs an HTTP 'POST /asset/count-by-time-bucket' operation and returns the [Response].
  345. /// Parameters:
  346. ///
  347. /// * [GetAssetCountByTimeBucketDto] getAssetCountByTimeBucketDto (required):
  348. Future<Response> getAssetCountByTimeBucketWithHttpInfo(GetAssetCountByTimeBucketDto getAssetCountByTimeBucketDto,) async {
  349. // ignore: prefer_const_declarations
  350. final path = r'/asset/count-by-time-bucket';
  351. // ignore: prefer_final_locals
  352. Object? postBody = getAssetCountByTimeBucketDto;
  353. final queryParams = <QueryParam>[];
  354. final headerParams = <String, String>{};
  355. final formParams = <String, String>{};
  356. const contentTypes = <String>['application/json'];
  357. return apiClient.invokeAPI(
  358. path,
  359. 'POST',
  360. queryParams,
  361. postBody,
  362. headerParams,
  363. formParams,
  364. contentTypes.isEmpty ? null : contentTypes.first,
  365. );
  366. }
  367. /// Parameters:
  368. ///
  369. /// * [GetAssetCountByTimeBucketDto] getAssetCountByTimeBucketDto (required):
  370. Future<AssetCountByTimeBucketResponseDto?> getAssetCountByTimeBucket(GetAssetCountByTimeBucketDto getAssetCountByTimeBucketDto,) async {
  371. final response = await getAssetCountByTimeBucketWithHttpInfo(getAssetCountByTimeBucketDto,);
  372. if (response.statusCode >= HttpStatus.badRequest) {
  373. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  374. }
  375. // When a remote server returns no body with a status of 204, we shall not decode it.
  376. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  377. // FormatException when trying to decode an empty string.
  378. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  379. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetCountByTimeBucketResponseDto',) as AssetCountByTimeBucketResponseDto;
  380. }
  381. return null;
  382. }
  383. /// Performs an HTTP 'GET /asset/count-by-user-id' operation and returns the [Response].
  384. Future<Response> getAssetCountByUserIdWithHttpInfo() async {
  385. // ignore: prefer_const_declarations
  386. final path = r'/asset/count-by-user-id';
  387. // ignore: prefer_final_locals
  388. Object? postBody;
  389. final queryParams = <QueryParam>[];
  390. final headerParams = <String, String>{};
  391. final formParams = <String, String>{};
  392. const contentTypes = <String>[];
  393. return apiClient.invokeAPI(
  394. path,
  395. 'GET',
  396. queryParams,
  397. postBody,
  398. headerParams,
  399. formParams,
  400. contentTypes.isEmpty ? null : contentTypes.first,
  401. );
  402. }
  403. Future<AssetCountByUserIdResponseDto?> getAssetCountByUserId() async {
  404. final response = await getAssetCountByUserIdWithHttpInfo();
  405. if (response.statusCode >= HttpStatus.badRequest) {
  406. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  407. }
  408. // When a remote server returns no body with a status of 204, we shall not decode it.
  409. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  410. // FormatException when trying to decode an empty string.
  411. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  412. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetCountByUserIdResponseDto',) as AssetCountByUserIdResponseDto;
  413. }
  414. return null;
  415. }
  416. /// Performs an HTTP 'GET /asset/search-terms' operation and returns the [Response].
  417. Future<Response> getAssetSearchTermsWithHttpInfo() async {
  418. // ignore: prefer_const_declarations
  419. final path = r'/asset/search-terms';
  420. // ignore: prefer_final_locals
  421. Object? postBody;
  422. final queryParams = <QueryParam>[];
  423. final headerParams = <String, String>{};
  424. final formParams = <String, String>{};
  425. const contentTypes = <String>[];
  426. return apiClient.invokeAPI(
  427. path,
  428. 'GET',
  429. queryParams,
  430. postBody,
  431. headerParams,
  432. formParams,
  433. contentTypes.isEmpty ? null : contentTypes.first,
  434. );
  435. }
  436. Future<List<String>?> getAssetSearchTerms() async {
  437. final response = await getAssetSearchTermsWithHttpInfo();
  438. if (response.statusCode >= HttpStatus.badRequest) {
  439. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  440. }
  441. // When a remote server returns no body with a status of 204, we shall not decode it.
  442. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  443. // FormatException when trying to decode an empty string.
  444. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  445. final responseBody = await _decodeBodyBytes(response);
  446. return (await apiClient.deserializeAsync(responseBody, 'List<String>') as List)
  447. .cast<String>()
  448. .toList();
  449. }
  450. return null;
  451. }
  452. /// Performs an HTTP 'GET /asset/thumbnail/{assetId}' operation and returns the [Response].
  453. /// Parameters:
  454. ///
  455. /// * [String] assetId (required):
  456. ///
  457. /// * [ThumbnailFormat] format:
  458. Future<Response> getAssetThumbnailWithHttpInfo(String assetId, { ThumbnailFormat? format, }) async {
  459. // ignore: prefer_const_declarations
  460. final path = r'/asset/thumbnail/{assetId}'
  461. .replaceAll('{assetId}', assetId);
  462. // ignore: prefer_final_locals
  463. Object? postBody;
  464. final queryParams = <QueryParam>[];
  465. final headerParams = <String, String>{};
  466. final formParams = <String, String>{};
  467. if (format != null) {
  468. queryParams.addAll(_queryParams('', 'format', format));
  469. }
  470. const contentTypes = <String>[];
  471. return apiClient.invokeAPI(
  472. path,
  473. 'GET',
  474. queryParams,
  475. postBody,
  476. headerParams,
  477. formParams,
  478. contentTypes.isEmpty ? null : contentTypes.first,
  479. );
  480. }
  481. /// Parameters:
  482. ///
  483. /// * [String] assetId (required):
  484. ///
  485. /// * [ThumbnailFormat] format:
  486. Future<Object?> getAssetThumbnail(String assetId, { ThumbnailFormat? format, }) async {
  487. final response = await getAssetThumbnailWithHttpInfo(assetId, format: format, );
  488. if (response.statusCode >= HttpStatus.badRequest) {
  489. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  490. }
  491. // When a remote server returns no body with a status of 204, we shall not decode it.
  492. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  493. // FormatException when trying to decode an empty string.
  494. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  495. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Object',) as Object;
  496. }
  497. return null;
  498. }
  499. /// Performs an HTTP 'GET /asset/curated-locations' operation and returns the [Response].
  500. Future<Response> getCuratedLocationsWithHttpInfo() async {
  501. // ignore: prefer_const_declarations
  502. final path = r'/asset/curated-locations';
  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. Future<List<CuratedLocationsResponseDto>?> getCuratedLocations() async {
  520. final response = await getCuratedLocationsWithHttpInfo();
  521. if (response.statusCode >= HttpStatus.badRequest) {
  522. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  523. }
  524. // When a remote server returns no body with a status of 204, we shall not decode it.
  525. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  526. // FormatException when trying to decode an empty string.
  527. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  528. final responseBody = await _decodeBodyBytes(response);
  529. return (await apiClient.deserializeAsync(responseBody, 'List<CuratedLocationsResponseDto>') as List)
  530. .cast<CuratedLocationsResponseDto>()
  531. .toList();
  532. }
  533. return null;
  534. }
  535. /// Performs an HTTP 'GET /asset/curated-objects' operation and returns the [Response].
  536. Future<Response> getCuratedObjectsWithHttpInfo() async {
  537. // ignore: prefer_const_declarations
  538. final path = r'/asset/curated-objects';
  539. // ignore: prefer_final_locals
  540. Object? postBody;
  541. final queryParams = <QueryParam>[];
  542. final headerParams = <String, String>{};
  543. final formParams = <String, String>{};
  544. const contentTypes = <String>[];
  545. return apiClient.invokeAPI(
  546. path,
  547. 'GET',
  548. queryParams,
  549. postBody,
  550. headerParams,
  551. formParams,
  552. contentTypes.isEmpty ? null : contentTypes.first,
  553. );
  554. }
  555. Future<List<CuratedObjectsResponseDto>?> getCuratedObjects() async {
  556. final response = await getCuratedObjectsWithHttpInfo();
  557. if (response.statusCode >= HttpStatus.badRequest) {
  558. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  559. }
  560. // When a remote server returns no body with a status of 204, we shall not decode it.
  561. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  562. // FormatException when trying to decode an empty string.
  563. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  564. final responseBody = await _decodeBodyBytes(response);
  565. return (await apiClient.deserializeAsync(responseBody, 'List<CuratedObjectsResponseDto>') as List)
  566. .cast<CuratedObjectsResponseDto>()
  567. .toList();
  568. }
  569. return null;
  570. }
  571. ///
  572. ///
  573. /// Get all asset of a device that are in the database, ID only.
  574. ///
  575. /// Note: This method returns the HTTP [Response].
  576. ///
  577. /// Parameters:
  578. ///
  579. /// * [String] deviceId (required):
  580. Future<Response> getUserAssetsByDeviceIdWithHttpInfo(String deviceId,) async {
  581. // ignore: prefer_const_declarations
  582. final path = r'/asset/{deviceId}'
  583. .replaceAll('{deviceId}', deviceId);
  584. // ignore: prefer_final_locals
  585. Object? postBody;
  586. final queryParams = <QueryParam>[];
  587. final headerParams = <String, String>{};
  588. final formParams = <String, String>{};
  589. const contentTypes = <String>[];
  590. return apiClient.invokeAPI(
  591. path,
  592. 'GET',
  593. queryParams,
  594. postBody,
  595. headerParams,
  596. formParams,
  597. contentTypes.isEmpty ? null : contentTypes.first,
  598. );
  599. }
  600. ///
  601. ///
  602. /// Get all asset of a device that are in the database, ID only.
  603. ///
  604. /// Parameters:
  605. ///
  606. /// * [String] deviceId (required):
  607. Future<List<String>?> getUserAssetsByDeviceId(String deviceId,) async {
  608. final response = await getUserAssetsByDeviceIdWithHttpInfo(deviceId,);
  609. if (response.statusCode >= HttpStatus.badRequest) {
  610. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  611. }
  612. // When a remote server returns no body with a status of 204, we shall not decode it.
  613. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  614. // FormatException when trying to decode an empty string.
  615. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  616. final responseBody = await _decodeBodyBytes(response);
  617. return (await apiClient.deserializeAsync(responseBody, 'List<String>') as List)
  618. .cast<String>()
  619. .toList();
  620. }
  621. return null;
  622. }
  623. /// Performs an HTTP 'POST /asset/search' operation and returns the [Response].
  624. /// Parameters:
  625. ///
  626. /// * [SearchAssetDto] searchAssetDto (required):
  627. Future<Response> searchAssetWithHttpInfo(SearchAssetDto searchAssetDto,) async {
  628. // ignore: prefer_const_declarations
  629. final path = r'/asset/search';
  630. // ignore: prefer_final_locals
  631. Object? postBody = searchAssetDto;
  632. final queryParams = <QueryParam>[];
  633. final headerParams = <String, String>{};
  634. final formParams = <String, String>{};
  635. const contentTypes = <String>['application/json'];
  636. return apiClient.invokeAPI(
  637. path,
  638. 'POST',
  639. queryParams,
  640. postBody,
  641. headerParams,
  642. formParams,
  643. contentTypes.isEmpty ? null : contentTypes.first,
  644. );
  645. }
  646. /// Parameters:
  647. ///
  648. /// * [SearchAssetDto] searchAssetDto (required):
  649. Future<List<AssetResponseDto>?> searchAsset(SearchAssetDto searchAssetDto,) async {
  650. final response = await searchAssetWithHttpInfo(searchAssetDto,);
  651. if (response.statusCode >= HttpStatus.badRequest) {
  652. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  653. }
  654. // When a remote server returns no body with a status of 204, we shall not decode it.
  655. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  656. // FormatException when trying to decode an empty string.
  657. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  658. final responseBody = await _decodeBodyBytes(response);
  659. return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
  660. .cast<AssetResponseDto>()
  661. .toList();
  662. }
  663. return null;
  664. }
  665. /// Performs an HTTP 'GET /asset/file' operation and returns the [Response].
  666. /// Parameters:
  667. ///
  668. /// * [String] aid (required):
  669. ///
  670. /// * [String] did (required):
  671. ///
  672. /// * [bool] isThumb:
  673. ///
  674. /// * [bool] isWeb:
  675. Future<Response> serveFileWithHttpInfo(String aid, String did, { bool? isThumb, bool? isWeb, }) async {
  676. // ignore: prefer_const_declarations
  677. final path = r'/asset/file';
  678. // ignore: prefer_final_locals
  679. Object? postBody;
  680. final queryParams = <QueryParam>[];
  681. final headerParams = <String, String>{};
  682. final formParams = <String, String>{};
  683. queryParams.addAll(_queryParams('', 'aid', aid));
  684. queryParams.addAll(_queryParams('', 'did', did));
  685. if (isThumb != null) {
  686. queryParams.addAll(_queryParams('', 'isThumb', isThumb));
  687. }
  688. if (isWeb != null) {
  689. queryParams.addAll(_queryParams('', 'isWeb', isWeb));
  690. }
  691. const contentTypes = <String>[];
  692. return apiClient.invokeAPI(
  693. path,
  694. 'GET',
  695. queryParams,
  696. postBody,
  697. headerParams,
  698. formParams,
  699. contentTypes.isEmpty ? null : contentTypes.first,
  700. );
  701. }
  702. /// Parameters:
  703. ///
  704. /// * [String] aid (required):
  705. ///
  706. /// * [String] did (required):
  707. ///
  708. /// * [bool] isThumb:
  709. ///
  710. /// * [bool] isWeb:
  711. Future<Object?> serveFile(String aid, String did, { bool? isThumb, bool? isWeb, }) async {
  712. final response = await serveFileWithHttpInfo(aid, did, isThumb: isThumb, isWeb: isWeb, );
  713. if (response.statusCode >= HttpStatus.badRequest) {
  714. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  715. }
  716. // When a remote server returns no body with a status of 204, we shall not decode it.
  717. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  718. // FormatException when trying to decode an empty string.
  719. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  720. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Object',) as Object;
  721. }
  722. return null;
  723. }
  724. /// Performs an HTTP 'POST /asset/upload' operation and returns the [Response].
  725. /// Parameters:
  726. ///
  727. /// * [MultipartFile] assetData (required):
  728. Future<Response> uploadFileWithHttpInfo(MultipartFile assetData,) async {
  729. // ignore: prefer_const_declarations
  730. final path = r'/asset/upload';
  731. // ignore: prefer_final_locals
  732. Object? postBody;
  733. final queryParams = <QueryParam>[];
  734. final headerParams = <String, String>{};
  735. final formParams = <String, String>{};
  736. const contentTypes = <String>['multipart/form-data'];
  737. bool hasFields = false;
  738. final mp = MultipartRequest('POST', Uri.parse(path));
  739. if (assetData != null) {
  740. hasFields = true;
  741. mp.fields[r'assetData'] = assetData.field;
  742. mp.files.add(assetData);
  743. }
  744. if (hasFields) {
  745. postBody = mp;
  746. }
  747. return apiClient.invokeAPI(
  748. path,
  749. 'POST',
  750. queryParams,
  751. postBody,
  752. headerParams,
  753. formParams,
  754. contentTypes.isEmpty ? null : contentTypes.first,
  755. );
  756. }
  757. /// Parameters:
  758. ///
  759. /// * [MultipartFile] assetData (required):
  760. Future<AssetFileUploadResponseDto?> uploadFile(MultipartFile assetData,) async {
  761. final response = await uploadFileWithHttpInfo(assetData,);
  762. if (response.statusCode >= HttpStatus.badRequest) {
  763. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  764. }
  765. // When a remote server returns no body with a status of 204, we shall not decode it.
  766. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  767. // FormatException when trying to decode an empty string.
  768. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  769. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetFileUploadResponseDto',) as AssetFileUploadResponseDto;
  770. }
  771. return null;
  772. }
  773. }