public IRestResponse <ExecuteFiddleResponse> ExecuteFiddle(FiddleExecuteRequest request) { string apiUrl = ApiRootUrl + "/fiddles"; var client = new RestClient(apiUrl); // execute request through API var restRequest = new RestRequest("execute", Method.POST); restRequest.RequestFormat = DataFormat.Json; restRequest.AddBody(request); IRestResponse <ExecuteFiddleResponse> response = client.Execute <ExecuteFiddleResponse>(restRequest); return(response); }
public async Task <IRestResponse <ExecuteFiddleResponse> > ExecuteFiddleAsync(FiddleExecuteRequest request) { string apiUrl = ApiRootUrl + "/fiddles"; var client = new RestClient(apiUrl); // execute request through API var restRequest = new RestRequest("execute", Method.POST); restRequest.RequestFormat = DataFormat.Json; restRequest.AddBody(request); var cancellationTokenSource = new CancellationTokenSource(); IRestResponse <ExecuteFiddleResponse> response = await client.ExecuteTaskAsync <ExecuteFiddleResponse>(restRequest, cancellationTokenSource.Token); return(response); }