asset_api.dart 51 KB

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