getCustomDomain method
Implementation
Future<CustomDomain> getCustomDomain({required String projectId, required String domain}) async {
final encodedProjectId = Uri.encodeComponent(projectId);
final encodedDomain = Uri.encodeComponent(domain);
final uri = Uri.parse('$baseUrl/accounts/projects/$encodedProjectId/custom-domains/$encodedDomain');
final response = await httpClient.get(uri);
if (response.statusCode == 404) throw NotFoundException('Custom domain not found: $domain');
if (response.statusCode >= 400) {
throw MeshagentException('Failed to get custom domain. Status code: ${response.statusCode}, body: ${response.body}');
}
final data = jsonDecode(response.body) as Map<String, dynamic>;
return CustomDomain.fromJson((data['custom_domain'] as Map).cast<String, dynamic>());
}