asset_api.dart 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585
  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. /// Get a single asset's information
  377. ///
  378. /// Note: This method returns the HTTP [Response].
  379. ///
  380. /// Parameters:
  381. ///
  382. /// * [String] id (required):
  383. ///
  384. /// * [String] key:
  385. Future<Response> getAssetByIdWithHttpInfo(String id, { String? key, }) async {
  386. // ignore: prefer_const_declarations
  387. final path = r'/asset/assetById/{id}'
  388. .replaceAll('{id}', id);
  389. // ignore: prefer_final_locals
  390. Object? postBody;
  391. final queryParams = <QueryParam>[];
  392. final headerParams = <String, String>{};
  393. final formParams = <String, String>{};
  394. if (key != null) {
  395. queryParams.addAll(_queryParams('', 'key', key));
  396. }
  397. const contentTypes = <String>[];
  398. return apiClient.invokeAPI(
  399. path,
  400. 'GET',
  401. queryParams,
  402. postBody,
  403. headerParams,
  404. formParams,
  405. contentTypes.isEmpty ? null : contentTypes.first,
  406. );
  407. }
  408. /// Get a single asset's information
  409. ///
  410. /// Parameters:
  411. ///
  412. /// * [String] id (required):
  413. ///
  414. /// * [String] key:
  415. Future<AssetResponseDto?> getAssetById(String id, { String? key, }) async {
  416. final response = await getAssetByIdWithHttpInfo(id, key: key, );
  417. if (response.statusCode >= HttpStatus.badRequest) {
  418. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  419. }
  420. // When a remote server returns no body with a status of 204, we shall not decode it.
  421. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  422. // FormatException when trying to decode an empty string.
  423. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  424. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetResponseDto',) as AssetResponseDto;
  425. }
  426. return null;
  427. }
  428. /// Performs an HTTP 'GET /asset/search-terms' operation and returns the [Response].
  429. Future<Response> getAssetSearchTermsWithHttpInfo() async {
  430. // ignore: prefer_const_declarations
  431. final path = r'/asset/search-terms';
  432. // ignore: prefer_final_locals
  433. Object? postBody;
  434. final queryParams = <QueryParam>[];
  435. final headerParams = <String, String>{};
  436. final formParams = <String, String>{};
  437. const contentTypes = <String>[];
  438. return apiClient.invokeAPI(
  439. path,
  440. 'GET',
  441. queryParams,
  442. postBody,
  443. headerParams,
  444. formParams,
  445. contentTypes.isEmpty ? null : contentTypes.first,
  446. );
  447. }
  448. Future<List<String>?> getAssetSearchTerms() async {
  449. final response = await getAssetSearchTermsWithHttpInfo();
  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. final responseBody = await _decodeBodyBytes(response);
  458. return (await apiClient.deserializeAsync(responseBody, 'List<String>') as List)
  459. .cast<String>()
  460. .toList();
  461. }
  462. return null;
  463. }
  464. /// Performs an HTTP 'GET /asset/statistics' operation and returns the [Response].
  465. /// Parameters:
  466. ///
  467. /// * [bool] isArchived:
  468. ///
  469. /// * [bool] isFavorite:
  470. Future<Response> getAssetStatsWithHttpInfo({ bool? isArchived, bool? isFavorite, }) async {
  471. // ignore: prefer_const_declarations
  472. final path = r'/asset/statistics';
  473. // ignore: prefer_final_locals
  474. Object? postBody;
  475. final queryParams = <QueryParam>[];
  476. final headerParams = <String, String>{};
  477. final formParams = <String, String>{};
  478. if (isArchived != null) {
  479. queryParams.addAll(_queryParams('', 'isArchived', isArchived));
  480. }
  481. if (isFavorite != null) {
  482. queryParams.addAll(_queryParams('', 'isFavorite', isFavorite));
  483. }
  484. const contentTypes = <String>[];
  485. return apiClient.invokeAPI(
  486. path,
  487. 'GET',
  488. queryParams,
  489. postBody,
  490. headerParams,
  491. formParams,
  492. contentTypes.isEmpty ? null : contentTypes.first,
  493. );
  494. }
  495. /// Parameters:
  496. ///
  497. /// * [bool] isArchived:
  498. ///
  499. /// * [bool] isFavorite:
  500. Future<AssetStatsResponseDto?> getAssetStats({ bool? isArchived, bool? isFavorite, }) async {
  501. final response = await getAssetStatsWithHttpInfo( isArchived: isArchived, isFavorite: isFavorite, );
  502. if (response.statusCode >= HttpStatus.badRequest) {
  503. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  504. }
  505. // When a remote server returns no body with a status of 204, we shall not decode it.
  506. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  507. // FormatException when trying to decode an empty string.
  508. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  509. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetStatsResponseDto',) as AssetStatsResponseDto;
  510. }
  511. return null;
  512. }
  513. /// Performs an HTTP 'GET /asset/thumbnail/{id}' operation and returns the [Response].
  514. /// Parameters:
  515. ///
  516. /// * [String] id (required):
  517. ///
  518. /// * [ThumbnailFormat] format:
  519. ///
  520. /// * [String] key:
  521. Future<Response> getAssetThumbnailWithHttpInfo(String id, { ThumbnailFormat? format, String? key, }) async {
  522. // ignore: prefer_const_declarations
  523. final path = r'/asset/thumbnail/{id}'
  524. .replaceAll('{id}', id);
  525. // ignore: prefer_final_locals
  526. Object? postBody;
  527. final queryParams = <QueryParam>[];
  528. final headerParams = <String, String>{};
  529. final formParams = <String, String>{};
  530. if (format != null) {
  531. queryParams.addAll(_queryParams('', 'format', format));
  532. }
  533. if (key != null) {
  534. queryParams.addAll(_queryParams('', 'key', key));
  535. }
  536. const contentTypes = <String>[];
  537. return apiClient.invokeAPI(
  538. path,
  539. 'GET',
  540. queryParams,
  541. postBody,
  542. headerParams,
  543. formParams,
  544. contentTypes.isEmpty ? null : contentTypes.first,
  545. );
  546. }
  547. /// Parameters:
  548. ///
  549. /// * [String] id (required):
  550. ///
  551. /// * [ThumbnailFormat] format:
  552. ///
  553. /// * [String] key:
  554. Future<MultipartFile?> getAssetThumbnail(String id, { ThumbnailFormat? format, String? key, }) async {
  555. final response = await getAssetThumbnailWithHttpInfo(id, format: format, key: key, );
  556. if (response.statusCode >= HttpStatus.badRequest) {
  557. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  558. }
  559. // When a remote server returns no body with a status of 204, we shall not decode it.
  560. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  561. // FormatException when trying to decode an empty string.
  562. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  563. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'MultipartFile',) as MultipartFile;
  564. }
  565. return null;
  566. }
  567. /// Performs an HTTP 'GET /asset/time-bucket' operation and returns the [Response].
  568. /// Parameters:
  569. ///
  570. /// * [TimeBucketSize] size (required):
  571. ///
  572. /// * [String] timeBucket (required):
  573. ///
  574. /// * [String] userId:
  575. ///
  576. /// * [String] albumId:
  577. ///
  578. /// * [String] personId:
  579. ///
  580. /// * [bool] isArchived:
  581. ///
  582. /// * [bool] isFavorite:
  583. ///
  584. /// * [String] key:
  585. Future<Response> getByTimeBucketWithHttpInfo(TimeBucketSize size, String timeBucket, { String? userId, String? albumId, String? personId, bool? isArchived, bool? isFavorite, String? key, }) async {
  586. // ignore: prefer_const_declarations
  587. final path = r'/asset/time-bucket';
  588. // ignore: prefer_final_locals
  589. Object? postBody;
  590. final queryParams = <QueryParam>[];
  591. final headerParams = <String, String>{};
  592. final formParams = <String, String>{};
  593. queryParams.addAll(_queryParams('', 'size', size));
  594. if (userId != null) {
  595. queryParams.addAll(_queryParams('', 'userId', userId));
  596. }
  597. if (albumId != null) {
  598. queryParams.addAll(_queryParams('', 'albumId', albumId));
  599. }
  600. if (personId != null) {
  601. queryParams.addAll(_queryParams('', 'personId', personId));
  602. }
  603. if (isArchived != null) {
  604. queryParams.addAll(_queryParams('', 'isArchived', isArchived));
  605. }
  606. if (isFavorite != null) {
  607. queryParams.addAll(_queryParams('', 'isFavorite', isFavorite));
  608. }
  609. queryParams.addAll(_queryParams('', 'timeBucket', timeBucket));
  610. if (key != null) {
  611. queryParams.addAll(_queryParams('', 'key', key));
  612. }
  613. const contentTypes = <String>[];
  614. return apiClient.invokeAPI(
  615. path,
  616. 'GET',
  617. queryParams,
  618. postBody,
  619. headerParams,
  620. formParams,
  621. contentTypes.isEmpty ? null : contentTypes.first,
  622. );
  623. }
  624. /// Parameters:
  625. ///
  626. /// * [TimeBucketSize] size (required):
  627. ///
  628. /// * [String] timeBucket (required):
  629. ///
  630. /// * [String] userId:
  631. ///
  632. /// * [String] albumId:
  633. ///
  634. /// * [String] personId:
  635. ///
  636. /// * [bool] isArchived:
  637. ///
  638. /// * [bool] isFavorite:
  639. ///
  640. /// * [String] key:
  641. Future<List<AssetResponseDto>?> getByTimeBucket(TimeBucketSize size, String timeBucket, { String? userId, String? albumId, String? personId, bool? isArchived, bool? isFavorite, String? key, }) async {
  642. final response = await getByTimeBucketWithHttpInfo(size, timeBucket, userId: userId, albumId: albumId, personId: personId, isArchived: isArchived, isFavorite: isFavorite, key: key, );
  643. if (response.statusCode >= HttpStatus.badRequest) {
  644. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  645. }
  646. // When a remote server returns no body with a status of 204, we shall not decode it.
  647. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  648. // FormatException when trying to decode an empty string.
  649. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  650. final responseBody = await _decodeBodyBytes(response);
  651. return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
  652. .cast<AssetResponseDto>()
  653. .toList();
  654. }
  655. return null;
  656. }
  657. /// Performs an HTTP 'GET /asset/curated-locations' operation and returns the [Response].
  658. Future<Response> getCuratedLocationsWithHttpInfo() async {
  659. // ignore: prefer_const_declarations
  660. final path = r'/asset/curated-locations';
  661. // ignore: prefer_final_locals
  662. Object? postBody;
  663. final queryParams = <QueryParam>[];
  664. final headerParams = <String, String>{};
  665. final formParams = <String, String>{};
  666. const contentTypes = <String>[];
  667. return apiClient.invokeAPI(
  668. path,
  669. 'GET',
  670. queryParams,
  671. postBody,
  672. headerParams,
  673. formParams,
  674. contentTypes.isEmpty ? null : contentTypes.first,
  675. );
  676. }
  677. Future<List<CuratedLocationsResponseDto>?> getCuratedLocations() async {
  678. final response = await getCuratedLocationsWithHttpInfo();
  679. if (response.statusCode >= HttpStatus.badRequest) {
  680. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  681. }
  682. // When a remote server returns no body with a status of 204, we shall not decode it.
  683. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  684. // FormatException when trying to decode an empty string.
  685. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  686. final responseBody = await _decodeBodyBytes(response);
  687. return (await apiClient.deserializeAsync(responseBody, 'List<CuratedLocationsResponseDto>') as List)
  688. .cast<CuratedLocationsResponseDto>()
  689. .toList();
  690. }
  691. return null;
  692. }
  693. /// Performs an HTTP 'GET /asset/curated-objects' operation and returns the [Response].
  694. Future<Response> getCuratedObjectsWithHttpInfo() async {
  695. // ignore: prefer_const_declarations
  696. final path = r'/asset/curated-objects';
  697. // ignore: prefer_final_locals
  698. Object? postBody;
  699. final queryParams = <QueryParam>[];
  700. final headerParams = <String, String>{};
  701. final formParams = <String, String>{};
  702. const contentTypes = <String>[];
  703. return apiClient.invokeAPI(
  704. path,
  705. 'GET',
  706. queryParams,
  707. postBody,
  708. headerParams,
  709. formParams,
  710. contentTypes.isEmpty ? null : contentTypes.first,
  711. );
  712. }
  713. Future<List<CuratedObjectsResponseDto>?> getCuratedObjects() async {
  714. final response = await getCuratedObjectsWithHttpInfo();
  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. final responseBody = await _decodeBodyBytes(response);
  723. return (await apiClient.deserializeAsync(responseBody, 'List<CuratedObjectsResponseDto>') as List)
  724. .cast<CuratedObjectsResponseDto>()
  725. .toList();
  726. }
  727. return null;
  728. }
  729. /// Performs an HTTP 'GET /asset/download' operation and returns the [Response].
  730. /// Parameters:
  731. ///
  732. /// * [List<String>] assetIds:
  733. ///
  734. /// * [String] albumId:
  735. ///
  736. /// * [String] userId:
  737. ///
  738. /// * [num] archiveSize:
  739. ///
  740. /// * [String] key:
  741. Future<Response> getDownloadInfoWithHttpInfo({ List<String>? assetIds, String? albumId, String? userId, num? archiveSize, String? key, }) async {
  742. // ignore: prefer_const_declarations
  743. final path = r'/asset/download';
  744. // ignore: prefer_final_locals
  745. Object? postBody;
  746. final queryParams = <QueryParam>[];
  747. final headerParams = <String, String>{};
  748. final formParams = <String, String>{};
  749. if (assetIds != null) {
  750. queryParams.addAll(_queryParams('multi', 'assetIds', assetIds));
  751. }
  752. if (albumId != null) {
  753. queryParams.addAll(_queryParams('', 'albumId', albumId));
  754. }
  755. if (userId != null) {
  756. queryParams.addAll(_queryParams('', 'userId', userId));
  757. }
  758. if (archiveSize != null) {
  759. queryParams.addAll(_queryParams('', 'archiveSize', archiveSize));
  760. }
  761. if (key != null) {
  762. queryParams.addAll(_queryParams('', 'key', key));
  763. }
  764. const contentTypes = <String>[];
  765. return apiClient.invokeAPI(
  766. path,
  767. 'GET',
  768. queryParams,
  769. postBody,
  770. headerParams,
  771. formParams,
  772. contentTypes.isEmpty ? null : contentTypes.first,
  773. );
  774. }
  775. /// Parameters:
  776. ///
  777. /// * [List<String>] assetIds:
  778. ///
  779. /// * [String] albumId:
  780. ///
  781. /// * [String] userId:
  782. ///
  783. /// * [num] archiveSize:
  784. ///
  785. /// * [String] key:
  786. Future<DownloadResponseDto?> getDownloadInfo({ List<String>? assetIds, String? albumId, String? userId, num? archiveSize, String? key, }) async {
  787. final response = await getDownloadInfoWithHttpInfo( assetIds: assetIds, albumId: albumId, userId: userId, archiveSize: archiveSize, key: key, );
  788. if (response.statusCode >= HttpStatus.badRequest) {
  789. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  790. }
  791. // When a remote server returns no body with a status of 204, we shall not decode it.
  792. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  793. // FormatException when trying to decode an empty string.
  794. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  795. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'DownloadResponseDto',) as DownloadResponseDto;
  796. }
  797. return null;
  798. }
  799. /// Performs an HTTP 'GET /asset/map-marker' operation and returns the [Response].
  800. /// Parameters:
  801. ///
  802. /// * [bool] isFavorite:
  803. ///
  804. /// * [DateTime] fileCreatedAfter:
  805. ///
  806. /// * [DateTime] fileCreatedBefore:
  807. Future<Response> getMapMarkersWithHttpInfo({ bool? isFavorite, DateTime? fileCreatedAfter, DateTime? fileCreatedBefore, }) async {
  808. // ignore: prefer_const_declarations
  809. final path = r'/asset/map-marker';
  810. // ignore: prefer_final_locals
  811. Object? postBody;
  812. final queryParams = <QueryParam>[];
  813. final headerParams = <String, String>{};
  814. final formParams = <String, String>{};
  815. if (isFavorite != null) {
  816. queryParams.addAll(_queryParams('', 'isFavorite', isFavorite));
  817. }
  818. if (fileCreatedAfter != null) {
  819. queryParams.addAll(_queryParams('', 'fileCreatedAfter', fileCreatedAfter));
  820. }
  821. if (fileCreatedBefore != null) {
  822. queryParams.addAll(_queryParams('', 'fileCreatedBefore', fileCreatedBefore));
  823. }
  824. const contentTypes = <String>[];
  825. return apiClient.invokeAPI(
  826. path,
  827. 'GET',
  828. queryParams,
  829. postBody,
  830. headerParams,
  831. formParams,
  832. contentTypes.isEmpty ? null : contentTypes.first,
  833. );
  834. }
  835. /// Parameters:
  836. ///
  837. /// * [bool] isFavorite:
  838. ///
  839. /// * [DateTime] fileCreatedAfter:
  840. ///
  841. /// * [DateTime] fileCreatedBefore:
  842. Future<List<MapMarkerResponseDto>?> getMapMarkers({ bool? isFavorite, DateTime? fileCreatedAfter, DateTime? fileCreatedBefore, }) async {
  843. final response = await getMapMarkersWithHttpInfo( isFavorite: isFavorite, fileCreatedAfter: fileCreatedAfter, fileCreatedBefore: fileCreatedBefore, );
  844. if (response.statusCode >= HttpStatus.badRequest) {
  845. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  846. }
  847. // When a remote server returns no body with a status of 204, we shall not decode it.
  848. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  849. // FormatException when trying to decode an empty string.
  850. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  851. final responseBody = await _decodeBodyBytes(response);
  852. return (await apiClient.deserializeAsync(responseBody, 'List<MapMarkerResponseDto>') as List)
  853. .cast<MapMarkerResponseDto>()
  854. .toList();
  855. }
  856. return null;
  857. }
  858. /// Performs an HTTP 'GET /asset/memory-lane' operation and returns the [Response].
  859. /// Parameters:
  860. ///
  861. /// * [DateTime] timestamp (required):
  862. /// Get pictures for +24 hours from this time going back x years
  863. Future<Response> getMemoryLaneWithHttpInfo(DateTime timestamp,) async {
  864. // ignore: prefer_const_declarations
  865. final path = r'/asset/memory-lane';
  866. // ignore: prefer_final_locals
  867. Object? postBody;
  868. final queryParams = <QueryParam>[];
  869. final headerParams = <String, String>{};
  870. final formParams = <String, String>{};
  871. queryParams.addAll(_queryParams('', 'timestamp', timestamp));
  872. const contentTypes = <String>[];
  873. return apiClient.invokeAPI(
  874. path,
  875. 'GET',
  876. queryParams,
  877. postBody,
  878. headerParams,
  879. formParams,
  880. contentTypes.isEmpty ? null : contentTypes.first,
  881. );
  882. }
  883. /// Parameters:
  884. ///
  885. /// * [DateTime] timestamp (required):
  886. /// Get pictures for +24 hours from this time going back x years
  887. Future<List<MemoryLaneResponseDto>?> getMemoryLane(DateTime timestamp,) async {
  888. final response = await getMemoryLaneWithHttpInfo(timestamp,);
  889. if (response.statusCode >= HttpStatus.badRequest) {
  890. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  891. }
  892. // When a remote server returns no body with a status of 204, we shall not decode it.
  893. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  894. // FormatException when trying to decode an empty string.
  895. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  896. final responseBody = await _decodeBodyBytes(response);
  897. return (await apiClient.deserializeAsync(responseBody, 'List<MemoryLaneResponseDto>') as List)
  898. .cast<MemoryLaneResponseDto>()
  899. .toList();
  900. }
  901. return null;
  902. }
  903. /// Performs an HTTP 'GET /asset/time-buckets' operation and returns the [Response].
  904. /// Parameters:
  905. ///
  906. /// * [TimeBucketSize] size (required):
  907. ///
  908. /// * [String] userId:
  909. ///
  910. /// * [String] albumId:
  911. ///
  912. /// * [String] personId:
  913. ///
  914. /// * [bool] isArchived:
  915. ///
  916. /// * [bool] isFavorite:
  917. ///
  918. /// * [String] key:
  919. Future<Response> getTimeBucketsWithHttpInfo(TimeBucketSize size, { String? userId, String? albumId, String? personId, bool? isArchived, bool? isFavorite, String? key, }) async {
  920. // ignore: prefer_const_declarations
  921. final path = r'/asset/time-buckets';
  922. // ignore: prefer_final_locals
  923. Object? postBody;
  924. final queryParams = <QueryParam>[];
  925. final headerParams = <String, String>{};
  926. final formParams = <String, String>{};
  927. queryParams.addAll(_queryParams('', 'size', size));
  928. if (userId != null) {
  929. queryParams.addAll(_queryParams('', 'userId', userId));
  930. }
  931. if (albumId != null) {
  932. queryParams.addAll(_queryParams('', 'albumId', albumId));
  933. }
  934. if (personId != null) {
  935. queryParams.addAll(_queryParams('', 'personId', personId));
  936. }
  937. if (isArchived != null) {
  938. queryParams.addAll(_queryParams('', 'isArchived', isArchived));
  939. }
  940. if (isFavorite != null) {
  941. queryParams.addAll(_queryParams('', 'isFavorite', isFavorite));
  942. }
  943. if (key != null) {
  944. queryParams.addAll(_queryParams('', 'key', key));
  945. }
  946. const contentTypes = <String>[];
  947. return apiClient.invokeAPI(
  948. path,
  949. 'GET',
  950. queryParams,
  951. postBody,
  952. headerParams,
  953. formParams,
  954. contentTypes.isEmpty ? null : contentTypes.first,
  955. );
  956. }
  957. /// Parameters:
  958. ///
  959. /// * [TimeBucketSize] size (required):
  960. ///
  961. /// * [String] userId:
  962. ///
  963. /// * [String] albumId:
  964. ///
  965. /// * [String] personId:
  966. ///
  967. /// * [bool] isArchived:
  968. ///
  969. /// * [bool] isFavorite:
  970. ///
  971. /// * [String] key:
  972. Future<List<TimeBucketResponseDto>?> getTimeBuckets(TimeBucketSize size, { String? userId, String? albumId, String? personId, bool? isArchived, bool? isFavorite, String? key, }) async {
  973. final response = await getTimeBucketsWithHttpInfo(size, userId: userId, albumId: albumId, personId: personId, isArchived: isArchived, isFavorite: isFavorite, key: key, );
  974. if (response.statusCode >= HttpStatus.badRequest) {
  975. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  976. }
  977. // When a remote server returns no body with a status of 204, we shall not decode it.
  978. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  979. // FormatException when trying to decode an empty string.
  980. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  981. final responseBody = await _decodeBodyBytes(response);
  982. return (await apiClient.deserializeAsync(responseBody, 'List<TimeBucketResponseDto>') as List)
  983. .cast<TimeBucketResponseDto>()
  984. .toList();
  985. }
  986. return null;
  987. }
  988. /// Get all asset of a device that are in the database, ID only.
  989. ///
  990. /// Note: This method returns the HTTP [Response].
  991. ///
  992. /// Parameters:
  993. ///
  994. /// * [String] deviceId (required):
  995. Future<Response> getUserAssetsByDeviceIdWithHttpInfo(String deviceId,) async {
  996. // ignore: prefer_const_declarations
  997. final path = r'/asset/{deviceId}'
  998. .replaceAll('{deviceId}', deviceId);
  999. // ignore: prefer_final_locals
  1000. Object? postBody;
  1001. final queryParams = <QueryParam>[];
  1002. final headerParams = <String, String>{};
  1003. final formParams = <String, String>{};
  1004. const contentTypes = <String>[];
  1005. return apiClient.invokeAPI(
  1006. path,
  1007. 'GET',
  1008. queryParams,
  1009. postBody,
  1010. headerParams,
  1011. formParams,
  1012. contentTypes.isEmpty ? null : contentTypes.first,
  1013. );
  1014. }
  1015. /// Get all asset of a device that are in the database, ID only.
  1016. ///
  1017. /// Parameters:
  1018. ///
  1019. /// * [String] deviceId (required):
  1020. Future<List<String>?> getUserAssetsByDeviceId(String deviceId,) async {
  1021. final response = await getUserAssetsByDeviceIdWithHttpInfo(deviceId,);
  1022. if (response.statusCode >= HttpStatus.badRequest) {
  1023. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  1024. }
  1025. // When a remote server returns no body with a status of 204, we shall not decode it.
  1026. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  1027. // FormatException when trying to decode an empty string.
  1028. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  1029. final responseBody = await _decodeBodyBytes(response);
  1030. return (await apiClient.deserializeAsync(responseBody, 'List<String>') as List)
  1031. .cast<String>()
  1032. .toList();
  1033. }
  1034. return null;
  1035. }
  1036. /// Performs an HTTP 'POST /asset/import' operation and returns the [Response].
  1037. /// Parameters:
  1038. ///
  1039. /// * [ImportAssetDto] importAssetDto (required):
  1040. Future<Response> importFileWithHttpInfo(ImportAssetDto importAssetDto,) async {
  1041. // ignore: prefer_const_declarations
  1042. final path = r'/asset/import';
  1043. // ignore: prefer_final_locals
  1044. Object? postBody = importAssetDto;
  1045. final queryParams = <QueryParam>[];
  1046. final headerParams = <String, String>{};
  1047. final formParams = <String, String>{};
  1048. const contentTypes = <String>['application/json'];
  1049. return apiClient.invokeAPI(
  1050. path,
  1051. 'POST',
  1052. queryParams,
  1053. postBody,
  1054. headerParams,
  1055. formParams,
  1056. contentTypes.isEmpty ? null : contentTypes.first,
  1057. );
  1058. }
  1059. /// Parameters:
  1060. ///
  1061. /// * [ImportAssetDto] importAssetDto (required):
  1062. Future<AssetFileUploadResponseDto?> importFile(ImportAssetDto importAssetDto,) async {
  1063. final response = await importFileWithHttpInfo(importAssetDto,);
  1064. if (response.statusCode >= HttpStatus.badRequest) {
  1065. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  1066. }
  1067. // When a remote server returns no body with a status of 204, we shall not decode it.
  1068. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  1069. // FormatException when trying to decode an empty string.
  1070. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  1071. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetFileUploadResponseDto',) as AssetFileUploadResponseDto;
  1072. }
  1073. return null;
  1074. }
  1075. /// Performs an HTTP 'POST /asset/search' operation and returns the [Response].
  1076. /// Parameters:
  1077. ///
  1078. /// * [SearchAssetDto] searchAssetDto (required):
  1079. Future<Response> searchAssetWithHttpInfo(SearchAssetDto searchAssetDto,) async {
  1080. // ignore: prefer_const_declarations
  1081. final path = r'/asset/search';
  1082. // ignore: prefer_final_locals
  1083. Object? postBody = searchAssetDto;
  1084. final queryParams = <QueryParam>[];
  1085. final headerParams = <String, String>{};
  1086. final formParams = <String, String>{};
  1087. const contentTypes = <String>['application/json'];
  1088. return apiClient.invokeAPI(
  1089. path,
  1090. 'POST',
  1091. queryParams,
  1092. postBody,
  1093. headerParams,
  1094. formParams,
  1095. contentTypes.isEmpty ? null : contentTypes.first,
  1096. );
  1097. }
  1098. /// Parameters:
  1099. ///
  1100. /// * [SearchAssetDto] searchAssetDto (required):
  1101. Future<List<AssetResponseDto>?> searchAsset(SearchAssetDto searchAssetDto,) async {
  1102. final response = await searchAssetWithHttpInfo(searchAssetDto,);
  1103. if (response.statusCode >= HttpStatus.badRequest) {
  1104. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  1105. }
  1106. // When a remote server returns no body with a status of 204, we shall not decode it.
  1107. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  1108. // FormatException when trying to decode an empty string.
  1109. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  1110. final responseBody = await _decodeBodyBytes(response);
  1111. return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
  1112. .cast<AssetResponseDto>()
  1113. .toList();
  1114. }
  1115. return null;
  1116. }
  1117. /// Performs an HTTP 'GET /asset/file/{id}' operation and returns the [Response].
  1118. /// Parameters:
  1119. ///
  1120. /// * [String] id (required):
  1121. ///
  1122. /// * [bool] isThumb:
  1123. ///
  1124. /// * [bool] isWeb:
  1125. ///
  1126. /// * [String] key:
  1127. Future<Response> serveFileWithHttpInfo(String id, { bool? isThumb, bool? isWeb, String? key, }) async {
  1128. // ignore: prefer_const_declarations
  1129. final path = r'/asset/file/{id}'
  1130. .replaceAll('{id}', id);
  1131. // ignore: prefer_final_locals
  1132. Object? postBody;
  1133. final queryParams = <QueryParam>[];
  1134. final headerParams = <String, String>{};
  1135. final formParams = <String, String>{};
  1136. if (isThumb != null) {
  1137. queryParams.addAll(_queryParams('', 'isThumb', isThumb));
  1138. }
  1139. if (isWeb != null) {
  1140. queryParams.addAll(_queryParams('', 'isWeb', isWeb));
  1141. }
  1142. if (key != null) {
  1143. queryParams.addAll(_queryParams('', 'key', key));
  1144. }
  1145. const contentTypes = <String>[];
  1146. return apiClient.invokeAPI(
  1147. path,
  1148. 'GET',
  1149. queryParams,
  1150. postBody,
  1151. headerParams,
  1152. formParams,
  1153. contentTypes.isEmpty ? null : contentTypes.first,
  1154. );
  1155. }
  1156. /// Parameters:
  1157. ///
  1158. /// * [String] id (required):
  1159. ///
  1160. /// * [bool] isThumb:
  1161. ///
  1162. /// * [bool] isWeb:
  1163. ///
  1164. /// * [String] key:
  1165. Future<MultipartFile?> serveFile(String id, { bool? isThumb, bool? isWeb, String? key, }) async {
  1166. final response = await serveFileWithHttpInfo(id, isThumb: isThumb, isWeb: isWeb, key: key, );
  1167. if (response.statusCode >= HttpStatus.badRequest) {
  1168. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  1169. }
  1170. // When a remote server returns no body with a status of 204, we shall not decode it.
  1171. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  1172. // FormatException when trying to decode an empty string.
  1173. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  1174. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'MultipartFile',) as MultipartFile;
  1175. }
  1176. return null;
  1177. }
  1178. /// Update an asset
  1179. ///
  1180. /// Note: This method returns the HTTP [Response].
  1181. ///
  1182. /// Parameters:
  1183. ///
  1184. /// * [String] id (required):
  1185. ///
  1186. /// * [UpdateAssetDto] updateAssetDto (required):
  1187. Future<Response> updateAssetWithHttpInfo(String id, UpdateAssetDto updateAssetDto,) async {
  1188. // ignore: prefer_const_declarations
  1189. final path = r'/asset/{id}'
  1190. .replaceAll('{id}', id);
  1191. // ignore: prefer_final_locals
  1192. Object? postBody = updateAssetDto;
  1193. final queryParams = <QueryParam>[];
  1194. final headerParams = <String, String>{};
  1195. final formParams = <String, String>{};
  1196. const contentTypes = <String>['application/json'];
  1197. return apiClient.invokeAPI(
  1198. path,
  1199. 'PUT',
  1200. queryParams,
  1201. postBody,
  1202. headerParams,
  1203. formParams,
  1204. contentTypes.isEmpty ? null : contentTypes.first,
  1205. );
  1206. }
  1207. /// Update an asset
  1208. ///
  1209. /// Parameters:
  1210. ///
  1211. /// * [String] id (required):
  1212. ///
  1213. /// * [UpdateAssetDto] updateAssetDto (required):
  1214. Future<AssetResponseDto?> updateAsset(String id, UpdateAssetDto updateAssetDto,) async {
  1215. final response = await updateAssetWithHttpInfo(id, updateAssetDto,);
  1216. if (response.statusCode >= HttpStatus.badRequest) {
  1217. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  1218. }
  1219. // When a remote server returns no body with a status of 204, we shall not decode it.
  1220. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  1221. // FormatException when trying to decode an empty string.
  1222. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  1223. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetResponseDto',) as AssetResponseDto;
  1224. }
  1225. return null;
  1226. }
  1227. /// Performs an HTTP 'POST /asset/upload' operation and returns the [Response].
  1228. /// Parameters:
  1229. ///
  1230. /// * [MultipartFile] assetData (required):
  1231. ///
  1232. /// * [String] deviceAssetId (required):
  1233. ///
  1234. /// * [String] deviceId (required):
  1235. ///
  1236. /// * [DateTime] fileCreatedAt (required):
  1237. ///
  1238. /// * [DateTime] fileModifiedAt (required):
  1239. ///
  1240. /// * [bool] isFavorite (required):
  1241. ///
  1242. /// * [String] key:
  1243. ///
  1244. /// * [String] duration:
  1245. ///
  1246. /// * [bool] isArchived:
  1247. ///
  1248. /// * [bool] isReadOnly:
  1249. ///
  1250. /// * [bool] isVisible:
  1251. ///
  1252. /// * [MultipartFile] livePhotoData:
  1253. ///
  1254. /// * [MultipartFile] sidecarData:
  1255. Future<Response> uploadFileWithHttpInfo(MultipartFile assetData, String deviceAssetId, String deviceId, DateTime fileCreatedAt, DateTime fileModifiedAt, bool isFavorite, { String? key, String? duration, bool? isArchived, bool? isReadOnly, bool? isVisible, MultipartFile? livePhotoData, MultipartFile? sidecarData, }) async {
  1256. // ignore: prefer_const_declarations
  1257. final path = r'/asset/upload';
  1258. // ignore: prefer_final_locals
  1259. Object? postBody;
  1260. final queryParams = <QueryParam>[];
  1261. final headerParams = <String, String>{};
  1262. final formParams = <String, String>{};
  1263. if (key != null) {
  1264. queryParams.addAll(_queryParams('', 'key', key));
  1265. }
  1266. const contentTypes = <String>['multipart/form-data'];
  1267. bool hasFields = false;
  1268. final mp = MultipartRequest('POST', Uri.parse(path));
  1269. if (assetData != null) {
  1270. hasFields = true;
  1271. mp.fields[r'assetData'] = assetData.field;
  1272. mp.files.add(assetData);
  1273. }
  1274. if (deviceAssetId != null) {
  1275. hasFields = true;
  1276. mp.fields[r'deviceAssetId'] = parameterToString(deviceAssetId);
  1277. }
  1278. if (deviceId != null) {
  1279. hasFields = true;
  1280. mp.fields[r'deviceId'] = parameterToString(deviceId);
  1281. }
  1282. if (duration != null) {
  1283. hasFields = true;
  1284. mp.fields[r'duration'] = parameterToString(duration);
  1285. }
  1286. if (fileCreatedAt != null) {
  1287. hasFields = true;
  1288. mp.fields[r'fileCreatedAt'] = parameterToString(fileCreatedAt);
  1289. }
  1290. if (fileModifiedAt != null) {
  1291. hasFields = true;
  1292. mp.fields[r'fileModifiedAt'] = parameterToString(fileModifiedAt);
  1293. }
  1294. if (isArchived != null) {
  1295. hasFields = true;
  1296. mp.fields[r'isArchived'] = parameterToString(isArchived);
  1297. }
  1298. if (isFavorite != null) {
  1299. hasFields = true;
  1300. mp.fields[r'isFavorite'] = parameterToString(isFavorite);
  1301. }
  1302. if (isReadOnly != null) {
  1303. hasFields = true;
  1304. mp.fields[r'isReadOnly'] = parameterToString(isReadOnly);
  1305. }
  1306. if (isVisible != null) {
  1307. hasFields = true;
  1308. mp.fields[r'isVisible'] = parameterToString(isVisible);
  1309. }
  1310. if (livePhotoData != null) {
  1311. hasFields = true;
  1312. mp.fields[r'livePhotoData'] = livePhotoData.field;
  1313. mp.files.add(livePhotoData);
  1314. }
  1315. if (sidecarData != null) {
  1316. hasFields = true;
  1317. mp.fields[r'sidecarData'] = sidecarData.field;
  1318. mp.files.add(sidecarData);
  1319. }
  1320. if (hasFields) {
  1321. postBody = mp;
  1322. }
  1323. return apiClient.invokeAPI(
  1324. path,
  1325. 'POST',
  1326. queryParams,
  1327. postBody,
  1328. headerParams,
  1329. formParams,
  1330. contentTypes.isEmpty ? null : contentTypes.first,
  1331. );
  1332. }
  1333. /// Parameters:
  1334. ///
  1335. /// * [MultipartFile] assetData (required):
  1336. ///
  1337. /// * [String] deviceAssetId (required):
  1338. ///
  1339. /// * [String] deviceId (required):
  1340. ///
  1341. /// * [DateTime] fileCreatedAt (required):
  1342. ///
  1343. /// * [DateTime] fileModifiedAt (required):
  1344. ///
  1345. /// * [bool] isFavorite (required):
  1346. ///
  1347. /// * [String] key:
  1348. ///
  1349. /// * [String] duration:
  1350. ///
  1351. /// * [bool] isArchived:
  1352. ///
  1353. /// * [bool] isReadOnly:
  1354. ///
  1355. /// * [bool] isVisible:
  1356. ///
  1357. /// * [MultipartFile] livePhotoData:
  1358. ///
  1359. /// * [MultipartFile] sidecarData:
  1360. Future<AssetFileUploadResponseDto?> uploadFile(MultipartFile assetData, String deviceAssetId, String deviceId, DateTime fileCreatedAt, DateTime fileModifiedAt, bool isFavorite, { String? key, String? duration, bool? isArchived, bool? isReadOnly, bool? isVisible, MultipartFile? livePhotoData, MultipartFile? sidecarData, }) async {
  1361. final response = await uploadFileWithHttpInfo(assetData, deviceAssetId, deviceId, fileCreatedAt, fileModifiedAt, isFavorite, key: key, duration: duration, isArchived: isArchived, isReadOnly: isReadOnly, isVisible: isVisible, livePhotoData: livePhotoData, sidecarData: sidecarData, );
  1362. if (response.statusCode >= HttpStatus.badRequest) {
  1363. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  1364. }
  1365. // When a remote server returns no body with a status of 204, we shall not decode it.
  1366. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  1367. // FormatException when trying to decode an empty string.
  1368. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  1369. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetFileUploadResponseDto',) as AssetFileUploadResponseDto;
  1370. }
  1371. return null;
  1372. }
  1373. }