createCustomDomain method
Implementation
Future<CustomDomain> createCustomDomain({required String projectId, required String domain}) async {
final encodedProjectId = Uri.encodeComponent(projectId);
final uri = Uri.parse('$baseUrl/accounts/projects/$encodedProjectId/custom-domains');
final response = await httpClient.post(uri, body: jsonEncode({'domain': domain}));
if (response.statusCode >= 400) {
throw MeshagentException('Failed to create 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>());
}