share_api.dart 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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 ShareApi {
  11. ShareApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
  12. final ApiClient apiClient;
  13. ///
  14. ///
  15. /// Note: This method returns the HTTP [Response].
  16. ///
  17. /// Parameters:
  18. ///
  19. /// * [String] id (required):
  20. ///
  21. /// * [EditSharedLinkDto] editSharedLinkDto (required):
  22. Future<Response> editSharedLinkWithHttpInfo(String id, EditSharedLinkDto editSharedLinkDto,) async {
  23. // ignore: prefer_const_declarations
  24. final path = r'/share/{id}'
  25. .replaceAll('{id}', id);
  26. // ignore: prefer_final_locals
  27. Object? postBody = editSharedLinkDto;
  28. final queryParams = <QueryParam>[];
  29. final headerParams = <String, String>{};
  30. final formParams = <String, String>{};
  31. const contentTypes = <String>['application/json'];
  32. return apiClient.invokeAPI(
  33. path,
  34. 'PATCH',
  35. queryParams,
  36. postBody,
  37. headerParams,
  38. formParams,
  39. contentTypes.isEmpty ? null : contentTypes.first,
  40. );
  41. }
  42. ///
  43. ///
  44. /// Parameters:
  45. ///
  46. /// * [String] id (required):
  47. ///
  48. /// * [EditSharedLinkDto] editSharedLinkDto (required):
  49. Future<SharedLinkResponseDto?> editSharedLink(String id, EditSharedLinkDto editSharedLinkDto,) async {
  50. final response = await editSharedLinkWithHttpInfo(id, editSharedLinkDto,);
  51. if (response.statusCode >= HttpStatus.badRequest) {
  52. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  53. }
  54. // When a remote server returns no body with a status of 204, we shall not decode it.
  55. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  56. // FormatException when trying to decode an empty string.
  57. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  58. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'SharedLinkResponseDto',) as SharedLinkResponseDto;
  59. }
  60. return null;
  61. }
  62. ///
  63. ///
  64. /// Note: This method returns the HTTP [Response].
  65. Future<Response> getAllSharedLinksWithHttpInfo() async {
  66. // ignore: prefer_const_declarations
  67. final path = r'/share';
  68. // ignore: prefer_final_locals
  69. Object? postBody;
  70. final queryParams = <QueryParam>[];
  71. final headerParams = <String, String>{};
  72. final formParams = <String, String>{};
  73. const contentTypes = <String>[];
  74. return apiClient.invokeAPI(
  75. path,
  76. 'GET',
  77. queryParams,
  78. postBody,
  79. headerParams,
  80. formParams,
  81. contentTypes.isEmpty ? null : contentTypes.first,
  82. );
  83. }
  84. ///
  85. Future<List<SharedLinkResponseDto>?> getAllSharedLinks() async {
  86. final response = await getAllSharedLinksWithHttpInfo();
  87. if (response.statusCode >= HttpStatus.badRequest) {
  88. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  89. }
  90. // When a remote server returns no body with a status of 204, we shall not decode it.
  91. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  92. // FormatException when trying to decode an empty string.
  93. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  94. final responseBody = await _decodeBodyBytes(response);
  95. return (await apiClient.deserializeAsync(responseBody, 'List<SharedLinkResponseDto>') as List)
  96. .cast<SharedLinkResponseDto>()
  97. .toList();
  98. }
  99. return null;
  100. }
  101. ///
  102. ///
  103. /// Note: This method returns the HTTP [Response].
  104. ///
  105. /// Parameters:
  106. ///
  107. /// * [String] key:
  108. Future<Response> getMySharedLinkWithHttpInfo({ String? key, }) async {
  109. // ignore: prefer_const_declarations
  110. final path = r'/share/me';
  111. // ignore: prefer_final_locals
  112. Object? postBody;
  113. final queryParams = <QueryParam>[];
  114. final headerParams = <String, String>{};
  115. final formParams = <String, String>{};
  116. if (key != null) {
  117. queryParams.addAll(_queryParams('', 'key', key));
  118. }
  119. const contentTypes = <String>[];
  120. return apiClient.invokeAPI(
  121. path,
  122. 'GET',
  123. queryParams,
  124. postBody,
  125. headerParams,
  126. formParams,
  127. contentTypes.isEmpty ? null : contentTypes.first,
  128. );
  129. }
  130. ///
  131. ///
  132. /// Parameters:
  133. ///
  134. /// * [String] key:
  135. Future<SharedLinkResponseDto?> getMySharedLink({ String? key, }) async {
  136. final response = await getMySharedLinkWithHttpInfo( key: key, );
  137. if (response.statusCode >= HttpStatus.badRequest) {
  138. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  139. }
  140. // When a remote server returns no body with a status of 204, we shall not decode it.
  141. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  142. // FormatException when trying to decode an empty string.
  143. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  144. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'SharedLinkResponseDto',) as SharedLinkResponseDto;
  145. }
  146. return null;
  147. }
  148. ///
  149. ///
  150. /// Note: This method returns the HTTP [Response].
  151. ///
  152. /// Parameters:
  153. ///
  154. /// * [String] id (required):
  155. Future<Response> getSharedLinkByIdWithHttpInfo(String id,) async {
  156. // ignore: prefer_const_declarations
  157. final path = r'/share/{id}'
  158. .replaceAll('{id}', id);
  159. // ignore: prefer_final_locals
  160. Object? postBody;
  161. final queryParams = <QueryParam>[];
  162. final headerParams = <String, String>{};
  163. final formParams = <String, String>{};
  164. const contentTypes = <String>[];
  165. return apiClient.invokeAPI(
  166. path,
  167. 'GET',
  168. queryParams,
  169. postBody,
  170. headerParams,
  171. formParams,
  172. contentTypes.isEmpty ? null : contentTypes.first,
  173. );
  174. }
  175. ///
  176. ///
  177. /// Parameters:
  178. ///
  179. /// * [String] id (required):
  180. Future<SharedLinkResponseDto?> getSharedLinkById(String id,) async {
  181. final response = await getSharedLinkByIdWithHttpInfo(id,);
  182. if (response.statusCode >= HttpStatus.badRequest) {
  183. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  184. }
  185. // When a remote server returns no body with a status of 204, we shall not decode it.
  186. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  187. // FormatException when trying to decode an empty string.
  188. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  189. return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'SharedLinkResponseDto',) as SharedLinkResponseDto;
  190. }
  191. return null;
  192. }
  193. ///
  194. ///
  195. /// Note: This method returns the HTTP [Response].
  196. ///
  197. /// Parameters:
  198. ///
  199. /// * [String] id (required):
  200. Future<Response> removeSharedLinkWithHttpInfo(String id,) async {
  201. // ignore: prefer_const_declarations
  202. final path = r'/share/{id}'
  203. .replaceAll('{id}', id);
  204. // ignore: prefer_final_locals
  205. Object? postBody;
  206. final queryParams = <QueryParam>[];
  207. final headerParams = <String, String>{};
  208. final formParams = <String, String>{};
  209. const contentTypes = <String>[];
  210. return apiClient.invokeAPI(
  211. path,
  212. 'DELETE',
  213. queryParams,
  214. postBody,
  215. headerParams,
  216. formParams,
  217. contentTypes.isEmpty ? null : contentTypes.first,
  218. );
  219. }
  220. ///
  221. ///
  222. /// Parameters:
  223. ///
  224. /// * [String] id (required):
  225. Future<void> removeSharedLink(String id,) async {
  226. final response = await removeSharedLinkWithHttpInfo(id,);
  227. if (response.statusCode >= HttpStatus.badRequest) {
  228. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  229. }
  230. }
  231. }