lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb in twilio-ruby-5.77.0 vs lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb in twilio-ruby-6.0.0.pre.rc.1

- old
+ new

@@ -1,760 +1,713 @@ ## -# This code was generated by -# \ / _ _ _| _ _ -# | (_)\/(_)(_|\/| |(/_ v1.0.0 -# / / +# This code was generated by +# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ +# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ +# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ # -# frozen_string_literal: true +# Twilio - Taskrouter +# This is the public Twilio REST API. +# +# NOTE: This class is auto generated by OpenAPI Generator. +# https://openapi-generator.tech +# Do not edit the class manually. +# + module Twilio - module REST - class Taskrouter < Domain - class V1 < Version - class WorkspaceContext < InstanceContext - class TaskContext < InstanceContext - class ReservationList < ListResource - ## - # Initialize the ReservationList - # @param [Version] version Version that contains the resource - # @param [String] workspace_sid The SID of the Workspace that this task is - # contained within. - # @param [String] task_sid The SID of the reserved Task resource. - # @return [ReservationList] ReservationList - def initialize(version, workspace_sid: nil, task_sid: nil) - super(version) + module REST + class Taskrouter < TaskrouterBase + class V1 < Version + class WorkspaceContext < InstanceContext + class TaskContext < InstanceContext - # Path Solution - @solution = {workspace_sid: workspace_sid, task_sid: task_sid} - @uri = "/Workspaces/#{@solution[:workspace_sid]}/Tasks/#{@solution[:task_sid]}/Reservations" - end + class ReservationList < ListResource + ## + # Initialize the ReservationList + # @param [Version] version Version that contains the resource + # @return [ReservationList] ReservationList + def initialize(version, workspace_sid: nil, task_sid: nil) + super(version) + # Path Solution + @solution = { workspace_sid: workspace_sid, task_sid: task_sid } + @uri = "/Workspaces/#{@solution[:workspace_sid]}/Tasks/#{@solution[:task_sid]}/Reservations" + + end + + ## + # Lists ReservationInstance records from the API as a list. + # Unlike stream(), this operation is eager and will load `limit` records into + # memory before returning. + # @param [Status] reservation_status Returns the list of reservations for a task with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, or `timeout`. + # @param [String] worker_sid The SID of the reserved Worker resource to read. + # @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 + def list(reservation_status: :unset, worker_sid: :unset, limit: nil, page_size: nil) + self.stream( + reservation_status: reservation_status, + worker_sid: worker_sid, + limit: limit, + page_size: page_size + ).entries + end - ## - # Lists ReservationInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @param [reservation.Status] reservation_status Returns the list of reservations - # for a task with a specified ReservationStatus. Can be: `pending`, `accepted`, - # `rejected`, or `timeout`. - # @param [String] worker_sid The SID of the reserved Worker resource to read. - # @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 - def list(reservation_status: :unset, worker_sid: :unset, limit: nil, page_size: nil) - self.stream( - reservation_status: reservation_status, - worker_sid: worker_sid, - limit: limit, - page_size: page_size - ).entries - end + ## + # Streams Instance records from the API as an Enumerable. + # This operation lazily loads records as efficiently as possible until the limit + # is reached. + # @param [Status] reservation_status Returns the list of reservations for a task with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, or `timeout`. + # @param [String] worker_sid The SID of the reserved Worker resource to read. + # @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 + def stream(reservation_status: :unset, worker_sid: :unset, limit: nil, page_size: nil) + limits = @version.read_limits(limit, page_size) - ## - # Streams ReservationInstance records from the API as an Enumerable. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - # @param [reservation.Status] reservation_status Returns the list of reservations - # for a task with a specified ReservationStatus. Can be: `pending`, `accepted`, - # `rejected`, or `timeout`. - # @param [String] worker_sid The SID of the reserved Worker resource to read. - # @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 - def stream(reservation_status: :unset, worker_sid: :unset, limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) + page = self.page( + reservation_status: reservation_status, + worker_sid: worker_sid, + page_size: limits[:page_size], ) - page = self.page( - reservation_status: reservation_status, - worker_sid: worker_sid, - page_size: limits[:page_size], - ) + @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) + end - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end + ## + # When passed a block, yields ReservationInstance records from the API. + # This operation lazily loads records as efficiently as possible until the limit + # is reached. + def each + limits = @version.read_limits - ## - # When passed a block, yields ReservationInstance records from the API. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - def each - limits = @version.read_limits + page = self.page(page_size: limits[:page_size], ) - page = self.page(page_size: limits[:page_size], ) + @version.stream(page, + limit: limits[:limit], + page_limit: limits[:page_limit]).each {|x| yield x} + end - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end + ## + # Retrieve a single page of ReservationInstance records from the API. + # Request is executed immediately. + # @param [Status] reservation_status Returns the list of reservations for a task with a specified ReservationStatus. Can be: `pending`, `accepted`, `rejected`, or `timeout`. + # @param [String] worker_sid The SID of the reserved Worker resource to read. + # @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 ReservationInstance + def page(reservation_status: :unset, worker_sid: :unset, page_token: :unset, page_number: :unset, page_size: :unset) + params = Twilio::Values.of({ + + 'ReservationStatus' => reservation_status, + + 'WorkerSid' => worker_sid, + + 'PageToken' => page_token, + 'Page' => page_number, + 'PageSize' => page_size, + }) - ## - # Retrieve a single page of ReservationInstance records from the API. - # Request is executed immediately. - # @param [reservation.Status] reservation_status Returns the list of reservations - # for a task with a specified ReservationStatus. Can be: `pending`, `accepted`, - # `rejected`, or `timeout`. - # @param [String] worker_sid The SID of the reserved Worker resource to read. - # @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 ReservationInstance - def page(reservation_status: :unset, worker_sid: :unset, page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'ReservationStatus' => reservation_status, - 'WorkerSid' => worker_sid, - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) + response = @version.page('GET', @uri, params: params) - response = @version.page('GET', @uri, params: params) + ReservationPage.new(@version, response, @solution) + end - ReservationPage.new(@version, response, @solution) - end + ## + # Retrieve a single page of ReservationInstance records from the API. + # Request is executed immediately. + # @param [String] target_url API-generated URL for the requested results page + # @return [Page] Page of ReservationInstance + def get_page(target_url) + response = @version.domain.request( + 'GET', + target_url + ) + ReservationPage.new(@version, response, @solution) + end + - ## - # Retrieve a single page of ReservationInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of ReservationInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - ReservationPage.new(@version, response, @solution) - end - ## - # Provide a user friendly representation - def to_s - '#<Twilio.Taskrouter.V1.ReservationList>' - end - end + # Provide a user friendly representation + def to_s + '#<Twilio.Taskrouter.V1.ReservationList>' + end + end - class ReservationPage < Page - ## - # Initialize the ReservationPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [ReservationPage] ReservationPage - def initialize(version, response, solution) - super(version, response) - # Path Solution - @solution = solution - end + class ReservationContext < InstanceContext + ## + # Initialize the ReservationContext + # @param [Version] version Version that contains the resource + # @param [String] workspace_sid The SID of the Workspace with the TaskReservation resources to update. + # @param [String] task_sid The SID of the reserved Task resource with the TaskReservation resources to update. + # @param [String] sid The SID of the TaskReservation resource to update. + # @return [ReservationContext] ReservationContext + def initialize(version, workspace_sid, task_sid, sid) + super(version) - ## - # Build an instance of ReservationInstance - # @param [Hash] payload Payload response from the API - # @return [ReservationInstance] ReservationInstance - def get_instance(payload) - ReservationInstance.new( - @version, - payload, - workspace_sid: @solution[:workspace_sid], - task_sid: @solution[:task_sid], - ) - end + # Path Solution + @solution = { workspace_sid: workspace_sid, task_sid: task_sid, sid: sid, } + @uri = "/Workspaces/#{@solution[:workspace_sid]}/Tasks/#{@solution[:task_sid]}/Reservations/#{@solution[:sid]}" - ## - # Provide a user friendly representation - def to_s - '<Twilio.Taskrouter.V1.ReservationPage>' - end - end + + end + ## + # Fetch the ReservationInstance + # @return [ReservationInstance] Fetched ReservationInstance + def fetch - class ReservationContext < InstanceContext - ## - # Initialize the ReservationContext - # @param [Version] version Version that contains the resource - # @param [String] workspace_sid The SID of the Workspace with the TaskReservation - # resource to fetch. - # @param [String] task_sid The SID of the reserved Task resource with the - # TaskReservation resource to fetch. - # @param [String] sid The SID of the TaskReservation resource to fetch. - # @return [ReservationContext] ReservationContext - def initialize(version, workspace_sid, task_sid, sid) - super(version) + payload = @version.fetch('GET', @uri) + ReservationInstance.new( + @version, + payload, + workspace_sid: @solution[:workspace_sid], + task_sid: @solution[:task_sid], + sid: @solution[:sid], + ) + end - # Path Solution - @solution = {workspace_sid: workspace_sid, task_sid: task_sid, sid: sid, } - @uri = "/Workspaces/#{@solution[:workspace_sid]}/Tasks/#{@solution[:task_sid]}/Reservations/#{@solution[:sid]}" - end + ## + # Update the ReservationInstance + # @param [Status] reservation_status + # @param [String] worker_activity_sid The new worker activity SID if rejecting a reservation. + # @param [String] instruction The assignment instruction for reservation. + # @param [String] dequeue_post_work_activity_sid The SID of the Activity resource to start after executing a Dequeue instruction. + # @param [String] dequeue_from The Caller ID of the call to the worker when executing a Dequeue instruction. + # @param [String] dequeue_record Whether to record both legs of a call when executing a Dequeue instruction or which leg to record. + # @param [String] dequeue_timeout Timeout for call when executing a Dequeue instruction. + # @param [String] dequeue_to The Contact URI of the worker when executing a Dequeue instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. + # @param [String] dequeue_status_callback_url The Callback URL for completed call event when executing a Dequeue instruction. + # @param [String] call_from The Caller ID of the outbound call when executing a Call instruction. + # @param [String] call_record Whether to record both legs of a call when executing a Call instruction or which leg to record. + # @param [String] call_timeout Timeout for call when executing a Call instruction. + # @param [String] call_to The Contact URI of the worker when executing a Call instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. + # @param [String] call_url TwiML URI executed on answering the worker's leg as a result of the Call instruction. + # @param [String] call_status_callback_url The URL to call for the completed call event when executing a Call instruction. + # @param [Boolean] call_accept Whether to accept a reservation when executing a Call instruction. + # @param [String] redirect_call_sid The Call SID of the call parked in the queue when executing a Redirect instruction. + # @param [Boolean] redirect_accept Whether the reservation should be accepted when executing a Redirect instruction. + # @param [String] redirect_url TwiML URI to redirect the call to when executing the Redirect instruction. + # @param [String] to The Contact URI of the worker when executing a Conference instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. + # @param [String] from The Caller ID of the call to the worker when executing a Conference instruction. + # @param [String] status_callback The URL we should call using the `status_callback_method` to send status information to your application. + # @param [String] status_callback_method The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. + # @param [Array[CallStatus]] status_callback_event The call progress events that we will send to `status_callback`. Can be: `initiated`, `ringing`, `answered`, or `completed`. + # @param [String] timeout Timeout for call when executing a Conference instruction. + # @param [Boolean] record Whether to record the participant and their conferences, including the time between conferences. The default is `false`. + # @param [Boolean] muted Whether the agent is muted in the conference. The default is `false`. + # @param [String] beep Whether to play a notification beep when the participant joins or when to play a beep. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`. + # @param [Boolean] start_conference_on_enter Whether to start the conference when the participant joins, if it has not already started. The default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. + # @param [Boolean] end_conference_on_exit Whether to end the conference when the agent leaves. + # @param [String] wait_url The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). + # @param [String] wait_method The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. + # @param [Boolean] early_media Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. The default is `true`. + # @param [String] max_participants The maximum number of participants in the conference. Can be a positive integer from `2` to `250`. The default value is `250`. + # @param [String] conference_status_callback The URL we should call using the `conference_status_callback_method` when the conference events in `conference_status_callback_event` occur. Only the value set by the first participant to join the conference is used. Subsequent `conference_status_callback` values are ignored. + # @param [String] conference_status_callback_method The HTTP method we should use to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + # @param [Array[ConferenceEvent]] conference_status_callback_event The conference status events that we will send to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `speaker`. + # @param [String] conference_record Whether to record the conference the participant is joining or when to record the conference. Can be: `true`, `false`, `record-from-start`, and `do-not-record`. The default value is `false`. + # @param [String] conference_trim How to trim the leading and trailing silence from your recorded conference audio files. Can be: `trim-silence` or `do-not-trim` and defaults to `trim-silence`. + # @param [String] recording_channels The recording channels for the final recording. Can be: `mono` or `dual` and the default is `mono`. + # @param [String] recording_status_callback The URL that we should call using the `recording_status_callback_method` when the recording status changes. + # @param [String] recording_status_callback_method The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + # @param [String] conference_recording_status_callback The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. + # @param [String] conference_recording_status_callback_method The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + # @param [String] region The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. + # @param [String] sip_auth_username The SIP username used for authentication. + # @param [String] sip_auth_password The SIP password for authentication. + # @param [Array[String]] dequeue_status_callback_event The Call progress events sent via webhooks as a result of a Dequeue instruction. + # @param [String] post_work_activity_sid The new worker activity SID after executing a Conference instruction. + # @param [SupervisorMode] supervisor_mode + # @param [String] supervisor The Supervisor SID/URI when executing the Supervise instruction. + # @param [Boolean] end_conference_on_customer_exit Whether to end the conference when the customer leaves. + # @param [Boolean] beep_on_customer_entrance Whether to play a notification beep when the customer joins. + # @param [String] if_match The If-Match HTTP request header + # @return [ReservationInstance] Updated ReservationInstance + def update( + reservation_status: :unset, + worker_activity_sid: :unset, + instruction: :unset, + dequeue_post_work_activity_sid: :unset, + dequeue_from: :unset, + dequeue_record: :unset, + dequeue_timeout: :unset, + dequeue_to: :unset, + dequeue_status_callback_url: :unset, + call_from: :unset, + call_record: :unset, + call_timeout: :unset, + call_to: :unset, + call_url: :unset, + call_status_callback_url: :unset, + call_accept: :unset, + redirect_call_sid: :unset, + redirect_accept: :unset, + redirect_url: :unset, + to: :unset, + from: :unset, + status_callback: :unset, + status_callback_method: :unset, + status_callback_event: :unset, + timeout: :unset, + record: :unset, + muted: :unset, + beep: :unset, + start_conference_on_enter: :unset, + end_conference_on_exit: :unset, + wait_url: :unset, + wait_method: :unset, + early_media: :unset, + max_participants: :unset, + conference_status_callback: :unset, + conference_status_callback_method: :unset, + conference_status_callback_event: :unset, + conference_record: :unset, + conference_trim: :unset, + recording_channels: :unset, + recording_status_callback: :unset, + recording_status_callback_method: :unset, + conference_recording_status_callback: :unset, + conference_recording_status_callback_method: :unset, + region: :unset, + sip_auth_username: :unset, + sip_auth_password: :unset, + dequeue_status_callback_event: :unset, + post_work_activity_sid: :unset, + supervisor_mode: :unset, + supervisor: :unset, + end_conference_on_customer_exit: :unset, + beep_on_customer_entrance: :unset, + if_match: :unset + ) - ## - # Fetch the ReservationInstance - # @return [ReservationInstance] Fetched ReservationInstance - def fetch - payload = @version.fetch('GET', @uri) + data = Twilio::Values.of({ + 'ReservationStatus' => reservation_status, + 'WorkerActivitySid' => worker_activity_sid, + 'Instruction' => instruction, + 'DequeuePostWorkActivitySid' => dequeue_post_work_activity_sid, + 'DequeueFrom' => dequeue_from, + 'DequeueRecord' => dequeue_record, + 'DequeueTimeout' => dequeue_timeout, + 'DequeueTo' => dequeue_to, + 'DequeueStatusCallbackUrl' => dequeue_status_callback_url, + 'CallFrom' => call_from, + 'CallRecord' => call_record, + 'CallTimeout' => call_timeout, + 'CallTo' => call_to, + 'CallUrl' => call_url, + 'CallStatusCallbackUrl' => call_status_callback_url, + 'CallAccept' => call_accept, + 'RedirectCallSid' => redirect_call_sid, + 'RedirectAccept' => redirect_accept, + 'RedirectUrl' => redirect_url, + 'To' => to, + 'From' => from, + 'StatusCallback' => status_callback, + 'StatusCallbackMethod' => status_callback_method, + 'StatusCallbackEvent' => Twilio.serialize_list(status_callback_event) { |e| e }, + 'Timeout' => timeout, + 'Record' => record, + 'Muted' => muted, + 'Beep' => beep, + 'StartConferenceOnEnter' => start_conference_on_enter, + 'EndConferenceOnExit' => end_conference_on_exit, + 'WaitUrl' => wait_url, + 'WaitMethod' => wait_method, + 'EarlyMedia' => early_media, + 'MaxParticipants' => max_participants, + 'ConferenceStatusCallback' => conference_status_callback, + 'ConferenceStatusCallbackMethod' => conference_status_callback_method, + 'ConferenceStatusCallbackEvent' => Twilio.serialize_list(conference_status_callback_event) { |e| e }, + 'ConferenceRecord' => conference_record, + 'ConferenceTrim' => conference_trim, + 'RecordingChannels' => recording_channels, + 'RecordingStatusCallback' => recording_status_callback, + 'RecordingStatusCallbackMethod' => recording_status_callback_method, + 'ConferenceRecordingStatusCallback' => conference_recording_status_callback, + 'ConferenceRecordingStatusCallbackMethod' => conference_recording_status_callback_method, + 'Region' => region, + 'SipAuthUsername' => sip_auth_username, + 'SipAuthPassword' => sip_auth_password, + 'DequeueStatusCallbackEvent' => Twilio.serialize_list(dequeue_status_callback_event) { |e| e }, + 'PostWorkActivitySid' => post_work_activity_sid, + 'SupervisorMode' => supervisor_mode, + 'Supervisor' => supervisor, + 'EndConferenceOnCustomerExit' => end_conference_on_customer_exit, + 'BeepOnCustomerEntrance' => beep_on_customer_entrance, + }) - ReservationInstance.new( - @version, - payload, - workspace_sid: @solution[:workspace_sid], - task_sid: @solution[:task_sid], - sid: @solution[:sid], - ) - end + headers = Twilio::Values.of({ 'If-Match' => if_match, }) + payload = @version.update('POST', @uri, data: data, headers: headers) + ReservationInstance.new( + @version, + payload, + workspace_sid: @solution[:workspace_sid], + task_sid: @solution[:task_sid], + sid: @solution[:sid], + ) + end - ## - # Update the ReservationInstance - # @param [reservation.Status] reservation_status The new status of the - # reservation. Can be: `pending`, `accepted`, `rejected`, or `timeout`. - # @param [String] worker_activity_sid The new worker activity SID if rejecting a - # reservation. - # @param [String] instruction The assignment instruction for reservation. - # @param [String] dequeue_post_work_activity_sid The SID of the Activity resource - # to start after executing a Dequeue instruction. - # @param [String] dequeue_from The Caller ID of the call to the worker when - # executing a Dequeue instruction. - # @param [String] dequeue_record Whether to record both legs of a call when - # executing a Dequeue instruction or which leg to record. - # @param [String] dequeue_timeout Timeout for call when executing a Dequeue - # instruction. - # @param [String] dequeue_to The Contact URI of the worker when executing a - # Dequeue instruction. Can be the URI of the Twilio Client, the SIP URI for - # Programmable SIP, or the {E.164}[https://www.twilio.com/docs/glossary/what-e164] - # formatted phone number, depending on the destination. - # @param [String] dequeue_status_callback_url The Callback URL for completed call - # event when executing a Dequeue instruction. - # @param [String] call_from The Caller ID of the outbound call when executing a - # Call instruction. - # @param [String] call_record Whether to record both legs of a call when executing - # a Call instruction or which leg to record. - # @param [String] call_timeout Timeout for call when executing a Call instruction. - # @param [String] call_to The Contact URI of the worker when executing a Call - # instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable - # SIP, or the {E.164}[https://www.twilio.com/docs/glossary/what-e164] formatted - # phone number, depending on the destination. - # @param [String] call_url TwiML URI executed on answering the worker's leg as a - # result of the Call instruction. - # @param [String] call_status_callback_url The URL to call for the completed call - # event when executing a Call instruction. - # @param [Boolean] call_accept Whether to accept a reservation when executing a - # Call instruction. - # @param [String] redirect_call_sid The Call SID of the call parked in the queue - # when executing a Redirect instruction. - # @param [Boolean] redirect_accept Whether the reservation should be accepted when - # executing a Redirect instruction. - # @param [String] redirect_url TwiML URI to redirect the call to when executing - # the Redirect instruction. - # @param [String] to The Contact URI of the worker when executing a Conference - # instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable - # SIP, or the {E.164}[https://www.twilio.com/docs/glossary/what-e164] formatted - # phone number, depending on the destination. - # @param [String] from The Caller ID of the call to the worker when executing a - # Conference instruction. - # @param [String] status_callback The URL we should call using the - # `status_callback_method` to send status information to your application. - # @param [String] status_callback_method The HTTP method we should use to call - # `status_callback`. Can be: `POST` or `GET` and the default is `POST`. - # @param [Array[reservation.CallStatus]] status_callback_event The call progress - # events that we will send to `status_callback`. Can be: `initiated`, `ringing`, - # `answered`, or `completed`. - # @param [String] timeout Timeout for call when executing a Conference - # instruction. - # @param [Boolean] record Whether to record the participant and their conferences, - # including the time between conferences. The default is `false`. - # @param [Boolean] muted Whether the agent is muted in the conference. The default - # is `false`. - # @param [String] beep Whether to play a notification beep when the participant - # joins or when to play a beep. Can be: `true`, `false`, `onEnter`, or `onExit`. - # The default value is `true`. - # @param [Boolean] start_conference_on_enter Whether to start the conference when - # the participant joins, if it has not already started. The default is `true`. If - # `false` and the conference has not started, the participant is muted and hears - # background music until another participant starts the conference. - # @param [Boolean] end_conference_on_exit Whether to end the conference when the - # agent leaves. - # @param [String] wait_url The URL we should call using the `wait_method` for the - # music to play while participants are waiting for the conference to start. The - # default value is the URL of our standard hold music. {Learn more about hold - # music}[https://www.twilio.com/labs/twimlets/holdmusic]. - # @param [String] wait_method The HTTP method we should use to call `wait_url`. - # Can be `GET` or `POST` and the default is `POST`. When using a static audio - # file, this should be `GET` so that we can cache the file. - # @param [Boolean] early_media Whether to allow an agent to hear the state of the - # outbound call, including ringing or disconnect messages. The default is `true`. - # @param [String] max_participants The maximum number of participants in the - # conference. Can be a positive integer from `2` to `250`. The default value is - # `250`. - # @param [String] conference_status_callback The URL we should call using the - # `conference_status_callback_method` when the conference events in - # `conference_status_callback_event` occur. Only the value set by the first - # participant to join the conference is used. Subsequent - # `conference_status_callback` values are ignored. - # @param [String] conference_status_callback_method The HTTP method we should use - # to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to - # `POST`. - # @param [Array[reservation.ConferenceEvent]] conference_status_callback_event The - # conference status events that we will send to `conference_status_callback`. Can - # be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `speaker`. - # @param [String] conference_record Whether to record the conference the - # participant is joining or when to record the conference. Can be: `true`, - # `false`, `record-from-start`, and `do-not-record`. The default value is `false`. - # @param [String] conference_trim How to trim the leading and trailing silence - # from your recorded conference audio files. Can be: `trim-silence` or - # `do-not-trim` and defaults to `trim-silence`. - # @param [String] recording_channels The recording channels for the final - # recording. Can be: `mono` or `dual` and the default is `mono`. - # @param [String] recording_status_callback The URL that we should call using the - # `recording_status_callback_method` when the recording status changes. - # @param [String] recording_status_callback_method The HTTP method we should use - # when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults - # to `POST`. - # @param [String] conference_recording_status_callback The URL we should call - # using the `conference_recording_status_callback_method` when the conference - # recording is available. - # @param [String] conference_recording_status_callback_method The HTTP method we - # should use to call `conference_recording_status_callback`. Can be: `GET` or - # `POST` and defaults to `POST`. - # @param [String] region The - # {region}[https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls] - # where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, - # `br1`, `au1`, or `jp1`. - # @param [String] sip_auth_username The SIP username used for authentication. - # @param [String] sip_auth_password The SIP password for authentication. - # @param [Array[String]] dequeue_status_callback_event The Call progress events - # sent via webhooks as a result of a Dequeue instruction. - # @param [String] post_work_activity_sid The new worker activity SID after - # executing a Conference instruction. - # @param [reservation.SupervisorMode] supervisor_mode The Supervisor mode when - # executing the Supervise instruction. - # @param [String] supervisor The Supervisor SID/URI when executing the Supervise - # instruction. - # @param [Boolean] end_conference_on_customer_exit Whether to end the conference - # when the customer leaves. - # @param [Boolean] beep_on_customer_entrance Whether to play a notification beep - # when the customer joins. - # @param [String] if_match The If-Match HTTP request header - # @return [ReservationInstance] Updated ReservationInstance - def update(reservation_status: :unset, worker_activity_sid: :unset, instruction: :unset, dequeue_post_work_activity_sid: :unset, dequeue_from: :unset, dequeue_record: :unset, dequeue_timeout: :unset, dequeue_to: :unset, dequeue_status_callback_url: :unset, call_from: :unset, call_record: :unset, call_timeout: :unset, call_to: :unset, call_url: :unset, call_status_callback_url: :unset, call_accept: :unset, redirect_call_sid: :unset, redirect_accept: :unset, redirect_url: :unset, to: :unset, from: :unset, status_callback: :unset, status_callback_method: :unset, status_callback_event: :unset, timeout: :unset, record: :unset, muted: :unset, beep: :unset, start_conference_on_enter: :unset, end_conference_on_exit: :unset, wait_url: :unset, wait_method: :unset, early_media: :unset, max_participants: :unset, conference_status_callback: :unset, conference_status_callback_method: :unset, conference_status_callback_event: :unset, conference_record: :unset, conference_trim: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, conference_recording_status_callback: :unset, conference_recording_status_callback_method: :unset, region: :unset, sip_auth_username: :unset, sip_auth_password: :unset, dequeue_status_callback_event: :unset, post_work_activity_sid: :unset, supervisor_mode: :unset, supervisor: :unset, end_conference_on_customer_exit: :unset, beep_on_customer_entrance: :unset, if_match: :unset) - data = Twilio::Values.of({ - 'ReservationStatus' => reservation_status, - 'WorkerActivitySid' => worker_activity_sid, - 'Instruction' => instruction, - 'DequeuePostWorkActivitySid' => dequeue_post_work_activity_sid, - 'DequeueFrom' => dequeue_from, - 'DequeueRecord' => dequeue_record, - 'DequeueTimeout' => dequeue_timeout, - 'DequeueTo' => dequeue_to, - 'DequeueStatusCallbackUrl' => dequeue_status_callback_url, - 'CallFrom' => call_from, - 'CallRecord' => call_record, - 'CallTimeout' => call_timeout, - 'CallTo' => call_to, - 'CallUrl' => call_url, - 'CallStatusCallbackUrl' => call_status_callback_url, - 'CallAccept' => call_accept, - 'RedirectCallSid' => redirect_call_sid, - 'RedirectAccept' => redirect_accept, - 'RedirectUrl' => redirect_url, - 'To' => to, - 'From' => from, - 'StatusCallback' => status_callback, - 'StatusCallbackMethod' => status_callback_method, - 'StatusCallbackEvent' => Twilio.serialize_list(status_callback_event) { |e| e }, - 'Timeout' => timeout, - 'Record' => record, - 'Muted' => muted, - 'Beep' => beep, - 'StartConferenceOnEnter' => start_conference_on_enter, - 'EndConferenceOnExit' => end_conference_on_exit, - 'WaitUrl' => wait_url, - 'WaitMethod' => wait_method, - 'EarlyMedia' => early_media, - 'MaxParticipants' => max_participants, - 'ConferenceStatusCallback' => conference_status_callback, - 'ConferenceStatusCallbackMethod' => conference_status_callback_method, - 'ConferenceStatusCallbackEvent' => Twilio.serialize_list(conference_status_callback_event) { |e| e }, - 'ConferenceRecord' => conference_record, - 'ConferenceTrim' => conference_trim, - 'RecordingChannels' => recording_channels, - 'RecordingStatusCallback' => recording_status_callback, - 'RecordingStatusCallbackMethod' => recording_status_callback_method, - 'ConferenceRecordingStatusCallback' => conference_recording_status_callback, - 'ConferenceRecordingStatusCallbackMethod' => conference_recording_status_callback_method, - 'Region' => region, - 'SipAuthUsername' => sip_auth_username, - 'SipAuthPassword' => sip_auth_password, - 'DequeueStatusCallbackEvent' => Twilio.serialize_list(dequeue_status_callback_event) { |e| e }, - 'PostWorkActivitySid' => post_work_activity_sid, - 'SupervisorMode' => supervisor_mode, - 'Supervisor' => supervisor, - 'EndConferenceOnCustomerExit' => end_conference_on_customer_exit, - 'BeepOnCustomerEntrance' => beep_on_customer_entrance, - }) - headers = Twilio::Values.of({'If-Match' => if_match, }) - payload = @version.update('POST', @uri, data: data, headers: headers) + ## + # Provide a user friendly representation + def to_s + context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') + "#<Twilio.Taskrouter.V1.ReservationContext #{context}>" + end - ReservationInstance.new( - @version, - payload, - workspace_sid: @solution[:workspace_sid], - task_sid: @solution[:task_sid], - sid: @solution[:sid], - ) - end + ## + # Provide a detailed, user friendly representation + def inspect + context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') + "#<Twilio.Taskrouter.V1.ReservationContext #{context}>" + end + end - ## - # Provide a user friendly representation - def to_s - context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') - "#<Twilio.Taskrouter.V1.ReservationContext #{context}>" - end + class ReservationPage < Page + ## + # Initialize the ReservationPage + # @param [Version] version Version that contains the resource + # @param [Response] response Response from the API + # @param [Hash] solution Path solution for the resource + # @return [ReservationPage] ReservationPage + def initialize(version, response, solution) + super(version, response) - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') - "#<Twilio.Taskrouter.V1.ReservationContext #{context}>" - end - end + # Path Solution + @solution = solution + end - class ReservationInstance < InstanceResource - ## - # Initialize the ReservationInstance - # @param [Version] version Version that contains the resource - # @param [Hash] payload payload that contains response from Twilio - # @param [String] workspace_sid The SID of the Workspace that this task is - # contained within. - # @param [String] task_sid The SID of the reserved Task resource. - # @param [String] sid The SID of the TaskReservation resource to fetch. - # @return [ReservationInstance] ReservationInstance - def initialize(version, payload, workspace_sid: nil, task_sid: nil, sid: nil) - super(version) + ## + # Build an instance of ReservationInstance + # @param [Hash] payload Payload response from the API + # @return [ReservationInstance] ReservationInstance + def get_instance(payload) + ReservationInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid], task_sid: @solution[:task_sid]) + end - # Marshaled Properties - @properties = { - 'account_sid' => payload['account_sid'], - 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), - 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), - 'reservation_status' => payload['reservation_status'], - 'sid' => payload['sid'], - 'task_sid' => payload['task_sid'], - 'worker_name' => payload['worker_name'], - 'worker_sid' => payload['worker_sid'], - 'workspace_sid' => payload['workspace_sid'], - 'url' => payload['url'], - 'links' => payload['links'], - } - - # Context - @instance_context = nil - @params = { - 'workspace_sid' => workspace_sid, - 'task_sid' => task_sid, - 'sid' => sid || @properties['sid'], - } - end - - ## - # Generate an instance context for the instance, the context is capable of - # performing various actions. All instance actions are proxied to the context - # @return [ReservationContext] ReservationContext for this ReservationInstance - def context - unless @instance_context - @instance_context = ReservationContext.new( - @version, - @params['workspace_sid'], - @params['task_sid'], - @params['sid'], - ) + ## + # Provide a user friendly representation + def to_s + '<Twilio.Taskrouter.V1.ReservationPage>' + end end - @instance_context - end + class ReservationInstance < InstanceResource + ## + # Initialize the ReservationInstance + # @param [Version] version Version that contains the resource + # @param [Hash] payload payload that contains response from Twilio + # @param [String] account_sid The SID of the + # {Account}[https://www.twilio.com/docs/iam/api/account] that created this Reservation + # resource. + # @param [String] sid The SID of the Call resource to fetch. + # @return [ReservationInstance] ReservationInstance + def initialize(version, payload , workspace_sid: nil, task_sid: nil, sid: nil) + super(version) + + # Marshaled Properties + @properties = { + 'account_sid' => payload['account_sid'], + 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), + 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), + 'reservation_status' => payload['reservation_status'], + 'sid' => payload['sid'], + 'task_sid' => payload['task_sid'], + 'worker_name' => payload['worker_name'], + 'worker_sid' => payload['worker_sid'], + 'workspace_sid' => payload['workspace_sid'], + 'url' => payload['url'], + 'links' => payload['links'], + } - ## - # @return [String] The SID of the Account that created the resource - def account_sid - @properties['account_sid'] - end + # Context + @instance_context = nil + @params = { 'workspace_sid' => workspace_sid || @properties['workspace_sid'] ,'task_sid' => task_sid || @properties['task_sid'] ,'sid' => sid || @properties['sid'] , } + end - ## - # @return [Time] The ISO 8601 date and time in GMT when the resource was created - def date_created - @properties['date_created'] - end + ## + # Generate an instance context for the instance, the context is capable of + # performing various actions. All instance actions are proxied to the context + # @return [ReservationContext] CallContext for this CallInstance + def context + unless @instance_context + @instance_context = ReservationContext.new(@version , @params['workspace_sid'], @params['task_sid'], @params['sid']) + end + @instance_context + end + + ## + # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskReservation resource. + def account_sid + @properties['account_sid'] + end + + ## + # @return [Time] The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + def date_created + @properties['date_created'] + end + + ## + # @return [Time] The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + def date_updated + @properties['date_updated'] + end + + ## + # @return [Status] + def reservation_status + @properties['reservation_status'] + end + + ## + # @return [String] The unique string that we created to identify the TaskReservation resource. + def sid + @properties['sid'] + end + + ## + # @return [String] The SID of the reserved Task resource. + def task_sid + @properties['task_sid'] + end + + ## + # @return [String] The `friendly_name` of the Worker that is reserved. + def worker_name + @properties['worker_name'] + end + + ## + # @return [String] The SID of the reserved Worker resource. + def worker_sid + @properties['worker_sid'] + end + + ## + # @return [String] The SID of the Workspace that this task is contained within. + def workspace_sid + @properties['workspace_sid'] + end + + ## + # @return [String] The absolute URL of the TaskReservation reservation. + def url + @properties['url'] + end + + ## + # @return [Hash] The URLs of related resources. + def links + @properties['links'] + end + + ## + # Fetch the ReservationInstance + # @return [ReservationInstance] Fetched ReservationInstance + def fetch - ## - # @return [Time] The ISO 8601 date and time in GMT when the resource was last updated - def date_updated - @properties['date_updated'] - end + context.fetch + end - ## - # @return [reservation.Status] The current status of the reservation - def reservation_status - @properties['reservation_status'] - end + ## + # Update the ReservationInstance + # @param [Status] reservation_status + # @param [String] worker_activity_sid The new worker activity SID if rejecting a reservation. + # @param [String] instruction The assignment instruction for reservation. + # @param [String] dequeue_post_work_activity_sid The SID of the Activity resource to start after executing a Dequeue instruction. + # @param [String] dequeue_from The Caller ID of the call to the worker when executing a Dequeue instruction. + # @param [String] dequeue_record Whether to record both legs of a call when executing a Dequeue instruction or which leg to record. + # @param [String] dequeue_timeout Timeout for call when executing a Dequeue instruction. + # @param [String] dequeue_to The Contact URI of the worker when executing a Dequeue instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. + # @param [String] dequeue_status_callback_url The Callback URL for completed call event when executing a Dequeue instruction. + # @param [String] call_from The Caller ID of the outbound call when executing a Call instruction. + # @param [String] call_record Whether to record both legs of a call when executing a Call instruction or which leg to record. + # @param [String] call_timeout Timeout for call when executing a Call instruction. + # @param [String] call_to The Contact URI of the worker when executing a Call instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. + # @param [String] call_url TwiML URI executed on answering the worker's leg as a result of the Call instruction. + # @param [String] call_status_callback_url The URL to call for the completed call event when executing a Call instruction. + # @param [Boolean] call_accept Whether to accept a reservation when executing a Call instruction. + # @param [String] redirect_call_sid The Call SID of the call parked in the queue when executing a Redirect instruction. + # @param [Boolean] redirect_accept Whether the reservation should be accepted when executing a Redirect instruction. + # @param [String] redirect_url TwiML URI to redirect the call to when executing the Redirect instruction. + # @param [String] to The Contact URI of the worker when executing a Conference instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable SIP, or the [E.164](https://www.twilio.com/docs/glossary/what-e164) formatted phone number, depending on the destination. + # @param [String] from The Caller ID of the call to the worker when executing a Conference instruction. + # @param [String] status_callback The URL we should call using the `status_callback_method` to send status information to your application. + # @param [String] status_callback_method The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`. + # @param [Array[CallStatus]] status_callback_event The call progress events that we will send to `status_callback`. Can be: `initiated`, `ringing`, `answered`, or `completed`. + # @param [String] timeout Timeout for call when executing a Conference instruction. + # @param [Boolean] record Whether to record the participant and their conferences, including the time between conferences. The default is `false`. + # @param [Boolean] muted Whether the agent is muted in the conference. The default is `false`. + # @param [String] beep Whether to play a notification beep when the participant joins or when to play a beep. Can be: `true`, `false`, `onEnter`, or `onExit`. The default value is `true`. + # @param [Boolean] start_conference_on_enter Whether to start the conference when the participant joins, if it has not already started. The default is `true`. If `false` and the conference has not started, the participant is muted and hears background music until another participant starts the conference. + # @param [Boolean] end_conference_on_exit Whether to end the conference when the agent leaves. + # @param [String] wait_url The URL we should call using the `wait_method` for the music to play while participants are waiting for the conference to start. The default value is the URL of our standard hold music. [Learn more about hold music](https://www.twilio.com/labs/twimlets/holdmusic). + # @param [String] wait_method The HTTP method we should use to call `wait_url`. Can be `GET` or `POST` and the default is `POST`. When using a static audio file, this should be `GET` so that we can cache the file. + # @param [Boolean] early_media Whether to allow an agent to hear the state of the outbound call, including ringing or disconnect messages. The default is `true`. + # @param [String] max_participants The maximum number of participants in the conference. Can be a positive integer from `2` to `250`. The default value is `250`. + # @param [String] conference_status_callback The URL we should call using the `conference_status_callback_method` when the conference events in `conference_status_callback_event` occur. Only the value set by the first participant to join the conference is used. Subsequent `conference_status_callback` values are ignored. + # @param [String] conference_status_callback_method The HTTP method we should use to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + # @param [Array[ConferenceEvent]] conference_status_callback_event The conference status events that we will send to `conference_status_callback`. Can be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `speaker`. + # @param [String] conference_record Whether to record the conference the participant is joining or when to record the conference. Can be: `true`, `false`, `record-from-start`, and `do-not-record`. The default value is `false`. + # @param [String] conference_trim How to trim the leading and trailing silence from your recorded conference audio files. Can be: `trim-silence` or `do-not-trim` and defaults to `trim-silence`. + # @param [String] recording_channels The recording channels for the final recording. Can be: `mono` or `dual` and the default is `mono`. + # @param [String] recording_status_callback The URL that we should call using the `recording_status_callback_method` when the recording status changes. + # @param [String] recording_status_callback_method The HTTP method we should use when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + # @param [String] conference_recording_status_callback The URL we should call using the `conference_recording_status_callback_method` when the conference recording is available. + # @param [String] conference_recording_status_callback_method The HTTP method we should use to call `conference_recording_status_callback`. Can be: `GET` or `POST` and defaults to `POST`. + # @param [String] region The [region](https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls) where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, `br1`, `au1`, or `jp1`. + # @param [String] sip_auth_username The SIP username used for authentication. + # @param [String] sip_auth_password The SIP password for authentication. + # @param [Array[String]] dequeue_status_callback_event The Call progress events sent via webhooks as a result of a Dequeue instruction. + # @param [String] post_work_activity_sid The new worker activity SID after executing a Conference instruction. + # @param [SupervisorMode] supervisor_mode + # @param [String] supervisor The Supervisor SID/URI when executing the Supervise instruction. + # @param [Boolean] end_conference_on_customer_exit Whether to end the conference when the customer leaves. + # @param [Boolean] beep_on_customer_entrance Whether to play a notification beep when the customer joins. + # @param [String] if_match The If-Match HTTP request header + # @return [ReservationInstance] Updated ReservationInstance + def update( + reservation_status: :unset, + worker_activity_sid: :unset, + instruction: :unset, + dequeue_post_work_activity_sid: :unset, + dequeue_from: :unset, + dequeue_record: :unset, + dequeue_timeout: :unset, + dequeue_to: :unset, + dequeue_status_callback_url: :unset, + call_from: :unset, + call_record: :unset, + call_timeout: :unset, + call_to: :unset, + call_url: :unset, + call_status_callback_url: :unset, + call_accept: :unset, + redirect_call_sid: :unset, + redirect_accept: :unset, + redirect_url: :unset, + to: :unset, + from: :unset, + status_callback: :unset, + status_callback_method: :unset, + status_callback_event: :unset, + timeout: :unset, + record: :unset, + muted: :unset, + beep: :unset, + start_conference_on_enter: :unset, + end_conference_on_exit: :unset, + wait_url: :unset, + wait_method: :unset, + early_media: :unset, + max_participants: :unset, + conference_status_callback: :unset, + conference_status_callback_method: :unset, + conference_status_callback_event: :unset, + conference_record: :unset, + conference_trim: :unset, + recording_channels: :unset, + recording_status_callback: :unset, + recording_status_callback_method: :unset, + conference_recording_status_callback: :unset, + conference_recording_status_callback_method: :unset, + region: :unset, + sip_auth_username: :unset, + sip_auth_password: :unset, + dequeue_status_callback_event: :unset, + post_work_activity_sid: :unset, + supervisor_mode: :unset, + supervisor: :unset, + end_conference_on_customer_exit: :unset, + beep_on_customer_entrance: :unset, + if_match: :unset + ) - ## - # @return [String] The unique string that identifies the resource - def sid - @properties['sid'] - end + context.update( + reservation_status: reservation_status, + worker_activity_sid: worker_activity_sid, + instruction: instruction, + dequeue_post_work_activity_sid: dequeue_post_work_activity_sid, + dequeue_from: dequeue_from, + dequeue_record: dequeue_record, + dequeue_timeout: dequeue_timeout, + dequeue_to: dequeue_to, + dequeue_status_callback_url: dequeue_status_callback_url, + call_from: call_from, + call_record: call_record, + call_timeout: call_timeout, + call_to: call_to, + call_url: call_url, + call_status_callback_url: call_status_callback_url, + call_accept: call_accept, + redirect_call_sid: redirect_call_sid, + redirect_accept: redirect_accept, + redirect_url: redirect_url, + to: to, + from: from, + status_callback: status_callback, + status_callback_method: status_callback_method, + status_callback_event: status_callback_event, + timeout: timeout, + record: record, + muted: muted, + beep: beep, + start_conference_on_enter: start_conference_on_enter, + end_conference_on_exit: end_conference_on_exit, + wait_url: wait_url, + wait_method: wait_method, + early_media: early_media, + max_participants: max_participants, + conference_status_callback: conference_status_callback, + conference_status_callback_method: conference_status_callback_method, + conference_status_callback_event: conference_status_callback_event, + conference_record: conference_record, + conference_trim: conference_trim, + recording_channels: recording_channels, + recording_status_callback: recording_status_callback, + recording_status_callback_method: recording_status_callback_method, + conference_recording_status_callback: conference_recording_status_callback, + conference_recording_status_callback_method: conference_recording_status_callback_method, + region: region, + sip_auth_username: sip_auth_username, + sip_auth_password: sip_auth_password, + dequeue_status_callback_event: dequeue_status_callback_event, + post_work_activity_sid: post_work_activity_sid, + supervisor_mode: supervisor_mode, + supervisor: supervisor, + end_conference_on_customer_exit: end_conference_on_customer_exit, + beep_on_customer_entrance: beep_on_customer_entrance, + if_match: if_match, + ) + end - ## - # @return [String] The SID of the reserved Task resource - def task_sid - @properties['task_sid'] - end + ## + # Provide a user friendly representation + def to_s + values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") + "<Twilio.Taskrouter.V1.ReservationInstance #{values}>" + end - ## - # @return [String] The friendly_name of the Worker that is reserved - def worker_name - @properties['worker_name'] - end + ## + # Provide a detailed, user friendly representation + def inspect + values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") + "<Twilio.Taskrouter.V1.ReservationInstance #{values}>" + end + end - ## - # @return [String] The SID of the reserved Worker resource - def worker_sid - @properties['worker_sid'] - end - - ## - # @return [String] The SID of the Workspace that this task is contained within. - def workspace_sid - @properties['workspace_sid'] - end - - ## - # @return [String] The absolute URL of the TaskReservation reservation - def url - @properties['url'] - end - - ## - # @return [String] The URLs of related resources - def links - @properties['links'] - end - - ## - # Fetch the ReservationInstance - # @return [ReservationInstance] Fetched ReservationInstance - def fetch - context.fetch - end - - ## - # Update the ReservationInstance - # @param [reservation.Status] reservation_status The new status of the - # reservation. Can be: `pending`, `accepted`, `rejected`, or `timeout`. - # @param [String] worker_activity_sid The new worker activity SID if rejecting a - # reservation. - # @param [String] instruction The assignment instruction for reservation. - # @param [String] dequeue_post_work_activity_sid The SID of the Activity resource - # to start after executing a Dequeue instruction. - # @param [String] dequeue_from The Caller ID of the call to the worker when - # executing a Dequeue instruction. - # @param [String] dequeue_record Whether to record both legs of a call when - # executing a Dequeue instruction or which leg to record. - # @param [String] dequeue_timeout Timeout for call when executing a Dequeue - # instruction. - # @param [String] dequeue_to The Contact URI of the worker when executing a - # Dequeue instruction. Can be the URI of the Twilio Client, the SIP URI for - # Programmable SIP, or the {E.164}[https://www.twilio.com/docs/glossary/what-e164] - # formatted phone number, depending on the destination. - # @param [String] dequeue_status_callback_url The Callback URL for completed call - # event when executing a Dequeue instruction. - # @param [String] call_from The Caller ID of the outbound call when executing a - # Call instruction. - # @param [String] call_record Whether to record both legs of a call when executing - # a Call instruction or which leg to record. - # @param [String] call_timeout Timeout for call when executing a Call instruction. - # @param [String] call_to The Contact URI of the worker when executing a Call - # instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable - # SIP, or the {E.164}[https://www.twilio.com/docs/glossary/what-e164] formatted - # phone number, depending on the destination. - # @param [String] call_url TwiML URI executed on answering the worker's leg as a - # result of the Call instruction. - # @param [String] call_status_callback_url The URL to call for the completed call - # event when executing a Call instruction. - # @param [Boolean] call_accept Whether to accept a reservation when executing a - # Call instruction. - # @param [String] redirect_call_sid The Call SID of the call parked in the queue - # when executing a Redirect instruction. - # @param [Boolean] redirect_accept Whether the reservation should be accepted when - # executing a Redirect instruction. - # @param [String] redirect_url TwiML URI to redirect the call to when executing - # the Redirect instruction. - # @param [String] to The Contact URI of the worker when executing a Conference - # instruction. Can be the URI of the Twilio Client, the SIP URI for Programmable - # SIP, or the {E.164}[https://www.twilio.com/docs/glossary/what-e164] formatted - # phone number, depending on the destination. - # @param [String] from The Caller ID of the call to the worker when executing a - # Conference instruction. - # @param [String] status_callback The URL we should call using the - # `status_callback_method` to send status information to your application. - # @param [String] status_callback_method The HTTP method we should use to call - # `status_callback`. Can be: `POST` or `GET` and the default is `POST`. - # @param [Array[reservation.CallStatus]] status_callback_event The call progress - # events that we will send to `status_callback`. Can be: `initiated`, `ringing`, - # `answered`, or `completed`. - # @param [String] timeout Timeout for call when executing a Conference - # instruction. - # @param [Boolean] record Whether to record the participant and their conferences, - # including the time between conferences. The default is `false`. - # @param [Boolean] muted Whether the agent is muted in the conference. The default - # is `false`. - # @param [String] beep Whether to play a notification beep when the participant - # joins or when to play a beep. Can be: `true`, `false`, `onEnter`, or `onExit`. - # The default value is `true`. - # @param [Boolean] start_conference_on_enter Whether to start the conference when - # the participant joins, if it has not already started. The default is `true`. If - # `false` and the conference has not started, the participant is muted and hears - # background music until another participant starts the conference. - # @param [Boolean] end_conference_on_exit Whether to end the conference when the - # agent leaves. - # @param [String] wait_url The URL we should call using the `wait_method` for the - # music to play while participants are waiting for the conference to start. The - # default value is the URL of our standard hold music. {Learn more about hold - # music}[https://www.twilio.com/labs/twimlets/holdmusic]. - # @param [String] wait_method The HTTP method we should use to call `wait_url`. - # Can be `GET` or `POST` and the default is `POST`. When using a static audio - # file, this should be `GET` so that we can cache the file. - # @param [Boolean] early_media Whether to allow an agent to hear the state of the - # outbound call, including ringing or disconnect messages. The default is `true`. - # @param [String] max_participants The maximum number of participants in the - # conference. Can be a positive integer from `2` to `250`. The default value is - # `250`. - # @param [String] conference_status_callback The URL we should call using the - # `conference_status_callback_method` when the conference events in - # `conference_status_callback_event` occur. Only the value set by the first - # participant to join the conference is used. Subsequent - # `conference_status_callback` values are ignored. - # @param [String] conference_status_callback_method The HTTP method we should use - # to call `conference_status_callback`. Can be: `GET` or `POST` and defaults to - # `POST`. - # @param [Array[reservation.ConferenceEvent]] conference_status_callback_event The - # conference status events that we will send to `conference_status_callback`. Can - # be: `start`, `end`, `join`, `leave`, `mute`, `hold`, `speaker`. - # @param [String] conference_record Whether to record the conference the - # participant is joining or when to record the conference. Can be: `true`, - # `false`, `record-from-start`, and `do-not-record`. The default value is `false`. - # @param [String] conference_trim How to trim the leading and trailing silence - # from your recorded conference audio files. Can be: `trim-silence` or - # `do-not-trim` and defaults to `trim-silence`. - # @param [String] recording_channels The recording channels for the final - # recording. Can be: `mono` or `dual` and the default is `mono`. - # @param [String] recording_status_callback The URL that we should call using the - # `recording_status_callback_method` when the recording status changes. - # @param [String] recording_status_callback_method The HTTP method we should use - # when we call `recording_status_callback`. Can be: `GET` or `POST` and defaults - # to `POST`. - # @param [String] conference_recording_status_callback The URL we should call - # using the `conference_recording_status_callback_method` when the conference - # recording is available. - # @param [String] conference_recording_status_callback_method The HTTP method we - # should use to call `conference_recording_status_callback`. Can be: `GET` or - # `POST` and defaults to `POST`. - # @param [String] region The - # {region}[https://support.twilio.com/hc/en-us/articles/223132167-How-global-low-latency-routing-and-region-selection-work-for-conferences-and-Client-calls] - # where we should mix the recorded audio. Can be:`us1`, `ie1`, `de1`, `sg1`, - # `br1`, `au1`, or `jp1`. - # @param [String] sip_auth_username The SIP username used for authentication. - # @param [String] sip_auth_password The SIP password for authentication. - # @param [Array[String]] dequeue_status_callback_event The Call progress events - # sent via webhooks as a result of a Dequeue instruction. - # @param [String] post_work_activity_sid The new worker activity SID after - # executing a Conference instruction. - # @param [reservation.SupervisorMode] supervisor_mode The Supervisor mode when - # executing the Supervise instruction. - # @param [String] supervisor The Supervisor SID/URI when executing the Supervise - # instruction. - # @param [Boolean] end_conference_on_customer_exit Whether to end the conference - # when the customer leaves. - # @param [Boolean] beep_on_customer_entrance Whether to play a notification beep - # when the customer joins. - # @param [String] if_match The If-Match HTTP request header - # @return [ReservationInstance] Updated ReservationInstance - def update(reservation_status: :unset, worker_activity_sid: :unset, instruction: :unset, dequeue_post_work_activity_sid: :unset, dequeue_from: :unset, dequeue_record: :unset, dequeue_timeout: :unset, dequeue_to: :unset, dequeue_status_callback_url: :unset, call_from: :unset, call_record: :unset, call_timeout: :unset, call_to: :unset, call_url: :unset, call_status_callback_url: :unset, call_accept: :unset, redirect_call_sid: :unset, redirect_accept: :unset, redirect_url: :unset, to: :unset, from: :unset, status_callback: :unset, status_callback_method: :unset, status_callback_event: :unset, timeout: :unset, record: :unset, muted: :unset, beep: :unset, start_conference_on_enter: :unset, end_conference_on_exit: :unset, wait_url: :unset, wait_method: :unset, early_media: :unset, max_participants: :unset, conference_status_callback: :unset, conference_status_callback_method: :unset, conference_status_callback_event: :unset, conference_record: :unset, conference_trim: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, conference_recording_status_callback: :unset, conference_recording_status_callback_method: :unset, region: :unset, sip_auth_username: :unset, sip_auth_password: :unset, dequeue_status_callback_event: :unset, post_work_activity_sid: :unset, supervisor_mode: :unset, supervisor: :unset, end_conference_on_customer_exit: :unset, beep_on_customer_entrance: :unset, if_match: :unset) - context.update( - reservation_status: reservation_status, - worker_activity_sid: worker_activity_sid, - instruction: instruction, - dequeue_post_work_activity_sid: dequeue_post_work_activity_sid, - dequeue_from: dequeue_from, - dequeue_record: dequeue_record, - dequeue_timeout: dequeue_timeout, - dequeue_to: dequeue_to, - dequeue_status_callback_url: dequeue_status_callback_url, - call_from: call_from, - call_record: call_record, - call_timeout: call_timeout, - call_to: call_to, - call_url: call_url, - call_status_callback_url: call_status_callback_url, - call_accept: call_accept, - redirect_call_sid: redirect_call_sid, - redirect_accept: redirect_accept, - redirect_url: redirect_url, - to: to, - from: from, - status_callback: status_callback, - status_callback_method: status_callback_method, - status_callback_event: status_callback_event, - timeout: timeout, - record: record, - muted: muted, - beep: beep, - start_conference_on_enter: start_conference_on_enter, - end_conference_on_exit: end_conference_on_exit, - wait_url: wait_url, - wait_method: wait_method, - early_media: early_media, - max_participants: max_participants, - conference_status_callback: conference_status_callback, - conference_status_callback_method: conference_status_callback_method, - conference_status_callback_event: conference_status_callback_event, - conference_record: conference_record, - conference_trim: conference_trim, - recording_channels: recording_channels, - recording_status_callback: recording_status_callback, - recording_status_callback_method: recording_status_callback_method, - conference_recording_status_callback: conference_recording_status_callback, - conference_recording_status_callback_method: conference_recording_status_callback_method, - region: region, - sip_auth_username: sip_auth_username, - sip_auth_password: sip_auth_password, - dequeue_status_callback_event: dequeue_status_callback_event, - post_work_activity_sid: post_work_activity_sid, - supervisor_mode: supervisor_mode, - supervisor: supervisor, - end_conference_on_customer_exit: end_conference_on_customer_exit, - beep_on_customer_entrance: beep_on_customer_entrance, - if_match: if_match, - ) - end - - ## - # Provide a user friendly representation - def to_s - values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") - "<Twilio.Taskrouter.V1.ReservationInstance #{values}>" - end - - ## - # Provide a detailed, user friendly representation - def inspect - values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") - "<Twilio.Taskrouter.V1.ReservationInstance #{values}>" - end + end + end end - end end - end end - end -end \ No newline at end of file +end + +