asset_api.dart 33 KB

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