asset_api.dart 44 KB

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