public void TestUpdateResponse() { var twilioRestClient = Substitute.For <ITwilioRestClient>(); twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); twilioRestClient.Request(Arg.Any <Request>()) .Returns(new Response( System.Net.HttpStatusCode.OK, "{\"language\": \"language\",\"date_created\": \"2015-07-30T20:00:00Z\",\"model_build_sid\": \"UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"query\": \"query\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"status\": \"status\",\"sample_sid\": \"UFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"service_sid\": \"UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"results\": {\"intent\": {\"name\": \"name\",\"intent_sid\": \"UDaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"confidence\": 0.9},\"entities\": [{\"name\": \"name\",\"value\": \"value\",\"type\": \"type\"}]},\"url\": \"https://preview.twilio.com/understand/Services/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queries/UHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"sid\": \"UHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); var response = QueryResource.Update("UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "UHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); Assert.NotNull(response); }
public void TestUpdateResponse() { var twilioRestClient = Substitute.For <ITwilioRestClient>(); twilioRestClient.AccountSid.Returns("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); twilioRestClient.Request(Arg.Any <Request>()) .Returns(new Response( System.Net.HttpStatusCode.OK, "{\"language\": \"language\",\"date_created\": \"2015-07-30T20:00:00Z\",\"model_build_sid\": \"UGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"query\": \"query\",\"date_updated\": \"2015-07-30T20:00:00Z\",\"status\": \"status\",\"sample_sid\": \"UFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"assistant_sid\": \"UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"results\": {\"task\": \"name\",\"fields\": [{\"name\": \"name\",\"value\": \"value\",\"type\": \"type\"}]},\"url\": \"https://autopilot.twilio.com/v1/Assistants/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queries/UHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"sid\": \"UHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"source_channel\": \"sms\",\"dialogue_sid\": \"UKaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); var response = QueryResource.Update("UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); Assert.NotNull(response); }
static void Main(string[] args) { // Find your Account Sid and Token at twilio.com/console const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; const string authToken = "your_auth_token"; TwilioClient.Init(accountSid, authToken); var query = QueryResource.Update( sampleSid: "UFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", pathAssistantSid: "UAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", pathSid: "UHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ); Console.WriteLine(query.DateCreated); }
public void TestUpdateRequest() { var twilioRestClient = Substitute.For <ITwilioRestClient>(); var request = new Request( HttpMethod.Post, Twilio.Rest.Domain.Preview, "/understand/Services/UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queries/UHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "" ); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { QueryResource.Update("UAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "UHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} twilioRestClient.Received().Request(request); }