Exemplo n.º 1
0
        /// <summary>
        /// Retrieve a list of all Variables.
        /// </summary>
        /// <param name="options"> Read Variable parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Variable </returns>
        public static ResourceSet <VariableResource> Read(ReadVariableOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildReadRequest(options, client));

            var page = Page <VariableResource> .FromJson("variables", response.Content);

            return(new ResourceSet <VariableResource>(page, options, client));
        }
Exemplo n.º 2
0
 private static Request BuildReadRequest(ReadVariableOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Serverless,
                "/v1/Services/" + options.PathServiceSid + "/Environments/" + options.PathEnvironmentSid + "/Variables",
                queryParams: options.GetParams()
                ));
 }
Exemplo n.º 3
0
        /// <summary>
        /// Retrieve a list of all Variables.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service to read the Variable resources from </param>
        /// <param name="pathEnvironmentSid"> The SID of the environment with the Variable resources to read </param>
        /// <param name="pageSize"> Page size </param>
        /// <param name="limit"> Record limit </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Variable </returns>
        public static ResourceSet <VariableResource> Read(string pathServiceSid,
                                                          string pathEnvironmentSid,
                                                          int?pageSize             = null,
                                                          long?limit               = null,
                                                          ITwilioRestClient client = null)
        {
            var options = new ReadVariableOptions(pathServiceSid, pathEnvironmentSid)
            {
                PageSize = pageSize, Limit = limit
            };

            return(Read(options, client));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Retrieve a list of all Variables.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service to read the Variable resources from </param>
        /// <param name="pathEnvironmentSid"> The SID of the environment with the Variable resources to read </param>
        /// <param name="pageSize"> Page size </param>
        /// <param name="limit"> Record limit </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 <ResourceSet <VariableResource> > ReadAsync(string pathServiceSid,
                                                                                                    string pathEnvironmentSid,
                                                                                                    int?pageSize             = null,
                                                                                                    long?limit               = null,
                                                                                                    ITwilioRestClient client = null)
        {
            var options = new ReadVariableOptions(pathServiceSid, pathEnvironmentSid)
            {
                PageSize = pageSize, Limit = limit
            };

            return(await ReadAsync(options, client));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Retrieve a list of all Variables.
        /// </summary>
        /// <param name="options"> Read 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 <ResourceSet <VariableResource> > ReadAsync(ReadVariableOptions options,
                                                                                                    ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildReadRequest(options, client));

            var page = Page <VariableResource> .FromJson("variables", response.Content);

            return(new ResourceSet <VariableResource>(page, options, client));
        }