class Twilio::REST::Video::V1::RoomContext::ParticipantList
Public Class Methods
Initialize the ParticipantList
@param [Version] version Version
that contains the resource @param [String] room_sid The SID of the participant's room. @return [ParticipantList] ParticipantList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/video/v1/room/room_participant.rb 20 def initialize(version, room_sid: nil) 21 super(version) 22 23 # Path Solution 24 @solution = {room_sid: room_sid} 25 @uri = "/Rooms/#{@solution[:room_sid]}/Participants" 26 end
Public Instance Methods
When passed a block, yields ParticipantInstance
records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
# File lib/twilio-ruby/rest/video/v1/room/room_participant.rb 99 def each 100 limits = @version.read_limits 101 102 page = self.page(page_size: limits[:page_size], ) 103 104 @version.stream(page, 105 limit: limits[:limit], 106 page_limit: limits[:page_limit]).each {|x| yield x} 107 end
Retrieve a single page of ParticipantInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of ParticipantInstance
# File lib/twilio-ruby/rest/video/v1/room/room_participant.rb 147 def get_page(target_url) 148 response = @version.domain.request( 149 'GET', 150 target_url 151 ) 152 ParticipantPage.new(@version, response, @solution) 153 end
Lists ParticipantInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [participant.Status] status Read only the participants with this status.
Can be: `connected` or `disconnected`. For `in-progress` Rooms the default Status is `connected`, for `completed` Rooms only `disconnected` Participants are returned.
@param [String] identity Read only the Participants with this
{User}[https://www.twilio.com/docs/chat/rest/user-resource] `identity` value.
@param [Time] date_created_after Read only Participants that started after this
date in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#UTC] format.
@param [Time] date_created_before Read only Participants that started before
this date in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#UTC] format.
@param [Integer] limit Upper limit for the number of records to return. stream()
guarantees to never return more than limit. Default is no limit
@param [Integer] page_size Number of records to fetch per request, when
not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)
@return [Array] Array of up to limit results
# File lib/twilio-ruby/rest/video/v1/room/room_participant.rb 49 def list(status: :unset, identity: :unset, date_created_after: :unset, date_created_before: :unset, limit: nil, page_size: nil) 50 self.stream( 51 status: status, 52 identity: identity, 53 date_created_after: date_created_after, 54 date_created_before: date_created_before, 55 limit: limit, 56 page_size: page_size 57 ).entries 58 end
Retrieve a single page of ParticipantInstance
records from the API. Request
is executed immediately. @param [participant.Status] status Read only the participants with this status.
Can be: `connected` or `disconnected`. For `in-progress` Rooms the default Status is `connected`, for `completed` Rooms only `disconnected` Participants are returned.
@param [String] identity Read only the Participants with this
{User}[https://www.twilio.com/docs/chat/rest/user-resource] `identity` value.
@param [Time] date_created_after Read only Participants that started after this
date in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#UTC] format.
@param [Time] date_created_before Read only Participants that started before
this date in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#UTC] format.
@param [String] page_token PageToken provided by the API @param [Integer] page_number Page
Number, this value is simply for client state @param [Integer] page_size Number of records to return, defaults to 50 @return [Page] Page
of ParticipantInstance
# File lib/twilio-ruby/rest/video/v1/room/room_participant.rb 126 def page(status: :unset, identity: :unset, date_created_after: :unset, date_created_before: :unset, page_token: :unset, page_number: :unset, page_size: :unset) 127 params = Twilio::Values.of({ 128 'Status' => status, 129 'Identity' => identity, 130 'DateCreatedAfter' => Twilio.serialize_iso8601_datetime(date_created_after), 131 'DateCreatedBefore' => Twilio.serialize_iso8601_datetime(date_created_before), 132 'PageToken' => page_token, 133 'Page' => page_number, 134 'PageSize' => page_size, 135 }) 136 137 response = @version.page('GET', @uri, params: params) 138 139 ParticipantPage.new(@version, response, @solution) 140 end
Streams ParticipantInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [participant.Status] status Read only the participants with this status.
Can be: `connected` or `disconnected`. For `in-progress` Rooms the default Status is `connected`, for `completed` Rooms only `disconnected` Participants are returned.
@param [String] identity Read only the Participants with this
{User}[https://www.twilio.com/docs/chat/rest/user-resource] `identity` value.
@param [Time] date_created_after Read only Participants that started after this
date in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#UTC] format.
@param [Time] date_created_before Read only Participants that started before
this date in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#UTC] format.
@param [Integer] limit Upper limit for the number of records to return. stream()
guarantees to never return more than limit. Default is no limit.
@param [Integer] page_size Number of records to fetch per request, when
not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)
@return [Enumerable] Enumerable that will yield up to limit results
# File lib/twilio-ruby/rest/video/v1/room/room_participant.rb 81 def stream(status: :unset, identity: :unset, date_created_after: :unset, date_created_before: :unset, limit: nil, page_size: nil) 82 limits = @version.read_limits(limit, page_size) 83 84 page = self.page( 85 status: status, 86 identity: identity, 87 date_created_after: date_created_after, 88 date_created_before: date_created_before, 89 page_size: limits[:page_size], 90 ) 91 92 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 93 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/video/v1/room/room_participant.rb 157 def to_s 158 '#<Twilio.Video.V1.ParticipantList>' 159 end