Ejemplo n.º 1
0
        /// <summary>
        /// Create a new variable.
        /// </summary>
        /// <param name="options"> Create Variable parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Variable </returns>
        public static VariableResource Create(CreateVariableOptions 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(CreateVariableOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Post,
                Rest.Domain.Serverless,
                "/v1/Services/" + options.PathServiceSid + "/Environments/" + options.PathEnvironmentSid + "/Variables",
                postParams: options.GetParams()
                ));
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a new variable.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service to create the Variable resource under </param>
        /// <param name="pathEnvironmentSid"> The SID of the environment in which the variable exists </param>
        /// <param name="key"> A string by which the Variable resource can be referenced </param>
        /// <param name="value"> A string that contains the actual value of the variable </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Variable </returns>
        public static async System.Threading.Tasks.Task <VariableResource> CreateAsync(string pathServiceSid,
                                                                                       string pathEnvironmentSid,
                                                                                       string key,
                                                                                       string value,
                                                                                       ITwilioRestClient client = null)
        {
            var options = new CreateVariableOptions(pathServiceSid, pathEnvironmentSid, key, value);

            return(await CreateAsync(options, client));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Create a new variable.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service to create the Variable resource under </param>
        /// <param name="pathEnvironmentSid"> The SID of the environment in which the variable exists </param>
        /// <param name="key"> A string by which the Variable resource can be referenced </param>
        /// <param name="value"> A string that contains the actual value of the variable </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Variable </returns>
        public static VariableResource Create(string pathServiceSid,
                                              string pathEnvironmentSid,
                                              string key,
                                              string value,
                                              ITwilioRestClient client = null)
        {
            var options = new CreateVariableOptions(pathServiceSid, pathEnvironmentSid, key, value);

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

            return(FromJson(response.Content));
        }