Esempio n. 1
0
        /// <summary>
        /// Create a new Sink
        /// </summary>
        /// <param name="options"> Create Sink parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Sink </returns>
        public static SinkResource Create(CreateSinkOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Esempio n. 2
0
        /// <summary>
        /// Create a new Sink
        /// </summary>
        /// <param name="options"> Create Sink parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Sink </returns>
        public static async System.Threading.Tasks.Task <SinkResource> CreateAsync(CreateSinkOptions options,
                                                                                   ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Esempio n. 3
0
        /// <summary>
        /// Create a new Sink
        /// </summary>
        /// <param name="description"> Sink Description </param>
        /// <param name="sinkConfiguration"> JSON Sink configuration. </param>
        /// <param name="sinkType"> Sink type. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Sink </returns>
        public static async System.Threading.Tasks.Task <SinkResource> CreateAsync(string description,
                                                                                   object sinkConfiguration,
                                                                                   SinkResource.SinkTypeEnum sinkType,
                                                                                   ITwilioRestClient client = null)
        {
            var options = new CreateSinkOptions(description, sinkConfiguration, sinkType);

            return(await CreateAsync(options, client));
        }
Esempio n. 4
0
        /// <summary>
        /// Create a new Sink
        /// </summary>
        /// <param name="description"> Sink Description </param>
        /// <param name="sinkConfiguration"> JSON Sink configuration. </param>
        /// <param name="sinkType"> Sink type. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Sink </returns>
        public static SinkResource Create(string description,
                                          object sinkConfiguration,
                                          SinkResource.SinkTypeEnum sinkType,
                                          ITwilioRestClient client = null)
        {
            var options = new CreateSinkOptions(description, sinkConfiguration, sinkType);

            return(Create(options, client));
        }
Esempio n. 5
0
 private static Request BuildCreateRequest(CreateSinkOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Events,
                "/v1/Sinks",
                postParams: options.GetParams()
                ));
 }