library_api.dart 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  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 LibraryApi {
  11. LibraryApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
  12. final ApiClient apiClient;
  13. /// Performs an HTTP 'POST /library' operation and returns the [Response].
  14. /// Parameters:
  15. ///
  16. /// * [CreateLibraryDto] createLibraryDto (required):
  17. Future<Response> createLibraryWithHttpInfo(CreateLibraryDto createLibraryDto,) async {
  18. // ignore: prefer_const_declarations
  19. final path = r'/library';
  20. // ignore: prefer_final_locals
  21. Object? postBody = createLibraryDto;
  22. final queryParams = <QueryParam>[];
  23. final headerParams = <String, String>{};
  24. final formParams = <String, String>{};
  25. const contentTypes = <String>['application/json'];
  26. return apiClient.invokeAPI(
  27. path,
  28. 'POST',
  29. queryParams,
  30. postBody,
  31. headerParams,
  32. formParams,
  33. contentTypes.isEmpty ? null : contentTypes.first,
  34. );
  35. }
  36. /// Parameters:
  37. ///
  38. /// * [CreateLibraryDto] createLibraryDto (required):
  39. Future<LibraryResponseDto?> createLibrary(CreateLibraryDto createLibraryDto,) async {
  40. final response = await createLibraryWithHttpInfo(createLibraryDto,);
  41. if (response.statusCode >= HttpStatus.badRequest) {
  42. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  43. }
  44. // When a remote server returns no body with a status of 204, we shall not decode it.
  45. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  46. // FormatException when trying to decode an empty string.
  47. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  48. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'LibraryResponseDto',) as LibraryResponseDto;
  49. }
  50. return null;
  51. }
  52. /// Performs an HTTP 'DELETE /library/{id}' operation and returns the [Response].
  53. /// Parameters:
  54. ///
  55. /// * [String] id (required):
  56. Future<Response> deleteLibraryWithHttpInfo(String id,) async {
  57. // ignore: prefer_const_declarations
  58. final path = r'/library/{id}'
  59. .replaceAll('{id}', id);
  60. // ignore: prefer_final_locals
  61. Object? postBody;
  62. final queryParams = <QueryParam>[];
  63. final headerParams = <String, String>{};
  64. final formParams = <String, String>{};
  65. const contentTypes = <String>[];
  66. return apiClient.invokeAPI(
  67. path,
  68. 'DELETE',
  69. queryParams,
  70. postBody,
  71. headerParams,
  72. formParams,
  73. contentTypes.isEmpty ? null : contentTypes.first,
  74. );
  75. }
  76. /// Parameters:
  77. ///
  78. /// * [String] id (required):
  79. Future<void> deleteLibrary(String id,) async {
  80. final response = await deleteLibraryWithHttpInfo(id,);
  81. if (response.statusCode >= HttpStatus.badRequest) {
  82. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  83. }
  84. }
  85. /// Performs an HTTP 'GET /library' operation and returns the [Response].
  86. Future<Response> getAllForUserWithHttpInfo() async {
  87. // ignore: prefer_const_declarations
  88. final path = r'/library';
  89. // ignore: prefer_final_locals
  90. Object? postBody;
  91. final queryParams = <QueryParam>[];
  92. final headerParams = <String, String>{};
  93. final formParams = <String, String>{};
  94. const contentTypes = <String>[];
  95. return apiClient.invokeAPI(
  96. path,
  97. 'GET',
  98. queryParams,
  99. postBody,
  100. headerParams,
  101. formParams,
  102. contentTypes.isEmpty ? null : contentTypes.first,
  103. );
  104. }
  105. Future<List<LibraryResponseDto>?> getAllForUser() async {
  106. final response = await getAllForUserWithHttpInfo();
  107. if (response.statusCode >= HttpStatus.badRequest) {
  108. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  109. }
  110. // When a remote server returns no body with a status of 204, we shall not decode it.
  111. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  112. // FormatException when trying to decode an empty string.
  113. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  114. final responseBody = await _decodeBodyBytes(response);
  115. return (await apiClient.deserializeAsync(responseBody, 'List<LibraryResponseDto>') as List)
  116. .cast<LibraryResponseDto>()
  117. .toList();
  118. }
  119. return null;
  120. }
  121. /// Performs an HTTP 'GET /library/{id}' operation and returns the [Response].
  122. /// Parameters:
  123. ///
  124. /// * [String] id (required):
  125. Future<Response> getLibraryInfoWithHttpInfo(String id,) async {
  126. // ignore: prefer_const_declarations
  127. final path = r'/library/{id}'
  128. .replaceAll('{id}', id);
  129. // ignore: prefer_final_locals
  130. Object? postBody;
  131. final queryParams = <QueryParam>[];
  132. final headerParams = <String, String>{};
  133. final formParams = <String, String>{};
  134. const contentTypes = <String>[];
  135. return apiClient.invokeAPI(
  136. path,
  137. 'GET',
  138. queryParams,
  139. postBody,
  140. headerParams,
  141. formParams,
  142. contentTypes.isEmpty ? null : contentTypes.first,
  143. );
  144. }
  145. /// Parameters:
  146. ///
  147. /// * [String] id (required):
  148. Future<LibraryResponseDto?> getLibraryInfo(String id,) async {
  149. final response = await getLibraryInfoWithHttpInfo(id,);
  150. if (response.statusCode >= HttpStatus.badRequest) {
  151. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  152. }
  153. // When a remote server returns no body with a status of 204, we shall not decode it.
  154. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  155. // FormatException when trying to decode an empty string.
  156. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  157. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'LibraryResponseDto',) as LibraryResponseDto;
  158. }
  159. return null;
  160. }
  161. /// Performs an HTTP 'GET /library/{id}/statistics' operation and returns the [Response].
  162. /// Parameters:
  163. ///
  164. /// * [String] id (required):
  165. Future<Response> getLibraryStatisticsWithHttpInfo(String id,) async {
  166. // ignore: prefer_const_declarations
  167. final path = r'/library/{id}/statistics'
  168. .replaceAll('{id}', id);
  169. // ignore: prefer_final_locals
  170. Object? postBody;
  171. final queryParams = <QueryParam>[];
  172. final headerParams = <String, String>{};
  173. final formParams = <String, String>{};
  174. const contentTypes = <String>[];
  175. return apiClient.invokeAPI(
  176. path,
  177. 'GET',
  178. queryParams,
  179. postBody,
  180. headerParams,
  181. formParams,
  182. contentTypes.isEmpty ? null : contentTypes.first,
  183. );
  184. }
  185. /// Parameters:
  186. ///
  187. /// * [String] id (required):
  188. Future<LibraryStatsResponseDto?> getLibraryStatistics(String id,) async {
  189. final response = await getLibraryStatisticsWithHttpInfo(id,);
  190. if (response.statusCode >= HttpStatus.badRequest) {
  191. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  192. }
  193. // When a remote server returns no body with a status of 204, we shall not decode it.
  194. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  195. // FormatException when trying to decode an empty string.
  196. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  197. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'LibraryStatsResponseDto',) as LibraryStatsResponseDto;
  198. }
  199. return null;
  200. }
  201. /// Performs an HTTP 'POST /library/{id}/removeOffline' operation and returns the [Response].
  202. /// Parameters:
  203. ///
  204. /// * [String] id (required):
  205. Future<Response> removeOfflineFilesWithHttpInfo(String id,) async {
  206. // ignore: prefer_const_declarations
  207. final path = r'/library/{id}/removeOffline'
  208. .replaceAll('{id}', id);
  209. // ignore: prefer_final_locals
  210. Object? postBody;
  211. final queryParams = <QueryParam>[];
  212. final headerParams = <String, String>{};
  213. final formParams = <String, String>{};
  214. const contentTypes = <String>[];
  215. return apiClient.invokeAPI(
  216. path,
  217. 'POST',
  218. queryParams,
  219. postBody,
  220. headerParams,
  221. formParams,
  222. contentTypes.isEmpty ? null : contentTypes.first,
  223. );
  224. }
  225. /// Parameters:
  226. ///
  227. /// * [String] id (required):
  228. Future<void> removeOfflineFiles(String id,) async {
  229. final response = await removeOfflineFilesWithHttpInfo(id,);
  230. if (response.statusCode >= HttpStatus.badRequest) {
  231. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  232. }
  233. }
  234. /// Performs an HTTP 'POST /library/{id}/scan' operation and returns the [Response].
  235. /// Parameters:
  236. ///
  237. /// * [String] id (required):
  238. ///
  239. /// * [ScanLibraryDto] scanLibraryDto (required):
  240. Future<Response> scanLibraryWithHttpInfo(String id, ScanLibraryDto scanLibraryDto,) async {
  241. // ignore: prefer_const_declarations
  242. final path = r'/library/{id}/scan'
  243. .replaceAll('{id}', id);
  244. // ignore: prefer_final_locals
  245. Object? postBody = scanLibraryDto;
  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. 'POST',
  253. queryParams,
  254. postBody,
  255. headerParams,
  256. formParams,
  257. contentTypes.isEmpty ? null : contentTypes.first,
  258. );
  259. }
  260. /// Parameters:
  261. ///
  262. /// * [String] id (required):
  263. ///
  264. /// * [ScanLibraryDto] scanLibraryDto (required):
  265. Future<void> scanLibrary(String id, ScanLibraryDto scanLibraryDto,) async {
  266. final response = await scanLibraryWithHttpInfo(id, scanLibraryDto,);
  267. if (response.statusCode >= HttpStatus.badRequest) {
  268. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  269. }
  270. }
  271. /// Performs an HTTP 'PUT /library/{id}' operation and returns the [Response].
  272. /// Parameters:
  273. ///
  274. /// * [String] id (required):
  275. ///
  276. /// * [UpdateLibraryDto] updateLibraryDto (required):
  277. Future<Response> updateLibraryWithHttpInfo(String id, UpdateLibraryDto updateLibraryDto,) async {
  278. // ignore: prefer_const_declarations
  279. final path = r'/library/{id}'
  280. .replaceAll('{id}', id);
  281. // ignore: prefer_final_locals
  282. Object? postBody = updateLibraryDto;
  283. final queryParams = <QueryParam>[];
  284. final headerParams = <String, String>{};
  285. final formParams = <String, String>{};
  286. const contentTypes = <String>['application/json'];
  287. return apiClient.invokeAPI(
  288. path,
  289. 'PUT',
  290. queryParams,
  291. postBody,
  292. headerParams,
  293. formParams,
  294. contentTypes.isEmpty ? null : contentTypes.first,
  295. );
  296. }
  297. /// Parameters:
  298. ///
  299. /// * [String] id (required):
  300. ///
  301. /// * [UpdateLibraryDto] updateLibraryDto (required):
  302. Future<LibraryResponseDto?> updateLibrary(String id, UpdateLibraryDto updateLibraryDto,) async {
  303. final response = await updateLibraryWithHttpInfo(id, updateLibraryDto,);
  304. if (response.statusCode >= HttpStatus.badRequest) {
  305. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  306. }
  307. // When a remote server returns no body with a status of 204, we shall not decode it.
  308. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  309. // FormatException when trying to decode an empty string.
  310. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  311. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'LibraryResponseDto',) as LibraryResponseDto;
  312. }
  313. return null;
  314. }
  315. }