getFeedSubscription method
Implementation
Future<FeedSubscription> getFeedSubscription({required String projectId, required String feedId, required String subscriptionId}) 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 response = await httpClient.get(uri);
if (response.statusCode == 404) {
throw NotFoundException('Feed subscription not found: $subscriptionId');
}
if (response.statusCode >= 400) {
throw MeshagentException(
'Failed to get feed subscription. '
'Status code: ${response.statusCode}, body: ${response.body}',
);
}
final data = jsonDecode(response.body) as Map<String, dynamic>;
return FeedSubscription.fromJson(data['subscription'] as Map<String, dynamic>);
}