updateFeedSubscription method

Future<void> updateFeedSubscription({
  1. required String projectId,
  2. required String feedId,
  3. required String subscriptionId,
  4. Map<String, String> annotations = const {},
})

Implementation

Future<void> updateFeedSubscription({
  required String projectId,
  required String feedId,
  required String subscriptionId,
  Map<String, String> annotations = const {},
}) async {
  final encodedProjectId = Uri.encodeComponent(projectId);
  final encodedFeedId = Uri.encodeComponent(feedId);
  final encodedSubscriptionId = Uri.encodeComponent(subscriptionId);
  final uri = Uri.parse('$baseUrl/accounts/projects/$encodedProjectId/feeds/$encodedFeedId/subscriptions/$encodedSubscriptionId');
  final body = {'annotations': annotations};

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