asset_api.dart 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513
  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. /// Checks if assets exist by checksums
  14. ///
  15. /// Note: This method returns the HTTP [Response].
  16. ///
  17. /// Parameters:
  18. ///
  19. /// * [AssetBulkUploadCheckDto] assetBulkUploadCheckDto (required):
  20. Future<Response> bulkUploadCheckWithHttpInfo(AssetBulkUploadCheckDto assetBulkUploadCheckDto,) async {
  21. // ignore: prefer_const_declarations
  22. final path = r'/asset/bulk-upload-check';
  23. // ignore: prefer_final_locals
  24. Object? postBody = assetBulkUploadCheckDto;
  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. /// Checks if assets exist by checksums
  40. ///
  41. /// Parameters:
  42. ///
  43. /// * [AssetBulkUploadCheckDto] assetBulkUploadCheckDto (required):
  44. Future<AssetBulkUploadCheckResponseDto?> bulkUploadCheck(AssetBulkUploadCheckDto assetBulkUploadCheckDto,) async {
  45. final response = await bulkUploadCheckWithHttpInfo(assetBulkUploadCheckDto,);
  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), 'AssetBulkUploadCheckResponseDto',) as AssetBulkUploadCheckResponseDto;
  54. }
  55. return null;
  56. }
  57. /// Check duplicated asset before uploading - for Web upload used
  58. ///
  59. /// Note: This method returns the HTTP [Response].
  60. ///
  61. /// Parameters:
  62. ///
  63. /// * [CheckDuplicateAssetDto] checkDuplicateAssetDto (required):
  64. ///
  65. /// * [String] key:
  66. Future<Response> checkDuplicateAssetWithHttpInfo(CheckDuplicateAssetDto checkDuplicateAssetDto, { String? key, }) async {
  67. // ignore: prefer_const_declarations
  68. final path = r'/asset/check';
  69. // ignore: prefer_final_locals
  70. Object? postBody = checkDuplicateAssetDto;
  71. final queryParams = <QueryParam>[];
  72. final headerParams = <String, String>{};
  73. final formParams = <String, String>{};
  74. if (key != null) {
  75. queryParams.addAll(_queryParams('', 'key', key));
  76. }
  77. const contentTypes = <String>['application/json'];
  78. return apiClient.invokeAPI(
  79. path,
  80. 'POST',
  81. queryParams,
  82. postBody,
  83. headerParams,
  84. formParams,
  85. contentTypes.isEmpty ? null : contentTypes.first,
  86. );
  87. }
  88. /// Check duplicated asset before uploading - for Web upload used
  89. ///
  90. /// Parameters:
  91. ///
  92. /// * [CheckDuplicateAssetDto] checkDuplicateAssetDto (required):
  93. ///
  94. /// * [String] key:
  95. Future<CheckDuplicateAssetResponseDto?> checkDuplicateAsset(CheckDuplicateAssetDto checkDuplicateAssetDto, { String? key, }) async {
  96. final response = await checkDuplicateAssetWithHttpInfo(checkDuplicateAssetDto, key: key, );
  97. if (response.statusCode >= HttpStatus.badRequest) {
  98. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  99. }
  100. // When a remote server returns no body with a status of 204, we shall not decode it.
  101. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  102. // FormatException when trying to decode an empty string.
  103. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  104. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'CheckDuplicateAssetResponseDto',) as CheckDuplicateAssetResponseDto;
  105. }
  106. return null;
  107. }
  108. /// Checks if multiple assets exist on the server and returns all existing - used by background backup
  109. ///
  110. /// Note: This method returns the HTTP [Response].
  111. ///
  112. /// Parameters:
  113. ///
  114. /// * [CheckExistingAssetsDto] checkExistingAssetsDto (required):
  115. Future<Response> checkExistingAssetsWithHttpInfo(CheckExistingAssetsDto checkExistingAssetsDto,) async {
  116. // ignore: prefer_const_declarations
  117. final path = r'/asset/exist';
  118. // ignore: prefer_final_locals
  119. Object? postBody = checkExistingAssetsDto;
  120. final queryParams = <QueryParam>[];
  121. final headerParams = <String, String>{};
  122. final formParams = <String, String>{};
  123. const contentTypes = <String>['application/json'];
  124. return apiClient.invokeAPI(
  125. path,
  126. 'POST',
  127. queryParams,
  128. postBody,
  129. headerParams,
  130. formParams,
  131. contentTypes.isEmpty ? null : contentTypes.first,
  132. );
  133. }
  134. /// Checks if multiple assets exist on the server and returns all existing - used by background backup
  135. ///
  136. /// Parameters:
  137. ///
  138. /// * [CheckExistingAssetsDto] checkExistingAssetsDto (required):
  139. Future<CheckExistingAssetsResponseDto?> checkExistingAssets(CheckExistingAssetsDto checkExistingAssetsDto,) async {
  140. final response = await checkExistingAssetsWithHttpInfo(checkExistingAssetsDto,);
  141. if (response.statusCode >= HttpStatus.badRequest) {
  142. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  143. }
  144. // When a remote server returns no body with a status of 204, we shall not decode it.
  145. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  146. // FormatException when trying to decode an empty string.
  147. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  148. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'CheckExistingAssetsResponseDto',) as CheckExistingAssetsResponseDto;
  149. }
  150. return null;
  151. }
  152. /// Performs an HTTP 'DELETE /asset' operation and returns the [Response].
  153. /// Parameters:
  154. ///
  155. /// * [DeleteAssetDto] deleteAssetDto (required):
  156. Future<Response> deleteAssetWithHttpInfo(DeleteAssetDto deleteAssetDto,) async {
  157. // ignore: prefer_const_declarations
  158. final path = r'/asset';
  159. // ignore: prefer_final_locals
  160. Object? postBody = deleteAssetDto;
  161. final queryParams = <QueryParam>[];
  162. final headerParams = <String, String>{};
  163. final formParams = <String, String>{};
  164. const contentTypes = <String>['application/json'];
  165. return apiClient.invokeAPI(
  166. path,
  167. 'DELETE',
  168. queryParams,
  169. postBody,
  170. headerParams,
  171. formParams,
  172. contentTypes.isEmpty ? null : contentTypes.first,
  173. );
  174. }
  175. /// Parameters:
  176. ///
  177. /// * [DeleteAssetDto] deleteAssetDto (required):
  178. Future<List<DeleteAssetResponseDto>?> deleteAsset(DeleteAssetDto deleteAssetDto,) async {
  179. final response = await deleteAssetWithHttpInfo(deleteAssetDto,);
  180. if (response.statusCode >= HttpStatus.badRequest) {
  181. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  182. }
  183. // When a remote server returns no body with a status of 204, we shall not decode it.
  184. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  185. // FormatException when trying to decode an empty string.
  186. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  187. final responseBody = await _decodeBodyBytes(response);
  188. return (await apiClient.deserializeAsync(responseBody, 'List<DeleteAssetResponseDto>') as List)
  189. .cast<DeleteAssetResponseDto>()
  190. .toList();
  191. }
  192. return null;
  193. }
  194. /// Performs an HTTP 'POST /asset/download' operation and returns the [Response].
  195. /// Parameters:
  196. ///
  197. /// * [AssetIdsDto] assetIdsDto (required):
  198. ///
  199. /// * [String] key:
  200. Future<Response> downloadArchiveWithHttpInfo(AssetIdsDto assetIdsDto, { String? key, }) async {
  201. // ignore: prefer_const_declarations
  202. final path = r'/asset/download';
  203. // ignore: prefer_final_locals
  204. Object? postBody = assetIdsDto;
  205. final queryParams = <QueryParam>[];
  206. final headerParams = <String, String>{};
  207. final formParams = <String, String>{};
  208. if (key != null) {
  209. queryParams.addAll(_queryParams('', 'key', key));
  210. }
  211. const contentTypes = <String>['application/json'];
  212. return apiClient.invokeAPI(
  213. path,
  214. 'POST',
  215. queryParams,
  216. postBody,
  217. headerParams,
  218. formParams,
  219. contentTypes.isEmpty ? null : contentTypes.first,
  220. );
  221. }
  222. /// Parameters:
  223. ///
  224. /// * [AssetIdsDto] assetIdsDto (required):
  225. ///
  226. /// * [String] key:
  227. Future<MultipartFile?> downloadArchive(AssetIdsDto assetIdsDto, { String? key, }) async {
  228. final response = await downloadArchiveWithHttpInfo(assetIdsDto, key: key, );
  229. if (response.statusCode >= HttpStatus.badRequest) {
  230. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  231. }
  232. // When a remote server returns no body with a status of 204, we shall not decode it.
  233. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  234. // FormatException when trying to decode an empty string.
  235. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  236. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'MultipartFile',) as MultipartFile;
  237. }
  238. return null;
  239. }
  240. /// Performs an HTTP 'POST /asset/download/{id}' operation and returns the [Response].
  241. /// Parameters:
  242. ///
  243. /// * [String] id (required):
  244. ///
  245. /// * [String] key:
  246. Future<Response> downloadFileWithHttpInfo(String id, { String? key, }) async {
  247. // ignore: prefer_const_declarations
  248. final path = r'/asset/download/{id}'
  249. .replaceAll('{id}', id);
  250. // ignore: prefer_final_locals
  251. Object? postBody;
  252. final queryParams = <QueryParam>[];
  253. final headerParams = <String, String>{};
  254. final formParams = <String, String>{};
  255. if (key != null) {
  256. queryParams.addAll(_queryParams('', 'key', key));
  257. }
  258. const contentTypes = <String>[];
  259. return apiClient.invokeAPI(
  260. path,
  261. 'POST',
  262. queryParams,
  263. postBody,
  264. headerParams,
  265. formParams,
  266. contentTypes.isEmpty ? null : contentTypes.first,
  267. );
  268. }
  269. /// Parameters:
  270. ///
  271. /// * [String] id (required):
  272. ///
  273. /// * [String] key:
  274. Future<MultipartFile?> downloadFile(String id, { String? key, }) async {
  275. final response = await downloadFileWithHttpInfo(id, key: key, );
  276. if (response.statusCode >= HttpStatus.badRequest) {
  277. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  278. }
  279. // When a remote server returns no body with a status of 204, we shall not decode it.
  280. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  281. // FormatException when trying to decode an empty string.
  282. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  283. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'MultipartFile',) as MultipartFile;
  284. }
  285. return null;
  286. }
  287. /// Get all AssetEntity belong to the user
  288. ///
  289. /// Note: This method returns the HTTP [Response].
  290. ///
  291. /// Parameters:
  292. ///
  293. /// * [String] userId:
  294. ///
  295. /// * [bool] isFavorite:
  296. ///
  297. /// * [bool] isArchived:
  298. ///
  299. /// * [bool] withoutThumbs:
  300. /// Include assets without thumbnails
  301. ///
  302. /// * [num] skip:
  303. ///
  304. /// * [String] ifNoneMatch:
  305. /// ETag of data already cached on the client
  306. Future<Response> getAllAssetsWithHttpInfo({ String? userId, bool? isFavorite, bool? isArchived, bool? withoutThumbs, num? skip, String? ifNoneMatch, }) async {
  307. // ignore: prefer_const_declarations
  308. final path = r'/asset';
  309. // ignore: prefer_final_locals
  310. Object? postBody;
  311. final queryParams = <QueryParam>[];
  312. final headerParams = <String, String>{};
  313. final formParams = <String, String>{};
  314. if (userId != null) {
  315. queryParams.addAll(_queryParams('', 'userId', userId));
  316. }
  317. if (isFavorite != null) {
  318. queryParams.addAll(_queryParams('', 'isFavorite', isFavorite));
  319. }
  320. if (isArchived != null) {
  321. queryParams.addAll(_queryParams('', 'isArchived', isArchived));
  322. }
  323. if (withoutThumbs != null) {
  324. queryParams.addAll(_queryParams('', 'withoutThumbs', withoutThumbs));
  325. }
  326. if (skip != null) {
  327. queryParams.addAll(_queryParams('', 'skip', skip));
  328. }
  329. if (ifNoneMatch != null) {
  330. headerParams[r'if-none-match'] = parameterToString(ifNoneMatch);
  331. }
  332. const contentTypes = <String>[];
  333. return apiClient.invokeAPI(
  334. path,
  335. 'GET',
  336. queryParams,
  337. postBody,
  338. headerParams,
  339. formParams,
  340. contentTypes.isEmpty ? null : contentTypes.first,
  341. );
  342. }
  343. /// Get all AssetEntity belong to the user
  344. ///
  345. /// Parameters:
  346. ///
  347. /// * [String] userId:
  348. ///
  349. /// * [bool] isFavorite:
  350. ///
  351. /// * [bool] isArchived:
  352. ///
  353. /// * [bool] withoutThumbs:
  354. /// Include assets without thumbnails
  355. ///
  356. /// * [num] skip:
  357. ///
  358. /// * [String] ifNoneMatch:
  359. /// ETag of data already cached on the client
  360. Future<List<AssetResponseDto>?> getAllAssets({ String? userId, bool? isFavorite, bool? isArchived, bool? withoutThumbs, num? skip, String? ifNoneMatch, }) async {
  361. final response = await getAllAssetsWithHttpInfo( userId: userId, isFavorite: isFavorite, isArchived: isArchived, withoutThumbs: withoutThumbs, skip: skip, ifNoneMatch: ifNoneMatch, );
  362. if (response.statusCode >= HttpStatus.badRequest) {
  363. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  364. }
  365. // When a remote server returns no body with a status of 204, we shall not decode it.
  366. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  367. // FormatException when trying to decode an empty string.
  368. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  369. final responseBody = await _decodeBodyBytes(response);
  370. return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
  371. .cast<AssetResponseDto>()
  372. .toList();
  373. }
  374. return null;
  375. }
  376. /// Performs an HTTP 'GET /asset/stat/archive' operation and returns the [Response].
  377. Future<Response> getArchivedAssetCountByUserIdWithHttpInfo() async {
  378. // ignore: prefer_const_declarations
  379. final path = r'/asset/stat/archive';
  380. // ignore: prefer_final_locals
  381. Object? postBody;
  382. final queryParams = <QueryParam>[];
  383. final headerParams = <String, String>{};
  384. final formParams = <String, String>{};
  385. const contentTypes = <String>[];
  386. return apiClient.invokeAPI(
  387. path,
  388. 'GET',
  389. queryParams,
  390. postBody,
  391. headerParams,
  392. formParams,
  393. contentTypes.isEmpty ? null : contentTypes.first,
  394. );
  395. }
  396. Future<AssetCountByUserIdResponseDto?> getArchivedAssetCountByUserId() async {
  397. final response = await getArchivedAssetCountByUserIdWithHttpInfo();
  398. if (response.statusCode >= HttpStatus.badRequest) {
  399. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  400. }
  401. // When a remote server returns no body with a status of 204, we shall not decode it.
  402. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  403. // FormatException when trying to decode an empty string.
  404. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  405. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetCountByUserIdResponseDto',) as AssetCountByUserIdResponseDto;
  406. }
  407. return null;
  408. }
  409. /// Get a single asset's information
  410. ///
  411. /// Note: This method returns the HTTP [Response].
  412. ///
  413. /// Parameters:
  414. ///
  415. /// * [String] id (required):
  416. ///
  417. /// * [String] key:
  418. Future<Response> getAssetByIdWithHttpInfo(String id, { String? key, }) async {
  419. // ignore: prefer_const_declarations
  420. final path = r'/asset/assetById/{id}'
  421. .replaceAll('{id}', id);
  422. // ignore: prefer_final_locals
  423. Object? postBody;
  424. final queryParams = <QueryParam>[];
  425. final headerParams = <String, String>{};
  426. final formParams = <String, String>{};
  427. if (key != null) {
  428. queryParams.addAll(_queryParams('', 'key', key));
  429. }
  430. const contentTypes = <String>[];
  431. return apiClient.invokeAPI(
  432. path,
  433. 'GET',
  434. queryParams,
  435. postBody,
  436. headerParams,
  437. formParams,
  438. contentTypes.isEmpty ? null : contentTypes.first,
  439. );
  440. }
  441. /// Get a single asset's information
  442. ///
  443. /// Parameters:
  444. ///
  445. /// * [String] id (required):
  446. ///
  447. /// * [String] key:
  448. Future<AssetResponseDto?> getAssetById(String id, { String? key, }) async {
  449. final response = await getAssetByIdWithHttpInfo(id, key: key, );
  450. if (response.statusCode >= HttpStatus.badRequest) {
  451. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  452. }
  453. // When a remote server returns no body with a status of 204, we shall not decode it.
  454. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  455. // FormatException when trying to decode an empty string.
  456. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  457. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetResponseDto',) as AssetResponseDto;
  458. }
  459. return null;
  460. }
  461. /// Performs an HTTP 'POST /asset/time-bucket' operation and returns the [Response].
  462. /// Parameters:
  463. ///
  464. /// * [GetAssetByTimeBucketDto] getAssetByTimeBucketDto (required):
  465. Future<Response> getAssetByTimeBucketWithHttpInfo(GetAssetByTimeBucketDto getAssetByTimeBucketDto,) async {
  466. // ignore: prefer_const_declarations
  467. final path = r'/asset/time-bucket';
  468. // ignore: prefer_final_locals
  469. Object? postBody = getAssetByTimeBucketDto;
  470. final queryParams = <QueryParam>[];
  471. final headerParams = <String, String>{};
  472. final formParams = <String, String>{};
  473. const contentTypes = <String>['application/json'];
  474. return apiClient.invokeAPI(
  475. path,
  476. 'POST',
  477. queryParams,
  478. postBody,
  479. headerParams,
  480. formParams,
  481. contentTypes.isEmpty ? null : contentTypes.first,
  482. );
  483. }
  484. /// Parameters:
  485. ///
  486. /// * [GetAssetByTimeBucketDto] getAssetByTimeBucketDto (required):
  487. Future<List<AssetResponseDto>?> getAssetByTimeBucket(GetAssetByTimeBucketDto getAssetByTimeBucketDto,) async {
  488. final response = await getAssetByTimeBucketWithHttpInfo(getAssetByTimeBucketDto,);
  489. if (response.statusCode >= HttpStatus.badRequest) {
  490. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  491. }
  492. // When a remote server returns no body with a status of 204, we shall not decode it.
  493. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  494. // FormatException when trying to decode an empty string.
  495. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  496. final responseBody = await _decodeBodyBytes(response);
  497. return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
  498. .cast<AssetResponseDto>()
  499. .toList();
  500. }
  501. return null;
  502. }
  503. /// Performs an HTTP 'POST /asset/count-by-time-bucket' operation and returns the [Response].
  504. /// Parameters:
  505. ///
  506. /// * [GetAssetCountByTimeBucketDto] getAssetCountByTimeBucketDto (required):
  507. Future<Response> getAssetCountByTimeBucketWithHttpInfo(GetAssetCountByTimeBucketDto getAssetCountByTimeBucketDto,) async {
  508. // ignore: prefer_const_declarations
  509. final path = r'/asset/count-by-time-bucket';
  510. // ignore: prefer_final_locals
  511. Object? postBody = getAssetCountByTimeBucketDto;
  512. final queryParams = <QueryParam>[];
  513. final headerParams = <String, String>{};
  514. final formParams = <String, String>{};
  515. const contentTypes = <String>['application/json'];
  516. return apiClient.invokeAPI(
  517. path,
  518. 'POST',
  519. queryParams,
  520. postBody,
  521. headerParams,
  522. formParams,
  523. contentTypes.isEmpty ? null : contentTypes.first,
  524. );
  525. }
  526. /// Parameters:
  527. ///
  528. /// * [GetAssetCountByTimeBucketDto] getAssetCountByTimeBucketDto (required):
  529. Future<AssetCountByTimeBucketResponseDto?> getAssetCountByTimeBucket(GetAssetCountByTimeBucketDto getAssetCountByTimeBucketDto,) async {
  530. final response = await getAssetCountByTimeBucketWithHttpInfo(getAssetCountByTimeBucketDto,);
  531. if (response.statusCode >= HttpStatus.badRequest) {
  532. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  533. }
  534. // When a remote server returns no body with a status of 204, we shall not decode it.
  535. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  536. // FormatException when trying to decode an empty string.
  537. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  538. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetCountByTimeBucketResponseDto',) as AssetCountByTimeBucketResponseDto;
  539. }
  540. return null;
  541. }
  542. /// Performs an HTTP 'GET /asset/count-by-user-id' operation and returns the [Response].
  543. Future<Response> getAssetCountByUserIdWithHttpInfo() async {
  544. // ignore: prefer_const_declarations
  545. final path = r'/asset/count-by-user-id';
  546. // ignore: prefer_final_locals
  547. Object? postBody;
  548. final queryParams = <QueryParam>[];
  549. final headerParams = <String, String>{};
  550. final formParams = <String, String>{};
  551. const contentTypes = <String>[];
  552. return apiClient.invokeAPI(
  553. path,
  554. 'GET',
  555. queryParams,
  556. postBody,
  557. headerParams,
  558. formParams,
  559. contentTypes.isEmpty ? null : contentTypes.first,
  560. );
  561. }
  562. Future<AssetCountByUserIdResponseDto?> getAssetCountByUserId() async {
  563. final response = await getAssetCountByUserIdWithHttpInfo();
  564. if (response.statusCode >= HttpStatus.badRequest) {
  565. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  566. }
  567. // When a remote server returns no body with a status of 204, we shall not decode it.
  568. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  569. // FormatException when trying to decode an empty string.
  570. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  571. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetCountByUserIdResponseDto',) as AssetCountByUserIdResponseDto;
  572. }
  573. return null;
  574. }
  575. /// Performs an HTTP 'GET /asset/search-terms' operation and returns the [Response].
  576. Future<Response> getAssetSearchTermsWithHttpInfo() async {
  577. // ignore: prefer_const_declarations
  578. final path = r'/asset/search-terms';
  579. // ignore: prefer_final_locals
  580. Object? postBody;
  581. final queryParams = <QueryParam>[];
  582. final headerParams = <String, String>{};
  583. final formParams = <String, String>{};
  584. const contentTypes = <String>[];
  585. return apiClient.invokeAPI(
  586. path,
  587. 'GET',
  588. queryParams,
  589. postBody,
  590. headerParams,
  591. formParams,
  592. contentTypes.isEmpty ? null : contentTypes.first,
  593. );
  594. }
  595. Future<List<String>?> getAssetSearchTerms() async {
  596. final response = await getAssetSearchTermsWithHttpInfo();
  597. if (response.statusCode >= HttpStatus.badRequest) {
  598. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  599. }
  600. // When a remote server returns no body with a status of 204, we shall not decode it.
  601. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  602. // FormatException when trying to decode an empty string.
  603. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  604. final responseBody = await _decodeBodyBytes(response);
  605. return (await apiClient.deserializeAsync(responseBody, 'List<String>') as List)
  606. .cast<String>()
  607. .toList();
  608. }
  609. return null;
  610. }
  611. /// Performs an HTTP 'GET /asset/thumbnail/{id}' operation and returns the [Response].
  612. /// Parameters:
  613. ///
  614. /// * [String] id (required):
  615. ///
  616. /// * [ThumbnailFormat] format:
  617. ///
  618. /// * [String] key:
  619. Future<Response> getAssetThumbnailWithHttpInfo(String id, { ThumbnailFormat? format, String? key, }) async {
  620. // ignore: prefer_const_declarations
  621. final path = r'/asset/thumbnail/{id}'
  622. .replaceAll('{id}', id);
  623. // ignore: prefer_final_locals
  624. Object? postBody;
  625. final queryParams = <QueryParam>[];
  626. final headerParams = <String, String>{};
  627. final formParams = <String, String>{};
  628. if (format != null) {
  629. queryParams.addAll(_queryParams('', 'format', format));
  630. }
  631. if (key != null) {
  632. queryParams.addAll(_queryParams('', 'key', key));
  633. }
  634. const contentTypes = <String>[];
  635. return apiClient.invokeAPI(
  636. path,
  637. 'GET',
  638. queryParams,
  639. postBody,
  640. headerParams,
  641. formParams,
  642. contentTypes.isEmpty ? null : contentTypes.first,
  643. );
  644. }
  645. /// Parameters:
  646. ///
  647. /// * [String] id (required):
  648. ///
  649. /// * [ThumbnailFormat] format:
  650. ///
  651. /// * [String] key:
  652. Future<void> getAssetThumbnail(String id, { ThumbnailFormat? format, String? key, }) async {
  653. final response = await getAssetThumbnailWithHttpInfo(id, format: format, key: key, );
  654. if (response.statusCode >= HttpStatus.badRequest) {
  655. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  656. }
  657. }
  658. /// Performs an HTTP 'GET /asset/curated-locations' operation and returns the [Response].
  659. Future<Response> getCuratedLocationsWithHttpInfo() async {
  660. // ignore: prefer_const_declarations
  661. final path = r'/asset/curated-locations';
  662. // ignore: prefer_final_locals
  663. Object? postBody;
  664. final queryParams = <QueryParam>[];
  665. final headerParams = <String, String>{};
  666. final formParams = <String, String>{};
  667. const contentTypes = <String>[];
  668. return apiClient.invokeAPI(
  669. path,
  670. 'GET',
  671. queryParams,
  672. postBody,
  673. headerParams,
  674. formParams,
  675. contentTypes.isEmpty ? null : contentTypes.first,
  676. );
  677. }
  678. Future<List<CuratedLocationsResponseDto>?> getCuratedLocations() async {
  679. final response = await getCuratedLocationsWithHttpInfo();
  680. if (response.statusCode >= HttpStatus.badRequest) {
  681. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  682. }
  683. // When a remote server returns no body with a status of 204, we shall not decode it.
  684. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  685. // FormatException when trying to decode an empty string.
  686. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  687. final responseBody = await _decodeBodyBytes(response);
  688. return (await apiClient.deserializeAsync(responseBody, 'List<CuratedLocationsResponseDto>') as List)
  689. .cast<CuratedLocationsResponseDto>()
  690. .toList();
  691. }
  692. return null;
  693. }
  694. /// Performs an HTTP 'GET /asset/curated-objects' operation and returns the [Response].
  695. Future<Response> getCuratedObjectsWithHttpInfo() async {
  696. // ignore: prefer_const_declarations
  697. final path = r'/asset/curated-objects';
  698. // ignore: prefer_final_locals
  699. Object? postBody;
  700. final queryParams = <QueryParam>[];
  701. final headerParams = <String, String>{};
  702. final formParams = <String, String>{};
  703. const contentTypes = <String>[];
  704. return apiClient.invokeAPI(
  705. path,
  706. 'GET',
  707. queryParams,
  708. postBody,
  709. headerParams,
  710. formParams,
  711. contentTypes.isEmpty ? null : contentTypes.first,
  712. );
  713. }
  714. Future<List<CuratedObjectsResponseDto>?> getCuratedObjects() async {
  715. final response = await getCuratedObjectsWithHttpInfo();
  716. if (response.statusCode >= HttpStatus.badRequest) {
  717. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  718. }
  719. // When a remote server returns no body with a status of 204, we shall not decode it.
  720. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  721. // FormatException when trying to decode an empty string.
  722. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  723. final responseBody = await _decodeBodyBytes(response);
  724. return (await apiClient.deserializeAsync(responseBody, 'List<CuratedObjectsResponseDto>') as List)
  725. .cast<CuratedObjectsResponseDto>()
  726. .toList();
  727. }
  728. return null;
  729. }
  730. /// Performs an HTTP 'GET /asset/download' operation and returns the [Response].
  731. /// Parameters:
  732. ///
  733. /// * [List<String>] assetIds:
  734. ///
  735. /// * [String] albumId:
  736. ///
  737. /// * [String] userId:
  738. ///
  739. /// * [num] archiveSize:
  740. ///
  741. /// * [String] key:
  742. Future<Response> getDownloadInfoWithHttpInfo({ List<String>? assetIds, String? albumId, String? userId, num? archiveSize, String? key, }) async {
  743. // ignore: prefer_const_declarations
  744. final path = r'/asset/download';
  745. // ignore: prefer_final_locals
  746. Object? postBody;
  747. final queryParams = <QueryParam>[];
  748. final headerParams = <String, String>{};
  749. final formParams = <String, String>{};
  750. if (assetIds != null) {
  751. queryParams.addAll(_queryParams('multi', 'assetIds', assetIds));
  752. }
  753. if (albumId != null) {
  754. queryParams.addAll(_queryParams('', 'albumId', albumId));
  755. }
  756. if (userId != null) {
  757. queryParams.addAll(_queryParams('', 'userId', userId));
  758. }
  759. if (archiveSize != null) {
  760. queryParams.addAll(_queryParams('', 'archiveSize', archiveSize));
  761. }
  762. if (key != null) {
  763. queryParams.addAll(_queryParams('', 'key', key));
  764. }
  765. const contentTypes = <String>[];
  766. return apiClient.invokeAPI(
  767. path,
  768. 'GET',
  769. queryParams,
  770. postBody,
  771. headerParams,
  772. formParams,
  773. contentTypes.isEmpty ? null : contentTypes.first,
  774. );
  775. }
  776. /// Parameters:
  777. ///
  778. /// * [List<String>] assetIds:
  779. ///
  780. /// * [String] albumId:
  781. ///
  782. /// * [String] userId:
  783. ///
  784. /// * [num] archiveSize:
  785. ///
  786. /// * [String] key:
  787. Future<DownloadResponseDto?> getDownloadInfo({ List<String>? assetIds, String? albumId, String? userId, num? archiveSize, String? key, }) async {
  788. final response = await getDownloadInfoWithHttpInfo( assetIds: assetIds, albumId: albumId, userId: userId, archiveSize: archiveSize, key: key, );
  789. if (response.statusCode >= HttpStatus.badRequest) {
  790. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  791. }
  792. // When a remote server returns no body with a status of 204, we shall not decode it.
  793. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  794. // FormatException when trying to decode an empty string.
  795. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  796. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'DownloadResponseDto',) as DownloadResponseDto;
  797. }
  798. return null;
  799. }
  800. /// Performs an HTTP 'GET /asset/map-marker' operation and returns the [Response].
  801. /// Parameters:
  802. ///
  803. /// * [bool] isFavorite:
  804. ///
  805. /// * [DateTime] fileCreatedAfter:
  806. ///
  807. /// * [DateTime] fileCreatedBefore:
  808. Future<Response> getMapMarkersWithHttpInfo({ bool? isFavorite, DateTime? fileCreatedAfter, DateTime? fileCreatedBefore, }) async {
  809. // ignore: prefer_const_declarations
  810. final path = r'/asset/map-marker';
  811. // ignore: prefer_final_locals
  812. Object? postBody;
  813. final queryParams = <QueryParam>[];
  814. final headerParams = <String, String>{};
  815. final formParams = <String, String>{};
  816. if (isFavorite != null) {
  817. queryParams.addAll(_queryParams('', 'isFavorite', isFavorite));
  818. }
  819. if (fileCreatedAfter != null) {
  820. queryParams.addAll(_queryParams('', 'fileCreatedAfter', fileCreatedAfter));
  821. }
  822. if (fileCreatedBefore != null) {
  823. queryParams.addAll(_queryParams('', 'fileCreatedBefore', fileCreatedBefore));
  824. }
  825. const contentTypes = <String>[];
  826. return apiClient.invokeAPI(
  827. path,
  828. 'GET',
  829. queryParams,
  830. postBody,
  831. headerParams,
  832. formParams,
  833. contentTypes.isEmpty ? null : contentTypes.first,
  834. );
  835. }
  836. /// Parameters:
  837. ///
  838. /// * [bool] isFavorite:
  839. ///
  840. /// * [DateTime] fileCreatedAfter:
  841. ///
  842. /// * [DateTime] fileCreatedBefore:
  843. Future<List<MapMarkerResponseDto>?> getMapMarkers({ bool? isFavorite, DateTime? fileCreatedAfter, DateTime? fileCreatedBefore, }) async {
  844. final response = await getMapMarkersWithHttpInfo( isFavorite: isFavorite, fileCreatedAfter: fileCreatedAfter, fileCreatedBefore: fileCreatedBefore, );
  845. if (response.statusCode >= HttpStatus.badRequest) {
  846. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  847. }
  848. // When a remote server returns no body with a status of 204, we shall not decode it.
  849. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  850. // FormatException when trying to decode an empty string.
  851. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  852. final responseBody = await _decodeBodyBytes(response);
  853. return (await apiClient.deserializeAsync(responseBody, 'List<MapMarkerResponseDto>') as List)
  854. .cast<MapMarkerResponseDto>()
  855. .toList();
  856. }
  857. return null;
  858. }
  859. /// Performs an HTTP 'GET /asset/memory-lane' operation and returns the [Response].
  860. /// Parameters:
  861. ///
  862. /// * [DateTime] timestamp (required):
  863. /// Get pictures for +24 hours from this time going back x years
  864. Future<Response> getMemoryLaneWithHttpInfo(DateTime timestamp,) async {
  865. // ignore: prefer_const_declarations
  866. final path = r'/asset/memory-lane';
  867. // ignore: prefer_final_locals
  868. Object? postBody;
  869. final queryParams = <QueryParam>[];
  870. final headerParams = <String, String>{};
  871. final formParams = <String, String>{};
  872. queryParams.addAll(_queryParams('', 'timestamp', timestamp));
  873. const contentTypes = <String>[];
  874. return apiClient.invokeAPI(
  875. path,
  876. 'GET',
  877. queryParams,
  878. postBody,
  879. headerParams,
  880. formParams,
  881. contentTypes.isEmpty ? null : contentTypes.first,
  882. );
  883. }
  884. /// Parameters:
  885. ///
  886. /// * [DateTime] timestamp (required):
  887. /// Get pictures for +24 hours from this time going back x years
  888. Future<List<MemoryLaneResponseDto>?> getMemoryLane(DateTime timestamp,) async {
  889. final response = await getMemoryLaneWithHttpInfo(timestamp,);
  890. if (response.statusCode >= HttpStatus.badRequest) {
  891. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  892. }
  893. // When a remote server returns no body with a status of 204, we shall not decode it.
  894. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  895. // FormatException when trying to decode an empty string.
  896. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  897. final responseBody = await _decodeBodyBytes(response);
  898. return (await apiClient.deserializeAsync(responseBody, 'List<MemoryLaneResponseDto>') as List)
  899. .cast<MemoryLaneResponseDto>()
  900. .toList();
  901. }
  902. return null;
  903. }
  904. /// Get all asset of a device that are in the database, ID only.
  905. ///
  906. /// Note: This method returns the HTTP [Response].
  907. ///
  908. /// Parameters:
  909. ///
  910. /// * [String] deviceId (required):
  911. Future<Response> getUserAssetsByDeviceIdWithHttpInfo(String deviceId,) async {
  912. // ignore: prefer_const_declarations
  913. final path = r'/asset/{deviceId}'
  914. .replaceAll('{deviceId}', deviceId);
  915. // ignore: prefer_final_locals
  916. Object? postBody;
  917. final queryParams = <QueryParam>[];
  918. final headerParams = <String, String>{};
  919. final formParams = <String, String>{};
  920. const contentTypes = <String>[];
  921. return apiClient.invokeAPI(
  922. path,
  923. 'GET',
  924. queryParams,
  925. postBody,
  926. headerParams,
  927. formParams,
  928. contentTypes.isEmpty ? null : contentTypes.first,
  929. );
  930. }
  931. /// Get all asset of a device that are in the database, ID only.
  932. ///
  933. /// Parameters:
  934. ///
  935. /// * [String] deviceId (required):
  936. Future<List<String>?> getUserAssetsByDeviceId(String deviceId,) async {
  937. final response = await getUserAssetsByDeviceIdWithHttpInfo(deviceId,);
  938. if (response.statusCode >= HttpStatus.badRequest) {
  939. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  940. }
  941. // When a remote server returns no body with a status of 204, we shall not decode it.
  942. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  943. // FormatException when trying to decode an empty string.
  944. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  945. final responseBody = await _decodeBodyBytes(response);
  946. return (await apiClient.deserializeAsync(responseBody, 'List<String>') as List)
  947. .cast<String>()
  948. .toList();
  949. }
  950. return null;
  951. }
  952. /// Performs an HTTP 'POST /asset/import' operation and returns the [Response].
  953. /// Parameters:
  954. ///
  955. /// * [ImportAssetDto] importAssetDto (required):
  956. Future<Response> importFileWithHttpInfo(ImportAssetDto importAssetDto,) async {
  957. // ignore: prefer_const_declarations
  958. final path = r'/asset/import';
  959. // ignore: prefer_final_locals
  960. Object? postBody = importAssetDto;
  961. final queryParams = <QueryParam>[];
  962. final headerParams = <String, String>{};
  963. final formParams = <String, String>{};
  964. const contentTypes = <String>['application/json'];
  965. return apiClient.invokeAPI(
  966. path,
  967. 'POST',
  968. queryParams,
  969. postBody,
  970. headerParams,
  971. formParams,
  972. contentTypes.isEmpty ? null : contentTypes.first,
  973. );
  974. }
  975. /// Parameters:
  976. ///
  977. /// * [ImportAssetDto] importAssetDto (required):
  978. Future<AssetFileUploadResponseDto?> importFile(ImportAssetDto importAssetDto,) async {
  979. final response = await importFileWithHttpInfo(importAssetDto,);
  980. if (response.statusCode >= HttpStatus.badRequest) {
  981. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  982. }
  983. // When a remote server returns no body with a status of 204, we shall not decode it.
  984. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  985. // FormatException when trying to decode an empty string.
  986. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  987. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetFileUploadResponseDto',) as AssetFileUploadResponseDto;
  988. }
  989. return null;
  990. }
  991. /// Performs an HTTP 'POST /asset/search' operation and returns the [Response].
  992. /// Parameters:
  993. ///
  994. /// * [SearchAssetDto] searchAssetDto (required):
  995. Future<Response> searchAssetWithHttpInfo(SearchAssetDto searchAssetDto,) async {
  996. // ignore: prefer_const_declarations
  997. final path = r'/asset/search';
  998. // ignore: prefer_final_locals
  999. Object? postBody = searchAssetDto;
  1000. final queryParams = <QueryParam>[];
  1001. final headerParams = <String, String>{};
  1002. final formParams = <String, String>{};
  1003. const contentTypes = <String>['application/json'];
  1004. return apiClient.invokeAPI(
  1005. path,
  1006. 'POST',
  1007. queryParams,
  1008. postBody,
  1009. headerParams,
  1010. formParams,
  1011. contentTypes.isEmpty ? null : contentTypes.first,
  1012. );
  1013. }
  1014. /// Parameters:
  1015. ///
  1016. /// * [SearchAssetDto] searchAssetDto (required):
  1017. Future<List<AssetResponseDto>?> searchAsset(SearchAssetDto searchAssetDto,) async {
  1018. final response = await searchAssetWithHttpInfo(searchAssetDto,);
  1019. if (response.statusCode >= HttpStatus.badRequest) {
  1020. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  1021. }
  1022. // When a remote server returns no body with a status of 204, we shall not decode it.
  1023. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  1024. // FormatException when trying to decode an empty string.
  1025. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  1026. final responseBody = await _decodeBodyBytes(response);
  1027. return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
  1028. .cast<AssetResponseDto>()
  1029. .toList();
  1030. }
  1031. return null;
  1032. }
  1033. /// Performs an HTTP 'GET /asset/file/{id}' operation and returns the [Response].
  1034. /// Parameters:
  1035. ///
  1036. /// * [String] id (required):
  1037. ///
  1038. /// * [bool] isThumb:
  1039. ///
  1040. /// * [bool] isWeb:
  1041. ///
  1042. /// * [String] key:
  1043. Future<Response> serveFileWithHttpInfo(String id, { bool? isThumb, bool? isWeb, String? key, }) async {
  1044. // ignore: prefer_const_declarations
  1045. final path = r'/asset/file/{id}'
  1046. .replaceAll('{id}', id);
  1047. // ignore: prefer_final_locals
  1048. Object? postBody;
  1049. final queryParams = <QueryParam>[];
  1050. final headerParams = <String, String>{};
  1051. final formParams = <String, String>{};
  1052. if (isThumb != null) {
  1053. queryParams.addAll(_queryParams('', 'isThumb', isThumb));
  1054. }
  1055. if (isWeb != null) {
  1056. queryParams.addAll(_queryParams('', 'isWeb', isWeb));
  1057. }
  1058. if (key != null) {
  1059. queryParams.addAll(_queryParams('', 'key', key));
  1060. }
  1061. const contentTypes = <String>[];
  1062. return apiClient.invokeAPI(
  1063. path,
  1064. 'GET',
  1065. queryParams,
  1066. postBody,
  1067. headerParams,
  1068. formParams,
  1069. contentTypes.isEmpty ? null : contentTypes.first,
  1070. );
  1071. }
  1072. /// Parameters:
  1073. ///
  1074. /// * [String] id (required):
  1075. ///
  1076. /// * [bool] isThumb:
  1077. ///
  1078. /// * [bool] isWeb:
  1079. ///
  1080. /// * [String] key:
  1081. Future<void> serveFile(String id, { bool? isThumb, bool? isWeb, String? key, }) async {
  1082. final response = await serveFileWithHttpInfo(id, isThumb: isThumb, isWeb: isWeb, key: key, );
  1083. if (response.statusCode >= HttpStatus.badRequest) {
  1084. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  1085. }
  1086. }
  1087. /// Update an asset
  1088. ///
  1089. /// Note: This method returns the HTTP [Response].
  1090. ///
  1091. /// Parameters:
  1092. ///
  1093. /// * [String] id (required):
  1094. ///
  1095. /// * [UpdateAssetDto] updateAssetDto (required):
  1096. Future<Response> updateAssetWithHttpInfo(String id, UpdateAssetDto updateAssetDto,) async {
  1097. // ignore: prefer_const_declarations
  1098. final path = r'/asset/{id}'
  1099. .replaceAll('{id}', id);
  1100. // ignore: prefer_final_locals
  1101. Object? postBody = updateAssetDto;
  1102. final queryParams = <QueryParam>[];
  1103. final headerParams = <String, String>{};
  1104. final formParams = <String, String>{};
  1105. const contentTypes = <String>['application/json'];
  1106. return apiClient.invokeAPI(
  1107. path,
  1108. 'PUT',
  1109. queryParams,
  1110. postBody,
  1111. headerParams,
  1112. formParams,
  1113. contentTypes.isEmpty ? null : contentTypes.first,
  1114. );
  1115. }
  1116. /// Update an asset
  1117. ///
  1118. /// Parameters:
  1119. ///
  1120. /// * [String] id (required):
  1121. ///
  1122. /// * [UpdateAssetDto] updateAssetDto (required):
  1123. Future<AssetResponseDto?> updateAsset(String id, UpdateAssetDto updateAssetDto,) async {
  1124. final response = await updateAssetWithHttpInfo(id, updateAssetDto,);
  1125. if (response.statusCode >= HttpStatus.badRequest) {
  1126. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  1127. }
  1128. // When a remote server returns no body with a status of 204, we shall not decode it.
  1129. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  1130. // FormatException when trying to decode an empty string.
  1131. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  1132. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetResponseDto',) as AssetResponseDto;
  1133. }
  1134. return null;
  1135. }
  1136. /// Performs an HTTP 'POST /asset/upload' operation and returns the [Response].
  1137. /// Parameters:
  1138. ///
  1139. /// * [AssetTypeEnum] assetType (required):
  1140. ///
  1141. /// * [MultipartFile] assetData (required):
  1142. ///
  1143. /// * [String] fileExtension (required):
  1144. ///
  1145. /// * [String] deviceAssetId (required):
  1146. ///
  1147. /// * [String] deviceId (required):
  1148. ///
  1149. /// * [DateTime] fileCreatedAt (required):
  1150. ///
  1151. /// * [DateTime] fileModifiedAt (required):
  1152. ///
  1153. /// * [bool] isFavorite (required):
  1154. ///
  1155. /// * [String] key:
  1156. ///
  1157. /// * [MultipartFile] livePhotoData:
  1158. ///
  1159. /// * [MultipartFile] sidecarData:
  1160. ///
  1161. /// * [bool] isReadOnly:
  1162. ///
  1163. /// * [bool] isArchived:
  1164. ///
  1165. /// * [bool] isVisible:
  1166. ///
  1167. /// * [String] duration:
  1168. Future<Response> uploadFileWithHttpInfo(AssetTypeEnum assetType, MultipartFile assetData, String fileExtension, String deviceAssetId, String deviceId, DateTime fileCreatedAt, DateTime fileModifiedAt, bool isFavorite, { String? key, MultipartFile? livePhotoData, MultipartFile? sidecarData, bool? isReadOnly, bool? isArchived, bool? isVisible, String? duration, }) async {
  1169. // ignore: prefer_const_declarations
  1170. final path = r'/asset/upload';
  1171. // ignore: prefer_final_locals
  1172. Object? postBody;
  1173. final queryParams = <QueryParam>[];
  1174. final headerParams = <String, String>{};
  1175. final formParams = <String, String>{};
  1176. if (key != null) {
  1177. queryParams.addAll(_queryParams('', 'key', key));
  1178. }
  1179. const contentTypes = <String>['multipart/form-data'];
  1180. bool hasFields = false;
  1181. final mp = MultipartRequest('POST', Uri.parse(path));
  1182. if (assetType != null) {
  1183. hasFields = true;
  1184. mp.fields[r'assetType'] = parameterToString(assetType);
  1185. }
  1186. if (assetData != null) {
  1187. hasFields = true;
  1188. mp.fields[r'assetData'] = assetData.field;
  1189. mp.files.add(assetData);
  1190. }
  1191. if (livePhotoData != null) {
  1192. hasFields = true;
  1193. mp.fields[r'livePhotoData'] = livePhotoData.field;
  1194. mp.files.add(livePhotoData);
  1195. }
  1196. if (sidecarData != null) {
  1197. hasFields = true;
  1198. mp.fields[r'sidecarData'] = sidecarData.field;
  1199. mp.files.add(sidecarData);
  1200. }
  1201. if (isReadOnly != null) {
  1202. hasFields = true;
  1203. mp.fields[r'isReadOnly'] = parameterToString(isReadOnly);
  1204. }
  1205. if (fileExtension != null) {
  1206. hasFields = true;
  1207. mp.fields[r'fileExtension'] = parameterToString(fileExtension);
  1208. }
  1209. if (deviceAssetId != null) {
  1210. hasFields = true;
  1211. mp.fields[r'deviceAssetId'] = parameterToString(deviceAssetId);
  1212. }
  1213. if (deviceId != null) {
  1214. hasFields = true;
  1215. mp.fields[r'deviceId'] = parameterToString(deviceId);
  1216. }
  1217. if (fileCreatedAt != null) {
  1218. hasFields = true;
  1219. mp.fields[r'fileCreatedAt'] = parameterToString(fileCreatedAt);
  1220. }
  1221. if (fileModifiedAt != null) {
  1222. hasFields = true;
  1223. mp.fields[r'fileModifiedAt'] = parameterToString(fileModifiedAt);
  1224. }
  1225. if (isFavorite != null) {
  1226. hasFields = true;
  1227. mp.fields[r'isFavorite'] = parameterToString(isFavorite);
  1228. }
  1229. if (isArchived != null) {
  1230. hasFields = true;
  1231. mp.fields[r'isArchived'] = parameterToString(isArchived);
  1232. }
  1233. if (isVisible != null) {
  1234. hasFields = true;
  1235. mp.fields[r'isVisible'] = parameterToString(isVisible);
  1236. }
  1237. if (duration != null) {
  1238. hasFields = true;
  1239. mp.fields[r'duration'] = parameterToString(duration);
  1240. }
  1241. if (hasFields) {
  1242. postBody = mp;
  1243. }
  1244. return apiClient.invokeAPI(
  1245. path,
  1246. 'POST',
  1247. queryParams,
  1248. postBody,
  1249. headerParams,
  1250. formParams,
  1251. contentTypes.isEmpty ? null : contentTypes.first,
  1252. );
  1253. }
  1254. /// Parameters:
  1255. ///
  1256. /// * [AssetTypeEnum] assetType (required):
  1257. ///
  1258. /// * [MultipartFile] assetData (required):
  1259. ///
  1260. /// * [String] fileExtension (required):
  1261. ///
  1262. /// * [String] deviceAssetId (required):
  1263. ///
  1264. /// * [String] deviceId (required):
  1265. ///
  1266. /// * [DateTime] fileCreatedAt (required):
  1267. ///
  1268. /// * [DateTime] fileModifiedAt (required):
  1269. ///
  1270. /// * [bool] isFavorite (required):
  1271. ///
  1272. /// * [String] key:
  1273. ///
  1274. /// * [MultipartFile] livePhotoData:
  1275. ///
  1276. /// * [MultipartFile] sidecarData:
  1277. ///
  1278. /// * [bool] isReadOnly:
  1279. ///
  1280. /// * [bool] isArchived:
  1281. ///
  1282. /// * [bool] isVisible:
  1283. ///
  1284. /// * [String] duration:
  1285. Future<AssetFileUploadResponseDto?> uploadFile(AssetTypeEnum assetType, MultipartFile assetData, String fileExtension, String deviceAssetId, String deviceId, DateTime fileCreatedAt, DateTime fileModifiedAt, bool isFavorite, { String? key, MultipartFile? livePhotoData, MultipartFile? sidecarData, bool? isReadOnly, bool? isArchived, bool? isVisible, String? duration, }) async {
  1286. final response = await uploadFileWithHttpInfo(assetType, assetData, fileExtension, deviceAssetId, deviceId, fileCreatedAt, fileModifiedAt, isFavorite, key: key, livePhotoData: livePhotoData, sidecarData: sidecarData, isReadOnly: isReadOnly, isArchived: isArchived, isVisible: isVisible, duration: duration, );
  1287. if (response.statusCode >= HttpStatus.badRequest) {
  1288. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  1289. }
  1290. // When a remote server returns no body with a status of 204, we shall not decode it.
  1291. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  1292. // FormatException when trying to decode an empty string.
  1293. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  1294. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetFileUploadResponseDto',) as AssetFileUploadResponseDto;
  1295. }
  1296. return null;
  1297. }
  1298. }