public dynamic CallEndpoint(ClientCredentialsRestHost host, string endpoint, RestOptions options, out bool threwException) { dynamic response = null; threwException = false; try { if (options is RestDeleteOptions) { response = host.DeleteToDynamic(2, endpoint, true, (RestDeleteOptions)options); } else if (options is RestPutOptions) { response = host.PutToDynamic(2, endpoint, true, (RestPutOptions)options); } else if (options is RestPostOptions) { response = host.PostToDynamic(2, endpoint, true, (RestPostOptions)options); } else { response = host.GetToDynamic(2, endpoint, true, (RestGetOptions)options); } } catch (Exception ex) { if (options is RestDeleteOptions) { return(response); } threwException = true; var sb = new StringBuilder(); sb.AppendLine(string.Format("TelligentManager.CallEndpoint - Endpoint: {0}", endpoint)); sb.AppendLine("Options: "); sb.AppendLine(Newtonsoft.Json.JsonConvert.SerializeObject(options)); sb.AppendLine("Exception Messages: "); sb.AppendLine(ex.Message); sb.AppendLine("Stack Trace: "); sb.AppendLine(ex.StackTrace); Sitecore.Diagnostics.Log.Error(sb.ToString(), this); } return(response); }
public BaseTelligentClient() { telligentManager = TelligentManagerSingleton.GetInstance(); this.Host = telligentManager.GetHost(); }