solution = [ 'chatServiceSid' => $chatServiceSid, 'conversationSid' => $conversationSid, 'sid' => $sid, ]; $this->uri = '/Services/' . \rawurlencode($chatServiceSid) .'/Conversations/' . \rawurlencode($conversationSid) .'/Participants/' . \rawurlencode($sid) .''; } /** * Delete the ParticipantInstance * * @param array|Options $options Optional Arguments * @return bool True if delete succeeds, false otherwise * @throws TwilioException When an HTTP error occurs. */ public function delete(array $options = []): bool { $options = new Values($options); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled']]); return $this->version->delete('DELETE', $this->uri, [], [], $headers); } /** * Fetch the ParticipantInstance * * @return ParticipantInstance Fetched ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function fetch(): ParticipantInstance { $payload = $this->version->fetch('GET', $this->uri); return new ParticipantInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $this->solution['sid'] ); } /** * Update the ParticipantInstance * * @param array|Options $options Optional Arguments * @return ParticipantInstance Updated ParticipantInstance * @throws TwilioException When an HTTP error occurs. */ public function update(array $options = []): ParticipantInstance { $options = new Values($options); $data = Values::of([ 'DateCreated' => Serialize::iso8601DateTime($options['dateCreated']), 'DateUpdated' => Serialize::iso8601DateTime($options['dateUpdated']), 'Identity' => $options['identity'], 'Attributes' => $options['attributes'], 'RoleSid' => $options['roleSid'], 'MessagingBinding.ProxyAddress' => $options['messagingBindingProxyAddress'], 'MessagingBinding.ProjectedAddress' => $options['messagingBindingProjectedAddress'], 'LastReadMessageIndex' => $options['lastReadMessageIndex'], 'LastReadTimestamp' => $options['lastReadTimestamp'], ]); $headers = Values::of(['X-Twilio-Webhook-Enabled' => $options['xTwilioWebhookEnabled']]); $payload = $this->version->update('POST', $this->uri, [], $data, $headers); return new ParticipantInstance( $this->version, $payload, $this->solution['chatServiceSid'], $this->solution['conversationSid'], $this->solution['sid'] ); } /** * Provide a friendly representation * * @return string Machine friendly representation */ public function __toString(): string { $context = []; foreach ($this->solution as $key => $value) { $context[] = "$key=$value"; } return '[Twilio.Conversations.V1.ParticipantContext ' . \implode(' ', $context) . ']'; } }