Exemple #1
0
        /// <summary>
        /// Create a new MessagingConfiguration for a service.
        /// </summary>
        /// <param name="options"> Create MessagingConfiguration parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of MessagingConfiguration </returns>
        public static MessagingConfigurationResource Create(CreateMessagingConfigurationOptions options,
                                                            ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }
Exemple #2
0
        /// <summary>
        /// Create a new MessagingConfiguration for a service.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service that the resource is associated with </param>
        /// <param name="country"> The ISO-3166-1 country code of the country or `all`. </param>
        /// <param name="messagingServiceSid"> The SID of the Messaging Service used for this configuration. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of MessagingConfiguration </returns>
        public static async System.Threading.Tasks.Task <MessagingConfigurationResource> CreateAsync(string pathServiceSid,
                                                                                                     string country,
                                                                                                     string messagingServiceSid,
                                                                                                     ITwilioRestClient client = null)
        {
            var options = new CreateMessagingConfigurationOptions(pathServiceSid, country, messagingServiceSid);

            return(await CreateAsync(options, client));
        }
Exemple #3
0
        /// <summary>
        /// Create a new MessagingConfiguration for a service.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service that the resource is associated with </param>
        /// <param name="country"> The ISO-3166-1 country code of the country or `all`. </param>
        /// <param name="messagingServiceSid"> The SID of the Messaging Service used for this configuration. </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of MessagingConfiguration </returns>
        public static MessagingConfigurationResource Create(string pathServiceSid,
                                                            string country,
                                                            string messagingServiceSid,
                                                            ITwilioRestClient client = null)
        {
            var options = new CreateMessagingConfigurationOptions(pathServiceSid, country, messagingServiceSid);

            return(Create(options, client));
        }
 private static Request BuildCreateRequest(CreateMessagingConfigurationOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Verify,
                "/v2/Services/" + options.PathServiceSid + "/MessagingConfigurations",
                postParams: options.GetParams()
                ));
 }
Exemple #5
0
        /// <summary>
        /// Create a new MessagingConfiguration for a service.
        /// </summary>
        /// <param name="options"> Create MessagingConfiguration parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of MessagingConfiguration </returns>
        public static async System.Threading.Tasks.Task <MessagingConfigurationResource> CreateAsync(CreateMessagingConfigurationOptions options,
                                                                                                     ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }