asset_api.dart 50 KB

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