diff --git a/lib/twilio-ruby/rest/autopilot.rb b/lib/twilio-ruby/rest/autopilot.rb deleted file mode 100644 index 3c9135b93..000000000 --- a/lib/twilio-ruby/rest/autopilot.rb +++ /dev/null @@ -1,22 +0,0 @@ -module Twilio - module REST - class Autopilot < AutopilotBase - ## - # @param [String] sid The unique string that we created to identify the Assistant - # resource. - # @return [Twilio::REST::Autopilot::V1::AssistantInstance] if sid was passed. - # @return [Twilio::REST::Autopilot::V1::AssistantList] - def assistants(sid=:unset) - warn "assistants is deprecated. Use v1.assistants instead." - self.v1.assistants(sid) - end - - ## - # @return [Twilio::REST::Autopilot::V1::RestoreAssistantInstance] - def restore_assistant - warn "restore_assistant is deprecated. Use v1.restore_assistant instead." - self.v1.restore_assistant() - end - end - end -end \ No newline at end of file diff --git a/lib/twilio-ruby/rest/autopilot/v1.rb b/lib/twilio-ruby/rest/autopilot/v1.rb deleted file mode 100644 index 8e1a0bee1..000000000 --- a/lib/twilio-ruby/rest/autopilot/v1.rb +++ /dev/null @@ -1,55 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Autopilot -# 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 Autopilot - class V1 < Version - ## - # Initialize the V1 version of Autopilot - def initialize(domain) - super - @version = 'v1' - @assistants = nil - @restore_assistant = nil - end - - ## - # @param [String] sid The Twilio-provided string that uniquely identifies the Assistant resource to fetch. - # @return [Twilio::REST::Autopilot::V1::AssistantContext] if sid was passed. - # @return [Twilio::REST::Autopilot::V1::AssistantList] - def assistants(sid=:unset) - if sid.nil? - raise ArgumentError, 'sid cannot be nil' - end - if sid == :unset - @assistants ||= AssistantList.new self - else - AssistantContext.new(self, sid) - end - end - ## - # @return [Twilio::REST::Autopilot::V1::RestoreAssistantList] - def restore_assistant - @restore_assistant ||= RestoreAssistantList.new self - end - ## - # Provide a user friendly representation - def to_s - ''; - end - end - end - end -end diff --git a/lib/twilio-ruby/rest/autopilot/v1/assistant.rb b/lib/twilio-ruby/rest/autopilot/v1/assistant.rb deleted file mode 100644 index db4aec470..000000000 --- a/lib/twilio-ruby/rest/autopilot/v1/assistant.rb +++ /dev/null @@ -1,683 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Autopilot -# 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 Autopilot < AutopilotBase - class V1 < Version - class AssistantList < ListResource - ## - # Initialize the AssistantList - # @param [Version] version Version that contains the resource - # @return [AssistantList] AssistantList - def initialize(version) - super(version) - # Path Solution - @solution = { } - @uri = "/Assistants" - - end - ## - # Create the AssistantInstance - # @param [String] friendly_name A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. - # @param [Boolean] log_queries Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. - # @param [String] unique_name An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. - # @param [String] callback_url Reserved. - # @param [String] callback_events Reserved. - # @param [Object] style_sheet The JSON string that defines the Assistant's [style sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet) - # @param [Object] defaults A JSON object that defines the Assistant's [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks. - # @return [AssistantInstance] Created AssistantInstance - def create( - friendly_name: :unset, - log_queries: :unset, - unique_name: :unset, - callback_url: :unset, - callback_events: :unset, - style_sheet: :unset, - defaults: :unset - ) - - data = Twilio::Values.of({ - 'FriendlyName' => friendly_name, - 'LogQueries' => log_queries, - 'UniqueName' => unique_name, - 'CallbackUrl' => callback_url, - 'CallbackEvents' => callback_events, - 'StyleSheet' => Twilio.serialize_object(style_sheet), - 'Defaults' => Twilio.serialize_object(defaults), - }) - - payload = @version.create('POST', @uri, data: data) - AssistantInstance.new( - @version, - payload, - ) - end - - - ## - # Lists AssistantInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @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(limit: nil, page_size: nil) - self.stream( - 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 [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(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields AssistantInstance 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], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of AssistantInstance records from the API. - # Request is executed immediately. - # @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 AssistantInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - AssistantPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of AssistantInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of AssistantInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - AssistantPage.new(@version, response, @solution) - 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 AssistantContext < InstanceContext - ## - # Initialize the AssistantContext - # @param [Version] version Version that contains the resource - # @param [String] sid The Twilio-provided string that uniquely identifies the Assistant resource to update. - # @return [AssistantContext] AssistantContext - def initialize(version, sid) - super(version) - - # Path Solution - @solution = { sid: sid, } - @uri = "/Assistants/#{@solution[:sid]}" - - # Dependents - @tasks = nil - @defaults = nil - @webhooks = nil - @dialogues = nil - @model_builds = nil - @field_types = nil - @style_sheet = nil - @queries = nil - end - ## - # Delete the AssistantInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - @version.delete('DELETE', @uri) - end - - ## - # Fetch the AssistantInstance - # @return [AssistantInstance] Fetched AssistantInstance - def fetch - - payload = @version.fetch('GET', @uri) - AssistantInstance.new( - @version, - payload, - sid: @solution[:sid], - ) - end - - ## - # Update the AssistantInstance - # @param [String] friendly_name A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. - # @param [Boolean] log_queries Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. - # @param [String] unique_name An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. - # @param [String] callback_url Reserved. - # @param [String] callback_events Reserved. - # @param [Object] style_sheet The JSON string that defines the Assistant's [style sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet) - # @param [Object] defaults A JSON object that defines the Assistant's [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks. - # @param [String] development_stage A string describing the state of the assistant. - # @return [AssistantInstance] Updated AssistantInstance - def update( - friendly_name: :unset, - log_queries: :unset, - unique_name: :unset, - callback_url: :unset, - callback_events: :unset, - style_sheet: :unset, - defaults: :unset, - development_stage: :unset - ) - - data = Twilio::Values.of({ - 'FriendlyName' => friendly_name, - 'LogQueries' => log_queries, - 'UniqueName' => unique_name, - 'CallbackUrl' => callback_url, - 'CallbackEvents' => callback_events, - 'StyleSheet' => Twilio.serialize_object(style_sheet), - 'Defaults' => Twilio.serialize_object(defaults), - 'DevelopmentStage' => development_stage, - }) - - payload = @version.update('POST', @uri, data: data) - AssistantInstance.new( - @version, - payload, - sid: @solution[:sid], - ) - end - - ## - # Access the tasks - # @return [TaskList] - # @return [TaskContext] if sid was passed. - def tasks(sid=:unset) - - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return TaskContext.new(@version, @solution[:sid],sid ) - end - - unless @tasks - @tasks = TaskList.new( - @version, assistant_sid: @solution[:sid], ) - end - - @tasks - end - ## - # Access the defaults - # @return [DefaultsList] - # @return [DefaultsContext] - def defaults - DefaultsContext.new( - @version, - @solution[:sid] - ) - end - ## - # Access the webhooks - # @return [WebhookList] - # @return [WebhookContext] if sid was passed. - def webhooks(sid=:unset) - - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return WebhookContext.new(@version, @solution[:sid],sid ) - end - - unless @webhooks - @webhooks = WebhookList.new( - @version, assistant_sid: @solution[:sid], ) - end - - @webhooks - end - ## - # Access the dialogues - # @return [DialogueList] - # @return [DialogueContext] if sid was passed. - def dialogues(sid=:unset) - - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return DialogueContext.new(@version, @solution[:sid],sid ) - end - - unless @dialogues - @dialogues = DialogueList.new( - @version, assistant_sid: @solution[:sid], ) - end - - @dialogues - end - ## - # Access the model_builds - # @return [ModelBuildList] - # @return [ModelBuildContext] if sid was passed. - def model_builds(sid=:unset) - - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return ModelBuildContext.new(@version, @solution[:sid],sid ) - end - - unless @model_builds - @model_builds = ModelBuildList.new( - @version, assistant_sid: @solution[:sid], ) - end - - @model_builds - end - ## - # Access the field_types - # @return [FieldTypeList] - # @return [FieldTypeContext] if sid was passed. - def field_types(sid=:unset) - - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return FieldTypeContext.new(@version, @solution[:sid],sid ) - end - - unless @field_types - @field_types = FieldTypeList.new( - @version, assistant_sid: @solution[:sid], ) - end - - @field_types - end - ## - # Access the style_sheet - # @return [StyleSheetList] - # @return [StyleSheetContext] - def style_sheet - StyleSheetContext.new( - @version, - @solution[:sid] - ) - end - ## - # Access the queries - # @return [QueryList] - # @return [QueryContext] if sid was passed. - def queries(sid=:unset) - - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return QueryContext.new(@version, @solution[:sid],sid ) - end - - unless @queries - @queries = QueryList.new( - @version, assistant_sid: @solution[:sid], ) - end - - @queries - end - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class AssistantPage < Page - ## - # Initialize the AssistantPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [AssistantPage] AssistantPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of AssistantInstance - # @param [Hash] payload Payload response from the API - # @return [AssistantInstance] AssistantInstance - def get_instance(payload) - AssistantInstance.new(@version, payload) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class AssistantInstance < InstanceResource - ## - # Initialize the AssistantInstance - # @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 Assistant - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [AssistantInstance] AssistantInstance - def initialize(version, payload , 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']), - 'friendly_name' => payload['friendly_name'], - 'latest_model_build_sid' => payload['latest_model_build_sid'], - 'links' => payload['links'], - 'log_queries' => payload['log_queries'], - 'development_stage' => payload['development_stage'], - 'needs_model_build' => payload['needs_model_build'], - 'sid' => payload['sid'], - 'unique_name' => payload['unique_name'], - 'url' => payload['url'], - 'callback_url' => payload['callback_url'], - 'callback_events' => payload['callback_events'], - } - - # Context - @instance_context = nil - @params = { '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 [AssistantContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = AssistantContext.new(@version , @params['sid']) - end - @instance_context - end - - ## - # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Assistant resource. - def account_sid - @properties['account_sid'] - end - - ## - # @return [Time] The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. - def friendly_name - @properties['friendly_name'] - end - - ## - # @return [String] Reserved. - def latest_model_build_sid - @properties['latest_model_build_sid'] - end - - ## - # @return [Hash] A list of the URLs of the Assistant's related resources. - def links - @properties['links'] - end - - ## - # @return [Boolean] Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. - def log_queries - @properties['log_queries'] - end - - ## - # @return [String] A string describing the state of the assistant. - def development_stage - @properties['development_stage'] - end - - ## - # @return [Boolean] Whether model needs to be rebuilt. - def needs_model_build - @properties['needs_model_build'] - end - - ## - # @return [String] The unique string that we created to identify the Assistant resource. - def sid - @properties['sid'] - end - - ## - # @return [String] An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. It can be up to 64 characters long. - def unique_name - @properties['unique_name'] - end - - ## - # @return [String] The absolute URL of the Assistant resource. - def url - @properties['url'] - end - - ## - # @return [String] Reserved. - def callback_url - @properties['callback_url'] - end - - ## - # @return [String] Reserved. - def callback_events - @properties['callback_events'] - end - - ## - # Delete the AssistantInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the AssistantInstance - # @return [AssistantInstance] Fetched AssistantInstance - def fetch - - context.fetch - end - - ## - # Update the AssistantInstance - # @param [String] friendly_name A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. - # @param [Boolean] log_queries Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. - # @param [String] unique_name An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. - # @param [String] callback_url Reserved. - # @param [String] callback_events Reserved. - # @param [Object] style_sheet The JSON string that defines the Assistant's [style sheet](https://www.twilio.com/docs/autopilot/api/assistant/stylesheet) - # @param [Object] defaults A JSON object that defines the Assistant's [default tasks](https://www.twilio.com/docs/autopilot/api/assistant/defaults) for various scenarios, including initiation actions and fallback tasks. - # @param [String] development_stage A string describing the state of the assistant. - # @return [AssistantInstance] Updated AssistantInstance - def update( - friendly_name: :unset, - log_queries: :unset, - unique_name: :unset, - callback_url: :unset, - callback_events: :unset, - style_sheet: :unset, - defaults: :unset, - development_stage: :unset - ) - - context.update( - friendly_name: friendly_name, - log_queries: log_queries, - unique_name: unique_name, - callback_url: callback_url, - callback_events: callback_events, - style_sheet: style_sheet, - defaults: defaults, - development_stage: development_stage, - ) - end - - ## - # Access the tasks - # @return [tasks] tasks - def tasks - context.tasks - end - - ## - # Access the defaults - # @return [defaults] defaults - def defaults - context.defaults - end - - ## - # Access the webhooks - # @return [webhooks] webhooks - def webhooks - context.webhooks - end - - ## - # Access the dialogues - # @return [dialogues] dialogues - def dialogues - context.dialogues - end - - ## - # Access the model_builds - # @return [model_builds] model_builds - def model_builds - context.model_builds - end - - ## - # Access the field_types - # @return [field_types] field_types - def field_types - context.field_types - end - - ## - # Access the style_sheet - # @return [style_sheet] style_sheet - def style_sheet - context.style_sheet - end - - ## - # Access the queries - # @return [queries] queries - def queries - context.queries - 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 diff --git a/lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb b/lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb deleted file mode 100644 index 4aa23e443..000000000 --- a/lib/twilio-ruby/rest/autopilot/v1/assistant/defaults.rb +++ /dev/null @@ -1,241 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Autopilot -# 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 Autopilot < AutopilotBase - class V1 < Version - class AssistantContext < InstanceContext - - class DefaultsList < ListResource - ## - # Initialize the DefaultsList - # @param [Version] version Version that contains the resource - # @return [DefaultsList] DefaultsList - def initialize(version, assistant_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_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 DefaultsContext < InstanceContext - ## - # Initialize the DefaultsContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to update. - # @return [DefaultsContext] DefaultsContext - def initialize(version, assistant_sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Defaults" - - - end - ## - # Fetch the DefaultsInstance - # @return [DefaultsInstance] Fetched DefaultsInstance - def fetch - - payload = @version.fetch('GET', @uri) - DefaultsInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - ## - # Update the DefaultsInstance - # @param [Object] defaults A JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations. - # @return [DefaultsInstance] Updated DefaultsInstance - def update( - defaults: :unset - ) - - data = Twilio::Values.of({ - 'Defaults' => Twilio.serialize_object(defaults), - }) - - payload = @version.update('POST', @uri, data: data) - DefaultsInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class DefaultsPage < Page - ## - # Initialize the DefaultsPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [DefaultsPage] DefaultsPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of DefaultsInstance - # @param [Hash] payload Payload response from the API - # @return [DefaultsInstance] DefaultsInstance - def get_instance(payload) - DefaultsInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class DefaultsInstance < InstanceResource - ## - # Initialize the DefaultsInstance - # @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 Defaults - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [DefaultsInstance] DefaultsInstance - def initialize(version, payload , assistant_sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'account_sid' => payload['account_sid'], - 'assistant_sid' => payload['assistant_sid'], - 'url' => payload['url'], - 'data' => payload['data'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_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 [DefaultsContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = DefaultsContext.new(@version , @params['assistant_sid']) - end - @instance_context - end - - ## - # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Defaults resource. - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] The absolute URL of the Defaults resource. - def url - @properties['url'] - end - - ## - # @return [Hash] The JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations. - def data - @properties['data'] - end - - ## - # Fetch the DefaultsInstance - # @return [DefaultsInstance] Fetched DefaultsInstance - def fetch - - context.fetch - end - - ## - # Update the DefaultsInstance - # @param [Object] defaults A JSON string that describes the default task links for the `assistant_initiation`, `collect`, and `fallback` situations. - # @return [DefaultsInstance] Updated DefaultsInstance - def update( - defaults: :unset - ) - - context.update( - defaults: defaults, - ) - 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 - - diff --git a/lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb b/lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb deleted file mode 100644 index c8cbfe9a7..000000000 --- a/lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb +++ /dev/null @@ -1,217 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Autopilot -# 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 Autopilot < AutopilotBase - class V1 < Version - class AssistantContext < InstanceContext - - class DialogueList < ListResource - ## - # Initialize the DialogueList - # @param [Version] version Version that contains the resource - # @return [DialogueList] DialogueList - def initialize(version, assistant_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_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 DialogueContext < InstanceContext - ## - # Initialize the DialogueContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to fetch. - # @param [String] sid The Twilio-provided string that uniquely identifies the Dialogue resource to fetch. - # @return [DialogueContext] DialogueContext - def initialize(version, assistant_sid, sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, sid: sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Dialogues/#{@solution[:sid]}" - - - end - ## - # Fetch the DialogueInstance - # @return [DialogueInstance] Fetched DialogueInstance - def fetch - - payload = @version.fetch('GET', @uri) - DialogueInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class DialoguePage < Page - ## - # Initialize the DialoguePage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [DialoguePage] DialoguePage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of DialogueInstance - # @param [Hash] payload Payload response from the API - # @return [DialogueInstance] DialogueInstance - def get_instance(payload) - DialogueInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class DialogueInstance < InstanceResource - ## - # Initialize the DialogueInstance - # @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 Dialogue - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [DialogueInstance] DialogueInstance - def initialize(version, payload , assistant_sid: nil, sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'account_sid' => payload['account_sid'], - 'assistant_sid' => payload['assistant_sid'], - 'sid' => payload['sid'], - 'data' => payload['data'], - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_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 [DialogueContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = DialogueContext.new(@version , @params['assistant_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 Dialogue resource. - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] The unique string that we created to identify the Dialogue resource. - def sid - @properties['sid'] - end - - ## - # @return [Hash] The JSON string that describes the dialogue session object. - def data - @properties['data'] - end - - ## - # @return [String] The absolute URL of the Dialogue resource. - def url - @properties['url'] - end - - ## - # Fetch the DialogueInstance - # @return [DialogueInstance] Fetched DialogueInstance - def fetch - - context.fetch - 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 - - diff --git a/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb b/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb deleted file mode 100644 index 050084257..000000000 --- a/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type.rb +++ /dev/null @@ -1,435 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Autopilot -# 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 Autopilot < AutopilotBase - class V1 < Version - class AssistantContext < InstanceContext - - class FieldTypeList < ListResource - ## - # Initialize the FieldTypeList - # @param [Version] version Version that contains the resource - # @return [FieldTypeList] FieldTypeList - def initialize(version, assistant_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid } - @uri = "/Assistants/#{@solution[:assistant_sid]}/FieldTypes" - - end - ## - # Create the FieldTypeInstance - # @param [String] unique_name An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. - # @param [String] friendly_name A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. - # @return [FieldTypeInstance] Created FieldTypeInstance - def create( - unique_name: nil, - friendly_name: :unset - ) - - data = Twilio::Values.of({ - 'UniqueName' => unique_name, - 'FriendlyName' => friendly_name, - }) - - payload = @version.create('POST', @uri, data: data) - FieldTypeInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - - ## - # Lists FieldTypeInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @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(limit: nil, page_size: nil) - self.stream( - 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 [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(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields FieldTypeInstance 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], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of FieldTypeInstance records from the API. - # Request is executed immediately. - # @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 FieldTypeInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - FieldTypePage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of FieldTypeInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of FieldTypeInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - FieldTypePage.new(@version, response, @solution) - 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 FieldTypeContext < InstanceContext - ## - # Initialize the FieldTypeContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the to update. - # @param [String] sid The Twilio-provided string that uniquely identifies the FieldType resource to update. - # @return [FieldTypeContext] FieldTypeContext - def initialize(version, assistant_sid, sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, sid: sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/FieldTypes/#{@solution[:sid]}" - - # Dependents - @field_values = nil - end - ## - # Delete the FieldTypeInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - @version.delete('DELETE', @uri) - end - - ## - # Fetch the FieldTypeInstance - # @return [FieldTypeInstance] Fetched FieldTypeInstance - def fetch - - payload = @version.fetch('GET', @uri) - FieldTypeInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - ## - # Update the FieldTypeInstance - # @param [String] friendly_name A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. - # @param [String] unique_name An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. - # @return [FieldTypeInstance] Updated FieldTypeInstance - def update( - friendly_name: :unset, - unique_name: :unset - ) - - data = Twilio::Values.of({ - 'FriendlyName' => friendly_name, - 'UniqueName' => unique_name, - }) - - payload = @version.update('POST', @uri, data: data) - FieldTypeInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - ## - # Access the field_values - # @return [FieldValueList] - # @return [FieldValueContext] if sid was passed. - def field_values(sid=:unset) - - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return FieldValueContext.new(@version, @solution[:assistant_sid], @solution[:sid],sid ) - end - - unless @field_values - @field_values = FieldValueList.new( - @version, assistant_sid: @solution[:assistant_sid], field_type_sid: @solution[:sid], ) - end - - @field_values - end - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class FieldTypePage < Page - ## - # Initialize the FieldTypePage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [FieldTypePage] FieldTypePage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of FieldTypeInstance - # @param [Hash] payload Payload response from the API - # @return [FieldTypeInstance] FieldTypeInstance - def get_instance(payload) - FieldTypeInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class FieldTypeInstance < InstanceResource - ## - # Initialize the FieldTypeInstance - # @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 FieldType - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [FieldTypeInstance] FieldTypeInstance - def initialize(version, payload , assistant_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']), - 'friendly_name' => payload['friendly_name'], - 'links' => payload['links'], - 'assistant_sid' => payload['assistant_sid'], - 'sid' => payload['sid'], - 'unique_name' => payload['unique_name'], - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_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 [FieldTypeContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = FieldTypeContext.new(@version , @params['assistant_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 FieldType resource. - def account_sid - @properties['account_sid'] - end - - ## - # @return [Time] The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. - def friendly_name - @properties['friendly_name'] - end - - ## - # @return [Hash] A list of the URLs of related resources. - def links - @properties['links'] - end - - ## - # @return [String] The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] The unique string that we created to identify the FieldType resource. - def sid - @properties['sid'] - end - - ## - # @return [String] An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - def unique_name - @properties['unique_name'] - end - - ## - # @return [String] The absolute URL of the FieldType resource. - def url - @properties['url'] - end - - ## - # Delete the FieldTypeInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the FieldTypeInstance - # @return [FieldTypeInstance] Fetched FieldTypeInstance - def fetch - - context.fetch - end - - ## - # Update the FieldTypeInstance - # @param [String] friendly_name A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. - # @param [String] unique_name An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. The first 64 characters must be unique. - # @return [FieldTypeInstance] Updated FieldTypeInstance - def update( - friendly_name: :unset, - unique_name: :unset - ) - - context.update( - friendly_name: friendly_name, - unique_name: unique_name, - ) - end - - ## - # Access the field_values - # @return [field_values] field_values - def field_values - context.field_values - 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 - - diff --git a/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb b/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb deleted file mode 100644 index 1fab8c6bb..000000000 --- a/lib/twilio-ruby/rest/autopilot/v1/assistant/field_type/field_value.rb +++ /dev/null @@ -1,389 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Autopilot -# 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 Autopilot < AutopilotBase - class V1 < Version - class AssistantContext < InstanceContext - class FieldTypeContext < InstanceContext - - class FieldValueList < ListResource - ## - # Initialize the FieldValueList - # @param [Version] version Version that contains the resource - # @return [FieldValueList] FieldValueList - def initialize(version, assistant_sid: nil, field_type_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid, field_type_sid: field_type_sid } - @uri = "/Assistants/#{@solution[:assistant_sid]}/FieldTypes/#{@solution[:field_type_sid]}/FieldValues" - - end - ## - # Create the FieldValueInstance - # @param [String] language The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` - # @param [String] value The Field Value data. - # @param [String] synonym_of The string value that indicates which word the field value is a synonym of. - # @return [FieldValueInstance] Created FieldValueInstance - def create( - language: nil, - value: nil, - synonym_of: :unset - ) - - data = Twilio::Values.of({ - 'Language' => language, - 'Value' => value, - 'SynonymOf' => synonym_of, - }) - - payload = @version.create('POST', @uri, data: data) - FieldValueInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - field_type_sid: @solution[:field_type_sid], - ) - end - - - ## - # Lists FieldValueInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @param [String] language The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` - # @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(language: :unset, limit: nil, page_size: nil) - self.stream( - language: language, - 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 [String] language The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` - # @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(language: :unset, limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - language: language, - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields FieldValueInstance 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], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of FieldValueInstance records from the API. - # Request is executed immediately. - # @param [String] language The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` - # @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 FieldValueInstance - def page(language: :unset, page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'Language' => language, - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - FieldValuePage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of FieldValueInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of FieldValueInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - FieldValuePage.new(@version, response, @solution) - 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 FieldValueContext < InstanceContext - ## - # Initialize the FieldValueContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the FieldType associated with the resource to fetch. - # @param [String] field_type_sid The SID of the Field Type associated with the Field Value to fetch. - # @param [String] sid The Twilio-provided string that uniquely identifies the FieldValue resource to fetch. - # @return [FieldValueContext] FieldValueContext - def initialize(version, assistant_sid, field_type_sid, sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, field_type_sid: field_type_sid, sid: sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/FieldTypes/#{@solution[:field_type_sid]}/FieldValues/#{@solution[:sid]}" - - - end - ## - # Delete the FieldValueInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - @version.delete('DELETE', @uri) - end - - ## - # Fetch the FieldValueInstance - # @return [FieldValueInstance] Fetched FieldValueInstance - def fetch - - payload = @version.fetch('GET', @uri) - FieldValueInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - field_type_sid: @solution[:field_type_sid], - sid: @solution[:sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class FieldValuePage < Page - ## - # Initialize the FieldValuePage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [FieldValuePage] FieldValuePage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of FieldValueInstance - # @param [Hash] payload Payload response from the API - # @return [FieldValueInstance] FieldValueInstance - def get_instance(payload) - FieldValueInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], field_type_sid: @solution[:field_type_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class FieldValueInstance < InstanceResource - ## - # Initialize the FieldValueInstance - # @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 FieldValue - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [FieldValueInstance] FieldValueInstance - def initialize(version, payload , assistant_sid: nil, field_type_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']), - 'field_type_sid' => payload['field_type_sid'], - 'language' => payload['language'], - 'assistant_sid' => payload['assistant_sid'], - 'sid' => payload['sid'], - 'value' => payload['value'], - 'url' => payload['url'], - 'synonym_of' => payload['synonym_of'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_sid'] ,'field_type_sid' => field_type_sid || @properties['field_type_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 [FieldValueContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = FieldValueContext.new(@version , @params['assistant_sid'], @params['field_type_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 FieldValue resource. - def account_sid - @properties['account_sid'] - end - - ## - # @return [Time] The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] The SID of the Field Type associated with the Field Value. - def field_type_sid - @properties['field_type_sid'] - end - - ## - # @return [String] The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) tag that specifies the language of the value. Currently supported tags: `en-US` - def language - @properties['language'] - end - - ## - # @return [String] The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the FieldType associated with the resource. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] The unique string that we created to identify the FieldValue resource. - def sid - @properties['sid'] - end - - ## - # @return [String] The Field Value data. - def value - @properties['value'] - end - - ## - # @return [String] The absolute URL of the FieldValue resource. - def url - @properties['url'] - end - - ## - # @return [String] The word for which the field value is a synonym of. - def synonym_of - @properties['synonym_of'] - end - - ## - # Delete the FieldValueInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the FieldValueInstance - # @return [FieldValueInstance] Fetched FieldValueInstance - def fetch - - context.fetch - 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 - - diff --git a/lib/twilio-ruby/rest/autopilot/v1/assistant/model_build.rb b/lib/twilio-ruby/rest/autopilot/v1/assistant/model_build.rb deleted file mode 100644 index ecc5d22c2..000000000 --- a/lib/twilio-ruby/rest/autopilot/v1/assistant/model_build.rb +++ /dev/null @@ -1,409 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Autopilot -# 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 Autopilot < AutopilotBase - class V1 < Version - class AssistantContext < InstanceContext - - class ModelBuildList < ListResource - ## - # Initialize the ModelBuildList - # @param [Version] version Version that contains the resource - # @return [ModelBuildList] ModelBuildList - def initialize(version, assistant_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid } - @uri = "/Assistants/#{@solution[:assistant_sid]}/ModelBuilds" - - end - ## - # Create the ModelBuildInstance - # @param [String] status_callback The URL we should call using a POST method to send status information to your application. - # @param [String] unique_name An application-defined string that uniquely identifies the new resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. - # @return [ModelBuildInstance] Created ModelBuildInstance - def create( - status_callback: :unset, - unique_name: :unset - ) - - data = Twilio::Values.of({ - 'StatusCallback' => status_callback, - 'UniqueName' => unique_name, - }) - - payload = @version.create('POST', @uri, data: data) - ModelBuildInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - - ## - # Lists ModelBuildInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @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(limit: nil, page_size: nil) - self.stream( - 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 [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(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields ModelBuildInstance 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], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of ModelBuildInstance records from the API. - # Request is executed immediately. - # @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 ModelBuildInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - ModelBuildPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of ModelBuildInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of ModelBuildInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - ModelBuildPage.new(@version, response, @solution) - 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 ModelBuildContext < InstanceContext - ## - # Initialize the ModelBuildContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to update. - # @param [String] sid The Twilio-provided string that uniquely identifies the ModelBuild resource to update. - # @return [ModelBuildContext] ModelBuildContext - def initialize(version, assistant_sid, sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, sid: sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/ModelBuilds/#{@solution[:sid]}" - - - end - ## - # Delete the ModelBuildInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - @version.delete('DELETE', @uri) - end - - ## - # Fetch the ModelBuildInstance - # @return [ModelBuildInstance] Fetched ModelBuildInstance - def fetch - - payload = @version.fetch('GET', @uri) - ModelBuildInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - ## - # Update the ModelBuildInstance - # @param [String] unique_name An application-defined string that uniquely identifies the resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. - # @return [ModelBuildInstance] Updated ModelBuildInstance - def update( - unique_name: :unset - ) - - data = Twilio::Values.of({ - 'UniqueName' => unique_name, - }) - - payload = @version.update('POST', @uri, data: data) - ModelBuildInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class ModelBuildPage < Page - ## - # Initialize the ModelBuildPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [ModelBuildPage] ModelBuildPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of ModelBuildInstance - # @param [Hash] payload Payload response from the API - # @return [ModelBuildInstance] ModelBuildInstance - def get_instance(payload) - ModelBuildInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class ModelBuildInstance < InstanceResource - ## - # Initialize the ModelBuildInstance - # @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 ModelBuild - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [ModelBuildInstance] ModelBuildInstance - def initialize(version, payload , assistant_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']), - 'assistant_sid' => payload['assistant_sid'], - 'sid' => payload['sid'], - 'status' => payload['status'], - 'unique_name' => payload['unique_name'], - 'url' => payload['url'], - 'build_duration' => payload['build_duration'] == nil ? payload['build_duration'] : payload['build_duration'].to_i, - 'error_code' => payload['error_code'] == nil ? payload['error_code'] : payload['error_code'].to_i, - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_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 [ModelBuildContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = ModelBuildContext.new(@version , @params['assistant_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 ModelBuild resource. - def account_sid - @properties['account_sid'] - end - - ## - # @return [Time] The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] The unique string that we created to identify the ModelBuild resource. - def sid - @properties['sid'] - end - - ## - # @return [Status] - def status - @properties['status'] - end - - ## - # @return [String] An application-defined string that uniquely identifies the resource. It can be used as an alternative to the `sid` in the URL path to address the resource. - def unique_name - @properties['unique_name'] - end - - ## - # @return [String] The absolute URL of the ModelBuild resource. - def url - @properties['url'] - end - - ## - # @return [String] The time in seconds it took to build the model. - def build_duration - @properties['build_duration'] - end - - ## - # @return [String] If the `status` for the model build is `failed`, this value is a code to more information about the failure. This value will be null for all other statuses. See [error code dictionary](https://www.twilio.com/docs/api/errors) for a description of the error. - def error_code - @properties['error_code'] - end - - ## - # Delete the ModelBuildInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the ModelBuildInstance - # @return [ModelBuildInstance] Fetched ModelBuildInstance - def fetch - - context.fetch - end - - ## - # Update the ModelBuildInstance - # @param [String] unique_name An application-defined string that uniquely identifies the resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. - # @return [ModelBuildInstance] Updated ModelBuildInstance - def update( - unique_name: :unset - ) - - context.update( - unique_name: unique_name, - ) - 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 - - diff --git a/lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb b/lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb deleted file mode 100644 index 4ae6de95d..000000000 --- a/lib/twilio-ruby/rest/autopilot/v1/assistant/query.rb +++ /dev/null @@ -1,473 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Autopilot -# 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 Autopilot < AutopilotBase - class V1 < Version - class AssistantContext < InstanceContext - - class QueryList < ListResource - ## - # Initialize the QueryList - # @param [Version] version Version that contains the resource - # @return [QueryList] QueryList - def initialize(version, assistant_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Queries" - - end - ## - # Create the QueryInstance - # @param [String] language The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the new query. For example: `en-US`. - # @param [String] query The end-user's natural language input. It can be up to 2048 characters long. - # @param [String] tasks The list of tasks to limit the new query to. Tasks are expressed as a comma-separated list of task `unique_name` values. For example, `task-unique_name-1, task-unique_name-2`. Listing specific tasks is useful to constrain the paths that a user can take. - # @param [String] model_build The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. - # @return [QueryInstance] Created QueryInstance - def create( - language: nil, - query: nil, - tasks: :unset, - model_build: :unset - ) - - data = Twilio::Values.of({ - 'Language' => language, - 'Query' => query, - 'Tasks' => tasks, - 'ModelBuild' => model_build, - }) - - payload = @version.create('POST', @uri, data: data) - QueryInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - - ## - # Lists QueryInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @param [String] language The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`. - # @param [String] model_build The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. - # @param [String] status The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded` - # @param [String] dialogue_sid The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). - # @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(language: :unset, model_build: :unset, status: :unset, dialogue_sid: :unset, limit: nil, page_size: nil) - self.stream( - language: language, - model_build: model_build, - status: status, - dialogue_sid: dialogue_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 [String] language The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`. - # @param [String] model_build The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. - # @param [String] status The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded` - # @param [String] dialogue_sid The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). - # @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(language: :unset, model_build: :unset, status: :unset, dialogue_sid: :unset, limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - language: language, - model_build: model_build, - status: status, - dialogue_sid: dialogue_sid, - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields QueryInstance 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], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of QueryInstance records from the API. - # Request is executed immediately. - # @param [String] language The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query resources to read. For example: `en-US`. - # @param [String] model_build The SID or unique name of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) to be queried. - # @param [String] status The status of the resources to read. Can be: `pending-review`, `reviewed`, or `discarded` - # @param [String] dialogue_sid The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). - # @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 QueryInstance - def page(language: :unset, model_build: :unset, status: :unset, dialogue_sid: :unset, page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'Language' => language, - 'ModelBuild' => model_build, - 'Status' => status, - 'DialogueSid' => dialogue_sid, - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - QueryPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of QueryInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of QueryInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - QueryPage.new(@version, response, @solution) - 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 QueryContext < InstanceContext - ## - # Initialize the QueryContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to update. - # @param [String] sid The Twilio-provided string that uniquely identifies the Query resource to update. - # @return [QueryContext] QueryContext - def initialize(version, assistant_sid, sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, sid: sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Queries/#{@solution[:sid]}" - - - end - ## - # Delete the QueryInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - @version.delete('DELETE', @uri) - end - - ## - # Fetch the QueryInstance - # @return [QueryInstance] Fetched QueryInstance - def fetch - - payload = @version.fetch('GET', @uri) - QueryInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - ## - # Update the QueryInstance - # @param [String] sample_sid The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query. - # @param [String] status The new status of the resource. Can be: `pending-review`, `reviewed`, or `discarded` - # @return [QueryInstance] Updated QueryInstance - def update( - sample_sid: :unset, - status: :unset - ) - - data = Twilio::Values.of({ - 'SampleSid' => sample_sid, - 'Status' => status, - }) - - payload = @version.update('POST', @uri, data: data) - QueryInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class QueryPage < Page - ## - # Initialize the QueryPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [QueryPage] QueryPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of QueryInstance - # @param [Hash] payload Payload response from the API - # @return [QueryInstance] QueryInstance - def get_instance(payload) - QueryInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class QueryInstance < InstanceResource - ## - # Initialize the QueryInstance - # @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 Query - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [QueryInstance] QueryInstance - def initialize(version, payload , assistant_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']), - 'results' => payload['results'], - 'language' => payload['language'], - 'model_build_sid' => payload['model_build_sid'], - 'query' => payload['query'], - 'sample_sid' => payload['sample_sid'], - 'assistant_sid' => payload['assistant_sid'], - 'sid' => payload['sid'], - 'status' => payload['status'], - 'url' => payload['url'], - 'source_channel' => payload['source_channel'], - 'dialogue_sid' => payload['dialogue_sid'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_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 [QueryContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = QueryContext.new(@version , @params['assistant_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 Query resource. - def account_sid - @properties['account_sid'] - end - - ## - # @return [Time] The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_updated - @properties['date_updated'] - end - - ## - # @return [Hash] The natural language analysis results that include the [Task](https://www.twilio.com/docs/autopilot/api/task) recognized and a list of identified [Fields](https://www.twilio.com/docs/autopilot/api/task-field). - def results - @properties['results'] - end - - ## - # @return [String] The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used by the Query. For example: `en-US`. - def language - @properties['language'] - end - - ## - # @return [String] The SID of the [Model Build](https://www.twilio.com/docs/autopilot/api/model-build) queried. - def model_build_sid - @properties['model_build_sid'] - end - - ## - # @return [String] The end-user's natural language input. - def query - @properties['query'] - end - - ## - # @return [String] The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query. - def sample_sid - @properties['sample_sid'] - end - - ## - # @return [String] The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] The unique string that we created to identify the Query resource. - def sid - @properties['sid'] - end - - ## - # @return [String] The status of the Query. Can be: `pending-review`, `reviewed`, or `discarded` - def status - @properties['status'] - end - - ## - # @return [String] The absolute URL of the Query resource. - def url - @properties['url'] - end - - ## - # @return [String] The communication channel from where the end-user input came. - def source_channel - @properties['source_channel'] - end - - ## - # @return [String] The SID of the [Dialogue](https://www.twilio.com/docs/autopilot/api/dialogue). - def dialogue_sid - @properties['dialogue_sid'] - end - - ## - # Delete the QueryInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the QueryInstance - # @return [QueryInstance] Fetched QueryInstance - def fetch - - context.fetch - end - - ## - # Update the QueryInstance - # @param [String] sample_sid The SID of an optional reference to the [Sample](https://www.twilio.com/docs/autopilot/api/task-sample) created from the query. - # @param [String] status The new status of the resource. Can be: `pending-review`, `reviewed`, or `discarded` - # @return [QueryInstance] Updated QueryInstance - def update( - sample_sid: :unset, - status: :unset - ) - - context.update( - sample_sid: sample_sid, - status: status, - ) - 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 - - diff --git a/lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb b/lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb deleted file mode 100644 index 95ec9c36c..000000000 --- a/lib/twilio-ruby/rest/autopilot/v1/assistant/style_sheet.rb +++ /dev/null @@ -1,241 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Autopilot -# 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 Autopilot < AutopilotBase - class V1 < Version - class AssistantContext < InstanceContext - - class StyleSheetList < ListResource - ## - # Initialize the StyleSheetList - # @param [Version] version Version that contains the resource - # @return [StyleSheetList] StyleSheetList - def initialize(version, assistant_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_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 StyleSheetContext < InstanceContext - ## - # Initialize the StyleSheetContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to update. - # @return [StyleSheetContext] StyleSheetContext - def initialize(version, assistant_sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/StyleSheet" - - - end - ## - # Fetch the StyleSheetInstance - # @return [StyleSheetInstance] Fetched StyleSheetInstance - def fetch - - payload = @version.fetch('GET', @uri) - StyleSheetInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - ## - # Update the StyleSheetInstance - # @param [Object] style_sheet The JSON string that describes the style sheet object. - # @return [StyleSheetInstance] Updated StyleSheetInstance - def update( - style_sheet: :unset - ) - - data = Twilio::Values.of({ - 'StyleSheet' => Twilio.serialize_object(style_sheet), - }) - - payload = @version.update('POST', @uri, data: data) - StyleSheetInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class StyleSheetPage < Page - ## - # Initialize the StyleSheetPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [StyleSheetPage] StyleSheetPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of StyleSheetInstance - # @param [Hash] payload Payload response from the API - # @return [StyleSheetInstance] StyleSheetInstance - def get_instance(payload) - StyleSheetInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class StyleSheetInstance < InstanceResource - ## - # Initialize the StyleSheetInstance - # @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 StyleSheet - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [StyleSheetInstance] StyleSheetInstance - def initialize(version, payload , assistant_sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'account_sid' => payload['account_sid'], - 'assistant_sid' => payload['assistant_sid'], - 'url' => payload['url'], - 'data' => payload['data'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_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 [StyleSheetContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = StyleSheetContext.new(@version , @params['assistant_sid']) - end - @instance_context - end - - ## - # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the StyleSheet resource. - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] The absolute URL of the StyleSheet resource. - def url - @properties['url'] - end - - ## - # @return [Hash] The JSON string that describes the style sheet object. - def data - @properties['data'] - end - - ## - # Fetch the StyleSheetInstance - # @return [StyleSheetInstance] Fetched StyleSheetInstance - def fetch - - context.fetch - end - - ## - # Update the StyleSheetInstance - # @param [Object] style_sheet The JSON string that describes the style sheet object. - # @return [StyleSheetInstance] Updated StyleSheetInstance - def update( - style_sheet: :unset - ) - - context.update( - style_sheet: style_sheet, - ) - 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 - - diff --git a/lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb b/lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb deleted file mode 100644 index 7f9a0dc5d..000000000 --- a/lib/twilio-ruby/rest/autopilot/v1/assistant/task.rb +++ /dev/null @@ -1,525 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Autopilot -# 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 Autopilot < AutopilotBase - class V1 < Version - class AssistantContext < InstanceContext - - class TaskList < ListResource - ## - # Initialize the TaskList - # @param [Version] version Version that contains the resource - # @return [TaskList] TaskList - def initialize(version, assistant_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks" - - end - ## - # Create the TaskInstance - # @param [String] unique_name An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. - # @param [String] friendly_name A descriptive string that you create to describe the new resource. It is not unique and can be up to 255 characters long. - # @param [Object] actions The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. It is optional and not unique. - # @param [String] actions_url The URL from which the Assistant can fetch actions. - # @return [TaskInstance] Created TaskInstance - def create( - unique_name: nil, - friendly_name: :unset, - actions: :unset, - actions_url: :unset - ) - - data = Twilio::Values.of({ - 'UniqueName' => unique_name, - 'FriendlyName' => friendly_name, - 'Actions' => Twilio.serialize_object(actions), - 'ActionsUrl' => actions_url, - }) - - payload = @version.create('POST', @uri, data: data) - TaskInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - - ## - # Lists TaskInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @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(limit: nil, page_size: nil) - self.stream( - 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 [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(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields TaskInstance 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], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of TaskInstance records from the API. - # Request is executed immediately. - # @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 TaskInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - TaskPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of TaskInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of TaskInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - TaskPage.new(@version, response, @solution) - 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 TaskContext < InstanceContext - ## - # Initialize the TaskContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to update. - # @param [String] sid The Twilio-provided string that uniquely identifies the Task resource to update. - # @return [TaskContext] TaskContext - def initialize(version, assistant_sid, sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, sid: sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:sid]}" - - # Dependents - @samples = nil - @task_actions = nil - @statistics = nil - @fields = nil - end - ## - # Delete the TaskInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - @version.delete('DELETE', @uri) - end - - ## - # Fetch the TaskInstance - # @return [TaskInstance] Fetched TaskInstance - def fetch - - payload = @version.fetch('GET', @uri) - TaskInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - ## - # Update the TaskInstance - # @param [String] friendly_name A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. - # @param [String] unique_name An application-defined string that uniquely identifies the resource. This value must be 64 characters or less in length and be unique. It can be used as an alternative to the `sid` in the URL path to address the resource. - # @param [Object] actions The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. - # @param [String] actions_url The URL from which the Assistant can fetch actions. - # @return [TaskInstance] Updated TaskInstance - def update( - friendly_name: :unset, - unique_name: :unset, - actions: :unset, - actions_url: :unset - ) - - data = Twilio::Values.of({ - 'FriendlyName' => friendly_name, - 'UniqueName' => unique_name, - 'Actions' => Twilio.serialize_object(actions), - 'ActionsUrl' => actions_url, - }) - - payload = @version.update('POST', @uri, data: data) - TaskInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - ## - # Access the samples - # @return [SampleList] - # @return [SampleContext] if sid was passed. - def samples(sid=:unset) - - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return SampleContext.new(@version, @solution[:assistant_sid], @solution[:sid],sid ) - end - - unless @samples - @samples = SampleList.new( - @version, assistant_sid: @solution[:assistant_sid], task_sid: @solution[:sid], ) - end - - @samples - end - ## - # Access the task_actions - # @return [TaskActionsList] - # @return [TaskActionsContext] - def task_actions - TaskActionsContext.new( - @version, - @solution[:assistant_sid], - @solution[:sid] - ) - end - ## - # Access the statistics - # @return [TaskStatisticsList] - # @return [TaskStatisticsContext] - def statistics - TaskStatisticsContext.new( - @version, - @solution[:assistant_sid], - @solution[:sid] - ) - end - ## - # Access the fields - # @return [FieldList] - # @return [FieldContext] if sid was passed. - def fields(sid=:unset) - - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return FieldContext.new(@version, @solution[:assistant_sid], @solution[:sid],sid ) - end - - unless @fields - @fields = FieldList.new( - @version, assistant_sid: @solution[:assistant_sid], task_sid: @solution[:sid], ) - end - - @fields - end - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class TaskPage < Page - ## - # Initialize the TaskPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [TaskPage] TaskPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of TaskInstance - # @param [Hash] payload Payload response from the API - # @return [TaskInstance] TaskInstance - def get_instance(payload) - TaskInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class TaskInstance < InstanceResource - ## - # Initialize the TaskInstance - # @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 Task - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [TaskInstance] TaskInstance - def initialize(version, payload , assistant_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']), - 'friendly_name' => payload['friendly_name'], - 'links' => payload['links'], - 'assistant_sid' => payload['assistant_sid'], - 'sid' => payload['sid'], - 'unique_name' => payload['unique_name'], - 'actions_url' => payload['actions_url'], - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_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 [TaskContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = TaskContext.new(@version , @params['assistant_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 Task resource. - def account_sid - @properties['account_sid'] - end - - ## - # @return [Time] The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. - def friendly_name - @properties['friendly_name'] - end - - ## - # @return [Hash] A list of the URLs of related resources. - def links - @properties['links'] - end - - ## - # @return [String] The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] The unique string that we created to identify the Task resource. - def sid - @properties['sid'] - end - - ## - # @return [String] An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - def unique_name - @properties['unique_name'] - end - - ## - # @return [String] The URL from which the Assistant can fetch actions. - def actions_url - @properties['actions_url'] - end - - ## - # @return [String] The absolute URL of the Task resource. - def url - @properties['url'] - end - - ## - # Delete the TaskInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the TaskInstance - # @return [TaskInstance] Fetched TaskInstance - def fetch - - context.fetch - end - - ## - # Update the TaskInstance - # @param [String] friendly_name A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long. - # @param [String] unique_name An application-defined string that uniquely identifies the resource. This value must be 64 characters or less in length and be unique. It can be used as an alternative to the `sid` in the URL path to address the resource. - # @param [Object] actions The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. - # @param [String] actions_url The URL from which the Assistant can fetch actions. - # @return [TaskInstance] Updated TaskInstance - def update( - friendly_name: :unset, - unique_name: :unset, - actions: :unset, - actions_url: :unset - ) - - context.update( - friendly_name: friendly_name, - unique_name: unique_name, - actions: actions, - actions_url: actions_url, - ) - end - - ## - # Access the samples - # @return [samples] samples - def samples - context.samples - end - - ## - # Access the task_actions - # @return [task_actions] task_actions - def task_actions - context.task_actions - end - - ## - # Access the statistics - # @return [statistics] statistics - def statistics - context.statistics - end - - ## - # Access the fields - # @return [fields] fields - def fields - context.fields - 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 - - diff --git a/lib/twilio-ruby/rest/autopilot/v1/assistant/task/field.rb b/lib/twilio-ruby/rest/autopilot/v1/assistant/task/field.rb deleted file mode 100644 index 501ea3dfd..000000000 --- a/lib/twilio-ruby/rest/autopilot/v1/assistant/task/field.rb +++ /dev/null @@ -1,373 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Autopilot -# 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 Autopilot < AutopilotBase - class V1 < Version - class AssistantContext < InstanceContext - class TaskContext < InstanceContext - - class FieldList < ListResource - ## - # Initialize the FieldList - # @param [Version] version Version that contains the resource - # @return [FieldList] FieldList - def initialize(version, assistant_sid: nil, task_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid, task_sid: task_sid } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Fields" - - end - ## - # Create the FieldInstance - # @param [String] field_type The Field Type of the new field. Can be: a [Built-in Field Type](https://www.twilio.com/docs/autopilot/built-in-field-types), the `unique_name`, or the `sid` of a custom Field Type. - # @param [String] unique_name An application-defined string that uniquely identifies the new resource. This value must be a unique string of no more than 64 characters. It can be used as an alternative to the `sid` in the URL path to address the resource. - # @return [FieldInstance] Created FieldInstance - def create( - field_type: nil, - unique_name: nil - ) - - data = Twilio::Values.of({ - 'FieldType' => field_type, - 'UniqueName' => unique_name, - }) - - payload = @version.create('POST', @uri, data: data) - FieldInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - task_sid: @solution[:task_sid], - ) - end - - - ## - # Lists FieldInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @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(limit: nil, page_size: nil) - self.stream( - 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 [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(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields FieldInstance 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], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of FieldInstance records from the API. - # Request is executed immediately. - # @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 FieldInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - FieldPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of FieldInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of FieldInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - FieldPage.new(@version, response, @solution) - 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 FieldContext < InstanceContext - ## - # Initialize the FieldContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource to fetch. - # @param [String] task_sid The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) resource associated with the Field resource to fetch. - # @param [String] sid The Twilio-provided string that uniquely identifies the Field resource to fetch. - # @return [FieldContext] FieldContext - def initialize(version, assistant_sid, task_sid, sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, task_sid: task_sid, sid: sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Fields/#{@solution[:sid]}" - - - end - ## - # Delete the FieldInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - @version.delete('DELETE', @uri) - end - - ## - # Fetch the FieldInstance - # @return [FieldInstance] Fetched FieldInstance - def fetch - - payload = @version.fetch('GET', @uri) - FieldInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - task_sid: @solution[:task_sid], - sid: @solution[:sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class FieldPage < Page - ## - # Initialize the FieldPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [FieldPage] FieldPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of FieldInstance - # @param [Hash] payload Payload response from the API - # @return [FieldInstance] FieldInstance - def get_instance(payload) - FieldInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], task_sid: @solution[:task_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class FieldInstance < InstanceResource - ## - # Initialize the FieldInstance - # @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 Field - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [FieldInstance] FieldInstance - def initialize(version, payload , assistant_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']), - 'field_type' => payload['field_type'], - 'task_sid' => payload['task_sid'], - 'assistant_sid' => payload['assistant_sid'], - 'sid' => payload['sid'], - 'unique_name' => payload['unique_name'], - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_sid'] ,'task_sid' => task_sid || @properties['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 [FieldContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = FieldContext.new(@version , @params['assistant_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 Field resource. - def account_sid - @properties['account_sid'] - end - - ## - # @return [Time] The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] The Field Type of the field. Can be: a [Built-in Field Type](https://www.twilio.com/docs/autopilot/built-in-field-types), the unique_name, or the SID of a custom Field Type. - def field_type - @properties['field_type'] - end - - ## - # @return [String] The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) resource associated with this Field. - def task_sid - @properties['task_sid'] - end - - ## - # @return [String] The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] The unique string that we created to identify the Field resource. - def sid - @properties['sid'] - end - - ## - # @return [String] An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - def unique_name - @properties['unique_name'] - end - - ## - # @return [String] The absolute URL of the Field resource. - def url - @properties['url'] - end - - ## - # Delete the FieldInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the FieldInstance - # @return [FieldInstance] Fetched FieldInstance - def fetch - - context.fetch - 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 - - diff --git a/lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb b/lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb deleted file mode 100644 index 9cfc855d8..000000000 --- a/lib/twilio-ruby/rest/autopilot/v1/assistant/task/sample.rb +++ /dev/null @@ -1,436 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Autopilot -# 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 Autopilot < AutopilotBase - class V1 < Version - class AssistantContext < InstanceContext - class TaskContext < InstanceContext - - class SampleList < ListResource - ## - # Initialize the SampleList - # @param [Version] version Version that contains the resource - # @return [SampleList] SampleList - def initialize(version, assistant_sid: nil, task_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid, task_sid: task_sid } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Samples" - - end - ## - # Create the SampleInstance - # @param [String] language The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the new sample. For example: `en-US`. - # @param [String] tagged_text The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). - # @param [String] source_channel The communication channel from which the new sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. - # @return [SampleInstance] Created SampleInstance - def create( - language: nil, - tagged_text: nil, - source_channel: :unset - ) - - data = Twilio::Values.of({ - 'Language' => language, - 'TaggedText' => tagged_text, - 'SourceChannel' => source_channel, - }) - - payload = @version.create('POST', @uri, data: data) - SampleInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - task_sid: @solution[:task_sid], - ) - end - - - ## - # Lists SampleInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @param [String] language The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. - # @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(language: :unset, limit: nil, page_size: nil) - self.stream( - language: language, - 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 [String] language The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. - # @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(language: :unset, limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - language: language, - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields SampleInstance 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], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of SampleInstance records from the API. - # Request is executed immediately. - # @param [String] language The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. - # @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 SampleInstance - def page(language: :unset, page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'Language' => language, - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - SamplePage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of SampleInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of SampleInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - SamplePage.new(@version, response, @solution) - 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 SampleContext < InstanceContext - ## - # Initialize the SampleContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource to update. - # @param [String] task_sid The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) associated with the Sample resource to update. - # @param [String] sid The Twilio-provided string that uniquely identifies the Sample resource to update. - # @return [SampleContext] SampleContext - def initialize(version, assistant_sid, task_sid, sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, task_sid: task_sid, sid: sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Samples/#{@solution[:sid]}" - - - end - ## - # Delete the SampleInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - @version.delete('DELETE', @uri) - end - - ## - # Fetch the SampleInstance - # @return [SampleInstance] Fetched SampleInstance - def fetch - - payload = @version.fetch('GET', @uri) - SampleInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - task_sid: @solution[:task_sid], - sid: @solution[:sid], - ) - end - - ## - # Update the SampleInstance - # @param [String] language The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. - # @param [String] tagged_text The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). - # @param [String] source_channel The communication channel from which the sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. - # @return [SampleInstance] Updated SampleInstance - def update( - language: :unset, - tagged_text: :unset, - source_channel: :unset - ) - - data = Twilio::Values.of({ - 'Language' => language, - 'TaggedText' => tagged_text, - 'SourceChannel' => source_channel, - }) - - payload = @version.update('POST', @uri, data: data) - SampleInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - task_sid: @solution[:task_sid], - sid: @solution[:sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class SamplePage < Page - ## - # Initialize the SamplePage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [SamplePage] SamplePage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of SampleInstance - # @param [Hash] payload Payload response from the API - # @return [SampleInstance] SampleInstance - def get_instance(payload) - SampleInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], task_sid: @solution[:task_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class SampleInstance < InstanceResource - ## - # Initialize the SampleInstance - # @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 Sample - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [SampleInstance] SampleInstance - def initialize(version, payload , assistant_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']), - 'task_sid' => payload['task_sid'], - 'language' => payload['language'], - 'assistant_sid' => payload['assistant_sid'], - 'sid' => payload['sid'], - 'tagged_text' => payload['tagged_text'], - 'url' => payload['url'], - 'source_channel' => payload['source_channel'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_sid'] ,'task_sid' => task_sid || @properties['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 [SampleContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = SampleContext.new(@version , @params['assistant_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 Sample resource. - def account_sid - @properties['account_sid'] - end - - ## - # @return [Time] The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) associated with the resource. - def task_sid - @properties['task_sid'] - end - - ## - # @return [String] The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. - def language - @properties['language'] - end - - ## - # @return [String] The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] The unique string that we created to identify the Sample resource. - def sid - @properties['sid'] - end - - ## - # @return [String] The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). - def tagged_text - @properties['tagged_text'] - end - - ## - # @return [String] The absolute URL of the Sample resource. - def url - @properties['url'] - end - - ## - # @return [String] The communication channel from which the sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. - def source_channel - @properties['source_channel'] - end - - ## - # Delete the SampleInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the SampleInstance - # @return [SampleInstance] Fetched SampleInstance - def fetch - - context.fetch - end - - ## - # Update the SampleInstance - # @param [String] language The [ISO language-country](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html) string that specifies the language used for the sample. For example: `en-US`. - # @param [String] tagged_text The text example of how end users might express the task. The sample can contain [Field tag blocks](https://www.twilio.com/docs/autopilot/api/task-sample#field-tagging). - # @param [String] source_channel The communication channel from which the sample was captured. Can be: `voice`, `sms`, `chat`, `alexa`, `google-assistant`, `slack`, or null if not included. - # @return [SampleInstance] Updated SampleInstance - def update( - language: :unset, - tagged_text: :unset, - source_channel: :unset - ) - - context.update( - language: language, - tagged_text: tagged_text, - source_channel: source_channel, - ) - 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 - - diff --git a/lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb b/lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb deleted file mode 100644 index 54d524950..000000000 --- a/lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_actions.rb +++ /dev/null @@ -1,253 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Autopilot -# 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 Autopilot < AutopilotBase - class V1 < Version - class AssistantContext < InstanceContext - class TaskContext < InstanceContext - - class TaskActionsList < ListResource - ## - # Initialize the TaskActionsList - # @param [Version] version Version that contains the resource - # @return [TaskActionsList] TaskActionsList - def initialize(version, assistant_sid: nil, task_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid, task_sid: task_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 TaskActionsContext < InstanceContext - ## - # Initialize the TaskActionsContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task for which the task actions to update were defined. - # @param [String] task_sid The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) for which the task actions to update were defined. - # @return [TaskActionsContext] TaskActionsContext - def initialize(version, assistant_sid, task_sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, task_sid: task_sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Actions" - - - end - ## - # Fetch the TaskActionsInstance - # @return [TaskActionsInstance] Fetched TaskActionsInstance - def fetch - - payload = @version.fetch('GET', @uri) - TaskActionsInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - task_sid: @solution[:task_sid], - ) - end - - ## - # Update the TaskActionsInstance - # @param [Object] actions The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. - # @return [TaskActionsInstance] Updated TaskActionsInstance - def update( - actions: :unset - ) - - data = Twilio::Values.of({ - 'Actions' => Twilio.serialize_object(actions), - }) - - payload = @version.update('POST', @uri, data: data) - TaskActionsInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - task_sid: @solution[:task_sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class TaskActionsPage < Page - ## - # Initialize the TaskActionsPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [TaskActionsPage] TaskActionsPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of TaskActionsInstance - # @param [Hash] payload Payload response from the API - # @return [TaskActionsInstance] TaskActionsInstance - def get_instance(payload) - TaskActionsInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], task_sid: @solution[:task_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class TaskActionsInstance < InstanceResource - ## - # Initialize the TaskActionsInstance - # @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 TaskActions - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [TaskActionsInstance] TaskActionsInstance - def initialize(version, payload , assistant_sid: nil, task_sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'account_sid' => payload['account_sid'], - 'assistant_sid' => payload['assistant_sid'], - 'task_sid' => payload['task_sid'], - 'url' => payload['url'], - 'data' => payload['data'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_sid'] ,'task_sid' => task_sid || @properties['task_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 [TaskActionsContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = TaskActionsContext.new(@version , @params['assistant_sid'], @params['task_sid']) - end - @instance_context - end - - ## - # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskActions resource. - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) associated with the resource. - def task_sid - @properties['task_sid'] - end - - ## - # @return [String] The absolute URL of the TaskActions resource. - def url - @properties['url'] - end - - ## - # @return [Hash] The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. - def data - @properties['data'] - end - - ## - # Fetch the TaskActionsInstance - # @return [TaskActionsInstance] Fetched TaskActionsInstance - def fetch - - context.fetch - end - - ## - # Update the TaskActionsInstance - # @param [Object] actions The JSON string that specifies the [actions](https://www.twilio.com/docs/autopilot/actions) that instruct the Assistant on how to perform the task. - # @return [TaskActionsInstance] Updated TaskActionsInstance - 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 - - diff --git a/lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb b/lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb deleted file mode 100644 index 8e263221f..000000000 --- a/lib/twilio-ruby/rest/autopilot/v1/assistant/task/task_statistics.rb +++ /dev/null @@ -1,226 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Autopilot -# 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 Autopilot < AutopilotBase - class V1 < Version - class AssistantContext < InstanceContext - class TaskContext < InstanceContext - - class TaskStatisticsList < ListResource - ## - # Initialize the TaskStatisticsList - # @param [Version] version Version that contains the resource - # @return [TaskStatisticsList] TaskStatisticsList - def initialize(version, assistant_sid: nil, task_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid, task_sid: task_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 TaskStatisticsContext < InstanceContext - ## - # Initialize the TaskStatisticsContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to fetch. - # @param [String] task_sid The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) that is associated with the resource to fetch. - # @return [TaskStatisticsContext] TaskStatisticsContext - def initialize(version, assistant_sid, task_sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, task_sid: task_sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Statistics" - - - end - ## - # Fetch the TaskStatisticsInstance - # @return [TaskStatisticsInstance] Fetched TaskStatisticsInstance - def fetch - - payload = @version.fetch('GET', @uri) - TaskStatisticsInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - task_sid: @solution[:task_sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class TaskStatisticsPage < Page - ## - # Initialize the TaskStatisticsPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [TaskStatisticsPage] TaskStatisticsPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of TaskStatisticsInstance - # @param [Hash] payload Payload response from the API - # @return [TaskStatisticsInstance] TaskStatisticsInstance - def get_instance(payload) - TaskStatisticsInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], task_sid: @solution[:task_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class TaskStatisticsInstance < InstanceResource - ## - # Initialize the TaskStatisticsInstance - # @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 TaskStatistics - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [TaskStatisticsInstance] TaskStatisticsInstance - def initialize(version, payload , assistant_sid: nil, task_sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'account_sid' => payload['account_sid'], - 'assistant_sid' => payload['assistant_sid'], - 'task_sid' => payload['task_sid'], - 'samples_count' => payload['samples_count'] == nil ? payload['samples_count'] : payload['samples_count'].to_i, - 'fields_count' => payload['fields_count'] == nil ? payload['fields_count'] : payload['fields_count'].to_i, - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_sid'] ,'task_sid' => task_sid || @properties['task_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 [TaskStatisticsContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = TaskStatisticsContext.new(@version , @params['assistant_sid'], @params['task_sid']) - end - @instance_context - end - - ## - # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskStatistics resource. - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the Task associated with the resource. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] The SID of the [Task](https://www.twilio.com/docs/autopilot/api/task) for which the statistics were collected. - def task_sid - @properties['task_sid'] - end - - ## - # @return [String] The total number of [Samples](https://www.twilio.com/docs/autopilot/api/task-sample) associated with the Task. - def samples_count - @properties['samples_count'] - end - - ## - # @return [String] The total number of [Fields](https://www.twilio.com/docs/autopilot/api/task-field) associated with the Task. - def fields_count - @properties['fields_count'] - end - - ## - # @return [String] The absolute URL of the TaskStatistics resource. - def url - @properties['url'] - end - - ## - # Fetch the TaskStatisticsInstance - # @return [TaskStatisticsInstance] Fetched TaskStatisticsInstance - def fetch - - context.fetch - 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 - - diff --git a/lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb b/lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb deleted file mode 100644 index b2bc29730..000000000 --- a/lib/twilio-ruby/rest/autopilot/v1/assistant/webhook.rb +++ /dev/null @@ -1,433 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Autopilot -# 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 Autopilot < AutopilotBase - class V1 < Version - class AssistantContext < InstanceContext - - class WebhookList < ListResource - ## - # Initialize the WebhookList - # @param [Version] version Version that contains the resource - # @return [WebhookList] WebhookList - def initialize(version, assistant_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Webhooks" - - end - ## - # Create the WebhookInstance - # @param [String] unique_name An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. - # @param [String] events The list of space-separated events that this Webhook will subscribe to. - # @param [String] webhook_url The URL associated with this Webhook. - # @param [String] webhook_method The method to be used when calling the webhook's URL. - # @return [WebhookInstance] Created WebhookInstance - def create( - unique_name: nil, - events: nil, - webhook_url: nil, - webhook_method: :unset - ) - - data = Twilio::Values.of({ - 'UniqueName' => unique_name, - 'Events' => events, - 'WebhookUrl' => webhook_url, - 'WebhookMethod' => webhook_method, - }) - - payload = @version.create('POST', @uri, data: data) - WebhookInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - - ## - # Lists WebhookInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @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(limit: nil, page_size: nil) - self.stream( - 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 [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(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields WebhookInstance 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], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of WebhookInstance records from the API. - # Request is executed immediately. - # @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 WebhookInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - WebhookPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of WebhookInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of WebhookInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - WebhookPage.new(@version, response, @solution) - 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 WebhookContext < InstanceContext - ## - # Initialize the WebhookContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to update. - # @param [String] sid The Twilio-provided string that uniquely identifies the Webhook resource to update. - # @return [WebhookContext] WebhookContext - def initialize(version, assistant_sid, sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, sid: sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Webhooks/#{@solution[:sid]}" - - - end - ## - # Delete the WebhookInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - @version.delete('DELETE', @uri) - end - - ## - # Fetch the WebhookInstance - # @return [WebhookInstance] Fetched WebhookInstance - def fetch - - payload = @version.fetch('GET', @uri) - WebhookInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - ## - # Update the WebhookInstance - # @param [String] unique_name An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. - # @param [String] events The list of space-separated events that this Webhook will subscribe to. - # @param [String] webhook_url The URL associated with this Webhook. - # @param [String] webhook_method The method to be used when calling the webhook's URL. - # @return [WebhookInstance] Updated WebhookInstance - def update( - unique_name: :unset, - events: :unset, - webhook_url: :unset, - webhook_method: :unset - ) - - data = Twilio::Values.of({ - 'UniqueName' => unique_name, - 'Events' => events, - 'WebhookUrl' => webhook_url, - 'WebhookMethod' => webhook_method, - }) - - payload = @version.update('POST', @uri, data: data) - WebhookInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class WebhookPage < Page - ## - # Initialize the WebhookPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [WebhookPage] WebhookPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of WebhookInstance - # @param [Hash] payload Payload response from the API - # @return [WebhookInstance] WebhookInstance - def get_instance(payload) - WebhookInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class WebhookInstance < InstanceResource - ## - # Initialize the WebhookInstance - # @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 Webhook - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [WebhookInstance] WebhookInstance - def initialize(version, payload , assistant_sid: nil, sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'url' => payload['url'], - 'account_sid' => payload['account_sid'], - 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), - 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), - 'assistant_sid' => payload['assistant_sid'], - 'sid' => payload['sid'], - 'unique_name' => payload['unique_name'], - 'events' => payload['events'], - 'webhook_url' => payload['webhook_url'], - 'webhook_method' => payload['webhook_method'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_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 [WebhookContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = WebhookContext.new(@version , @params['assistant_sid'], @params['sid']) - end - @instance_context - end - - ## - # @return [String] The absolute URL of the Webhook resource. - def url - @properties['url'] - end - - ## - # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Webhook resource. - def account_sid - @properties['account_sid'] - end - - ## - # @return [Time] The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] The unique string that we created to identify the Webhook resource. - def sid - @properties['sid'] - end - - ## - # @return [String] An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - def unique_name - @properties['unique_name'] - end - - ## - # @return [String] The list of space-separated events that this Webhook is subscribed to. - def events - @properties['events'] - end - - ## - # @return [String] The URL associated with this Webhook. - def webhook_url - @properties['webhook_url'] - end - - ## - # @return [String] The method used when calling the webhook's URL. - def webhook_method - @properties['webhook_method'] - end - - ## - # Delete the WebhookInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the WebhookInstance - # @return [WebhookInstance] Fetched WebhookInstance - def fetch - - context.fetch - end - - ## - # Update the WebhookInstance - # @param [String] unique_name An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length. - # @param [String] events The list of space-separated events that this Webhook will subscribe to. - # @param [String] webhook_url The URL associated with this Webhook. - # @param [String] webhook_method The method to be used when calling the webhook's URL. - # @return [WebhookInstance] Updated WebhookInstance - def update( - unique_name: :unset, - events: :unset, - webhook_url: :unset, - webhook_method: :unset - ) - - context.update( - unique_name: unique_name, - events: events, - webhook_url: webhook_url, - webhook_method: webhook_method, - ) - 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 - - diff --git a/lib/twilio-ruby/rest/autopilot/v1/restore_assistant.rb b/lib/twilio-ruby/rest/autopilot/v1/restore_assistant.rb deleted file mode 100644 index ac380b1cd..000000000 --- a/lib/twilio-ruby/rest/autopilot/v1/restore_assistant.rb +++ /dev/null @@ -1,207 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Autopilot -# 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 Autopilot < AutopilotBase - class V1 < Version - class RestoreAssistantList < ListResource - ## - # Initialize the RestoreAssistantList - # @param [Version] version Version that contains the resource - # @return [RestoreAssistantList] RestoreAssistantList - def initialize(version) - super(version) - # Path Solution - @solution = { } - @uri = "/Assistants/Restore" - - end - ## - # Update the RestoreAssistantInstance - # @param [String] assistant The Twilio-provided string that uniquely identifies the Assistant resource to restore. - # @return [RestoreAssistantInstance] Updated RestoreAssistantInstance - def update( - assistant: nil - ) - - data = Twilio::Values.of({ - 'Assistant' => assistant, - }) - - payload = @version.update('POST', @uri, data: data) - RestoreAssistantInstance.new( - @version, - payload, - ) - end - - - - - # Provide a user friendly representation - def to_s - '#' - end - end - - class RestoreAssistantPage < Page - ## - # Initialize the RestoreAssistantPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [RestoreAssistantPage] RestoreAssistantPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of RestoreAssistantInstance - # @param [Hash] payload Payload response from the API - # @return [RestoreAssistantInstance] RestoreAssistantInstance - def get_instance(payload) - RestoreAssistantInstance.new(@version, payload) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class RestoreAssistantInstance < InstanceResource - ## - # Initialize the RestoreAssistantInstance - # @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 RestoreAssistant - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [RestoreAssistantInstance] RestoreAssistantInstance - def initialize(version, payload ) - super(version) - - # Marshaled Properties - @properties = { - 'account_sid' => payload['account_sid'], - 'sid' => payload['sid'], - 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), - 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), - 'unique_name' => payload['unique_name'], - 'friendly_name' => payload['friendly_name'], - 'needs_model_build' => payload['needs_model_build'], - 'latest_model_build_sid' => payload['latest_model_build_sid'], - 'log_queries' => payload['log_queries'], - 'development_stage' => payload['development_stage'], - 'callback_url' => payload['callback_url'], - 'callback_events' => payload['callback_events'], - } - end - - - ## - # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Assistant resource. - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] The unique string that we created to identify the Assistant resource. - def sid - @properties['sid'] - end - - ## - # @return [Time] The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource. - def unique_name - @properties['unique_name'] - end - - ## - # @return [String] The string that you assigned to describe the resource. It is not unique and can be up to 255 characters long. - def friendly_name - @properties['friendly_name'] - end - - ## - # @return [Boolean] Whether model needs to be rebuilt. - def needs_model_build - @properties['needs_model_build'] - end - - ## - # @return [String] Reserved. - def latest_model_build_sid - @properties['latest_model_build_sid'] - end - - ## - # @return [Boolean] Whether queries should be logged and kept after training. Can be: `true` or `false` and defaults to `true`. If `true`, queries are stored for 30 days, and then deleted. If `false`, no queries are stored. - def log_queries - @properties['log_queries'] - end - - ## - # @return [String] A string describing the state of the assistant. - def development_stage - @properties['development_stage'] - end - - ## - # @return [String] Reserved. - def callback_url - @properties['callback_url'] - end - - ## - # @return [String] Reserved. - def callback_events - @properties['callback_events'] - end - - ## - # Provide a user friendly representation - def to_s - "" - end - - ## - # Provide a detailed, user friendly representation - def inspect - "" - end - end - - end - end - end -end diff --git a/lib/twilio-ruby/rest/autopilot_base.rb b/lib/twilio-ruby/rest/autopilot_base.rb deleted file mode 100644 index 65dc475c1..000000000 --- a/lib/twilio-ruby/rest/autopilot_base.rb +++ /dev/null @@ -1,38 +0,0 @@ -## - # This code was generated by - # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - # - # NOTE: This class is auto generated by OpenAPI Generator. - # https://openapi-generator.tech - # Do not edit the class manually. -# frozen_string_literal: true -module Twilio - module REST - class AutopilotBase < Domain - ## - # Initialize autopilot domain - # - # @param twilio - The twilio client - # - def initialize(twilio) - super(twilio) - @base_url = "https://autopilot.twilio.com" - @host = "autopilot.twilio.com" - @port = 443 - @v1 = nil - end - - def v1 - @v1 ||= Autopilot::V1.new self - end - - ## - # Provide a user friendly representation - def to_s - ''; - end - end - end -end diff --git a/lib/twilio-ruby/rest/client.rb b/lib/twilio-ruby/rest/client.rb index f798e09dd..ca3ba2464 100644 --- a/lib/twilio-ruby/rest/client.rb +++ b/lib/twilio-ruby/rest/client.rb @@ -27,11 +27,6 @@ def api @api ||= Api.new self end ## - # Access the Autopilot Twilio Domain - def autopilot - @autopilot ||= Autopilot.new self - end - ## # Access the Bulkexports Twilio Domain def bulkexports @bulkexports ||= Bulkexports.new self @@ -66,7 +61,6 @@ def flex_api def frontline_api @frontline_api ||= FrontlineApi.new self end - ## # Access the Insights Twilio Domain def insights @insights ||= Insights.new self @@ -224,7 +218,7 @@ def authorized_connect_apps(connectAppSid=:unset) def available_phone_numbers(countryCode=:unset) self.api.v2010.account.available_phone_numbers(countryCode) end - + ## # @param [string] sid The SID of the Call resource to fetch. @@ -273,8 +267,8 @@ def keys(sid=:unset) def messages(sid=:unset) self.api.v2010.account.messages(sid) end - - + + ## # @param [string] sid The Twilio-provided string that uniquely identifies the Notification resource to fetch. @@ -322,8 +316,8 @@ def short_codes(sid=:unset) def signing_keys(sid=:unset) self.api.v2010.account.signing_keys(sid) end - - + + ## # @param [string] sid The Twilio-provided string that uniquely identifies the Transcription resource to fetch. @@ -332,8 +326,8 @@ def signing_keys(sid=:unset) def transcriptions(sid=:unset) self.api.v2010.account.transcriptions(sid) end - - + + ## # Provide a user friendly representation diff --git a/lib/twilio-ruby/rest/preview.rb b/lib/twilio-ruby/rest/preview.rb index cb7a321db..39ff48698 100644 --- a/lib/twilio-ruby/rest/preview.rb +++ b/lib/twilio-ruby/rest/preview.rb @@ -61,16 +61,6 @@ def services(sid=:unset) self.sync.services(sid) end - ## - # @param [String] sid A 34 character string that uniquely identifies this - # resource. - # @return [Twilio::REST::Preview::Understand::AssistantInstance] if sid was passed. - # @return [Twilio::REST::Preview::Understand::AssistantList] - def assistants(sid=:unset) - warn "assistants is deprecated. Use understand.assistants instead." - self.understand.assistants(sid) - end - ## # @param [String] sid The sid # @return [Twilio::REST::Preview::Wireless::CommandInstance] if sid was passed. @@ -99,4 +89,4 @@ def sims(sid=:unset) end end end -end \ No newline at end of file +end diff --git a/lib/twilio-ruby/rest/preview/understand.rb b/lib/twilio-ruby/rest/preview/understand.rb deleted file mode 100644 index e712a82f5..000000000 --- a/lib/twilio-ruby/rest/preview/understand.rb +++ /dev/null @@ -1,49 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# 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 Preview - class Understand < Version - ## - # Initialize the Understand version of Preview - def initialize(domain) - super - @version = 'understand' - @assistants = nil - end - - ## - # @param [String] sid A 34 character string that uniquely identifies this resource. - # @return [Twilio::REST::Preview::Understand::AssistantContext] if sid was passed. - # @return [Twilio::REST::Preview::Understand::AssistantList] - def assistants(sid=:unset) - if sid.nil? - raise ArgumentError, 'sid cannot be nil' - end - if sid == :unset - @assistants ||= AssistantList.new self - else - AssistantContext.new(self, sid) - end - end - ## - # Provide a user friendly representation - def to_s - ''; - end - end - end - end -end diff --git a/lib/twilio-ruby/rest/preview/understand/assistant.rb b/lib/twilio-ruby/rest/preview/understand/assistant.rb deleted file mode 100644 index 3be9b26df..000000000 --- a/lib/twilio-ruby/rest/preview/understand/assistant.rb +++ /dev/null @@ -1,663 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# 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 Preview < PreviewBase - class Understand < Version - class AssistantList < ListResource - ## - # Initialize the AssistantList - # @param [Version] version Version that contains the resource - # @return [AssistantList] AssistantList - def initialize(version) - super(version) - # Path Solution - @solution = { } - @uri = "/Assistants" - - end - ## - # Create the AssistantInstance - # @param [String] friendly_name A text description for the Assistant. It is non-unique and can up to 255 characters long. - # @param [Boolean] log_queries A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. Defaults to true if no value is provided. - # @param [String] unique_name A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - # @param [String] callback_url A user-provided URL to send event callbacks to. - # @param [String] callback_events Space-separated list of callback events that will trigger callbacks. - # @param [Object] fallback_actions The JSON actions to be executed when the user's input is not recognized as matching any Task. - # @param [Object] initiation_actions The JSON actions to be executed on inbound phone calls when the Assistant has to say something first. - # @param [Object] style_sheet The JSON object that holds the style sheet for the assistant - # @return [AssistantInstance] Created AssistantInstance - def create( - friendly_name: :unset, - log_queries: :unset, - unique_name: :unset, - callback_url: :unset, - callback_events: :unset, - fallback_actions: :unset, - initiation_actions: :unset, - style_sheet: :unset - ) - - data = Twilio::Values.of({ - 'FriendlyName' => friendly_name, - 'LogQueries' => log_queries, - 'UniqueName' => unique_name, - 'CallbackUrl' => callback_url, - 'CallbackEvents' => callback_events, - 'FallbackActions' => Twilio.serialize_object(fallback_actions), - 'InitiationActions' => Twilio.serialize_object(initiation_actions), - 'StyleSheet' => Twilio.serialize_object(style_sheet), - }) - - payload = @version.create('POST', @uri, data: data) - AssistantInstance.new( - @version, - payload, - ) - end - - - ## - # Lists AssistantInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @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(limit: nil, page_size: nil) - self.stream( - 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 [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(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields AssistantInstance 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], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of AssistantInstance records from the API. - # Request is executed immediately. - # @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 AssistantInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - AssistantPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of AssistantInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of AssistantInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - AssistantPage.new(@version, response, @solution) - 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 AssistantContext < InstanceContext - ## - # Initialize the AssistantContext - # @param [Version] version Version that contains the resource - # @param [String] sid A 34 character string that uniquely identifies this resource. - # @return [AssistantContext] AssistantContext - def initialize(version, sid) - super(version) - - # Path Solution - @solution = { sid: sid, } - @uri = "/Assistants/#{@solution[:sid]}" - - # Dependents - @field_types = nil - @assistant_fallback_actions = nil - @tasks = nil - @dialogues = nil - @assistant_initiation_actions = nil - @model_builds = nil - @style_sheet = nil - @queries = nil - end - ## - # Delete the AssistantInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - @version.delete('DELETE', @uri) - end - - ## - # Fetch the AssistantInstance - # @return [AssistantInstance] Fetched AssistantInstance - def fetch - - payload = @version.fetch('GET', @uri) - AssistantInstance.new( - @version, - payload, - sid: @solution[:sid], - ) - end - - ## - # Update the AssistantInstance - # @param [String] friendly_name A text description for the Assistant. It is non-unique and can up to 255 characters long. - # @param [Boolean] log_queries A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. Defaults to true if no value is provided. - # @param [String] unique_name A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - # @param [String] callback_url A user-provided URL to send event callbacks to. - # @param [String] callback_events Space-separated list of callback events that will trigger callbacks. - # @param [Object] fallback_actions The JSON actions to be executed when the user's input is not recognized as matching any Task. - # @param [Object] initiation_actions The JSON actions to be executed on inbound phone calls when the Assistant has to say something first. - # @param [Object] style_sheet The JSON object that holds the style sheet for the assistant - # @return [AssistantInstance] Updated AssistantInstance - def update( - friendly_name: :unset, - log_queries: :unset, - unique_name: :unset, - callback_url: :unset, - callback_events: :unset, - fallback_actions: :unset, - initiation_actions: :unset, - style_sheet: :unset - ) - - data = Twilio::Values.of({ - 'FriendlyName' => friendly_name, - 'LogQueries' => log_queries, - 'UniqueName' => unique_name, - 'CallbackUrl' => callback_url, - 'CallbackEvents' => callback_events, - 'FallbackActions' => Twilio.serialize_object(fallback_actions), - 'InitiationActions' => Twilio.serialize_object(initiation_actions), - 'StyleSheet' => Twilio.serialize_object(style_sheet), - }) - - payload = @version.update('POST', @uri, data: data) - AssistantInstance.new( - @version, - payload, - sid: @solution[:sid], - ) - end - - ## - # Access the field_types - # @return [FieldTypeList] - # @return [FieldTypeContext] if sid was passed. - def field_types(sid=:unset) - - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return FieldTypeContext.new(@version, @solution[:sid],sid ) - end - - unless @field_types - @field_types = FieldTypeList.new( - @version, assistant_sid: @solution[:sid], ) - end - - @field_types - end - ## - # Access the assistant_fallback_actions - # @return [AssistantFallbackActionsList] - # @return [AssistantFallbackActionsContext] - def assistant_fallback_actions - AssistantFallbackActionsContext.new( - @version, - @solution[:sid] - ) - end - ## - # Access the tasks - # @return [TaskList] - # @return [TaskContext] if sid was passed. - def tasks(sid=:unset) - - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return TaskContext.new(@version, @solution[:sid],sid ) - end - - unless @tasks - @tasks = TaskList.new( - @version, assistant_sid: @solution[:sid], ) - end - - @tasks - end - ## - # Access the dialogues - # @return [DialogueList] - # @return [DialogueContext] if sid was passed. - def dialogues(sid=:unset) - - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return DialogueContext.new(@version, @solution[:sid],sid ) - end - - unless @dialogues - @dialogues = DialogueList.new( - @version, assistant_sid: @solution[:sid], ) - end - - @dialogues - end - ## - # Access the assistant_initiation_actions - # @return [AssistantInitiationActionsList] - # @return [AssistantInitiationActionsContext] - def assistant_initiation_actions - AssistantInitiationActionsContext.new( - @version, - @solution[:sid] - ) - end - ## - # Access the model_builds - # @return [ModelBuildList] - # @return [ModelBuildContext] if sid was passed. - def model_builds(sid=:unset) - - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return ModelBuildContext.new(@version, @solution[:sid],sid ) - end - - unless @model_builds - @model_builds = ModelBuildList.new( - @version, assistant_sid: @solution[:sid], ) - end - - @model_builds - end - ## - # Access the style_sheet - # @return [StyleSheetList] - # @return [StyleSheetContext] - def style_sheet - StyleSheetContext.new( - @version, - @solution[:sid] - ) - end - ## - # Access the queries - # @return [QueryList] - # @return [QueryContext] if sid was passed. - def queries(sid=:unset) - - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return QueryContext.new(@version, @solution[:sid],sid ) - end - - unless @queries - @queries = QueryList.new( - @version, assistant_sid: @solution[:sid], ) - end - - @queries - end - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class AssistantPage < Page - ## - # Initialize the AssistantPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [AssistantPage] AssistantPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of AssistantInstance - # @param [Hash] payload Payload response from the API - # @return [AssistantInstance] AssistantInstance - def get_instance(payload) - AssistantInstance.new(@version, payload) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class AssistantInstance < InstanceResource - ## - # Initialize the AssistantInstance - # @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 Assistant - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [AssistantInstance] AssistantInstance - def initialize(version, payload , 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']), - 'friendly_name' => payload['friendly_name'], - 'latest_model_build_sid' => payload['latest_model_build_sid'], - 'links' => payload['links'], - 'log_queries' => payload['log_queries'], - 'sid' => payload['sid'], - 'unique_name' => payload['unique_name'], - 'url' => payload['url'], - 'callback_url' => payload['callback_url'], - 'callback_events' => payload['callback_events'], - } - - # Context - @instance_context = nil - @params = { '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 [AssistantContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = AssistantContext.new(@version , @params['sid']) - end - @instance_context - end - - ## - # @return [String] The unique ID of the Account that created this Assistant. - def account_sid - @properties['account_sid'] - end - - ## - # @return [Time] The date that this resource was created - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date that this resource was last updated - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] A text description for the Assistant. It is non-unique and can up to 255 characters long. - def friendly_name - @properties['friendly_name'] - end - - ## - # @return [String] The unique ID (Sid) of the latest model build. Null if no model has been built. - def latest_model_build_sid - @properties['latest_model_build_sid'] - end - - ## - # @return [Hash] - def links - @properties['links'] - end - - ## - # @return [Boolean] A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. - def log_queries - @properties['log_queries'] - end - - ## - # @return [String] A 34 character string that uniquely identifies this resource. - def sid - @properties['sid'] - end - - ## - # @return [String] A user-provided string that uniquely identifies this resource as an alternative to the sid. You can use the unique name in the URL path. Unique up to 64 characters long. - def unique_name - @properties['unique_name'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # @return [String] A user-provided URL to send event callbacks to. - def callback_url - @properties['callback_url'] - end - - ## - # @return [String] Space-separated list of callback events that will trigger callbacks. - def callback_events - @properties['callback_events'] - end - - ## - # Delete the AssistantInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the AssistantInstance - # @return [AssistantInstance] Fetched AssistantInstance - def fetch - - context.fetch - end - - ## - # Update the AssistantInstance - # @param [String] friendly_name A text description for the Assistant. It is non-unique and can up to 255 characters long. - # @param [Boolean] log_queries A boolean that specifies whether queries should be logged for 30 days further training. If false, no queries will be stored, if true, queries will be stored for 30 days and deleted thereafter. Defaults to true if no value is provided. - # @param [String] unique_name A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - # @param [String] callback_url A user-provided URL to send event callbacks to. - # @param [String] callback_events Space-separated list of callback events that will trigger callbacks. - # @param [Object] fallback_actions The JSON actions to be executed when the user's input is not recognized as matching any Task. - # @param [Object] initiation_actions The JSON actions to be executed on inbound phone calls when the Assistant has to say something first. - # @param [Object] style_sheet The JSON object that holds the style sheet for the assistant - # @return [AssistantInstance] Updated AssistantInstance - def update( - friendly_name: :unset, - log_queries: :unset, - unique_name: :unset, - callback_url: :unset, - callback_events: :unset, - fallback_actions: :unset, - initiation_actions: :unset, - style_sheet: :unset - ) - - context.update( - friendly_name: friendly_name, - log_queries: log_queries, - unique_name: unique_name, - callback_url: callback_url, - callback_events: callback_events, - fallback_actions: fallback_actions, - initiation_actions: initiation_actions, - style_sheet: style_sheet, - ) - end - - ## - # Access the field_types - # @return [field_types] field_types - def field_types - context.field_types - end - - ## - # Access the assistant_fallback_actions - # @return [assistant_fallback_actions] assistant_fallback_actions - def assistant_fallback_actions - context.assistant_fallback_actions - end - - ## - # Access the tasks - # @return [tasks] tasks - def tasks - context.tasks - end - - ## - # Access the dialogues - # @return [dialogues] dialogues - def dialogues - context.dialogues - end - - ## - # Access the assistant_initiation_actions - # @return [assistant_initiation_actions] assistant_initiation_actions - def assistant_initiation_actions - context.assistant_initiation_actions - end - - ## - # Access the model_builds - # @return [model_builds] model_builds - def model_builds - context.model_builds - end - - ## - # Access the style_sheet - # @return [style_sheet] style_sheet - def style_sheet - context.style_sheet - end - - ## - # Access the queries - # @return [queries] queries - def queries - context.queries - 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 diff --git a/lib/twilio-ruby/rest/preview/understand/assistant/assistant_fallback_actions.rb b/lib/twilio-ruby/rest/preview/understand/assistant/assistant_fallback_actions.rb deleted file mode 100644 index 2a1d3e8ab..000000000 --- a/lib/twilio-ruby/rest/preview/understand/assistant/assistant_fallback_actions.rb +++ /dev/null @@ -1,241 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# 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 Preview < PreviewBase - class Understand < Version - class AssistantContext < InstanceContext - - class AssistantFallbackActionsList < ListResource - ## - # Initialize the AssistantFallbackActionsList - # @param [Version] version Version that contains the resource - # @return [AssistantFallbackActionsList] AssistantFallbackActionsList - def initialize(version, assistant_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_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 AssistantFallbackActionsContext < InstanceContext - ## - # Initialize the AssistantFallbackActionsContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid - # @return [AssistantFallbackActionsContext] AssistantFallbackActionsContext - def initialize(version, assistant_sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/FallbackActions" - - - end - ## - # Fetch the AssistantFallbackActionsInstance - # @return [AssistantFallbackActionsInstance] Fetched AssistantFallbackActionsInstance - def fetch - - payload = @version.fetch('GET', @uri) - AssistantFallbackActionsInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - ## - # Update the AssistantFallbackActionsInstance - # @param [Object] fallback_actions - # @return [AssistantFallbackActionsInstance] Updated AssistantFallbackActionsInstance - def update( - fallback_actions: :unset - ) - - data = Twilio::Values.of({ - 'FallbackActions' => Twilio.serialize_object(fallback_actions), - }) - - payload = @version.update('POST', @uri, data: data) - AssistantFallbackActionsInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class AssistantFallbackActionsPage < Page - ## - # Initialize the AssistantFallbackActionsPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [AssistantFallbackActionsPage] AssistantFallbackActionsPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of AssistantFallbackActionsInstance - # @param [Hash] payload Payload response from the API - # @return [AssistantFallbackActionsInstance] AssistantFallbackActionsInstance - def get_instance(payload) - AssistantFallbackActionsInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class AssistantFallbackActionsInstance < InstanceResource - ## - # Initialize the AssistantFallbackActionsInstance - # @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 AssistantFallbackActions - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [AssistantFallbackActionsInstance] AssistantFallbackActionsInstance - def initialize(version, payload , assistant_sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'account_sid' => payload['account_sid'], - 'assistant_sid' => payload['assistant_sid'], - 'url' => payload['url'], - 'data' => payload['data'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_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 [AssistantFallbackActionsContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = AssistantFallbackActionsContext.new(@version , @params['assistant_sid']) - end - @instance_context - end - - ## - # @return [String] - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # @return [Hash] - def data - @properties['data'] - end - - ## - # Fetch the AssistantFallbackActionsInstance - # @return [AssistantFallbackActionsInstance] Fetched AssistantFallbackActionsInstance - def fetch - - context.fetch - end - - ## - # Update the AssistantFallbackActionsInstance - # @param [Object] fallback_actions - # @return [AssistantFallbackActionsInstance] Updated AssistantFallbackActionsInstance - def update( - fallback_actions: :unset - ) - - context.update( - fallback_actions: fallback_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 - - diff --git a/lib/twilio-ruby/rest/preview/understand/assistant/assistant_initiation_actions.rb b/lib/twilio-ruby/rest/preview/understand/assistant/assistant_initiation_actions.rb deleted file mode 100644 index 6dfe6c7d4..000000000 --- a/lib/twilio-ruby/rest/preview/understand/assistant/assistant_initiation_actions.rb +++ /dev/null @@ -1,241 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# 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 Preview < PreviewBase - class Understand < Version - class AssistantContext < InstanceContext - - class AssistantInitiationActionsList < ListResource - ## - # Initialize the AssistantInitiationActionsList - # @param [Version] version Version that contains the resource - # @return [AssistantInitiationActionsList] AssistantInitiationActionsList - def initialize(version, assistant_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_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 AssistantInitiationActionsContext < InstanceContext - ## - # Initialize the AssistantInitiationActionsContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid - # @return [AssistantInitiationActionsContext] AssistantInitiationActionsContext - def initialize(version, assistant_sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/InitiationActions" - - - end - ## - # Fetch the AssistantInitiationActionsInstance - # @return [AssistantInitiationActionsInstance] Fetched AssistantInitiationActionsInstance - def fetch - - payload = @version.fetch('GET', @uri) - AssistantInitiationActionsInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - ## - # Update the AssistantInitiationActionsInstance - # @param [Object] initiation_actions - # @return [AssistantInitiationActionsInstance] Updated AssistantInitiationActionsInstance - def update( - initiation_actions: :unset - ) - - data = Twilio::Values.of({ - 'InitiationActions' => Twilio.serialize_object(initiation_actions), - }) - - payload = @version.update('POST', @uri, data: data) - AssistantInitiationActionsInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class AssistantInitiationActionsPage < Page - ## - # Initialize the AssistantInitiationActionsPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [AssistantInitiationActionsPage] AssistantInitiationActionsPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of AssistantInitiationActionsInstance - # @param [Hash] payload Payload response from the API - # @return [AssistantInitiationActionsInstance] AssistantInitiationActionsInstance - def get_instance(payload) - AssistantInitiationActionsInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class AssistantInitiationActionsInstance < InstanceResource - ## - # Initialize the AssistantInitiationActionsInstance - # @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 AssistantInitiationActions - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [AssistantInitiationActionsInstance] AssistantInitiationActionsInstance - def initialize(version, payload , assistant_sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'account_sid' => payload['account_sid'], - 'assistant_sid' => payload['assistant_sid'], - 'url' => payload['url'], - 'data' => payload['data'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_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 [AssistantInitiationActionsContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = AssistantInitiationActionsContext.new(@version , @params['assistant_sid']) - end - @instance_context - end - - ## - # @return [String] - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # @return [Hash] - def data - @properties['data'] - end - - ## - # Fetch the AssistantInitiationActionsInstance - # @return [AssistantInitiationActionsInstance] Fetched AssistantInitiationActionsInstance - def fetch - - context.fetch - end - - ## - # Update the AssistantInitiationActionsInstance - # @param [Object] initiation_actions - # @return [AssistantInitiationActionsInstance] Updated AssistantInitiationActionsInstance - def update( - initiation_actions: :unset - ) - - context.update( - initiation_actions: initiation_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 - - diff --git a/lib/twilio-ruby/rest/preview/understand/assistant/dialogue.rb b/lib/twilio-ruby/rest/preview/understand/assistant/dialogue.rb deleted file mode 100644 index 93e64df14..000000000 --- a/lib/twilio-ruby/rest/preview/understand/assistant/dialogue.rb +++ /dev/null @@ -1,217 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# 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 Preview < PreviewBase - class Understand < Version - class AssistantContext < InstanceContext - - class DialogueList < ListResource - ## - # Initialize the DialogueList - # @param [Version] version Version that contains the resource - # @return [DialogueList] DialogueList - def initialize(version, assistant_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_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 DialogueContext < InstanceContext - ## - # Initialize the DialogueContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid - # @param [String] sid - # @return [DialogueContext] DialogueContext - def initialize(version, assistant_sid, sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, sid: sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Dialogues/#{@solution[:sid]}" - - - end - ## - # Fetch the DialogueInstance - # @return [DialogueInstance] Fetched DialogueInstance - def fetch - - payload = @version.fetch('GET', @uri) - DialogueInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class DialoguePage < Page - ## - # Initialize the DialoguePage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [DialoguePage] DialoguePage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of DialogueInstance - # @param [Hash] payload Payload response from the API - # @return [DialogueInstance] DialogueInstance - def get_instance(payload) - DialogueInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class DialogueInstance < InstanceResource - ## - # Initialize the DialogueInstance - # @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 Dialogue - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [DialogueInstance] DialogueInstance - def initialize(version, payload , assistant_sid: nil, sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'account_sid' => payload['account_sid'], - 'assistant_sid' => payload['assistant_sid'], - 'sid' => payload['sid'], - 'data' => payload['data'], - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_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 [DialogueContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = DialogueContext.new(@version , @params['assistant_sid'], @params['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 Dialogue - def sid - @properties['sid'] - end - - ## - # @return [Hash] The dialogue memory object as json - def data - @properties['data'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # Fetch the DialogueInstance - # @return [DialogueInstance] Fetched DialogueInstance - def fetch - - context.fetch - 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 - - diff --git a/lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb b/lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb deleted file mode 100644 index de92de9b3..000000000 --- a/lib/twilio-ruby/rest/preview/understand/assistant/field_type.rb +++ /dev/null @@ -1,435 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# 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 Preview < PreviewBase - class Understand < Version - class AssistantContext < InstanceContext - - class FieldTypeList < ListResource - ## - # Initialize the FieldTypeList - # @param [Version] version Version that contains the resource - # @return [FieldTypeList] FieldTypeList - def initialize(version, assistant_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid } - @uri = "/Assistants/#{@solution[:assistant_sid]}/FieldTypes" - - end - ## - # Create the FieldTypeInstance - # @param [String] unique_name A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - # @param [String] friendly_name A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - # @return [FieldTypeInstance] Created FieldTypeInstance - def create( - unique_name: nil, - friendly_name: :unset - ) - - data = Twilio::Values.of({ - 'UniqueName' => unique_name, - 'FriendlyName' => friendly_name, - }) - - payload = @version.create('POST', @uri, data: data) - FieldTypeInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - - ## - # Lists FieldTypeInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @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(limit: nil, page_size: nil) - self.stream( - 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 [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(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields FieldTypeInstance 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], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of FieldTypeInstance records from the API. - # Request is executed immediately. - # @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 FieldTypeInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - FieldTypePage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of FieldTypeInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of FieldTypeInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - FieldTypePage.new(@version, response, @solution) - 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 FieldTypeContext < InstanceContext - ## - # Initialize the FieldTypeContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid - # @param [String] sid - # @return [FieldTypeContext] FieldTypeContext - def initialize(version, assistant_sid, sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, sid: sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/FieldTypes/#{@solution[:sid]}" - - # Dependents - @field_values = nil - end - ## - # Delete the FieldTypeInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - @version.delete('DELETE', @uri) - end - - ## - # Fetch the FieldTypeInstance - # @return [FieldTypeInstance] Fetched FieldTypeInstance - def fetch - - payload = @version.fetch('GET', @uri) - FieldTypeInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - ## - # Update the FieldTypeInstance - # @param [String] friendly_name A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - # @param [String] unique_name A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - # @return [FieldTypeInstance] Updated FieldTypeInstance - def update( - friendly_name: :unset, - unique_name: :unset - ) - - data = Twilio::Values.of({ - 'FriendlyName' => friendly_name, - 'UniqueName' => unique_name, - }) - - payload = @version.update('POST', @uri, data: data) - FieldTypeInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - ## - # Access the field_values - # @return [FieldValueList] - # @return [FieldValueContext] if sid was passed. - def field_values(sid=:unset) - - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return FieldValueContext.new(@version, @solution[:assistant_sid], @solution[:sid],sid ) - end - - unless @field_values - @field_values = FieldValueList.new( - @version, assistant_sid: @solution[:assistant_sid], field_type_sid: @solution[:sid], ) - end - - @field_values - end - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class FieldTypePage < Page - ## - # Initialize the FieldTypePage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [FieldTypePage] FieldTypePage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of FieldTypeInstance - # @param [Hash] payload Payload response from the API - # @return [FieldTypeInstance] FieldTypeInstance - def get_instance(payload) - FieldTypeInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class FieldTypeInstance < InstanceResource - ## - # Initialize the FieldTypeInstance - # @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 FieldType - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [FieldTypeInstance] FieldTypeInstance - def initialize(version, payload , assistant_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']), - 'friendly_name' => payload['friendly_name'], - 'links' => payload['links'], - 'assistant_sid' => payload['assistant_sid'], - 'sid' => payload['sid'], - 'unique_name' => payload['unique_name'], - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_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 [FieldTypeContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = FieldTypeContext.new(@version , @params['assistant_sid'], @params['sid']) - end - @instance_context - end - - ## - # @return [String] The unique ID of the Account that created this Field Type. - def account_sid - @properties['account_sid'] - end - - ## - # @return [Time] The date that this resource was created - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date that this resource was last updated - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - def friendly_name - @properties['friendly_name'] - end - - ## - # @return [Hash] - def links - @properties['links'] - end - - ## - # @return [String] The unique ID of the Assistant. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] A 34 character string that uniquely identifies this resource. - def sid - @properties['sid'] - end - - ## - # @return [String] A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - def unique_name - @properties['unique_name'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # Delete the FieldTypeInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the FieldTypeInstance - # @return [FieldTypeInstance] Fetched FieldTypeInstance - def fetch - - context.fetch - end - - ## - # Update the FieldTypeInstance - # @param [String] friendly_name A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - # @param [String] unique_name A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - # @return [FieldTypeInstance] Updated FieldTypeInstance - def update( - friendly_name: :unset, - unique_name: :unset - ) - - context.update( - friendly_name: friendly_name, - unique_name: unique_name, - ) - end - - ## - # Access the field_values - # @return [field_values] field_values - def field_values - context.field_values - 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 - - diff --git a/lib/twilio-ruby/rest/preview/understand/assistant/field_type/field_value.rb b/lib/twilio-ruby/rest/preview/understand/assistant/field_type/field_value.rb deleted file mode 100644 index 8d61ab7c7..000000000 --- a/lib/twilio-ruby/rest/preview/understand/assistant/field_type/field_value.rb +++ /dev/null @@ -1,389 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# 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 Preview < PreviewBase - class Understand < Version - class AssistantContext < InstanceContext - class FieldTypeContext < InstanceContext - - class FieldValueList < ListResource - ## - # Initialize the FieldValueList - # @param [Version] version Version that contains the resource - # @return [FieldValueList] FieldValueList - def initialize(version, assistant_sid: nil, field_type_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid, field_type_sid: field_type_sid } - @uri = "/Assistants/#{@solution[:assistant_sid]}/FieldTypes/#{@solution[:field_type_sid]}/FieldValues" - - end - ## - # Create the FieldValueInstance - # @param [String] language An ISO language-country string of the value. - # @param [String] value A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - # @param [String] synonym_of A value that indicates this field value is a synonym of. Empty if the value is not a synonym. - # @return [FieldValueInstance] Created FieldValueInstance - def create( - language: nil, - value: nil, - synonym_of: :unset - ) - - data = Twilio::Values.of({ - 'Language' => language, - 'Value' => value, - 'SynonymOf' => synonym_of, - }) - - payload = @version.create('POST', @uri, data: data) - FieldValueInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - field_type_sid: @solution[:field_type_sid], - ) - end - - - ## - # Lists FieldValueInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @param [String] language An ISO language-country string of the value. For example: *en-US* - # @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(language: :unset, limit: nil, page_size: nil) - self.stream( - language: language, - 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 [String] language An ISO language-country string of the value. For example: *en-US* - # @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(language: :unset, limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - language: language, - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields FieldValueInstance 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], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of FieldValueInstance records from the API. - # Request is executed immediately. - # @param [String] language An ISO language-country string of the value. For example: *en-US* - # @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 FieldValueInstance - def page(language: :unset, page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'Language' => language, - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - FieldValuePage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of FieldValueInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of FieldValueInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - FieldValuePage.new(@version, response, @solution) - 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 FieldValueContext < InstanceContext - ## - # Initialize the FieldValueContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid - # @param [String] field_type_sid - # @param [String] sid - # @return [FieldValueContext] FieldValueContext - def initialize(version, assistant_sid, field_type_sid, sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, field_type_sid: field_type_sid, sid: sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/FieldTypes/#{@solution[:field_type_sid]}/FieldValues/#{@solution[:sid]}" - - - end - ## - # Delete the FieldValueInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - @version.delete('DELETE', @uri) - end - - ## - # Fetch the FieldValueInstance - # @return [FieldValueInstance] Fetched FieldValueInstance - def fetch - - payload = @version.fetch('GET', @uri) - FieldValueInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - field_type_sid: @solution[:field_type_sid], - sid: @solution[:sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class FieldValuePage < Page - ## - # Initialize the FieldValuePage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [FieldValuePage] FieldValuePage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of FieldValueInstance - # @param [Hash] payload Payload response from the API - # @return [FieldValueInstance] FieldValueInstance - def get_instance(payload) - FieldValueInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], field_type_sid: @solution[:field_type_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class FieldValueInstance < InstanceResource - ## - # Initialize the FieldValueInstance - # @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 FieldValue - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [FieldValueInstance] FieldValueInstance - def initialize(version, payload , assistant_sid: nil, field_type_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']), - 'field_type_sid' => payload['field_type_sid'], - 'language' => payload['language'], - 'assistant_sid' => payload['assistant_sid'], - 'sid' => payload['sid'], - 'value' => payload['value'], - 'url' => payload['url'], - 'synonym_of' => payload['synonym_of'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_sid'] ,'field_type_sid' => field_type_sid || @properties['field_type_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 [FieldValueContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = FieldValueContext.new(@version , @params['assistant_sid'], @params['field_type_sid'], @params['sid']) - end - @instance_context - end - - ## - # @return [String] The unique ID of the Account that created this Field Value. - def account_sid - @properties['account_sid'] - end - - ## - # @return [Time] The date that this resource was created - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date that this resource was last updated - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] The unique ID of the Field Type associated with this Field Value. - def field_type_sid - @properties['field_type_sid'] - end - - ## - # @return [String] An ISO language-country string of the value. - def language - @properties['language'] - end - - ## - # @return [String] The unique ID of the Assistant. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] A 34 character string that uniquely identifies this resource. - def sid - @properties['sid'] - end - - ## - # @return [String] The Field Value itself. - def value - @properties['value'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # @return [String] A value that indicates this field value is a synonym of. Empty if the value is not a synonym. - def synonym_of - @properties['synonym_of'] - end - - ## - # Delete the FieldValueInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the FieldValueInstance - # @return [FieldValueInstance] Fetched FieldValueInstance - def fetch - - context.fetch - 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 - - diff --git a/lib/twilio-ruby/rest/preview/understand/assistant/model_build.rb b/lib/twilio-ruby/rest/preview/understand/assistant/model_build.rb deleted file mode 100644 index 9a3b95d10..000000000 --- a/lib/twilio-ruby/rest/preview/understand/assistant/model_build.rb +++ /dev/null @@ -1,409 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# 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 Preview < PreviewBase - class Understand < Version - class AssistantContext < InstanceContext - - class ModelBuildList < ListResource - ## - # Initialize the ModelBuildList - # @param [Version] version Version that contains the resource - # @return [ModelBuildList] ModelBuildList - def initialize(version, assistant_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid } - @uri = "/Assistants/#{@solution[:assistant_sid]}/ModelBuilds" - - end - ## - # Create the ModelBuildInstance - # @param [String] status_callback - # @param [String] unique_name A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. For example: v0.1 - # @return [ModelBuildInstance] Created ModelBuildInstance - def create( - status_callback: :unset, - unique_name: :unset - ) - - data = Twilio::Values.of({ - 'StatusCallback' => status_callback, - 'UniqueName' => unique_name, - }) - - payload = @version.create('POST', @uri, data: data) - ModelBuildInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - - ## - # Lists ModelBuildInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @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(limit: nil, page_size: nil) - self.stream( - 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 [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(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields ModelBuildInstance 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], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of ModelBuildInstance records from the API. - # Request is executed immediately. - # @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 ModelBuildInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - ModelBuildPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of ModelBuildInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of ModelBuildInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - ModelBuildPage.new(@version, response, @solution) - 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 ModelBuildContext < InstanceContext - ## - # Initialize the ModelBuildContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid - # @param [String] sid - # @return [ModelBuildContext] ModelBuildContext - def initialize(version, assistant_sid, sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, sid: sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/ModelBuilds/#{@solution[:sid]}" - - - end - ## - # Delete the ModelBuildInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - @version.delete('DELETE', @uri) - end - - ## - # Fetch the ModelBuildInstance - # @return [ModelBuildInstance] Fetched ModelBuildInstance - def fetch - - payload = @version.fetch('GET', @uri) - ModelBuildInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - ## - # Update the ModelBuildInstance - # @param [String] unique_name A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. For example: v0.1 - # @return [ModelBuildInstance] Updated ModelBuildInstance - def update( - unique_name: :unset - ) - - data = Twilio::Values.of({ - 'UniqueName' => unique_name, - }) - - payload = @version.update('POST', @uri, data: data) - ModelBuildInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class ModelBuildPage < Page - ## - # Initialize the ModelBuildPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [ModelBuildPage] ModelBuildPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of ModelBuildInstance - # @param [Hash] payload Payload response from the API - # @return [ModelBuildInstance] ModelBuildInstance - def get_instance(payload) - ModelBuildInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class ModelBuildInstance < InstanceResource - ## - # Initialize the ModelBuildInstance - # @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 ModelBuild - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [ModelBuildInstance] ModelBuildInstance - def initialize(version, payload , assistant_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']), - 'assistant_sid' => payload['assistant_sid'], - 'sid' => payload['sid'], - 'status' => payload['status'], - 'unique_name' => payload['unique_name'], - 'url' => payload['url'], - 'build_duration' => payload['build_duration'] == nil ? payload['build_duration'] : payload['build_duration'].to_i, - 'error_code' => payload['error_code'] == nil ? payload['error_code'] : payload['error_code'].to_i, - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_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 [ModelBuildContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = ModelBuildContext.new(@version , @params['assistant_sid'], @params['sid']) - end - @instance_context - end - - ## - # @return [String] The unique ID of the Account that created this Model Build. - def account_sid - @properties['account_sid'] - end - - ## - # @return [Time] The date that this resource was created - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date that this resource was last updated - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] The unique ID of the parent Assistant. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] A 34 character string that uniquely identifies this resource. - def sid - @properties['sid'] - end - - ## - # @return [Status] - def status - @properties['status'] - end - - ## - # @return [String] A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - def unique_name - @properties['unique_name'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # @return [String] The time in seconds it took to build the model. - def build_duration - @properties['build_duration'] - end - - ## - # @return [String] - def error_code - @properties['error_code'] - end - - ## - # Delete the ModelBuildInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the ModelBuildInstance - # @return [ModelBuildInstance] Fetched ModelBuildInstance - def fetch - - context.fetch - end - - ## - # Update the ModelBuildInstance - # @param [String] unique_name A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. For example: v0.1 - # @return [ModelBuildInstance] Updated ModelBuildInstance - def update( - unique_name: :unset - ) - - context.update( - unique_name: unique_name, - ) - 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 - - diff --git a/lib/twilio-ruby/rest/preview/understand/assistant/query.rb b/lib/twilio-ruby/rest/preview/understand/assistant/query.rb deleted file mode 100644 index 18653c091..000000000 --- a/lib/twilio-ruby/rest/preview/understand/assistant/query.rb +++ /dev/null @@ -1,463 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# 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 Preview < PreviewBase - class Understand < Version - class AssistantContext < InstanceContext - - class QueryList < ListResource - ## - # Initialize the QueryList - # @param [Version] version Version that contains the resource - # @return [QueryList] QueryList - def initialize(version, assistant_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Queries" - - end - ## - # Create the QueryInstance - # @param [String] language An ISO language-country string of the sample. - # @param [String] query A user-provided string that uniquely identifies this resource as an alternative to the sid. It can be up to 2048 characters long. - # @param [String] tasks Constraints the query to a set of tasks. Useful when you need to constrain the paths the user can take. Tasks should be comma separated *task-unique-name-1*, *task-unique-name-2* - # @param [String] model_build The Model Build Sid or unique name of the Model Build to be queried. - # @param [String] field Constraints the query to a given Field with an task. Useful when you know the Field you are expecting. It accepts one field in the format *task-unique-name-1*:*field-unique-name* - # @return [QueryInstance] Created QueryInstance - def create( - language: nil, - query: nil, - tasks: :unset, - model_build: :unset, - field: :unset - ) - - data = Twilio::Values.of({ - 'Language' => language, - 'Query' => query, - 'Tasks' => tasks, - 'ModelBuild' => model_build, - 'Field' => field, - }) - - payload = @version.create('POST', @uri, data: data) - QueryInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - - ## - # Lists QueryInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @param [String] language An ISO language-country string of the sample. - # @param [String] model_build The Model Build Sid or unique name of the Model Build to be queried. - # @param [String] status A string that described the query status. The values can be: pending_review, reviewed, discarded - # @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(language: :unset, model_build: :unset, status: :unset, limit: nil, page_size: nil) - self.stream( - language: language, - model_build: model_build, - status: status, - 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 [String] language An ISO language-country string of the sample. - # @param [String] model_build The Model Build Sid or unique name of the Model Build to be queried. - # @param [String] status A string that described the query status. The values can be: pending_review, reviewed, discarded - # @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(language: :unset, model_build: :unset, status: :unset, limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - language: language, - model_build: model_build, - status: status, - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields QueryInstance 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], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of QueryInstance records from the API. - # Request is executed immediately. - # @param [String] language An ISO language-country string of the sample. - # @param [String] model_build The Model Build Sid or unique name of the Model Build to be queried. - # @param [String] status A string that described the query status. The values can be: pending_review, reviewed, discarded - # @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 QueryInstance - def page(language: :unset, model_build: :unset, status: :unset, page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'Language' => language, - 'ModelBuild' => model_build, - 'Status' => status, - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - QueryPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of QueryInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of QueryInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - QueryPage.new(@version, response, @solution) - 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 QueryContext < InstanceContext - ## - # Initialize the QueryContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The unique ID of the parent Assistant. - # @param [String] sid A 34 character string that uniquely identifies this resource. - # @return [QueryContext] QueryContext - def initialize(version, assistant_sid, sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, sid: sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Queries/#{@solution[:sid]}" - - - end - ## - # Delete the QueryInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - @version.delete('DELETE', @uri) - end - - ## - # Fetch the QueryInstance - # @return [QueryInstance] Fetched QueryInstance - def fetch - - payload = @version.fetch('GET', @uri) - QueryInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - ## - # Update the QueryInstance - # @param [String] sample_sid An optional reference to the Sample created from this query. - # @param [String] status A string that described the query status. The values can be: pending_review, reviewed, discarded - # @return [QueryInstance] Updated QueryInstance - def update( - sample_sid: :unset, - status: :unset - ) - - data = Twilio::Values.of({ - 'SampleSid' => sample_sid, - 'Status' => status, - }) - - payload = @version.update('POST', @uri, data: data) - QueryInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class QueryPage < Page - ## - # Initialize the QueryPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [QueryPage] QueryPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of QueryInstance - # @param [Hash] payload Payload response from the API - # @return [QueryInstance] QueryInstance - def get_instance(payload) - QueryInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class QueryInstance < InstanceResource - ## - # Initialize the QueryInstance - # @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 Query - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [QueryInstance] QueryInstance - def initialize(version, payload , assistant_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']), - 'results' => payload['results'], - 'language' => payload['language'], - 'model_build_sid' => payload['model_build_sid'], - 'query' => payload['query'], - 'sample_sid' => payload['sample_sid'], - 'assistant_sid' => payload['assistant_sid'], - 'sid' => payload['sid'], - 'status' => payload['status'], - 'url' => payload['url'], - 'source_channel' => payload['source_channel'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_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 [QueryContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = QueryContext.new(@version , @params['assistant_sid'], @params['sid']) - end - @instance_context - end - - ## - # @return [String] The unique ID of the Account that created this Query. - def account_sid - @properties['account_sid'] - end - - ## - # @return [Time] The date that this resource was created - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date that this resource was last updated - def date_updated - @properties['date_updated'] - end - - ## - # @return [Hash] The natural language analysis results which include the Task recognized, the confidence score and a list of identified Fields. - def results - @properties['results'] - end - - ## - # @return [String] An ISO language-country string of the sample. - def language - @properties['language'] - end - - ## - # @return [String] The unique ID of the Model Build queried. - def model_build_sid - @properties['model_build_sid'] - end - - ## - # @return [String] The end-user's natural language input. - def query - @properties['query'] - end - - ## - # @return [String] An optional reference to the Sample created from this query. - def sample_sid - @properties['sample_sid'] - end - - ## - # @return [String] The unique ID of the parent Assistant. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] A 34 character string that uniquely identifies this resource. - def sid - @properties['sid'] - end - - ## - # @return [String] A string that described the query status. The values can be: pending_review, reviewed, discarded - def status - @properties['status'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # @return [String] The communication channel where this end-user input came from - def source_channel - @properties['source_channel'] - end - - ## - # Delete the QueryInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the QueryInstance - # @return [QueryInstance] Fetched QueryInstance - def fetch - - context.fetch - end - - ## - # Update the QueryInstance - # @param [String] sample_sid An optional reference to the Sample created from this query. - # @param [String] status A string that described the query status. The values can be: pending_review, reviewed, discarded - # @return [QueryInstance] Updated QueryInstance - def update( - sample_sid: :unset, - status: :unset - ) - - context.update( - sample_sid: sample_sid, - status: status, - ) - 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 - - diff --git a/lib/twilio-ruby/rest/preview/understand/assistant/style_sheet.rb b/lib/twilio-ruby/rest/preview/understand/assistant/style_sheet.rb deleted file mode 100644 index d4174a0d6..000000000 --- a/lib/twilio-ruby/rest/preview/understand/assistant/style_sheet.rb +++ /dev/null @@ -1,241 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# 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 Preview < PreviewBase - class Understand < Version - class AssistantContext < InstanceContext - - class StyleSheetList < ListResource - ## - # Initialize the StyleSheetList - # @param [Version] version Version that contains the resource - # @return [StyleSheetList] StyleSheetList - def initialize(version, assistant_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_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 StyleSheetContext < InstanceContext - ## - # Initialize the StyleSheetContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The unique ID of the Assistant - # @return [StyleSheetContext] StyleSheetContext - def initialize(version, assistant_sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/StyleSheet" - - - end - ## - # Fetch the StyleSheetInstance - # @return [StyleSheetInstance] Fetched StyleSheetInstance - def fetch - - payload = @version.fetch('GET', @uri) - StyleSheetInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - ## - # Update the StyleSheetInstance - # @param [Object] style_sheet The JSON Style sheet string - # @return [StyleSheetInstance] Updated StyleSheetInstance - def update( - style_sheet: :unset - ) - - data = Twilio::Values.of({ - 'StyleSheet' => Twilio.serialize_object(style_sheet), - }) - - payload = @version.update('POST', @uri, data: data) - StyleSheetInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class StyleSheetPage < Page - ## - # Initialize the StyleSheetPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [StyleSheetPage] StyleSheetPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of StyleSheetInstance - # @param [Hash] payload Payload response from the API - # @return [StyleSheetInstance] StyleSheetInstance - def get_instance(payload) - StyleSheetInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class StyleSheetInstance < InstanceResource - ## - # Initialize the StyleSheetInstance - # @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 StyleSheet - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [StyleSheetInstance] StyleSheetInstance - def initialize(version, payload , assistant_sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'account_sid' => payload['account_sid'], - 'assistant_sid' => payload['assistant_sid'], - 'url' => payload['url'], - 'data' => payload['data'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_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 [StyleSheetContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = StyleSheetContext.new(@version , @params['assistant_sid']) - end - @instance_context - end - - ## - # @return [String] The unique ID of the Account that created this Assistant - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] The unique ID of the Assistant - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # @return [Hash] The JSON style sheet object - def data - @properties['data'] - end - - ## - # Fetch the StyleSheetInstance - # @return [StyleSheetInstance] Fetched StyleSheetInstance - def fetch - - context.fetch - end - - ## - # Update the StyleSheetInstance - # @param [Object] style_sheet The JSON Style sheet string - # @return [StyleSheetInstance] Updated StyleSheetInstance - def update( - style_sheet: :unset - ) - - context.update( - style_sheet: style_sheet, - ) - 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 - - diff --git a/lib/twilio-ruby/rest/preview/understand/assistant/task.rb b/lib/twilio-ruby/rest/preview/understand/assistant/task.rb deleted file mode 100644 index df90629cb..000000000 --- a/lib/twilio-ruby/rest/preview/understand/assistant/task.rb +++ /dev/null @@ -1,525 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# 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 Preview < PreviewBase - class Understand < Version - class AssistantContext < InstanceContext - - class TaskList < ListResource - ## - # Initialize the TaskList - # @param [Version] version Version that contains the resource - # @return [TaskList] TaskList - def initialize(version, assistant_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks" - - end - ## - # Create the TaskInstance - # @param [String] unique_name A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - # @param [String] friendly_name A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - # @param [Object] actions A user-provided JSON object encoded as a string to specify the actions for this task. It is optional and non-unique. - # @param [String] actions_url User-provided HTTP endpoint where from the assistant fetches actions - # @return [TaskInstance] Created TaskInstance - def create( - unique_name: nil, - friendly_name: :unset, - actions: :unset, - actions_url: :unset - ) - - data = Twilio::Values.of({ - 'UniqueName' => unique_name, - 'FriendlyName' => friendly_name, - 'Actions' => Twilio.serialize_object(actions), - 'ActionsUrl' => actions_url, - }) - - payload = @version.create('POST', @uri, data: data) - TaskInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - ) - end - - - ## - # Lists TaskInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @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(limit: nil, page_size: nil) - self.stream( - 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 [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(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields TaskInstance 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], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of TaskInstance records from the API. - # Request is executed immediately. - # @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 TaskInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - TaskPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of TaskInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of TaskInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - TaskPage.new(@version, response, @solution) - 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 TaskContext < InstanceContext - ## - # Initialize the TaskContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The unique ID of the Assistant. - # @param [String] sid A 34 character string that uniquely identifies this resource. - # @return [TaskContext] TaskContext - def initialize(version, assistant_sid, sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, sid: sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:sid]}" - - # Dependents - @task_actions = nil - @statistics = nil - @samples = nil - @fields = nil - end - ## - # Delete the TaskInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - @version.delete('DELETE', @uri) - end - - ## - # Fetch the TaskInstance - # @return [TaskInstance] Fetched TaskInstance - def fetch - - payload = @version.fetch('GET', @uri) - TaskInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - ## - # Update the TaskInstance - # @param [String] friendly_name A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - # @param [String] unique_name A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - # @param [Object] actions A user-provided JSON object encoded as a string to specify the actions for this task. It is optional and non-unique. - # @param [String] actions_url User-provided HTTP endpoint where from the assistant fetches actions - # @return [TaskInstance] Updated TaskInstance - def update( - friendly_name: :unset, - unique_name: :unset, - actions: :unset, - actions_url: :unset - ) - - data = Twilio::Values.of({ - 'FriendlyName' => friendly_name, - 'UniqueName' => unique_name, - 'Actions' => Twilio.serialize_object(actions), - 'ActionsUrl' => actions_url, - }) - - payload = @version.update('POST', @uri, data: data) - TaskInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - sid: @solution[:sid], - ) - end - - ## - # Access the task_actions - # @return [TaskActionsList] - # @return [TaskActionsContext] - def task_actions - TaskActionsContext.new( - @version, - @solution[:assistant_sid], - @solution[:sid] - ) - end - ## - # Access the statistics - # @return [TaskStatisticsList] - # @return [TaskStatisticsContext] - def statistics - TaskStatisticsContext.new( - @version, - @solution[:assistant_sid], - @solution[:sid] - ) - end - ## - # Access the samples - # @return [SampleList] - # @return [SampleContext] if sid was passed. - def samples(sid=:unset) - - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return SampleContext.new(@version, @solution[:assistant_sid], @solution[:sid],sid ) - end - - unless @samples - @samples = SampleList.new( - @version, assistant_sid: @solution[:assistant_sid], task_sid: @solution[:sid], ) - end - - @samples - end - ## - # Access the fields - # @return [FieldList] - # @return [FieldContext] if sid was passed. - def fields(sid=:unset) - - raise ArgumentError, 'sid cannot be nil' if sid.nil? - - if sid != :unset - return FieldContext.new(@version, @solution[:assistant_sid], @solution[:sid],sid ) - end - - unless @fields - @fields = FieldList.new( - @version, assistant_sid: @solution[:assistant_sid], task_sid: @solution[:sid], ) - end - - @fields - end - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class TaskPage < Page - ## - # Initialize the TaskPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [TaskPage] TaskPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of TaskInstance - # @param [Hash] payload Payload response from the API - # @return [TaskInstance] TaskInstance - def get_instance(payload) - TaskInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class TaskInstance < InstanceResource - ## - # Initialize the TaskInstance - # @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 Task - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [TaskInstance] TaskInstance - def initialize(version, payload , assistant_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']), - 'friendly_name' => payload['friendly_name'], - 'links' => payload['links'], - 'assistant_sid' => payload['assistant_sid'], - 'sid' => payload['sid'], - 'unique_name' => payload['unique_name'], - 'actions_url' => payload['actions_url'], - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_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 [TaskContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = TaskContext.new(@version , @params['assistant_sid'], @params['sid']) - end - @instance_context - end - - ## - # @return [String] The unique ID of the Account that created this Task. - def account_sid - @properties['account_sid'] - end - - ## - # @return [Time] The date that this resource was created - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date that this resource was last updated - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - def friendly_name - @properties['friendly_name'] - end - - ## - # @return [Hash] - def links - @properties['links'] - end - - ## - # @return [String] The unique ID of the Assistant. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] A 34 character string that uniquely identifies this resource. - def sid - @properties['sid'] - end - - ## - # @return [String] A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - def unique_name - @properties['unique_name'] - end - - ## - # @return [String] User-provided HTTP endpoint where from the assistant fetches actions - def actions_url - @properties['actions_url'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # Delete the TaskInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the TaskInstance - # @return [TaskInstance] Fetched TaskInstance - def fetch - - context.fetch - end - - ## - # Update the TaskInstance - # @param [String] friendly_name A user-provided string that identifies this resource. It is non-unique and can up to 255 characters long. - # @param [String] unique_name A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - # @param [Object] actions A user-provided JSON object encoded as a string to specify the actions for this task. It is optional and non-unique. - # @param [String] actions_url User-provided HTTP endpoint where from the assistant fetches actions - # @return [TaskInstance] Updated TaskInstance - def update( - friendly_name: :unset, - unique_name: :unset, - actions: :unset, - actions_url: :unset - ) - - context.update( - friendly_name: friendly_name, - unique_name: unique_name, - actions: actions, - actions_url: actions_url, - ) - end - - ## - # Access the task_actions - # @return [task_actions] task_actions - def task_actions - context.task_actions - end - - ## - # Access the statistics - # @return [statistics] statistics - def statistics - context.statistics - end - - ## - # Access the samples - # @return [samples] samples - def samples - context.samples - end - - ## - # Access the fields - # @return [fields] fields - def fields - context.fields - 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 - - diff --git a/lib/twilio-ruby/rest/preview/understand/assistant/task/field.rb b/lib/twilio-ruby/rest/preview/understand/assistant/task/field.rb deleted file mode 100644 index 1d9f277ef..000000000 --- a/lib/twilio-ruby/rest/preview/understand/assistant/task/field.rb +++ /dev/null @@ -1,373 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# 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 Preview < PreviewBase - class Understand < Version - class AssistantContext < InstanceContext - class TaskContext < InstanceContext - - class FieldList < ListResource - ## - # Initialize the FieldList - # @param [Version] version Version that contains the resource - # @return [FieldList] FieldList - def initialize(version, assistant_sid: nil, task_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid, task_sid: task_sid } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Fields" - - end - ## - # Create the FieldInstance - # @param [String] field_type The unique name or sid of the FieldType. It can be any [Built-in Field Type](https://www.twilio.com/docs/assistant/api/built-in-field-types) or the unique_name or the Field Type sid of a custom Field Type. - # @param [String] unique_name A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - # @return [FieldInstance] Created FieldInstance - def create( - field_type: nil, - unique_name: nil - ) - - data = Twilio::Values.of({ - 'FieldType' => field_type, - 'UniqueName' => unique_name, - }) - - payload = @version.create('POST', @uri, data: data) - FieldInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - task_sid: @solution[:task_sid], - ) - end - - - ## - # Lists FieldInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @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(limit: nil, page_size: nil) - self.stream( - 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 [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(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields FieldInstance 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], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of FieldInstance records from the API. - # Request is executed immediately. - # @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 FieldInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - FieldPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of FieldInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of FieldInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - FieldPage.new(@version, response, @solution) - 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 FieldContext < InstanceContext - ## - # Initialize the FieldContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The unique ID of the Assistant. - # @param [String] task_sid The unique ID of the Task associated with this Field. - # @param [String] sid A 34 character string that uniquely identifies this resource. - # @return [FieldContext] FieldContext - def initialize(version, assistant_sid, task_sid, sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, task_sid: task_sid, sid: sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Fields/#{@solution[:sid]}" - - - end - ## - # Delete the FieldInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - @version.delete('DELETE', @uri) - end - - ## - # Fetch the FieldInstance - # @return [FieldInstance] Fetched FieldInstance - def fetch - - payload = @version.fetch('GET', @uri) - FieldInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - task_sid: @solution[:task_sid], - sid: @solution[:sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class FieldPage < Page - ## - # Initialize the FieldPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [FieldPage] FieldPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of FieldInstance - # @param [Hash] payload Payload response from the API - # @return [FieldInstance] FieldInstance - def get_instance(payload) - FieldInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], task_sid: @solution[:task_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class FieldInstance < InstanceResource - ## - # Initialize the FieldInstance - # @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 Field - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [FieldInstance] FieldInstance - def initialize(version, payload , assistant_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']), - 'field_type' => payload['field_type'], - 'task_sid' => payload['task_sid'], - 'assistant_sid' => payload['assistant_sid'], - 'sid' => payload['sid'], - 'unique_name' => payload['unique_name'], - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_sid'] ,'task_sid' => task_sid || @properties['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 [FieldContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = FieldContext.new(@version , @params['assistant_sid'], @params['task_sid'], @params['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 [Time] The date that this resource was created - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date that this resource was last updated - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] The Field Type of this field. It can be any [Built-in Field Type](https://www.twilio.com/docs/assistant/api/built-in-field-types) or the unique_name or sid of a custom Field Type. - def field_type - @properties['field_type'] - end - - ## - # @return [String] The unique ID of the Task associated with this Field. - def task_sid - @properties['task_sid'] - end - - ## - # @return [String] The unique ID of the parent Assistant. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] A 34 character string that uniquely identifies this resource. - def sid - @properties['sid'] - end - - ## - # @return [String] A user-provided string that uniquely identifies this resource as an alternative to the sid. Unique up to 64 characters long. - def unique_name - @properties['unique_name'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # Delete the FieldInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the FieldInstance - # @return [FieldInstance] Fetched FieldInstance - def fetch - - context.fetch - 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 - - diff --git a/lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb b/lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb deleted file mode 100644 index 8abd4845b..000000000 --- a/lib/twilio-ruby/rest/preview/understand/assistant/task/sample.rb +++ /dev/null @@ -1,436 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# 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 Preview < PreviewBase - class Understand < Version - class AssistantContext < InstanceContext - class TaskContext < InstanceContext - - class SampleList < ListResource - ## - # Initialize the SampleList - # @param [Version] version Version that contains the resource - # @return [SampleList] SampleList - def initialize(version, assistant_sid: nil, task_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid, task_sid: task_sid } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Samples" - - end - ## - # Create the SampleInstance - # @param [String] language An ISO language-country string of the sample. - # @param [String] tagged_text The text example of how end-users may express this task. The sample may contain Field tag blocks. - # @param [String] source_channel The communication channel the sample was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or *slack*. If not included the value will be null - # @return [SampleInstance] Created SampleInstance - def create( - language: nil, - tagged_text: nil, - source_channel: :unset - ) - - data = Twilio::Values.of({ - 'Language' => language, - 'TaggedText' => tagged_text, - 'SourceChannel' => source_channel, - }) - - payload = @version.create('POST', @uri, data: data) - SampleInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - task_sid: @solution[:task_sid], - ) - end - - - ## - # Lists SampleInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @param [String] language An ISO language-country string of the sample. - # @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(language: :unset, limit: nil, page_size: nil) - self.stream( - language: language, - 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 [String] language An ISO language-country string of the sample. - # @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(language: :unset, limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - language: language, - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields SampleInstance 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], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of SampleInstance records from the API. - # Request is executed immediately. - # @param [String] language An ISO language-country string of the sample. - # @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 SampleInstance - def page(language: :unset, page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'Language' => language, - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - SamplePage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of SampleInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of SampleInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - SamplePage.new(@version, response, @solution) - 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 SampleContext < InstanceContext - ## - # Initialize the SampleContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The unique ID of the Assistant. - # @param [String] task_sid The unique ID of the Task associated with this Sample. - # @param [String] sid A 34 character string that uniquely identifies this resource. - # @return [SampleContext] SampleContext - def initialize(version, assistant_sid, task_sid, sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, task_sid: task_sid, sid: sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Samples/#{@solution[:sid]}" - - - end - ## - # Delete the SampleInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - @version.delete('DELETE', @uri) - end - - ## - # Fetch the SampleInstance - # @return [SampleInstance] Fetched SampleInstance - def fetch - - payload = @version.fetch('GET', @uri) - SampleInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - task_sid: @solution[:task_sid], - sid: @solution[:sid], - ) - end - - ## - # Update the SampleInstance - # @param [String] language An ISO language-country string of the sample. - # @param [String] tagged_text The text example of how end-users may express this task. The sample may contain Field tag blocks. - # @param [String] source_channel The communication channel the sample was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or *slack*. If not included the value will be null - # @return [SampleInstance] Updated SampleInstance - def update( - language: :unset, - tagged_text: :unset, - source_channel: :unset - ) - - data = Twilio::Values.of({ - 'Language' => language, - 'TaggedText' => tagged_text, - 'SourceChannel' => source_channel, - }) - - payload = @version.update('POST', @uri, data: data) - SampleInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - task_sid: @solution[:task_sid], - sid: @solution[:sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class SamplePage < Page - ## - # Initialize the SamplePage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [SamplePage] SamplePage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of SampleInstance - # @param [Hash] payload Payload response from the API - # @return [SampleInstance] SampleInstance - def get_instance(payload) - SampleInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], task_sid: @solution[:task_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class SampleInstance < InstanceResource - ## - # Initialize the SampleInstance - # @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 Sample - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [SampleInstance] SampleInstance - def initialize(version, payload , assistant_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']), - 'task_sid' => payload['task_sid'], - 'language' => payload['language'], - 'assistant_sid' => payload['assistant_sid'], - 'sid' => payload['sid'], - 'tagged_text' => payload['tagged_text'], - 'url' => payload['url'], - 'source_channel' => payload['source_channel'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_sid'] ,'task_sid' => task_sid || @properties['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 [SampleContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = SampleContext.new(@version , @params['assistant_sid'], @params['task_sid'], @params['sid']) - end - @instance_context - end - - ## - # @return [String] The unique ID of the Account that created this Sample. - def account_sid - @properties['account_sid'] - end - - ## - # @return [Time] The date that this resource was created - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date that this resource was last updated - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] The unique ID of the Task associated with this Sample. - def task_sid - @properties['task_sid'] - end - - ## - # @return [String] An ISO language-country string of the sample. - def language - @properties['language'] - end - - ## - # @return [String] The unique ID of the Assistant. - def assistant_sid - @properties['assistant_sid'] - end - - ## - # @return [String] A 34 character string that uniquely identifies this resource. - def sid - @properties['sid'] - end - - ## - # @return [String] The text example of how end-users may express this task. The sample may contain Field tag blocks. - def tagged_text - @properties['tagged_text'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # @return [String] The communication channel the sample was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or *slack*. If not included the value will be null - def source_channel - @properties['source_channel'] - end - - ## - # Delete the SampleInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the SampleInstance - # @return [SampleInstance] Fetched SampleInstance - def fetch - - context.fetch - end - - ## - # Update the SampleInstance - # @param [String] language An ISO language-country string of the sample. - # @param [String] tagged_text The text example of how end-users may express this task. The sample may contain Field tag blocks. - # @param [String] source_channel The communication channel the sample was captured. It can be: *voice*, *sms*, *chat*, *alexa*, *google-assistant*, or *slack*. If not included the value will be null - # @return [SampleInstance] Updated SampleInstance - def update( - language: :unset, - tagged_text: :unset, - source_channel: :unset - ) - - context.update( - language: language, - tagged_text: tagged_text, - source_channel: source_channel, - ) - 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 - - diff --git a/lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb b/lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb deleted file mode 100644 index bd2c4b187..000000000 --- a/lib/twilio-ruby/rest/preview/understand/assistant/task/task_actions.rb +++ /dev/null @@ -1,253 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# 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 Preview < PreviewBase - class Understand < Version - class AssistantContext < InstanceContext - class TaskContext < InstanceContext - - class TaskActionsList < ListResource - ## - # Initialize the TaskActionsList - # @param [Version] version Version that contains the resource - # @return [TaskActionsList] TaskActionsList - def initialize(version, assistant_sid: nil, task_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid, task_sid: task_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 TaskActionsContext < InstanceContext - ## - # Initialize the TaskActionsContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The unique ID of the parent Assistant. - # @param [String] task_sid The unique ID of the Task. - # @return [TaskActionsContext] TaskActionsContext - def initialize(version, assistant_sid, task_sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, task_sid: task_sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Actions" - - - end - ## - # Fetch the TaskActionsInstance - # @return [TaskActionsInstance] Fetched TaskActionsInstance - def fetch - - payload = @version.fetch('GET', @uri) - TaskActionsInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - task_sid: @solution[:task_sid], - ) - end - - ## - # Update the TaskActionsInstance - # @param [Object] actions The JSON actions that instruct the Assistant how to perform this task. - # @return [TaskActionsInstance] Updated TaskActionsInstance - def update( - actions: :unset - ) - - data = Twilio::Values.of({ - 'Actions' => Twilio.serialize_object(actions), - }) - - payload = @version.update('POST', @uri, data: data) - TaskActionsInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - task_sid: @solution[:task_sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class TaskActionsPage < Page - ## - # Initialize the TaskActionsPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [TaskActionsPage] TaskActionsPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of TaskActionsInstance - # @param [Hash] payload Payload response from the API - # @return [TaskActionsInstance] TaskActionsInstance - def get_instance(payload) - TaskActionsInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], task_sid: @solution[:task_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class TaskActionsInstance < InstanceResource - ## - # Initialize the TaskActionsInstance - # @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 TaskActions - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [TaskActionsInstance] TaskActionsInstance - def initialize(version, payload , assistant_sid: nil, task_sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'account_sid' => payload['account_sid'], - 'assistant_sid' => payload['assistant_sid'], - 'task_sid' => payload['task_sid'], - 'url' => payload['url'], - 'data' => payload['data'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_sid'] ,'task_sid' => task_sid || @properties['task_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 [TaskActionsContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = TaskActionsContext.new(@version , @params['assistant_sid'], @params['task_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 Task. - def task_sid - @properties['task_sid'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # @return [Hash] - def data - @properties['data'] - end - - ## - # Fetch the TaskActionsInstance - # @return [TaskActionsInstance] Fetched TaskActionsInstance - def fetch - - context.fetch - end - - ## - # Update the TaskActionsInstance - # @param [Object] actions The JSON actions that instruct the Assistant how to perform this task. - # @return [TaskActionsInstance] Updated TaskActionsInstance - 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 - - diff --git a/lib/twilio-ruby/rest/preview/understand/assistant/task/task_statistics.rb b/lib/twilio-ruby/rest/preview/understand/assistant/task/task_statistics.rb deleted file mode 100644 index 29a845ecc..000000000 --- a/lib/twilio-ruby/rest/preview/understand/assistant/task/task_statistics.rb +++ /dev/null @@ -1,226 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# 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 Preview < PreviewBase - class Understand < Version - class AssistantContext < InstanceContext - class TaskContext < InstanceContext - - class TaskStatisticsList < ListResource - ## - # Initialize the TaskStatisticsList - # @param [Version] version Version that contains the resource - # @return [TaskStatisticsList] TaskStatisticsList - def initialize(version, assistant_sid: nil, task_sid: nil) - super(version) - # Path Solution - @solution = { assistant_sid: assistant_sid, task_sid: task_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 TaskStatisticsContext < InstanceContext - ## - # Initialize the TaskStatisticsContext - # @param [Version] version Version that contains the resource - # @param [String] assistant_sid The unique ID of the parent Assistant. - # @param [String] task_sid The unique ID of the Task associated with this Field. - # @return [TaskStatisticsContext] TaskStatisticsContext - def initialize(version, assistant_sid, task_sid) - super(version) - - # Path Solution - @solution = { assistant_sid: assistant_sid, task_sid: task_sid, } - @uri = "/Assistants/#{@solution[:assistant_sid]}/Tasks/#{@solution[:task_sid]}/Statistics" - - - end - ## - # Fetch the TaskStatisticsInstance - # @return [TaskStatisticsInstance] Fetched TaskStatisticsInstance - def fetch - - payload = @version.fetch('GET', @uri) - TaskStatisticsInstance.new( - @version, - payload, - assistant_sid: @solution[:assistant_sid], - task_sid: @solution[:task_sid], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class TaskStatisticsPage < Page - ## - # Initialize the TaskStatisticsPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [TaskStatisticsPage] TaskStatisticsPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of TaskStatisticsInstance - # @param [Hash] payload Payload response from the API - # @return [TaskStatisticsInstance] TaskStatisticsInstance - def get_instance(payload) - TaskStatisticsInstance.new(@version, payload, assistant_sid: @solution[:assistant_sid], task_sid: @solution[:task_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class TaskStatisticsInstance < InstanceResource - ## - # Initialize the TaskStatisticsInstance - # @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 TaskStatistics - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [TaskStatisticsInstance] TaskStatisticsInstance - def initialize(version, payload , assistant_sid: nil, task_sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'account_sid' => payload['account_sid'], - 'assistant_sid' => payload['assistant_sid'], - 'task_sid' => payload['task_sid'], - 'samples_count' => payload['samples_count'] == nil ? payload['samples_count'] : payload['samples_count'].to_i, - 'fields_count' => payload['fields_count'] == nil ? payload['fields_count'] : payload['fields_count'].to_i, - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { 'assistant_sid' => assistant_sid || @properties['assistant_sid'] ,'task_sid' => task_sid || @properties['task_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 [TaskStatisticsContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = TaskStatisticsContext.new(@version , @params['assistant_sid'], @params['task_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 Task associated with this Field. - def task_sid - @properties['task_sid'] - end - - ## - # @return [String] The total number of Samples associated with this Task. - def samples_count - @properties['samples_count'] - end - - ## - # @return [String] The total number of Fields associated with this Task. - def fields_count - @properties['fields_count'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # Fetch the TaskStatisticsInstance - # @return [TaskStatisticsInstance] Fetched TaskStatisticsInstance - def fetch - - context.fetch - 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 - - diff --git a/lib/twilio-ruby/rest/preview_base.rb b/lib/twilio-ruby/rest/preview_base.rb index 5c9b43c69..68eaaf11a 100644 --- a/lib/twilio-ruby/rest/preview_base.rb +++ b/lib/twilio-ruby/rest/preview_base.rb @@ -25,7 +25,6 @@ def initialize(twilio) @hosted_numbers = nil @sync = nil @marketplace = nil - @understand = nil @wireless = nil end @@ -45,10 +44,6 @@ def marketplace @marketplace ||= Preview::Marketplace.new self end - def understand - @understand ||= Preview::Understand.new self - end - def wireless @wireless ||= Preview::Wireless.new self end