updateFeed method

Future<void> updateFeed({
  1. required String projectId,
  2. required String feedId,
  3. required String name,
  4. String description = '',
  5. bool paused = false,
  6. Map<String, String> annotations = const {},
  7. Object? messageSchema,
})

Implementation

Future<void> updateFeed({
  required String projectId,
  required String feedId,
  required String name,
  String description = '',
  bool paused = false,
  Map<String, String> annotations = const {},
  Object? messageSchema,
}) async {
  final encodedProjectId = Uri.encodeComponent(projectId);
  final encodedFeedId = Uri.encodeComponent(feedId);
  final uri = Uri.parse('$baseUrl/accounts/projects/$encodedProjectId/feeds/$encodedFeedId');
  final body = {'name': name, 'description': description, 'paused': paused, 'annotations': annotations, 'message_schema': messageSchema};

  final response = await httpClient.put(uri, body: jsonEncode(body));
  if (response.statusCode >= 400) {
    throw MeshagentException(
      'Failed to update feed. '
      'Status code: ${response.statusCode}, body: ${response.body}',
    );
  }
}