class Twilio::REST::Chat::V1::ServiceContext::ChannelContext::InviteList
Public Class Methods
Initialize the InviteList
@param [Version] version Version
that contains the resource @param [String] service_sid The SID of the
{Service}[https://www.twilio.com/docs/api/chat/rest/services] the resource is associated with.
@param [String] channel_sid The SID of the
{Channel}[https://www.twilio.com/docs/api/chat/rest/channels] the resource belongs to.
@return [InviteList] InviteList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb 26 def initialize(version, service_sid: nil, channel_sid: nil) 27 super(version) 28 29 # Path Solution 30 @solution = {service_sid: service_sid, channel_sid: channel_sid} 31 @uri = "/Services/#{@solution[:service_sid]}/Channels/#{@solution[:channel_sid]}/Invites" 32 end
Public Instance Methods
Create the InviteInstance
@param [String] identity The `identity` value that uniquely identifies the new
resource's {User}[https://www.twilio.com/docs/api/chat/rest/v1/user] within the {Service}[https://www.twilio.com/docs/api/chat/rest/v1/service]. See {access tokens}[https://www.twilio.com/docs/api/chat/guides/create-tokens] for more info.
@param [String] role_sid The SID of the
{Role}[https://www.twilio.com/docs/api/chat/rest/roles] assigned to the new member.
@return [InviteInstance] Created InviteInstance
# File lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb 45 def create(identity: nil, role_sid: :unset) 46 data = Twilio::Values.of({'Identity' => identity, 'RoleSid' => role_sid, }) 47 48 payload = @version.create('POST', @uri, data: data) 49 50 InviteInstance.new( 51 @version, 52 payload, 53 service_sid: @solution[:service_sid], 54 channel_sid: @solution[:channel_sid], 55 ) 56 end
When passed a block, yields InviteInstance
records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
# File lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb 106 def each 107 limits = @version.read_limits 108 109 page = self.page(page_size: limits[:page_size], ) 110 111 @version.stream(page, 112 limit: limits[:limit], 113 page_limit: limits[:page_limit]).each {|x| yield x} 114 end
Retrieve a single page of InviteInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of InviteInstance
# File lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb 146 def get_page(target_url) 147 response = @version.domain.request( 148 'GET', 149 target_url 150 ) 151 InvitePage.new(@version, response, @solution) 152 end
Lists InviteInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [Array] identity The
{User}[https://www.twilio.com/docs/api/chat/rest/v1/user]'s `identity` value of the resources to read. See {access tokens}[https://www.twilio.com/docs/api/chat/guides/create-tokens] for more details.
@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/chat/v1/service/channel/invite.rb 74 def list(identity: :unset, limit: nil, page_size: nil) 75 self.stream(identity: identity, limit: limit, page_size: page_size).entries 76 end
Retrieve a single page of InviteInstance
records from the API. Request
is executed immediately. @param [Array] identity The
{User}[https://www.twilio.com/docs/api/chat/rest/v1/user]'s `identity` value of the resources to read. See {access tokens}[https://www.twilio.com/docs/api/chat/guides/create-tokens] for more details.
@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 InviteInstance
# File lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb 128 def page(identity: :unset, page_token: :unset, page_number: :unset, page_size: :unset) 129 params = Twilio::Values.of({ 130 'Identity' => Twilio.serialize_list(identity) { |e| e }, 131 'PageToken' => page_token, 132 'Page' => page_number, 133 'PageSize' => page_size, 134 }) 135 136 response = @version.page('GET', @uri, params: params) 137 138 InvitePage.new(@version, response, @solution) 139 end
Streams InviteInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [Array] identity The
{User}[https://www.twilio.com/docs/api/chat/rest/v1/user]'s `identity` value of the resources to read. See {access tokens}[https://www.twilio.com/docs/api/chat/guides/create-tokens] for more details.
@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/chat/v1/service/channel/invite.rb 94 def stream(identity: :unset, limit: nil, page_size: nil) 95 limits = @version.read_limits(limit, page_size) 96 97 page = self.page(identity: identity, page_size: limits[:page_size], ) 98 99 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 100 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb 156 def to_s 157 '#<Twilio.Chat.V1.InviteList>' 158 end