Exemplo n.º 1
0
        /// <summary>
        /// Create a new Subscribed Event type for the subscription
        /// </summary>
        /// <param name="options"> Create SubscribedEvent parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of SubscribedEvent </returns>
        public static SubscribedEventResource Create(CreateSubscribedEventOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Exemplo n.º 2
0
 private static Request BuildCreateRequest(CreateSubscribedEventOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Events,
                "/v1/Subscriptions/" + options.PathSubscriptionSid + "/SubscribedEvents",
                postParams: options.GetParams()
                ));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Create a new Subscribed Event type for the subscription
        /// </summary>
        /// <param name="pathSubscriptionSid"> Subscription SID. </param>
        /// <param name="type"> Type of event being subscribed to. </param>
        /// <param name="version"> The schema version that the subscription should use. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of SubscribedEvent </returns>
        public static async System.Threading.Tasks.Task <SubscribedEventResource> CreateAsync(string pathSubscriptionSid,
                                                                                              string type,
                                                                                              int?version = null,
                                                                                              ITwilioRestClient client = null)
        {
            var options = new CreateSubscribedEventOptions(pathSubscriptionSid, type)
            {
                Version = version
            };

            return(await CreateAsync(options, client));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Create a new Subscribed Event type for the subscription
        /// </summary>
        /// <param name="pathSubscriptionSid"> Subscription SID. </param>
        /// <param name="type"> Type of event being subscribed to. </param>
        /// <param name="version"> The schema version that the subscription should use. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of SubscribedEvent </returns>
        public static SubscribedEventResource Create(string pathSubscriptionSid,
                                                     string type,
                                                     int?version = null,
                                                     ITwilioRestClient client = null)
        {
            var options = new CreateSubscribedEventOptions(pathSubscriptionSid, type)
            {
                Version = version
            };

            return(Create(options, client));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Create a new Subscribed Event type for the subscription
        /// </summary>
        /// <param name="options"> Create SubscribedEvent parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of SubscribedEvent </returns>
        public static async System.Threading.Tasks.Task <SubscribedEventResource> CreateAsync(CreateSubscribedEventOptions options,
                                                                                              ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }