asset_api.dart 50 KB

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