## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true module Twilio module REST class Preview < Domain class Understand < Version class AssistantContext < InstanceContext class IntentContext < InstanceContext ## # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com. class IntentActionsList < ListResource ## # Initialize the IntentActionsList # @param [Version] version Version that contains the resource # @param [String] assistant_sid The unique ID of the parent Assistant. # @param [String] intent_sid The unique ID of the Intent. # @return [IntentActionsList] IntentActionsList def initialize(version, assistant_sid: nil, intent_sid: nil) super(version) # Path Solution @solution = {assistant_sid: assistant_sid, intent_sid: intent_sid} end ## # Provide a user friendly representation def to_s '#' end end ## # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com. class IntentActionsPage < Page ## # Initialize the IntentActionsPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [IntentActionsPage] IntentActionsPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of IntentActionsInstance # @param [Hash] payload Payload response from the API # @return [IntentActionsInstance] IntentActionsInstance def get_instance(payload) IntentActionsInstance.new( @version, payload, assistant_sid: @solution[:assistant_sid], intent_sid: @solution[:intent_sid], ) end ## # Provide a user friendly representation def to_s '' end end ## # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com. class IntentActionsContext < InstanceContext ## # Initialize the IntentActionsContext # @param [Version] version Version that contains the resource # @param [String] assistant_sid The unique ID of the parent Assistant. # @param [String] intent_sid The unique ID of the Intent. # @return [IntentActionsContext] IntentActionsContext def initialize(version, assistant_sid, intent_sid) super(version) # Path Solution @solution = {assistant_sid: assistant_sid, intent_sid: intent_sid, } @uri = "/Assistants/#{@solution[:assistant_sid]}/Intents/#{@solution[:intent_sid]}/Actions" end ## # Fetch a IntentActionsInstance # @return [IntentActionsInstance] Fetched IntentActionsInstance def fetch params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) IntentActionsInstance.new( @version, payload, assistant_sid: @solution[:assistant_sid], intent_sid: @solution[:intent_sid], ) end ## # Update the IntentActionsInstance # @param [Hash] actions The JSON actions that instruct the Assistant how to # perform this task. # @return [IntentActionsInstance] Updated IntentActionsInstance def update(actions: :unset) data = Twilio::Values.of({'Actions' => Twilio.serialize_object(actions), }) payload = @version.update( 'POST', @uri, data: data, ) IntentActionsInstance.new( @version, payload, assistant_sid: @solution[:assistant_sid], intent_sid: @solution[:intent_sid], ) end ## # Provide a user friendly representation def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#" end end ## # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com. class IntentActionsInstance < InstanceResource ## # Initialize the IntentActionsInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] assistant_sid The unique ID of the parent Assistant. # @param [String] intent_sid The unique ID of the Intent. # @return [IntentActionsInstance] IntentActionsInstance def initialize(version, payload, assistant_sid: nil, intent_sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'assistant_sid' => payload['assistant_sid'], 'intent_sid' => payload['intent_sid'], 'url' => payload['url'], 'data' => payload['data'], } # Context @instance_context = nil @params = {'assistant_sid' => assistant_sid, 'intent_sid' => intent_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 [IntentActionsContext] IntentActionsContext for this IntentActionsInstance def context unless @instance_context @instance_context = IntentActionsContext.new( @version, @params['assistant_sid'], @params['intent_sid'], ) end @instance_context end ## # @return [String] The unique ID of the Account that created this Field. def account_sid @properties['account_sid'] end ## # @return [String] The unique ID of the parent Assistant. def assistant_sid @properties['assistant_sid'] end ## # @return [String] The unique ID of the Intent. def intent_sid @properties['intent_sid'] end ## # @return [String] The url def url @properties['url'] end ## # @return [Hash] The data def data @properties['data'] end ## # Fetch a IntentActionsInstance # @return [IntentActionsInstance] Fetched IntentActionsInstance def fetch context.fetch end ## # Update the IntentActionsInstance # @param [Hash] actions The JSON actions that instruct the Assistant how to # perform this task. # @return [IntentActionsInstance] Updated IntentActionsInstance def update(actions: :unset) context.update(actions: actions, ) end ## # Provide a user friendly representation def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "" end ## # Provide a detailed, user friendly representation def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "" end end end end end end end end