Example #1
0
        /// <summary>
        /// Retrieve a list of all environments.
        /// </summary>
        /// <param name="options"> Read Environment parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Environment </returns>
        public static ResourceSet <EnvironmentResource> Read(ReadEnvironmentOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildReadRequest(options, client));

            var page = Page <EnvironmentResource> .FromJson("environments", response.Content);

            return(new ResourceSet <EnvironmentResource>(page, options, client));
        }
Example #2
0
 private static Request BuildReadRequest(ReadEnvironmentOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Serverless,
                "/v1/Services/" + options.PathServiceSid + "/Environments",
                queryParams: options.GetParams()
                ));
 }
Example #3
0
        /// <summary>
        /// Retrieve a list of all environments.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service to read the Environment resources from </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 Environment </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <EnvironmentResource> > ReadAsync(string pathServiceSid,
                                                                                                       int?pageSize             = null,
                                                                                                       long?limit               = null,
                                                                                                       ITwilioRestClient client = null)
        {
            var options = new ReadEnvironmentOptions(pathServiceSid)
            {
                PageSize = pageSize, Limit = limit
            };

            return(await ReadAsync(options, client));
        }
Example #4
0
        /// <summary>
        /// Retrieve a list of all environments.
        /// </summary>
        /// <param name="pathServiceSid"> The SID of the Service to read the Environment resources from </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 Environment </returns>
        public static ResourceSet <EnvironmentResource> Read(string pathServiceSid,
                                                             int?pageSize             = null,
                                                             long?limit               = null,
                                                             ITwilioRestClient client = null)
        {
            var options = new ReadEnvironmentOptions(pathServiceSid)
            {
                PageSize = pageSize, Limit = limit
            };

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

            var page = Page <EnvironmentResource> .FromJson("environments", response.Content);

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