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

            return(FromJson(response.Content));
        }
Exemple #2
0
 private static Request BuildCreateRequest(CreateEnvironmentOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Serverless,
                "/v1/Services/" + options.PathServiceSid + "/Environments",
                postParams: options.GetParams()
                ));
 }
Exemple #3
0
        /// <summary>
        /// Create a new environment.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service to create the Environment resource under </param>
        /// <param name="uniqueName"> An application-defined string that uniquely identifies the Environment resource </param>
        /// <param name="domainSuffix"> A URL-friendly name that represents the environment </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Environment </returns>
        public static async System.Threading.Tasks.Task <EnvironmentResource> CreateAsync(string pathServiceSid,
                                                                                          string uniqueName,
                                                                                          string domainSuffix      = null,
                                                                                          ITwilioRestClient client = null)
        {
            var options = new CreateEnvironmentOptions(pathServiceSid, uniqueName)
            {
                DomainSuffix = domainSuffix
            };

            return(await CreateAsync(options, client));
        }
Exemple #4
0
        /// <summary>
        /// Create a new environment.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service to create the Environment resource under </param>
        /// <param name="uniqueName"> An application-defined string that uniquely identifies the Environment resource </param>
        /// <param name="domainSuffix"> A URL-friendly name that represents the environment </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Environment </returns>
        public static EnvironmentResource Create(string pathServiceSid,
                                                 string uniqueName,
                                                 string domainSuffix      = null,
                                                 ITwilioRestClient client = null)
        {
            var options = new CreateEnvironmentOptions(pathServiceSid, uniqueName)
            {
                DomainSuffix = domainSuffix
            };

            return(Create(options, client));
        }
Exemple #5
0
        /// <summary>
        /// Create a new environment.
        /// </summary>
        /// <param name="options"> Create Environment parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Environment </returns>
        public static async System.Threading.Tasks.Task <EnvironmentResource> CreateAsync(CreateEnvironmentOptions options,
                                                                                          ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildCreateRequest(options, client));

            return(FromJson(response.Content));
        }