asset_api.dart 48 KB

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