Beispiel #1
0
        public void TestReadEnqueuedResponse()
        {
            var twilioRestClient = Substitute.For <ITwilioRestClient>();

            twilioRestClient.AccountSid.Returns("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
            twilioRestClient.Request(Arg.Any <Request>())
            .Returns(new Response(
                         System.Net.HttpStatusCode.OK,
                         "{\"compositions\": [],\"meta\": {\"page\": 0,\"page_size\": 10,\"first_page_url\": \"https://video.twilio.com/v1/Compositions?Status=enqueued&PageSize=10&Page=0\",\"previous_page_url\": null,\"url\": \"https://video.twilio.com/v1/Compositions?Status=enqueued&PageSize=10&Page=0\",\"next_page_url\": null,\"key\": \"compositions\"}}"
                         ));

            var response = CompositionResource.Read(client: twilioRestClient);

            Assert.NotNull(response);
        }
Beispiel #2
0
        public void TestReadResultsResponse()
        {
            var twilioRestClient = Substitute.For <ITwilioRestClient>();

            twilioRestClient.AccountSid.Returns("ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
            twilioRestClient.Request(Arg.Any <Request>())
            .Returns(new Response(
                         System.Net.HttpStatusCode.OK,
                         "{\"compositions\": [{\"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\": [\"RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"user*\"],\"audio_sources_excluded\": [],\"video_layout\": {\"grid\": {\"video_sources\": [\"user*\"],\"video_sources_excluded\": [],\"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\"}}],\"meta\": {\"page\": 0,\"page_size\": 50,\"first_page_url\": \"https://video.twilio.com/v1/Compositions?Status=completed&RoomSid=RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&DateCreatedAfter=2017-01-01T00%3A00%3A01Z&DateCreatedBefore=2017-12-31T23%3A59%3A59Z&PageSize=50&Page=0\",\"previous_page_url\": null,\"url\": \"https://video.twilio.com/v1/Compositions?Status=completed&RoomSid=RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa&DateCreatedAfter=2017-01-01T00%3A00%3A01Z&DateCreatedBefore=2017-12-31T23%3A59%3A59Z&PageSize=50&Page=0\",\"next_page_url\": null,\"key\": \"compositions\"}}"
                         ));

            var response = CompositionResource.Read(client: twilioRestClient);

            Assert.NotNull(response);
        }
Beispiel #3
0
    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 compositions = CompositionResource.Read();

        foreach (var record in compositions)
        {
            Console.WriteLine(record.Sid);
        }
    }
        public void TestReadResultsResponse()
        {
            var twilioRestClient = Substitute.For <ITwilioRestClient>();

            twilioRestClient.AccountSid.Returns("ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
            twilioRestClient.Request(Arg.Any <Request>())
            .Returns(new Response(
                         System.Net.HttpStatusCode.OK,
                         "{\"compositions\": [{\"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\",\"RTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab\"],\"video_sources\": [],\"video_layout\": \"GRID\",\"resolution\": \"1280x720\",\"format\": \"mp3\",\"bitrate\": 16,\"size\": 55,\"duration\": 10,\"room_sid\": \"RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"url\": \"https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\",\"links\": {\"media\": \"https://video.twilio.com/v1/Compositions/CJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media\"}}],\"meta\": {\"page\": 0,\"page_size\": 50,\"first_page_url\": \"https://video.twilio.com/v1/Compositions?PageSize=50&Page=0\",\"previous_page_url\": null,\"url\": \"https://video.twilio.com/v1/Compositions?PageSize=50&Page=0\",\"next_page_url\": null,\"key\": \"compositions\"}}"
                         ));

            var response = CompositionResource.Read(client: twilioRestClient);

            Assert.NotNull(response);
        }
Beispiel #5
0
    static void Main(string[] args)
    {
        // Find your Account Sid and Token at twilio.com/console
        // DANGER! This is insecure. See http://twil.io/secure
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken  = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var compositions = CompositionResource.Read(limit: 20);

        foreach (var record in compositions)
        {
            Console.WriteLine(record.Sid);
        }
    }
Beispiel #6
0
    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 compositions = CompositionResource.Read(
            status: CompositionResource.StatusEnum.Completed
            );

        foreach (var record in compositions)
        {
            Console.WriteLine(record.Sid);
        }
    }
    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 compositions = CompositionResource.Read(
            roomSid: Promoter.ListOfOne("RMXXXX")
            );

        foreach (var record in compositions)
        {
            Console.WriteLine(record.Sid);
        }
    }
    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 compositions = CompositionResource.Read(
            roomSid: Promoter.ListOfOne("RMXXXX")
            );

        foreach (var record in compositions)
        {
            Console.WriteLine(record.Sid);
        }
    }
Beispiel #9
0
        public void TestReadRequest()
        {
            var twilioRestClient = Substitute.For <ITwilioRestClient>();
            var request          = new Request(
                HttpMethod.Get,
                Twilio.Rest.Domain.Video,
                "/v1/Compositions",
                ""
                );

            twilioRestClient.Request(request).Throws(new ApiException("Server Error, no content"));

            try
            {
                CompositionResource.Read(client: twilioRestClient);
                Assert.Fail("Expected TwilioException to be thrown for 500");
            }
            catch (ApiException) {}
            twilioRestClient.Received().Request(request);
        }
Beispiel #10
0
        public List <CompositionDto> GetAllCompositions()
        {
            TwilioClient.Init(_apiAccountSid, _accountSid);

            var compositions = CompositionResource.Read(new ReadCompositionOptions
            {
                Status = CompositionResource.StatusEnum.Completed
            });

            List <CompositionDto> compositionLst = new List <CompositionDto>();

            foreach (var comp in compositions)
            {
                compositionLst.Add(new CompositionDto
                {
                    CompositionSid = comp.Sid,
                    Links          = comp.Links,
                    Url            = comp.Url
                });
            }

            return(compositionLst);
        }