예제 #1
0
 private static Request BuildReadRequest(ReadParticipantOptions options, ITwilioRestClient client)
 {
     return(new Request(
                HttpMethod.Get,
                Rest.Domain.Preview,
                "/Proxy/Services/" + options.PathServiceSid + "/Sessions/" + options.PathSessionSid + "/Participants",
                client.Region,
                queryParams: options.GetParams()
                ));
 }
        /// <summary>
        /// Retrieve a list of all Participants in this Session.
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="pathSessionSid"> Session Sid. </param>
        /// <param name="identifier"> The Participant's contact identifier, normally a phone number. </param>
        /// <param name="participantType"> The Type of this Participant </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 Participant </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <ParticipantResource> > ReadAsync(string pathServiceSid,
                                                                                                       string pathSessionSid,
                                                                                                       string identifier = null,
                                                                                                       ParticipantResource.ParticipantTypeEnum participantType = null,
                                                                                                       int?pageSize             = null,
                                                                                                       long?limit               = null,
                                                                                                       ITwilioRestClient client = null)
        {
            var options = new ReadParticipantOptions(pathServiceSid, pathSessionSid)
            {
                Identifier = identifier, ParticipantType = participantType, PageSize = pageSize, Limit = limit
            };

            return(await ReadAsync(options, client));
        }
        /// <summary>
        /// Retrieve a list of all Participants in this Session.
        /// </summary>
        /// <param name="pathServiceSid"> Service Sid. </param>
        /// <param name="pathSessionSid"> Session Sid. </param>
        /// <param name="identifier"> The Participant's contact identifier, normally a phone number. </param>
        /// <param name="participantType"> The Type of this Participant </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 Participant </returns>
        public static ResourceSet <ParticipantResource> Read(string pathServiceSid,
                                                             string pathSessionSid,
                                                             string identifier = null,
                                                             ParticipantResource.ParticipantTypeEnum participantType = null,
                                                             int?pageSize             = null,
                                                             long?limit               = null,
                                                             ITwilioRestClient client = null)
        {
            var options = new ReadParticipantOptions(pathServiceSid, pathSessionSid)
            {
                Identifier = identifier, ParticipantType = participantType, PageSize = pageSize, Limit = limit
            };

            return(Read(options, client));
        }
        /// <summary>
        /// Retrieve a list of all Participants in this Session.
        /// </summary>
        /// <param name="options"> Read Participant parameters </param>
        /// <param name="client"> Client to make requests to Twilio </param>
        /// <returns> Task that resolves to A single instance of Participant </returns>
        public static async System.Threading.Tasks.Task <ResourceSet <ParticipantResource> > ReadAsync(ReadParticipantOptions options,
                                                                                                       ITwilioRestClient client = null)
        {
            client = client ?? TwilioClient.GetRestClient();
            var response = await client.RequestAsync(BuildReadRequest(options, client));

            var page = Page <ParticipantResource> .FromJson("participants", response.Content);

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