Esempio n. 1
0
        /// <summary>
        /// Retrieve a list of all Entities for a Service.
        /// </summary>
        /// <param name="options"> Read Entity parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> A single instance of Entity </returns>
        public static ResourceSet <EntityResource> Read(ReadEntityOptions options, ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = client.Request(BuildReadRequest(options, client));

            var page = Page <EntityResource> .FromJson("entities", response.Content);

            return(new ResourceSet <EntityResource>(page, options, client));
        }
Esempio n. 2
0
 private static Request BuildReadRequest(ReadEntityOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Verify,
                "/v2/Services/" + options.PathServiceSid + "/Entities",
                queryParams: options.GetParams()
                ));
 }
Esempio n. 3
0
        /// <summary>
        /// Retrieve a list of all Entities for a Service.
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </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 Entity </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <EntityResource> > ReadAsync(string pathServiceSid,
                                                                                                  int?pageSize             = null,
                                                                                                  long?limit               = null,
                                                                                                  ITwilioRestClient client = null)
        {
            var options = new ReadEntityOptions(pathServiceSid)
            {
                PageSize = pageSize, Limit = limit
            };

            return(await ReadAsync(options, client));
        }
Esempio n. 4
0
        /// <summary>
        /// Retrieve a list of all Entities for a Service.
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </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 Entity </returns>
        public static ResourceSet <EntityResource> Read(string pathServiceSid,
                                                        int?pageSize             = null,
                                                        long?limit               = null,
                                                        ITwilioRestClient client = null)
        {
            var options = new ReadEntityOptions(pathServiceSid)
            {
                PageSize = pageSize, Limit = limit
            };

            return(Read(options, client));
        }
Esempio n. 5
0
        /// <summary>
        /// Retrieve a list of all Entities for a Service.
        /// </summary>
        /// <param name="options"> Read Entity parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Entity </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <EntityResource> > ReadAsync(ReadEntityOptions options,
                                                                                                  ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildReadRequest(options, client));

            var page = Page <EntityResource> .FromJson("entities", response.Content);

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