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