asset_api.dart 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033
  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/{assetId}' operation and returns the [Response].
  152. /// Parameters:
  153. ///
  154. /// * [String] assetId (required):
  155. ///
  156. /// * [bool] isThumb:
  157. ///
  158. /// * [bool] isWeb:
  159. Future<Response> downloadFileWithHttpInfo(String assetId, { bool? isThumb, bool? isWeb, }) async {
  160. // ignore: prefer_const_declarations
  161. final path = r'/asset/download/{assetId}'
  162. .replaceAll('{assetId}', assetId);
  163. // ignore: prefer_final_locals
  164. Object? postBody;
  165. final queryParams = <QueryParam>[];
  166. final headerParams = <String, String>{};
  167. final formParams = <String, String>{};
  168. if (isThumb != null) {
  169. queryParams.addAll(_queryParams('', 'isThumb', isThumb));
  170. }
  171. if (isWeb != null) {
  172. queryParams.addAll(_queryParams('', 'isWeb', isWeb));
  173. }
  174. const contentTypes = <String>[];
  175. return apiClient.invokeAPI(
  176. path,
  177. 'GET',
  178. queryParams,
  179. postBody,
  180. headerParams,
  181. formParams,
  182. contentTypes.isEmpty ? null : contentTypes.first,
  183. );
  184. }
  185. /// Parameters:
  186. ///
  187. /// * [String] assetId (required):
  188. ///
  189. /// * [bool] isThumb:
  190. ///
  191. /// * [bool] isWeb:
  192. Future<Object?> downloadFile(String assetId, { bool? isThumb, bool? isWeb, }) async {
  193. final response = await downloadFileWithHttpInfo(assetId, isThumb: isThumb, isWeb: isWeb, );
  194. if (response.statusCode >= HttpStatus.badRequest) {
  195. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  196. }
  197. // When a remote server returns no body with a status of 204, we shall not decode it.
  198. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  199. // FormatException when trying to decode an empty string.
  200. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  201. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Object',) as Object;
  202. }
  203. return null;
  204. }
  205. /// Performs an HTTP 'GET /asset/download-library' operation and returns the [Response].
  206. /// Parameters:
  207. ///
  208. /// * [num] skip:
  209. Future<Response> downloadLibraryWithHttpInfo({ num? skip, }) async {
  210. // ignore: prefer_const_declarations
  211. final path = r'/asset/download-library';
  212. // ignore: prefer_final_locals
  213. Object? postBody;
  214. final queryParams = <QueryParam>[];
  215. final headerParams = <String, String>{};
  216. final formParams = <String, String>{};
  217. if (skip != null) {
  218. queryParams.addAll(_queryParams('', 'skip', skip));
  219. }
  220. const contentTypes = <String>[];
  221. return apiClient.invokeAPI(
  222. path,
  223. 'GET',
  224. queryParams,
  225. postBody,
  226. headerParams,
  227. formParams,
  228. contentTypes.isEmpty ? null : contentTypes.first,
  229. );
  230. }
  231. /// Parameters:
  232. ///
  233. /// * [num] skip:
  234. Future<Object?> downloadLibrary({ num? skip, }) async {
  235. final response = await downloadLibraryWithHttpInfo( skip: skip, );
  236. if (response.statusCode >= HttpStatus.badRequest) {
  237. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  238. }
  239. // When a remote server returns no body with a status of 204, we shall not decode it.
  240. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  241. // FormatException when trying to decode an empty string.
  242. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  243. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Object',) as Object;
  244. }
  245. return null;
  246. }
  247. ///
  248. ///
  249. /// Get all AssetEntity belong to the user
  250. ///
  251. /// Note: This method returns the HTTP [Response].
  252. ///
  253. /// Parameters:
  254. ///
  255. /// * [String] ifNoneMatch:
  256. /// ETag of data already cached on the client
  257. Future<Response> getAllAssetsWithHttpInfo({ String? ifNoneMatch, }) async {
  258. // ignore: prefer_const_declarations
  259. final path = r'/asset';
  260. // ignore: prefer_final_locals
  261. Object? postBody;
  262. final queryParams = <QueryParam>[];
  263. final headerParams = <String, String>{};
  264. final formParams = <String, String>{};
  265. if (ifNoneMatch != null) {
  266. headerParams[r'if-none-match'] = parameterToString(ifNoneMatch);
  267. }
  268. const contentTypes = <String>[];
  269. return apiClient.invokeAPI(
  270. path,
  271. 'GET',
  272. queryParams,
  273. postBody,
  274. headerParams,
  275. formParams,
  276. contentTypes.isEmpty ? null : contentTypes.first,
  277. );
  278. }
  279. ///
  280. ///
  281. /// Get all AssetEntity belong to the user
  282. ///
  283. /// Parameters:
  284. ///
  285. /// * [String] ifNoneMatch:
  286. /// ETag of data already cached on the client
  287. Future<List<AssetResponseDto>?> getAllAssets({ String? ifNoneMatch, }) async {
  288. final response = await getAllAssetsWithHttpInfo( ifNoneMatch: ifNoneMatch, );
  289. if (response.statusCode >= HttpStatus.badRequest) {
  290. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  291. }
  292. // When a remote server returns no body with a status of 204, we shall not decode it.
  293. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  294. // FormatException when trying to decode an empty string.
  295. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  296. final responseBody = await _decodeBodyBytes(response);
  297. return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
  298. .cast<AssetResponseDto>()
  299. .toList();
  300. }
  301. return null;
  302. }
  303. ///
  304. ///
  305. /// Get a single asset's information
  306. ///
  307. /// Note: This method returns the HTTP [Response].
  308. ///
  309. /// Parameters:
  310. ///
  311. /// * [String] assetId (required):
  312. Future<Response> getAssetByIdWithHttpInfo(String assetId,) async {
  313. // ignore: prefer_const_declarations
  314. final path = r'/asset/assetById/{assetId}'
  315. .replaceAll('{assetId}', assetId);
  316. // ignore: prefer_final_locals
  317. Object? postBody;
  318. final queryParams = <QueryParam>[];
  319. final headerParams = <String, String>{};
  320. final formParams = <String, String>{};
  321. const contentTypes = <String>[];
  322. return apiClient.invokeAPI(
  323. path,
  324. 'GET',
  325. queryParams,
  326. postBody,
  327. headerParams,
  328. formParams,
  329. contentTypes.isEmpty ? null : contentTypes.first,
  330. );
  331. }
  332. ///
  333. ///
  334. /// Get a single asset's information
  335. ///
  336. /// Parameters:
  337. ///
  338. /// * [String] assetId (required):
  339. Future<AssetResponseDto?> getAssetById(String assetId,) async {
  340. final response = await getAssetByIdWithHttpInfo(assetId,);
  341. if (response.statusCode >= HttpStatus.badRequest) {
  342. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  343. }
  344. // When a remote server returns no body with a status of 204, we shall not decode it.
  345. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  346. // FormatException when trying to decode an empty string.
  347. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  348. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetResponseDto',) as AssetResponseDto;
  349. }
  350. return null;
  351. }
  352. /// Performs an HTTP 'POST /asset/time-bucket' operation and returns the [Response].
  353. /// Parameters:
  354. ///
  355. /// * [GetAssetByTimeBucketDto] getAssetByTimeBucketDto (required):
  356. Future<Response> getAssetByTimeBucketWithHttpInfo(GetAssetByTimeBucketDto getAssetByTimeBucketDto,) async {
  357. // ignore: prefer_const_declarations
  358. final path = r'/asset/time-bucket';
  359. // ignore: prefer_final_locals
  360. Object? postBody = getAssetByTimeBucketDto;
  361. final queryParams = <QueryParam>[];
  362. final headerParams = <String, String>{};
  363. final formParams = <String, String>{};
  364. const contentTypes = <String>['application/json'];
  365. return apiClient.invokeAPI(
  366. path,
  367. 'POST',
  368. queryParams,
  369. postBody,
  370. headerParams,
  371. formParams,
  372. contentTypes.isEmpty ? null : contentTypes.first,
  373. );
  374. }
  375. /// Parameters:
  376. ///
  377. /// * [GetAssetByTimeBucketDto] getAssetByTimeBucketDto (required):
  378. Future<List<AssetResponseDto>?> getAssetByTimeBucket(GetAssetByTimeBucketDto getAssetByTimeBucketDto,) async {
  379. final response = await getAssetByTimeBucketWithHttpInfo(getAssetByTimeBucketDto,);
  380. if (response.statusCode >= HttpStatus.badRequest) {
  381. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  382. }
  383. // When a remote server returns no body with a status of 204, we shall not decode it.
  384. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  385. // FormatException when trying to decode an empty string.
  386. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  387. final responseBody = await _decodeBodyBytes(response);
  388. return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
  389. .cast<AssetResponseDto>()
  390. .toList();
  391. }
  392. return null;
  393. }
  394. /// Performs an HTTP 'POST /asset/count-by-time-bucket' operation and returns the [Response].
  395. /// Parameters:
  396. ///
  397. /// * [GetAssetCountByTimeBucketDto] getAssetCountByTimeBucketDto (required):
  398. Future<Response> getAssetCountByTimeBucketWithHttpInfo(GetAssetCountByTimeBucketDto getAssetCountByTimeBucketDto,) async {
  399. // ignore: prefer_const_declarations
  400. final path = r'/asset/count-by-time-bucket';
  401. // ignore: prefer_final_locals
  402. Object? postBody = getAssetCountByTimeBucketDto;
  403. final queryParams = <QueryParam>[];
  404. final headerParams = <String, String>{};
  405. final formParams = <String, String>{};
  406. const contentTypes = <String>['application/json'];
  407. return apiClient.invokeAPI(
  408. path,
  409. 'POST',
  410. queryParams,
  411. postBody,
  412. headerParams,
  413. formParams,
  414. contentTypes.isEmpty ? null : contentTypes.first,
  415. );
  416. }
  417. /// Parameters:
  418. ///
  419. /// * [GetAssetCountByTimeBucketDto] getAssetCountByTimeBucketDto (required):
  420. Future<AssetCountByTimeBucketResponseDto?> getAssetCountByTimeBucket(GetAssetCountByTimeBucketDto getAssetCountByTimeBucketDto,) async {
  421. final response = await getAssetCountByTimeBucketWithHttpInfo(getAssetCountByTimeBucketDto,);
  422. if (response.statusCode >= HttpStatus.badRequest) {
  423. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  424. }
  425. // When a remote server returns no body with a status of 204, we shall not decode it.
  426. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  427. // FormatException when trying to decode an empty string.
  428. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  429. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetCountByTimeBucketResponseDto',) as AssetCountByTimeBucketResponseDto;
  430. }
  431. return null;
  432. }
  433. /// Performs an HTTP 'GET /asset/count-by-user-id' operation and returns the [Response].
  434. Future<Response> getAssetCountByUserIdWithHttpInfo() async {
  435. // ignore: prefer_const_declarations
  436. final path = r'/asset/count-by-user-id';
  437. // ignore: prefer_final_locals
  438. Object? postBody;
  439. final queryParams = <QueryParam>[];
  440. final headerParams = <String, String>{};
  441. final formParams = <String, String>{};
  442. const contentTypes = <String>[];
  443. return apiClient.invokeAPI(
  444. path,
  445. 'GET',
  446. queryParams,
  447. postBody,
  448. headerParams,
  449. formParams,
  450. contentTypes.isEmpty ? null : contentTypes.first,
  451. );
  452. }
  453. Future<AssetCountByUserIdResponseDto?> getAssetCountByUserId() async {
  454. final response = await getAssetCountByUserIdWithHttpInfo();
  455. if (response.statusCode >= HttpStatus.badRequest) {
  456. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  457. }
  458. // When a remote server returns no body with a status of 204, we shall not decode it.
  459. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  460. // FormatException when trying to decode an empty string.
  461. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  462. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetCountByUserIdResponseDto',) as AssetCountByUserIdResponseDto;
  463. }
  464. return null;
  465. }
  466. /// Performs an HTTP 'GET /asset/search-terms' operation and returns the [Response].
  467. Future<Response> getAssetSearchTermsWithHttpInfo() async {
  468. // ignore: prefer_const_declarations
  469. final path = r'/asset/search-terms';
  470. // ignore: prefer_final_locals
  471. Object? postBody;
  472. final queryParams = <QueryParam>[];
  473. final headerParams = <String, String>{};
  474. final formParams = <String, String>{};
  475. const contentTypes = <String>[];
  476. return apiClient.invokeAPI(
  477. path,
  478. 'GET',
  479. queryParams,
  480. postBody,
  481. headerParams,
  482. formParams,
  483. contentTypes.isEmpty ? null : contentTypes.first,
  484. );
  485. }
  486. Future<List<String>?> getAssetSearchTerms() async {
  487. final response = await getAssetSearchTermsWithHttpInfo();
  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. final responseBody = await _decodeBodyBytes(response);
  496. return (await apiClient.deserializeAsync(responseBody, 'List<String>') as List)
  497. .cast<String>()
  498. .toList();
  499. }
  500. return null;
  501. }
  502. /// Performs an HTTP 'GET /asset/thumbnail/{assetId}' operation and returns the [Response].
  503. /// Parameters:
  504. ///
  505. /// * [String] assetId (required):
  506. ///
  507. /// * [ThumbnailFormat] format:
  508. Future<Response> getAssetThumbnailWithHttpInfo(String assetId, { ThumbnailFormat? format, }) async {
  509. // ignore: prefer_const_declarations
  510. final path = r'/asset/thumbnail/{assetId}'
  511. .replaceAll('{assetId}', assetId);
  512. // ignore: prefer_final_locals
  513. Object? postBody;
  514. final queryParams = <QueryParam>[];
  515. final headerParams = <String, String>{};
  516. final formParams = <String, String>{};
  517. if (format != null) {
  518. queryParams.addAll(_queryParams('', 'format', format));
  519. }
  520. const contentTypes = <String>[];
  521. return apiClient.invokeAPI(
  522. path,
  523. 'GET',
  524. queryParams,
  525. postBody,
  526. headerParams,
  527. formParams,
  528. contentTypes.isEmpty ? null : contentTypes.first,
  529. );
  530. }
  531. /// Parameters:
  532. ///
  533. /// * [String] assetId (required):
  534. ///
  535. /// * [ThumbnailFormat] format:
  536. Future<Object?> getAssetThumbnail(String assetId, { ThumbnailFormat? format, }) async {
  537. final response = await getAssetThumbnailWithHttpInfo(assetId, format: format, );
  538. if (response.statusCode >= HttpStatus.badRequest) {
  539. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  540. }
  541. // When a remote server returns no body with a status of 204, we shall not decode it.
  542. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  543. // FormatException when trying to decode an empty string.
  544. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  545. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Object',) as Object;
  546. }
  547. return null;
  548. }
  549. /// Performs an HTTP 'GET /asset/curated-locations' operation and returns the [Response].
  550. Future<Response> getCuratedLocationsWithHttpInfo() async {
  551. // ignore: prefer_const_declarations
  552. final path = r'/asset/curated-locations';
  553. // ignore: prefer_final_locals
  554. Object? postBody;
  555. final queryParams = <QueryParam>[];
  556. final headerParams = <String, String>{};
  557. final formParams = <String, String>{};
  558. const contentTypes = <String>[];
  559. return apiClient.invokeAPI(
  560. path,
  561. 'GET',
  562. queryParams,
  563. postBody,
  564. headerParams,
  565. formParams,
  566. contentTypes.isEmpty ? null : contentTypes.first,
  567. );
  568. }
  569. Future<List<CuratedLocationsResponseDto>?> getCuratedLocations() async {
  570. final response = await getCuratedLocationsWithHttpInfo();
  571. if (response.statusCode >= HttpStatus.badRequest) {
  572. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  573. }
  574. // When a remote server returns no body with a status of 204, we shall not decode it.
  575. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  576. // FormatException when trying to decode an empty string.
  577. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  578. final responseBody = await _decodeBodyBytes(response);
  579. return (await apiClient.deserializeAsync(responseBody, 'List<CuratedLocationsResponseDto>') as List)
  580. .cast<CuratedLocationsResponseDto>()
  581. .toList();
  582. }
  583. return null;
  584. }
  585. /// Performs an HTTP 'GET /asset/curated-objects' operation and returns the [Response].
  586. Future<Response> getCuratedObjectsWithHttpInfo() async {
  587. // ignore: prefer_const_declarations
  588. final path = r'/asset/curated-objects';
  589. // ignore: prefer_final_locals
  590. Object? postBody;
  591. final queryParams = <QueryParam>[];
  592. final headerParams = <String, String>{};
  593. final formParams = <String, String>{};
  594. const contentTypes = <String>[];
  595. return apiClient.invokeAPI(
  596. path,
  597. 'GET',
  598. queryParams,
  599. postBody,
  600. headerParams,
  601. formParams,
  602. contentTypes.isEmpty ? null : contentTypes.first,
  603. );
  604. }
  605. Future<List<CuratedObjectsResponseDto>?> getCuratedObjects() async {
  606. final response = await getCuratedObjectsWithHttpInfo();
  607. if (response.statusCode >= HttpStatus.badRequest) {
  608. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  609. }
  610. // When a remote server returns no body with a status of 204, we shall not decode it.
  611. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  612. // FormatException when trying to decode an empty string.
  613. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  614. final responseBody = await _decodeBodyBytes(response);
  615. return (await apiClient.deserializeAsync(responseBody, 'List<CuratedObjectsResponseDto>') as List)
  616. .cast<CuratedObjectsResponseDto>()
  617. .toList();
  618. }
  619. return null;
  620. }
  621. ///
  622. ///
  623. /// Get all asset of a device that are in the database, ID only.
  624. ///
  625. /// Note: This method returns the HTTP [Response].
  626. ///
  627. /// Parameters:
  628. ///
  629. /// * [String] deviceId (required):
  630. Future<Response> getUserAssetsByDeviceIdWithHttpInfo(String deviceId,) async {
  631. // ignore: prefer_const_declarations
  632. final path = r'/asset/{deviceId}'
  633. .replaceAll('{deviceId}', deviceId);
  634. // ignore: prefer_final_locals
  635. Object? postBody;
  636. final queryParams = <QueryParam>[];
  637. final headerParams = <String, String>{};
  638. final formParams = <String, String>{};
  639. const contentTypes = <String>[];
  640. return apiClient.invokeAPI(
  641. path,
  642. 'GET',
  643. queryParams,
  644. postBody,
  645. headerParams,
  646. formParams,
  647. contentTypes.isEmpty ? null : contentTypes.first,
  648. );
  649. }
  650. ///
  651. ///
  652. /// Get all asset of a device that are in the database, ID only.
  653. ///
  654. /// Parameters:
  655. ///
  656. /// * [String] deviceId (required):
  657. Future<List<String>?> getUserAssetsByDeviceId(String deviceId,) async {
  658. final response = await getUserAssetsByDeviceIdWithHttpInfo(deviceId,);
  659. if (response.statusCode >= HttpStatus.badRequest) {
  660. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  661. }
  662. // When a remote server returns no body with a status of 204, we shall not decode it.
  663. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  664. // FormatException when trying to decode an empty string.
  665. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  666. final responseBody = await _decodeBodyBytes(response);
  667. return (await apiClient.deserializeAsync(responseBody, 'List<String>') as List)
  668. .cast<String>()
  669. .toList();
  670. }
  671. return null;
  672. }
  673. /// Performs an HTTP 'POST /asset/search' operation and returns the [Response].
  674. /// Parameters:
  675. ///
  676. /// * [SearchAssetDto] searchAssetDto (required):
  677. Future<Response> searchAssetWithHttpInfo(SearchAssetDto searchAssetDto,) async {
  678. // ignore: prefer_const_declarations
  679. final path = r'/asset/search';
  680. // ignore: prefer_final_locals
  681. Object? postBody = searchAssetDto;
  682. final queryParams = <QueryParam>[];
  683. final headerParams = <String, String>{};
  684. final formParams = <String, String>{};
  685. const contentTypes = <String>['application/json'];
  686. return apiClient.invokeAPI(
  687. path,
  688. 'POST',
  689. queryParams,
  690. postBody,
  691. headerParams,
  692. formParams,
  693. contentTypes.isEmpty ? null : contentTypes.first,
  694. );
  695. }
  696. /// Parameters:
  697. ///
  698. /// * [SearchAssetDto] searchAssetDto (required):
  699. Future<List<AssetResponseDto>?> searchAsset(SearchAssetDto searchAssetDto,) async {
  700. final response = await searchAssetWithHttpInfo(searchAssetDto,);
  701. if (response.statusCode >= HttpStatus.badRequest) {
  702. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  703. }
  704. // When a remote server returns no body with a status of 204, we shall not decode it.
  705. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  706. // FormatException when trying to decode an empty string.
  707. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  708. final responseBody = await _decodeBodyBytes(response);
  709. return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
  710. .cast<AssetResponseDto>()
  711. .toList();
  712. }
  713. return null;
  714. }
  715. /// Performs an HTTP 'GET /asset/file/{assetId}' operation and returns the [Response].
  716. /// Parameters:
  717. ///
  718. /// * [String] assetId (required):
  719. ///
  720. /// * [bool] isThumb:
  721. ///
  722. /// * [bool] isWeb:
  723. Future<Response> serveFileWithHttpInfo(String assetId, { bool? isThumb, bool? isWeb, }) async {
  724. // ignore: prefer_const_declarations
  725. final path = r'/asset/file/{assetId}'
  726. .replaceAll('{assetId}', assetId);
  727. // ignore: prefer_final_locals
  728. Object? postBody;
  729. final queryParams = <QueryParam>[];
  730. final headerParams = <String, String>{};
  731. final formParams = <String, String>{};
  732. if (isThumb != null) {
  733. queryParams.addAll(_queryParams('', 'isThumb', isThumb));
  734. }
  735. if (isWeb != null) {
  736. queryParams.addAll(_queryParams('', 'isWeb', isWeb));
  737. }
  738. const contentTypes = <String>[];
  739. return apiClient.invokeAPI(
  740. path,
  741. 'GET',
  742. queryParams,
  743. postBody,
  744. headerParams,
  745. formParams,
  746. contentTypes.isEmpty ? null : contentTypes.first,
  747. );
  748. }
  749. /// Parameters:
  750. ///
  751. /// * [String] assetId (required):
  752. ///
  753. /// * [bool] isThumb:
  754. ///
  755. /// * [bool] isWeb:
  756. Future<Object?> serveFile(String assetId, { bool? isThumb, bool? isWeb, }) async {
  757. final response = await serveFileWithHttpInfo(assetId, isThumb: isThumb, isWeb: isWeb, );
  758. if (response.statusCode >= HttpStatus.badRequest) {
  759. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  760. }
  761. // When a remote server returns no body with a status of 204, we shall not decode it.
  762. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  763. // FormatException when trying to decode an empty string.
  764. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  765. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Object',) as Object;
  766. }
  767. return null;
  768. }
  769. ///
  770. ///
  771. /// Update an asset
  772. ///
  773. /// Note: This method returns the HTTP [Response].
  774. ///
  775. /// Parameters:
  776. ///
  777. /// * [String] assetId (required):
  778. ///
  779. /// * [UpdateAssetDto] updateAssetDto (required):
  780. Future<Response> updateAssetByIdWithHttpInfo(String assetId, UpdateAssetDto updateAssetDto,) async {
  781. // ignore: prefer_const_declarations
  782. final path = r'/asset/assetById/{assetId}'
  783. .replaceAll('{assetId}', assetId);
  784. // ignore: prefer_final_locals
  785. Object? postBody = updateAssetDto;
  786. final queryParams = <QueryParam>[];
  787. final headerParams = <String, String>{};
  788. final formParams = <String, String>{};
  789. const contentTypes = <String>['application/json'];
  790. return apiClient.invokeAPI(
  791. path,
  792. 'PUT',
  793. queryParams,
  794. postBody,
  795. headerParams,
  796. formParams,
  797. contentTypes.isEmpty ? null : contentTypes.first,
  798. );
  799. }
  800. ///
  801. ///
  802. /// Update an asset
  803. ///
  804. /// Parameters:
  805. ///
  806. /// * [String] assetId (required):
  807. ///
  808. /// * [UpdateAssetDto] updateAssetDto (required):
  809. Future<AssetResponseDto?> updateAssetById(String assetId, UpdateAssetDto updateAssetDto,) async {
  810. final response = await updateAssetByIdWithHttpInfo(assetId, updateAssetDto,);
  811. if (response.statusCode >= HttpStatus.badRequest) {
  812. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  813. }
  814. // When a remote server returns no body with a status of 204, we shall not decode it.
  815. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  816. // FormatException when trying to decode an empty string.
  817. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  818. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetResponseDto',) as AssetResponseDto;
  819. }
  820. return null;
  821. }
  822. /// Performs an HTTP 'POST /asset/upload' operation and returns the [Response].
  823. /// Parameters:
  824. ///
  825. /// * [MultipartFile] assetData (required):
  826. Future<Response> uploadFileWithHttpInfo(MultipartFile assetData,) async {
  827. // ignore: prefer_const_declarations
  828. final path = r'/asset/upload';
  829. // ignore: prefer_final_locals
  830. Object? postBody;
  831. final queryParams = <QueryParam>[];
  832. final headerParams = <String, String>{};
  833. final formParams = <String, String>{};
  834. const contentTypes = <String>['multipart/form-data'];
  835. bool hasFields = false;
  836. final mp = MultipartRequest('POST', Uri.parse(path));
  837. if (assetData != null) {
  838. hasFields = true;
  839. mp.fields[r'assetData'] = assetData.field;
  840. mp.files.add(assetData);
  841. }
  842. if (hasFields) {
  843. postBody = mp;
  844. }
  845. return apiClient.invokeAPI(
  846. path,
  847. 'POST',
  848. queryParams,
  849. postBody,
  850. headerParams,
  851. formParams,
  852. contentTypes.isEmpty ? null : contentTypes.first,
  853. );
  854. }
  855. /// Parameters:
  856. ///
  857. /// * [MultipartFile] assetData (required):
  858. Future<AssetFileUploadResponseDto?> uploadFile(MultipartFile assetData,) async {
  859. final response = await uploadFileWithHttpInfo(assetData,);
  860. if (response.statusCode >= HttpStatus.badRequest) {
  861. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  862. }
  863. // When a remote server returns no body with a status of 204, we shall not decode it.
  864. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  865. // FormatException when trying to decode an empty string.
  866. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  867. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetFileUploadResponseDto',) as AssetFileUploadResponseDto;
  868. }
  869. return null;
  870. }
  871. }