/// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create CompositionHook parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of CompositionHook </returns>
        public static CompositionHookResource Create(CreateCompositionHookOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Ejemplo n.º 2
0
 private static Request BuildCreateRequest(CreateCompositionHookOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Video,
                "/v1/CompositionHooks",
                postParams: options.GetParams()
                ));
 }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="friendlyName"> Friendly name of the Composition Hook to be shown in the console. </param>
        /// <param name="enabled"> Boolean flag for activating the Composition Hook. </param>
        /// <param name="videoLayout"> The JSON video layout description. </param>
        /// <param name="audioSources"> A list of audio sources related to this Composition Hook. </param>
        /// <param name="audioSourcesExcluded"> A list of audio sources excluded related to this Composition Hook. </param>
        /// <param name="resolution"> Pixel resolution of the composed video. </param>
        /// <param name="format"> Container format of the Composition Hook media file. Any of the following: `mp4`, `webm`.
        ///              </param>
        /// <param name="statusCallback"> A URL that Twilio sends asynchronous webhook requests to on every composition event.
        ///                      </param>
        /// <param name="statusCallbackMethod"> HTTP method Twilio should use when requesting the above URL. </param>
        /// <param name="trim"> Boolean flag for clipping intervals that have no media. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of CompositionHook </returns>
        public static async System.Threading.Tasks.Task <CompositionHookResource> CreateAsync(string friendlyName,
                                                                                              bool?enabled                                = null,
                                                                                              object videoLayout                          = null,
                                                                                              List <string> audioSources                  = null,
                                                                                              List <string> audioSourcesExcluded          = null,
                                                                                              string resolution                           = null,
                                                                                              CompositionHookResource.FormatEnum format   = null,
                                                                                              Uri statusCallback                          = null,
                                                                                              Twilio.Http.HttpMethod statusCallbackMethod = null,
                                                                                              bool?trim = null,
                                                                                              ITwilioRestClient client = null)
        {
            var options = new CreateCompositionHookOptions(friendlyName)
            {
                Enabled = enabled, VideoLayout = videoLayout, AudioSources = audioSources, AudioSourcesExcluded = audioSourcesExcluded, Resolution = resolution, Format = format, StatusCallback = statusCallback, StatusCallbackMethod = statusCallbackMethod, Trim = trim
            };

            return(await CreateAsync(options, client));
        }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="options"> Create CompositionHook parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of CompositionHook </returns>
        public static async System.Threading.Tasks.Task <CompositionHookResource> CreateAsync(CreateCompositionHookOptions options,
                                                                                              ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }