private RestMSDomain CreateFeed(string domainUri, string name)
{
_logger.Value.DebugFormat("Creating the feed {0} on the RestMS server: {1}", name, _gateway.Configuration.RestMS.Uri.AbsoluteUri);
var client = _gateway.Client();
try
{
var response = client.SendAsync(_gateway.CreateRequest(
domainUri, _gateway.CreateEntityBody(
new RestMSFeed
{
Name = name,
Type = "Default",
Title = name
}))
).Result;
response.EnsureSuccessStatusCode();
return _gateway.ParseResponse<RestMSDomain>(response);
}
catch (AggregateException ae)
{
foreach (var exception in ae.Flatten().InnerExceptions)
{
_logger.Value.ErrorFormat("Threw exception adding Feed {0} to RestMS Server {1}", name, exception.Message);
}
throw new RestMSClientException(string.Format("Error adding the Feed {0} to the RestMS server, see log for details", name));
}
}