activity_api.dart 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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 ActivityApi {
  11. ActivityApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
  12. final ApiClient apiClient;
  13. /// Performs an HTTP 'POST /activity' operation and returns the [Response].
  14. /// Parameters:
  15. ///
  16. /// * [ActivityCreateDto] activityCreateDto (required):
  17. Future<Response> createActivityWithHttpInfo(ActivityCreateDto activityCreateDto,) async {
  18. // ignore: prefer_const_declarations
  19. final path = r'/activity';
  20. // ignore: prefer_final_locals
  21. Object? postBody = activityCreateDto;
  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. /// * [ActivityCreateDto] activityCreateDto (required):
  39. Future<ActivityResponseDto?> createActivity(ActivityCreateDto activityCreateDto,) async {
  40. final response = await createActivityWithHttpInfo(activityCreateDto,);
  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), 'ActivityResponseDto',) as ActivityResponseDto;
  49. }
  50. return null;
  51. }
  52. /// Performs an HTTP 'DELETE /activity/{id}' operation and returns the [Response].
  53. /// Parameters:
  54. ///
  55. /// * [String] id (required):
  56. Future<Response> deleteActivityWithHttpInfo(String id,) async {
  57. // ignore: prefer_const_declarations
  58. final path = r'/activity/{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> deleteActivity(String id,) async {
  80. final response = await deleteActivityWithHttpInfo(id,);
  81. if (response.statusCode >= HttpStatus.badRequest) {
  82. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  83. }
  84. }
  85. /// Performs an HTTP 'GET /activity' operation and returns the [Response].
  86. /// Parameters:
  87. ///
  88. /// * [String] albumId (required):
  89. ///
  90. /// * [String] assetId:
  91. ///
  92. /// * [ReactionType] type:
  93. ///
  94. /// * [ReactionLevel] level:
  95. ///
  96. /// * [String] userId:
  97. Future<Response> getActivitiesWithHttpInfo(String albumId, { String? assetId, ReactionType? type, ReactionLevel? level, String? userId, }) async {
  98. // ignore: prefer_const_declarations
  99. final path = r'/activity';
  100. // ignore: prefer_final_locals
  101. Object? postBody;
  102. final queryParams = <QueryParam>[];
  103. final headerParams = <String, String>{};
  104. final formParams = <String, String>{};
  105. queryParams.addAll(_queryParams('', 'albumId', albumId));
  106. if (assetId != null) {
  107. queryParams.addAll(_queryParams('', 'assetId', assetId));
  108. }
  109. if (type != null) {
  110. queryParams.addAll(_queryParams('', 'type', type));
  111. }
  112. if (level != null) {
  113. queryParams.addAll(_queryParams('', 'level', level));
  114. }
  115. if (userId != null) {
  116. queryParams.addAll(_queryParams('', 'userId', userId));
  117. }
  118. const contentTypes = <String>[];
  119. return apiClient.invokeAPI(
  120. path,
  121. 'GET',
  122. queryParams,
  123. postBody,
  124. headerParams,
  125. formParams,
  126. contentTypes.isEmpty ? null : contentTypes.first,
  127. );
  128. }
  129. /// Parameters:
  130. ///
  131. /// * [String] albumId (required):
  132. ///
  133. /// * [String] assetId:
  134. ///
  135. /// * [ReactionType] type:
  136. ///
  137. /// * [ReactionLevel] level:
  138. ///
  139. /// * [String] userId:
  140. Future<List<ActivityResponseDto>?> getActivities(String albumId, { String? assetId, ReactionType? type, ReactionLevel? level, String? userId, }) async {
  141. final response = await getActivitiesWithHttpInfo(albumId, assetId: assetId, type: type, level: level, userId: userId, );
  142. if (response.statusCode >= HttpStatus.badRequest) {
  143. throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  144. }
  145. // When a remote server returns no body with a status of 204, we shall not decode it.
  146. // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  147. // FormatException when trying to decode an empty string.
  148. if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
  149. final responseBody = await _decodeBodyBytes(response);
  150. return (await apiClient.deserializeAsync(responseBody, 'List<ActivityResponseDto>') as List)
  151. .cast<ActivityResponseDto>()
  152. .toList();
  153. }
  154. return null;
  155. }
  156. /// Performs an HTTP 'GET /activity/statistics' operation and returns the [Response].
  157. /// Parameters:
  158. ///
  159. /// * [String] albumId (required):
  160. ///
  161. /// * [String] assetId:
  162. Future<Response> getActivityStatisticsWithHttpInfo(String albumId, { String? assetId, }) async {
  163. // ignore: prefer_const_declarations
  164. final path = r'/activity/statistics';
  165. // ignore: prefer_final_locals
  166. Object? postBody;
  167. final queryParams = <QueryParam>[];
  168. final headerParams = <String, String>{};
  169. final formParams = <String, String>{};
  170. queryParams.addAll(_queryParams('', 'albumId', albumId));
  171. if (assetId != null) {
  172. queryParams.addAll(_queryParams('', 'assetId', assetId));
  173. }
  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] albumId (required):
  188. ///
  189. /// * [String] assetId:
  190. Future<ActivityStatisticsResponseDto?> getActivityStatistics(String albumId, { String? assetId, }) async {
  191. final response = await getActivityStatisticsWithHttpInfo(albumId, assetId: assetId, );
  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), 'ActivityStatisticsResponseDto',) as ActivityStatisticsResponseDto;
  200. }
  201. return null;
  202. }
  203. }