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 fleet = FleetResource.Fetch(pathSid: "FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); Console.WriteLine(fleet.UniqueName); }
public static void Main(string[] args) { // Get your Account SID and Auth Token from https://twilio.com/console const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; const string authToken = "your_auth_token"; TwilioClient.Init(accountSid, authToken); const string fleetSid = "FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; var fleet = FleetResource.Fetch(fleetSid); Console.WriteLine(fleet.Sid); }
public static void Main(string[] args) { // Get your Account SID and Auth Token from https://twilio.com/console // To set up environmental variables, see http://twil.io/secure const string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID"); const string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN"); TwilioClient.Init(accountSid, authToken); const string fleetSid = "FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; var fleet = FleetResource.Fetch(fleetSid); Console.WriteLine(fleet.Sid); }
public void TestFetchResponse() { var twilioRestClient = Substitute.For <ITwilioRestClient>(); twilioRestClient.AccountSid.Returns("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); twilioRestClient.Request(Arg.Any <Request>()) .Returns(new Response( System.Net.HttpStatusCode.OK, "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"unique_name\": \"unique_name\",\"data_enabled\": true,\"data_limit\": 1000,\"data_metering\": \"payg\",\"date_created\": \"2019-07-30T20:00:00Z\",\"date_updated\": \"2019-07-30T20:00:00Z\",\"commands_enabled\": true,\"commands_method\": \"POST\",\"commands_url\": null,\"ip_commands_method\": \"POST\",\"ip_commands_url\": null,\"network_access_profile_sid\": \"HAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"sid\": \"HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"url\": \"https://supersim.twilio.com/v1/Fleets/HFaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"}" )); var response = FleetResource.Fetch("HFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); Assert.NotNull(response); }
public void TestFetchResponse() { var twilioRestClient = Substitute.For <ITwilioRestClient>(); twilioRestClient.AccountSid.Returns("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); twilioRestClient.Request(Arg.Any <Request>()) .Returns(new Response( System.Net.HttpStatusCode.OK, "{\"sid\": \"FLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"unique_name\": \"unique_name\",\"friendly_name\": \"friendly_name\",\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"default_deployment_sid\": \"DLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"date_created\": \"2016-07-30T20:00:00Z\",\"date_updated\": \"2016-07-30T20:00:00Z\",\"url\": \"https://preview.twilio.com/DeployedDevices/Fleets/FLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"devices\": \"https://preview.twilio.com/DeployedDevices/Fleets/FLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Devices\",\"deployments\": \"https://preview.twilio.com/DeployedDevices/Fleets/FLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Deployments\",\"certificates\": \"https://preview.twilio.com/DeployedDevices/Fleets/FLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Certificates\",\"keys\": \"https://preview.twilio.com/DeployedDevices/Fleets/FLaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Keys\"}}" )); var response = FleetResource.Fetch("FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); Assert.NotNull(response); }
public void TestFetchRequest() { var twilioRestClient = Substitute.For <ITwilioRestClient>(); var request = new Request( HttpMethod.Get, Twilio.Rest.Domain.Supersim, "/v1/Fleets/HFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { FleetResource.Fetch("HFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} twilioRestClient.Received().Request(request); }