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 composition = CompositionResource.Fetch( pathSid: "CJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" ); Console.WriteLine(composition.Status); }
static void Main(string[] args) { // Find your API Key SID and Secret at twilio.com/console const string apiKeySid = "SKXXXX"; const string apiKeySecret = "your_api_key_secret"; TwilioClient.Init(apiKeySid, apiKeySecret); var composition = CompositionResource.Fetch( pathSid: "CJXXXX" ); Console.WriteLine($"Composition Resource: {composition.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\",\"status\": \"completed\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_completed\": \"2015-07-30T20:01:33Z\",\"date_deleted\": null,\"sid\": \"CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"room_sid\": \"RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"audio_sources\": [\"PAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"user*\"],\"audio_sources_excluded\": [\"RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"],\"video_layout\": {\"grid\": {\"video_sources\": [\"*\"],\"video_sources_excluded\": [\"MTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"],\"reuse\": \"show_oldest\",\"x_pos\": 100,\"y_pos\": 600,\"z_pos\": 10,\"width\": 0,\"height\": 0,\"max_columns\": 0,\"max_rows\": 0,\"cells_excluded\": []},\"pip\": {\"video_sources\": [\"RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab\"],\"video_sources_excluded\": [],\"reuse\": \"none\",\"x_pos\": 100,\"y_pos\": 600,\"z_pos\": 10,\"width\": 0,\"height\": 0,\"max_columns\": 0,\"max_rows\": 0,\"cells_excluded\": []}},\"resolution\": \"1280x720\",\"format\": \"webm\",\"bitrate\": 64,\"size\": 4,\"duration\": 6,\"trim\": true,\"media_external_location\": null,\"encryption_key\": null,\"url\": \"https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"media\": \"https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media\"}}" )); var response = CompositionResource.Fetch("CJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); Assert.NotNull(response); }
public void TestFetchResponse() { var twilioRestClient = Substitute.For <ITwilioRestClient>(); twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); twilioRestClient.Request(Arg.Any <Request>()) .Returns(new Response( System.Net.HttpStatusCode.OK, "{\"account_sid\": \"ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"status\": \"completed\",\"date_created\": \"2015-07-30T20:00:00Z\",\"date_completed\": \"2015-07-30T20:01:33Z\",\"date_deleted\": null,\"sid\": \"CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"audio_sources\": [\"RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"],\"video_sources\": [\"RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"],\"video_layout\": \"GRID\",\"resolution\": \"1280x720\",\"format\": \"webm\",\"bitrate\": 64,\"size\": 4,\"duration\": 6,\"room_sid\": \"RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"url\": \"https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"media\": \"https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media\"}}" )); var response = CompositionResource.Fetch("CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", client: twilioRestClient); Assert.NotNull(response); }
static void Main(string[] args) { // Find your API Key SID and Secret at twilio.com/console // To set up environmental variables, see http://twil.io/secure const string apiKeySid = Environment.GetEnvironmentVariable("TWILIO_API_KEY_SID"); const string apiKeySecret = Environment.GetEnvironmentVariable("TWILIO_API_KEY_SECRET"); TwilioClient.Init(apiKeySid, apiKeySecret); var composition = CompositionResource.Fetch( pathSid: "CJXXXX" ); Console.WriteLine($"Composition Resource: {composition.Sid}"); }
public void TestFetchRequest() { var twilioRestClient = Substitute.For <ITwilioRestClient>(); var request = new Request( HttpMethod.Get, Twilio.Rest.Domain.Video, "/v1/Compositions/CJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "" ); twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content")); try { CompositionResource.Fetch("CJXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", client: twilioRestClient); Assert.Fail("Expected TwilioException to be thrown for 500"); } catch (ApiException) {} twilioRestClient.Received().Request(request); }