share_api.dart 7.7 KB

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