diff --git a/CHANGES.md b/CHANGES.md index cb76025f1..354480f3a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,17 @@ twilio-ruby changelog ===================== +[2024-09-25] Version 7.3.2 +-------------------------- +**Accounts** +- Update docs and mounts. +- Change library visibility to public +- Enable consent and contact bulk upsert APIs in prod. + +**Serverless** +- Add is_plugin parameter in deployments api to check if it is plugins deployment + + [2024-09-18] Version 7.3.1 -------------------------- **Intelligence** diff --git a/lib/twilio-ruby/rest/accounts/v1.rb b/lib/twilio-ruby/rest/accounts/v1.rb index 2361e4d14..283c8f38b 100644 --- a/lib/twilio-ruby/rest/accounts/v1.rb +++ b/lib/twilio-ruby/rest/accounts/v1.rb @@ -22,6 +22,8 @@ def initialize(domain) super @version = 'v1' @auth_token_promotion = nil + @bulk_consents = nil + @bulk_contacts = nil @credentials = nil @safelist = nil @secondary_auth_token = nil @@ -33,6 +35,16 @@ def auth_token_promotion @auth_token_promotion ||= AuthTokenPromotionContext.new self end ## + # @return [Twilio::REST::Accounts::V1::BulkConsentsList] + def bulk_consents + @bulk_consents ||= BulkConsentsList.new self + end + ## + # @return [Twilio::REST::Accounts::V1::BulkContactsList] + def bulk_contacts + @bulk_contacts ||= BulkContactsList.new self + end + ## # @return [Twilio::REST::Accounts::V1::CredentialList] def credentials @credentials ||= CredentialList.new self diff --git a/lib/twilio-ruby/rest/accounts/v1/bulk_consents.rb b/lib/twilio-ruby/rest/accounts/v1/bulk_consents.rb new file mode 100644 index 000000000..07a45cfa4 --- /dev/null +++ b/lib/twilio-ruby/rest/accounts/v1/bulk_consents.rb @@ -0,0 +1,133 @@ +## +# This code was generated by +# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ +# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ +# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ +# +# Twilio - Accounts +# 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 Accounts < AccountsBase + class V1 < Version + class BulkConsentsList < ListResource + + ## + # Initialize the BulkConsentsList + # @param [Version] version Version that contains the resource + # @return [BulkConsentsList] BulkConsentsList + def initialize(version) + super(version) + # Path Solution + @solution = { } + @uri = "/Consents/Bulk" + + end + ## + # Create the BulkConsentsInstance + # @param [Array[Hash]] items This is a list of objects that describes a contact's opt-in status. Each object contains the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID used to uniquely map the request item with the response item; `sender_id`, which can be either a valid messaging service SID or a from phone number; `status`, a string representing the consent status. Can be one of [`opt-in`, `opt-out`]; and `source`, a string indicating the medium through which the consent was collected. Can be one of [`website`, `offline`, `opt-in-message`, `opt-out-message`, `others`]. + # @return [BulkConsentsInstance] Created BulkConsentsInstance + def create( + items: nil + ) + + data = Twilio::Values.of({ + 'Items' => Twilio.serialize_list(items) { |e| Twilio.serialize_object(e) }, + }) + + headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) + + payload = @version.create('POST', @uri, data: data, headers: headers) + BulkConsentsInstance.new( + @version, + payload, + ) + end + + + + + # Provide a user friendly representation + def to_s + '#' + end + end + + class BulkConsentsPage < Page + ## + # Initialize the BulkConsentsPage + # @param [Version] version Version that contains the resource + # @param [Response] response Response from the API + # @param [Hash] solution Path solution for the resource + # @return [BulkConsentsPage] BulkConsentsPage + def initialize(version, response, solution) + super(version, response) + + # Path Solution + @solution = solution + end + + ## + # Build an instance of BulkConsentsInstance + # @param [Hash] payload Payload response from the API + # @return [BulkConsentsInstance] BulkConsentsInstance + def get_instance(payload) + BulkConsentsInstance.new(@version, payload) + end + + ## + # Provide a user friendly representation + def to_s + '' + end + end + class BulkConsentsInstance < InstanceResource + ## + # Initialize the BulkConsentsInstance + # @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 BulkConsents + # resource. + # @param [String] sid The SID of the Call resource to fetch. + # @return [BulkConsentsInstance] BulkConsentsInstance + def initialize(version, payload ) + super(version) + + # Marshaled Properties + @properties = { + 'items' => payload['items'], + } + end + + + ## + # @return [Hash] A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty. + def items + @properties['items'] + 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/accounts/v1/bulk_contacts.rb b/lib/twilio-ruby/rest/accounts/v1/bulk_contacts.rb new file mode 100644 index 000000000..09b1b8685 --- /dev/null +++ b/lib/twilio-ruby/rest/accounts/v1/bulk_contacts.rb @@ -0,0 +1,133 @@ +## +# This code was generated by +# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ +# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ +# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ +# +# Twilio - Accounts +# 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 Accounts < AccountsBase + class V1 < Version + class BulkContactsList < ListResource + + ## + # Initialize the BulkContactsList + # @param [Version] version Version that contains the resource + # @return [BulkContactsList] BulkContactsList + def initialize(version) + super(version) + # Path Solution + @solution = { } + @uri = "/Contacts/Bulk" + + end + ## + # Create the BulkContactsInstance + # @param [Array[Hash]] items A list of objects where each object represents a contact's details. Each object includes the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID that maps the response to the original request; `country_iso_code`, a string representing the country using the ISO format (e.g., US for the United States); and `zip_code`, a string representing the postal code. + # @return [BulkContactsInstance] Created BulkContactsInstance + def create( + items: nil + ) + + data = Twilio::Values.of({ + 'Items' => Twilio.serialize_list(items) { |e| Twilio.serialize_object(e) }, + }) + + headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) + + payload = @version.create('POST', @uri, data: data, headers: headers) + BulkContactsInstance.new( + @version, + payload, + ) + end + + + + + # Provide a user friendly representation + def to_s + '#' + end + end + + class BulkContactsPage < Page + ## + # Initialize the BulkContactsPage + # @param [Version] version Version that contains the resource + # @param [Response] response Response from the API + # @param [Hash] solution Path solution for the resource + # @return [BulkContactsPage] BulkContactsPage + def initialize(version, response, solution) + super(version, response) + + # Path Solution + @solution = solution + end + + ## + # Build an instance of BulkContactsInstance + # @param [Hash] payload Payload response from the API + # @return [BulkContactsInstance] BulkContactsInstance + def get_instance(payload) + BulkContactsInstance.new(@version, payload) + end + + ## + # Provide a user friendly representation + def to_s + '' + end + end + class BulkContactsInstance < InstanceResource + ## + # Initialize the BulkContactsInstance + # @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 BulkContacts + # resource. + # @param [String] sid The SID of the Call resource to fetch. + # @return [BulkContactsInstance] BulkContactsInstance + def initialize(version, payload ) + super(version) + + # Marshaled Properties + @properties = { + 'items' => payload['items'], + } + end + + + ## + # @return [Hash] A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty. + def items + @properties['items'] + 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/assistants/v1/assistant.rb b/lib/twilio-ruby/rest/assistants/v1/assistant.rb index 1c0246cb3..070c0d04a 100644 --- a/lib/twilio-ruby/rest/assistants/v1/assistant.rb +++ b/lib/twilio-ruby/rest/assistants/v1/assistant.rb @@ -326,7 +326,8 @@ def initialize(version, id) # Dependents @feedbacks = nil @messages = nil - @tools = nil + @assistants_tools = nil + @assistants_knowledge = nil end ## # Delete the AssistantInstance @@ -377,7 +378,7 @@ def update(assistants_v1_service_update_assistant_request: :unset def feedbacks unless @feedbacks @feedbacks = FeedbackList.new( - @version, ) + @version, id: @solution[:id], ) end @feedbacks end @@ -388,20 +389,47 @@ def feedbacks def messages unless @messages @messages = MessageList.new( - @version, ) + @version, id: @solution[:id], ) end @messages end ## - # Access the tools - # @return [ToolList] - # @return [ToolContext] - def tools - unless @tools - @tools = ToolList.new( + # Access the assistants_tools + # @return [AssistantsToolList] + # @return [AssistantsToolContext] if sid was passed. + def assistants_tools(id=:unset) + + raise ArgumentError, 'id cannot be nil' if id.nil? + + if id != :unset + return AssistantsToolContext.new(@version, @solution[:id],id ) + end + + unless @assistants_tools + @assistants_tools = AssistantsToolList.new( @version, ) - end - @tools + end + + @assistants_tools + end + ## + # Access the assistants_knowledge + # @return [AssistantsKnowledgeList] + # @return [AssistantsKnowledgeContext] if sid was passed. + def assistants_knowledge(id=:unset) + + raise ArgumentError, 'id cannot be nil' if id.nil? + + if id != :unset + return AssistantsKnowledgeContext.new(@version, @solution[:id],id ) + end + + unless @assistants_knowledge + @assistants_knowledge = AssistantsKnowledgeList.new( + @version, ) + end + + @assistants_knowledge end ## @@ -468,6 +496,7 @@ def initialize(version, payload , id: nil) 'model' => payload['model'], 'name' => payload['name'], 'owner' => payload['owner'], + 'url' => payload['url'], 'personality_prompt' => payload['personality_prompt'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), @@ -527,6 +556,12 @@ def owner @properties['owner'] end + ## + # @return [String] The url of the assistant resource. + def url + @properties['url'] + end + ## # @return [String] The personality prompt to be used for assistant. def personality_prompt @@ -599,10 +634,17 @@ def messages end ## - # Access the tools - # @return [tools] tools - def tools - context.tools + # Access the assistants_tools + # @return [assistants_tools] assistants_tools + def assistants_tools + context.assistants_tools + end + + ## + # Access the assistants_knowledge + # @return [assistants_knowledge] assistants_knowledge + def assistants_knowledge + context.assistants_knowledge end ## diff --git a/lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb b/lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb new file mode 100644 index 000000000..9e4aa4ff1 --- /dev/null +++ b/lib/twilio-ruby/rest/assistants/v1/assistant/assistants_knowledge.rb @@ -0,0 +1,355 @@ +## +# This code was generated by +# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ +# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ +# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ +# +# Twilio - Assistants +# 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 Assistants < AssistantsBase + class V1 < Version + class AssistantContext < InstanceContext + + class AssistantsKnowledgeList < ListResource + + ## + # Initialize the AssistantsKnowledgeList + # @param [Version] version Version that contains the resource + # @return [AssistantsKnowledgeList] AssistantsKnowledgeList + def initialize(version, assistant_id: nil) + super(version) + # Path Solution + @solution = { assistant_id: assistant_id } + @uri = "/Assistants/#{@solution[:assistant_id]}/Knowledge" + + end + + ## + # Lists AssistantsKnowledgeInstance 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 AssistantsKnowledgeInstance 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 AssistantsKnowledgeInstance 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 AssistantsKnowledgeInstance + 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) + + AssistantsKnowledgePage.new(@version, response, @solution) + end + + ## + # Retrieve a single page of AssistantsKnowledgeInstance records from the API. + # Request is executed immediately. + # @param [String] target_url API-generated URL for the requested results page + # @return [Page] Page of AssistantsKnowledgeInstance + def get_page(target_url) + response = @version.domain.request( + 'GET', + target_url + ) + AssistantsKnowledgePage.new(@version, response, @solution) + end + + + + # Provide a user friendly representation + def to_s + '#' + end + end + + + class AssistantsKnowledgeContext < InstanceContext + ## + # Initialize the AssistantsKnowledgeContext + # @param [Version] version Version that contains the resource + # @param [String] assistant_id The assistant ID. + # @param [String] id The knowledge ID. + # @return [AssistantsKnowledgeContext] AssistantsKnowledgeContext + def initialize(version, assistant_id, id) + super(version) + + # Path Solution + @solution = { assistant_id: assistant_id, id: id, } + @uri = "/Assistants/#{@solution[:assistant_id]}/Knowledge/#{@solution[:id]}" + + + end + ## + # Create the AssistantsKnowledgeInstance + # @return [AssistantsKnowledgeInstance] Created AssistantsKnowledgeInstance + def create + + headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) + + payload = @version.create('POST', @uri, headers: headers) + AssistantsKnowledgeInstance.new( + @version, + payload, + assistant_id: @solution[:assistant_id], + id: @solution[:id], + ) + end + + ## + # Delete the AssistantsKnowledgeInstance + # @return [Boolean] True if delete succeeds, false otherwise + def delete + + headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) + + @version.delete('DELETE', @uri, headers: headers) + 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 AssistantsKnowledgePage < Page + ## + # Initialize the AssistantsKnowledgePage + # @param [Version] version Version that contains the resource + # @param [Response] response Response from the API + # @param [Hash] solution Path solution for the resource + # @return [AssistantsKnowledgePage] AssistantsKnowledgePage + def initialize(version, response, solution) + super(version, response) + + # Path Solution + @solution = solution + end + + ## + # Build an instance of AssistantsKnowledgeInstance + # @param [Hash] payload Payload response from the API + # @return [AssistantsKnowledgeInstance] AssistantsKnowledgeInstance + def get_instance(payload) + AssistantsKnowledgeInstance.new(@version, payload, assistant_id: @solution[:assistant_id]) + end + + ## + # Provide a user friendly representation + def to_s + '' + end + end + class AssistantsKnowledgeInstance < InstanceResource + ## + # Initialize the AssistantsKnowledgeInstance + # @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 AssistantsKnowledge + # resource. + # @param [String] sid The SID of the Call resource to fetch. + # @return [AssistantsKnowledgeInstance] AssistantsKnowledgeInstance + def initialize(version, payload , assistant_id: nil, id: nil) + super(version) + + # Marshaled Properties + @properties = { + 'description' => payload['description'], + 'id' => payload['id'], + 'account_sid' => payload['account_sid'], + 'knowledge_source_details' => payload['knowledge_source_details'], + 'name' => payload['name'], + 'status' => payload['status'], + 'type' => payload['type'], + 'url' => payload['url'], + 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), + 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), + } + + # Context + @instance_context = nil + @params = { 'assistant_id' => assistant_id || @properties['assistant_id'] ,'id' => id || @properties['id'] , } + 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 [AssistantsKnowledgeContext] CallContext for this CallInstance + def context + unless @instance_context + @instance_context = AssistantsKnowledgeContext.new(@version , @params['assistant_id'], @params['id']) + end + @instance_context + end + + ## + # @return [String] The type of knowledge source. + def description + @properties['description'] + end + + ## + # @return [String] The description of knowledge. + def id + @properties['id'] + end + + ## + # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource. + def account_sid + @properties['account_sid'] + end + + ## + # @return [Hash] The details of the knowledge source based on the type. + def knowledge_source_details + @properties['knowledge_source_details'] + end + + ## + # @return [String] The name of the knowledge source. + def name + @properties['name'] + end + + ## + # @return [String] The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED') + def status + @properties['status'] + end + + ## + # @return [String] The type of knowledge source ('Web', 'Database', 'Text', 'File') + def type + @properties['type'] + end + + ## + # @return [String] The url of the knowledge resource. + def url + @properties['url'] + end + + ## + # @return [Time] The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + def date_created + @properties['date_created'] + end + + ## + # @return [Time] The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + def date_updated + @properties['date_updated'] + end + + ## + # Create the AssistantsKnowledgeInstance + # @return [AssistantsKnowledgeInstance] Created AssistantsKnowledgeInstance + def create + + context.create + end + + ## + # Delete the AssistantsKnowledgeInstance + # @return [Boolean] True if delete succeeds, false otherwise + def delete + + context.delete + 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/assistants/v1/assistant/assistants_tool.rb b/lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb new file mode 100644 index 000000000..8d128104b --- /dev/null +++ b/lib/twilio-ruby/rest/assistants/v1/assistant/assistants_tool.rb @@ -0,0 +1,362 @@ +## +# This code was generated by +# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ +# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ +# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ +# +# Twilio - Assistants +# 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 Assistants < AssistantsBase + class V1 < Version + class AssistantContext < InstanceContext + + class AssistantsToolList < ListResource + + ## + # Initialize the AssistantsToolList + # @param [Version] version Version that contains the resource + # @return [AssistantsToolList] AssistantsToolList + def initialize(version, assistant_id: nil) + super(version) + # Path Solution + @solution = { assistant_id: assistant_id } + @uri = "/Assistants/#{@solution[:assistant_id]}/Tools" + + end + + ## + # Lists AssistantsToolInstance 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 AssistantsToolInstance 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 AssistantsToolInstance 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 AssistantsToolInstance + 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) + + AssistantsToolPage.new(@version, response, @solution) + end + + ## + # Retrieve a single page of AssistantsToolInstance records from the API. + # Request is executed immediately. + # @param [String] target_url API-generated URL for the requested results page + # @return [Page] Page of AssistantsToolInstance + def get_page(target_url) + response = @version.domain.request( + 'GET', + target_url + ) + AssistantsToolPage.new(@version, response, @solution) + end + + + + # Provide a user friendly representation + def to_s + '#' + end + end + + + class AssistantsToolContext < InstanceContext + ## + # Initialize the AssistantsToolContext + # @param [Version] version Version that contains the resource + # @param [String] assistant_id The assistant ID. + # @param [String] id The tool ID. + # @return [AssistantsToolContext] AssistantsToolContext + def initialize(version, assistant_id, id) + super(version) + + # Path Solution + @solution = { assistant_id: assistant_id, id: id, } + @uri = "/Assistants/#{@solution[:assistant_id]}/Tools/#{@solution[:id]}" + + + end + ## + # Create the AssistantsToolInstance + # @return [AssistantsToolInstance] Created AssistantsToolInstance + def create + + headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) + + payload = @version.create('POST', @uri, headers: headers) + AssistantsToolInstance.new( + @version, + payload, + assistant_id: @solution[:assistant_id], + id: @solution[:id], + ) + end + + ## + # Delete the AssistantsToolInstance + # @return [Boolean] True if delete succeeds, false otherwise + def delete + + headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) + + @version.delete('DELETE', @uri, headers: headers) + 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 AssistantsToolPage < Page + ## + # Initialize the AssistantsToolPage + # @param [Version] version Version that contains the resource + # @param [Response] response Response from the API + # @param [Hash] solution Path solution for the resource + # @return [AssistantsToolPage] AssistantsToolPage + def initialize(version, response, solution) + super(version, response) + + # Path Solution + @solution = solution + end + + ## + # Build an instance of AssistantsToolInstance + # @param [Hash] payload Payload response from the API + # @return [AssistantsToolInstance] AssistantsToolInstance + def get_instance(payload) + AssistantsToolInstance.new(@version, payload, assistant_id: @solution[:assistant_id]) + end + + ## + # Provide a user friendly representation + def to_s + '' + end + end + class AssistantsToolInstance < InstanceResource + ## + # Initialize the AssistantsToolInstance + # @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 AssistantsTool + # resource. + # @param [String] sid The SID of the Call resource to fetch. + # @return [AssistantsToolInstance] AssistantsToolInstance + def initialize(version, payload , assistant_id: nil, id: nil) + super(version) + + # Marshaled Properties + @properties = { + 'account_sid' => payload['account_sid'], + 'description' => payload['description'], + 'enabled' => payload['enabled'], + 'id' => payload['id'], + 'meta' => payload['meta'], + 'name' => payload['name'], + 'requires_auth' => payload['requires_auth'], + 'type' => payload['type'], + 'url' => payload['url'], + 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), + 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), + } + + # Context + @instance_context = nil + @params = { 'assistant_id' => assistant_id || @properties['assistant_id'] ,'id' => id || @properties['id'] , } + 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 [AssistantsToolContext] CallContext for this CallInstance + def context + unless @instance_context + @instance_context = AssistantsToolContext.new(@version , @params['assistant_id'], @params['id']) + end + @instance_context + end + + ## + # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Tool resource. + def account_sid + @properties['account_sid'] + end + + ## + # @return [String] The description of the tool. + def description + @properties['description'] + end + + ## + # @return [Boolean] True if the tool is enabled. + def enabled + @properties['enabled'] + end + + ## + # @return [String] The tool ID. + def id + @properties['id'] + end + + ## + # @return [Hash] The metadata related to method, url, input_schema to used with the Tool. + def meta + @properties['meta'] + end + + ## + # @return [String] The name of the tool. + def name + @properties['name'] + end + + ## + # @return [Boolean] The authentication requirement for the tool. + def requires_auth + @properties['requires_auth'] + end + + ## + # @return [String] The type of the tool. ('WEBHOOK') + def type + @properties['type'] + end + + ## + # @return [String] The url of the tool resource. + def url + @properties['url'] + end + + ## + # @return [Time] The date and time in GMT when the Tool was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + def date_created + @properties['date_created'] + end + + ## + # @return [Time] The date and time in GMT when the Tool was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + def date_updated + @properties['date_updated'] + end + + ## + # Create the AssistantsToolInstance + # @return [AssistantsToolInstance] Created AssistantsToolInstance + def create + + context.create + end + + ## + # Delete the AssistantsToolInstance + # @return [Boolean] True if delete succeeds, false otherwise + def delete + + context.delete + 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/assistants/v1/assistant/feedback.rb b/lib/twilio-ruby/rest/assistants/v1/assistant/feedback.rb index a3ec5c289..cc1283afb 100644 --- a/lib/twilio-ruby/rest/assistants/v1/assistant/feedback.rb +++ b/lib/twilio-ruby/rest/assistants/v1/assistant/feedback.rb @@ -17,7 +17,7 @@ module Twilio module REST class Assistants < AssistantsBase class V1 < Version - class Assistant < InstanceContext + class AssistantContext < InstanceContext class FeedbackList < ListResource diff --git a/lib/twilio-ruby/rest/assistants/v1/assistant/message.rb b/lib/twilio-ruby/rest/assistants/v1/assistant/message.rb new file mode 100644 index 000000000..86e51be85 --- /dev/null +++ b/lib/twilio-ruby/rest/assistants/v1/assistant/message.rb @@ -0,0 +1,201 @@ +## +# This code was generated by +# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ +# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ +# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ +# +# Twilio - Assistants +# 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 Assistants < AssistantsBase + class V1 < Version + class AssistantContext < InstanceContext + + class MessageList < ListResource + + class AssistantsV1ServiceAssistantSendMessageRequest + # @param [identity]: [String] The unique identity of user for the session. + # @param [session_id]: [String] The unique name for the session. + # @param [body]: [String] The query to ask the assistant. + # @param [webhook]: [String] The webhook url to call after the assistant has generated a response or report an error. + # @param [mode]: [String] one of the modes 'chat', 'email' or 'voice' + attr_accessor :identity, :session_id, :body, :webhook, :mode + def initialize(payload) + @identity = payload["identity"] + @session_id = payload["session_id"] + @body = payload["body"] + @webhook = payload["webhook"] + @mode = payload["mode"] + end + def to_json(options = {}) + { + identity: @identity, + session_id: @session_id, + body: @body, + webhook: @webhook, + mode: @mode, + }.to_json(options) + end + end + + ## + # Initialize the MessageList + # @param [Version] version Version that contains the resource + # @return [MessageList] MessageList + def initialize(version, id: nil) + super(version) + # Path Solution + @solution = { id: id } + @uri = "/Assistants/#{@solution[:id]}/Messages" + + end + ## + # Create the MessageInstance + # @param [AssistantsV1ServiceAssistantSendMessageRequest] assistants_v1_service_assistant_send_message_request + # @return [MessageInstance] Created MessageInstance + def create(assistants_v1_service_assistant_send_message_request: nil + ) + + headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) + headers['Content-Type'] = 'application/json' + payload = @version.create('POST', @uri, headers: headers, data: assistants_v1_service_assistant_send_message_request.to_json) + MessageInstance.new( + @version, + payload, + id: @solution[:id], + ) + end + + + + + # Provide a user friendly representation + def to_s + '#' + end + end + + class MessagePage < Page + ## + # Initialize the MessagePage + # @param [Version] version Version that contains the resource + # @param [Response] response Response from the API + # @param [Hash] solution Path solution for the resource + # @return [MessagePage] MessagePage + def initialize(version, response, solution) + super(version, response) + + # Path Solution + @solution = solution + end + + ## + # Build an instance of MessageInstance + # @param [Hash] payload Payload response from the API + # @return [MessageInstance] MessageInstance + def get_instance(payload) + MessageInstance.new(@version, payload, id: @solution[:id]) + end + + ## + # Provide a user friendly representation + def to_s + '' + end + end + class MessageInstance < InstanceResource + ## + # Initialize the MessageInstance + # @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 Message + # resource. + # @param [String] sid The SID of the Call resource to fetch. + # @return [MessageInstance] MessageInstance + def initialize(version, payload , id: nil) + super(version) + + # Marshaled Properties + @properties = { + 'status' => payload['status'], + 'flagged' => payload['flagged'], + 'aborted' => payload['aborted'], + 'session_id' => payload['session_id'], + 'account_sid' => payload['account_sid'], + 'body' => payload['body'], + 'error' => payload['error'], + } + end + + + ## + # @return [String] success or failure based on whether the request successfully generated a response. + def status + @properties['status'] + end + + ## + # @return [Boolean] If successful, this property will denote whether the response was flagged or not. + def flagged + @properties['flagged'] + end + + ## + # @return [Boolean] This property will denote whether the request was aborted or not. + def aborted + @properties['aborted'] + end + + ## + # @return [String] The unique name for the session. + def session_id + @properties['session_id'] + end + + ## + # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that sent the Message. + def account_sid + @properties['account_sid'] + end + + ## + # @return [String] If successful, the body of the generated response + def body + @properties['body'] + end + + ## + # @return [String] The error message if generation was not successful + def error + @properties['error'] + end + + ## + # Provide a user friendly representation + def to_s + "" + end + + ## + # Provide a detailed, user friendly representation + def inspect + "" + end + end + + end + end + end + end +end + + diff --git a/lib/twilio-ruby/rest/assistants/v1/knowledge.rb b/lib/twilio-ruby/rest/assistants/v1/knowledge.rb index 578e77b34..8af5a51b5 100644 --- a/lib/twilio-ruby/rest/assistants/v1/knowledge.rb +++ b/lib/twilio-ruby/rest/assistants/v1/knowledge.rb @@ -184,8 +184,7 @@ def initialize(version) # Path Solution @solution = { } @uri = "/Knowledge" - # Components - @search = nil + end ## # Create the KnowledgeInstance @@ -295,13 +294,6 @@ def get_page(target_url) end - ## - # Access the search - # @return [SearchList] - # @return [SearchContext] - def search - @search ||= SearchList.new(@version ) - end # Provide a user friendly representation def to_s @@ -325,7 +317,7 @@ def initialize(version, id) # Dependents @chunks = nil - @status = nil + @knowledge_status = nil end ## # Delete the KnowledgeInstance @@ -381,15 +373,14 @@ def chunks @chunks end ## - # Access the status - # @return [StatusList] - # @return [StatusContext] - def status - unless @status - @status = StatusList.new( - @version, ) - end - @status + # Access the knowledge_status + # @return [KnowledgeStatusList] + # @return [KnowledgeStatusContext] + def knowledge_status + KnowledgeStatusContext.new( + @version, + @solution[:id] + ) end ## @@ -457,6 +448,7 @@ def initialize(version, payload , id: nil) 'name' => payload['name'], 'status' => payload['status'], 'type' => payload['type'], + 'url' => payload['url'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), } @@ -519,6 +511,12 @@ def type @properties['type'] end + ## + # @return [String] The url of the knowledge resource. + def url + @properties['url'] + end + ## # @return [Time] The date and time in GMT when the Knowledge was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. def date_created @@ -566,10 +564,10 @@ def chunks end ## - # Access the status - # @return [status] status - def status - context.status + # Access the knowledge_status + # @return [knowledge_status] knowledge_status + def knowledge_status + context.knowledge_status end ## diff --git a/lib/twilio-ruby/rest/assistants/v1/knowledge/knowledge_status.rb b/lib/twilio-ruby/rest/assistants/v1/knowledge/knowledge_status.rb new file mode 100644 index 000000000..958fcffb8 --- /dev/null +++ b/lib/twilio-ruby/rest/assistants/v1/knowledge/knowledge_status.rb @@ -0,0 +1,209 @@ +## +# This code was generated by +# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ +# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ +# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ +# +# Twilio - Assistants +# 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 Assistants < AssistantsBase + class V1 < Version + class Knowledge < InstanceContext + + class KnowledgeStatusList < ListResource + + ## + # Initialize the KnowledgeStatusList + # @param [Version] version Version that contains the resource + # @return [KnowledgeStatusList] KnowledgeStatusList + def initialize(version, id: nil) + super(version) + # Path Solution + @solution = { id: id } + + + end + + + + # Provide a user friendly representation + def to_s + '#' + end + end + + + class KnowledgeStatusContext < InstanceContext + ## + # Initialize the KnowledgeStatusContext + # @param [Version] version Version that contains the resource + # @param [String] id the Knowledge ID. + # @return [KnowledgeStatusContext] KnowledgeStatusContext + def initialize(version, id) + super(version) + + # Path Solution + @solution = { id: id, } + @uri = "/Knowledge/#{@solution[:id]}/Status" + + + end + ## + # Fetch the KnowledgeStatusInstance + # @return [KnowledgeStatusInstance] Fetched KnowledgeStatusInstance + def fetch + + headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) + + payload = @version.fetch('GET', @uri, headers: headers) + KnowledgeStatusInstance.new( + @version, + payload, + id: @solution[:id], + ) + 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 KnowledgeStatusPage < Page + ## + # Initialize the KnowledgeStatusPage + # @param [Version] version Version that contains the resource + # @param [Response] response Response from the API + # @param [Hash] solution Path solution for the resource + # @return [KnowledgeStatusPage] KnowledgeStatusPage + def initialize(version, response, solution) + super(version, response) + + # Path Solution + @solution = solution + end + + ## + # Build an instance of KnowledgeStatusInstance + # @param [Hash] payload Payload response from the API + # @return [KnowledgeStatusInstance] KnowledgeStatusInstance + def get_instance(payload) + KnowledgeStatusInstance.new(@version, payload, id: @solution[:id]) + end + + ## + # Provide a user friendly representation + def to_s + '' + end + end + class KnowledgeStatusInstance < InstanceResource + ## + # Initialize the KnowledgeStatusInstance + # @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 KnowledgeStatus + # resource. + # @param [String] sid The SID of the Call resource to fetch. + # @return [KnowledgeStatusInstance] KnowledgeStatusInstance + def initialize(version, payload , id: nil) + super(version) + + # Marshaled Properties + @properties = { + 'account_sid' => payload['account_sid'], + 'status' => payload['status'], + 'last_status' => payload['last_status'], + 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), + } + + # Context + @instance_context = nil + @params = { 'id' => id || @properties['id'] , } + 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 [KnowledgeStatusContext] CallContext for this CallInstance + def context + unless @instance_context + @instance_context = KnowledgeStatusContext.new(@version , @params['id']) + end + @instance_context + end + + ## + # @return [String] The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Knowledge resource. + def account_sid + @properties['account_sid'] + end + + ## + # @return [String] The status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED') + def status + @properties['status'] + end + + ## + # @return [String] The last status of processing the knowledge source ('QUEUED', 'PROCESSING', 'COMPLETED', 'FAILED') + def last_status + @properties['last_status'] + end + + ## + # @return [Time] The date and time in GMT when the Knowledge was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. + def date_updated + @properties['date_updated'] + end + + ## + # Fetch the KnowledgeStatusInstance + # @return [KnowledgeStatusInstance] Fetched KnowledgeStatusInstance + 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/assistants/v1/tool.rb b/lib/twilio-ruby/rest/assistants/v1/tool.rb index d0697f1d6..cf9016939 100644 --- a/lib/twilio-ruby/rest/assistants/v1/tool.rb +++ b/lib/twilio-ruby/rest/assistants/v1/tool.rb @@ -345,6 +345,21 @@ def delete @version.delete('DELETE', @uri, headers: headers) end + ## + # Fetch the ToolInstance + # @return [ToolInstance] Fetched ToolInstance + def fetch + + headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) + + payload = @version.fetch('GET', @uri, headers: headers) + ToolInstance.new( + @version, + payload, + id: @solution[:id], + ) + end + ## # Update the ToolInstance # @param [AssistantsV1ServiceUpdateToolRequest] assistants_v1_service_update_tool_request @@ -429,8 +444,10 @@ def initialize(version, payload , id: nil) 'name' => payload['name'], 'requires_auth' => payload['requires_auth'], 'type' => payload['type'], + 'url' => payload['url'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), + 'policies' => payload['policies'], } # Context @@ -497,6 +514,12 @@ def type @properties['type'] end + ## + # @return [String] The url of the tool resource. + def url + @properties['url'] + end + ## # @return [Time] The date and time in GMT when the Tool was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. def date_created @@ -509,6 +532,12 @@ def date_updated @properties['date_updated'] end + ## + # @return [Array] The Policies associated with the tool. + def policies + @properties['policies'] + end + ## # Delete the ToolInstance # @return [Boolean] True if delete succeeds, false otherwise @@ -517,6 +546,14 @@ def delete context.delete end + ## + # Fetch the ToolInstance + # @return [ToolInstance] Fetched ToolInstance + def fetch + + context.fetch + end + ## # Update the ToolInstance # @param [AssistantsV1ServiceUpdateToolRequest] assistants_v1_service_update_tool_request diff --git a/lib/twilio-ruby/rest/numbers/v1.rb b/lib/twilio-ruby/rest/numbers/v1.rb index b2bc9d3fe..feb87fe09 100644 --- a/lib/twilio-ruby/rest/numbers/v1.rb +++ b/lib/twilio-ruby/rest/numbers/v1.rb @@ -28,8 +28,8 @@ def initialize(domain) @porting_portabilities = nil @porting_webhook_configurations = nil @porting_webhook_configurations_delete = nil - @porting_webhook_configuration_fetch = nil @signing_request_configurations = nil + @webhook = nil end ## @@ -135,16 +135,16 @@ def porting_webhook_configurations_delete(webhook_type=:unset) end end ## - # @return [Twilio::REST::Numbers::V1::PortingWebhookConfigurationFetchList] - def porting_webhook_configuration_fetch - @porting_webhook_configuration_fetch ||= PortingWebhookConfigurationFetchList.new self - end - ## # @return [Twilio::REST::Numbers::V1::SigningRequestConfigurationList] def signing_request_configurations @signing_request_configurations ||= SigningRequestConfigurationList.new self end ## + # @return [Twilio::REST::Numbers::V1::WebhookList] + def webhook + @webhook ||= WebhookList.new self + end + ## # Provide a user friendly representation def to_s ''; diff --git a/lib/twilio-ruby/rest/numbers/v1/porting_webhook_configuration_fetch.rb b/lib/twilio-ruby/rest/numbers/v1/webhook.rb similarity index 77% rename from lib/twilio-ruby/rest/numbers/v1/porting_webhook_configuration_fetch.rb rename to lib/twilio-ruby/rest/numbers/v1/webhook.rb index f7828065b..4a1cc0bd6 100644 --- a/lib/twilio-ruby/rest/numbers/v1/porting_webhook_configuration_fetch.rb +++ b/lib/twilio-ruby/rest/numbers/v1/webhook.rb @@ -17,12 +17,12 @@ module Twilio module REST class Numbers < NumbersBase class V1 < Version - class PortingWebhookConfigurationFetchList < ListResource + class WebhookList < ListResource ## - # Initialize the PortingWebhookConfigurationFetchList + # Initialize the WebhookList # @param [Version] version Version that contains the resource - # @return [PortingWebhookConfigurationFetchList] PortingWebhookConfigurationFetchList + # @return [WebhookList] WebhookList def initialize(version) super(version) # Path Solution @@ -31,14 +31,14 @@ def initialize(version) end ## - # Fetch the PortingWebhookConfigurationFetchInstance - # @return [PortingWebhookConfigurationFetchInstance] Fetched PortingWebhookConfigurationFetchInstance + # Fetch the WebhookInstance + # @return [WebhookInstance] Fetched WebhookInstance def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) - PortingWebhookConfigurationFetchInstance.new( + WebhookInstance.new( @version, payload, ) @@ -49,17 +49,17 @@ def fetch # Provide a user friendly representation def to_s - '#' + '#' end end - class PortingWebhookConfigurationFetchPage < Page + class WebhookPage < Page ## - # Initialize the PortingWebhookConfigurationFetchPage + # 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 [PortingWebhookConfigurationFetchPage] PortingWebhookConfigurationFetchPage + # @return [WebhookPage] WebhookPage def initialize(version, response, solution) super(version, response) @@ -68,29 +68,29 @@ def initialize(version, response, solution) end ## - # Build an instance of PortingWebhookConfigurationFetchInstance + # Build an instance of WebhookInstance # @param [Hash] payload Payload response from the API - # @return [PortingWebhookConfigurationFetchInstance] PortingWebhookConfigurationFetchInstance + # @return [WebhookInstance] WebhookInstance def get_instance(payload) - PortingWebhookConfigurationFetchInstance.new(@version, payload) + WebhookInstance.new(@version, payload) end ## # Provide a user friendly representation def to_s - '' + '' end end - class PortingWebhookConfigurationFetchInstance < InstanceResource + class WebhookInstance < InstanceResource ## - # Initialize the PortingWebhookConfigurationFetchInstance + # 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 PortingWebhookConfigurationFetch + # {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 [PortingWebhookConfigurationFetchInstance] PortingWebhookConfigurationFetchInstance + # @return [WebhookInstance] WebhookInstance def initialize(version, payload ) super(version) @@ -145,13 +145,13 @@ def port_out_target_date_created ## # Provide a user friendly representation def to_s - "" + "" end ## # Provide a detailed, user friendly representation def inspect - "" + "" end end diff --git a/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb b/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb index 135e9e38f..fe4b52abb 100644 --- a/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb +++ b/lib/twilio-ruby/rest/serverless/v1/service/environment/deployment.rb @@ -36,13 +36,16 @@ def initialize(version, service_sid: nil, environment_sid: nil) ## # Create the DeploymentInstance # @param [String] build_sid The SID of the Build for the Deployment. + # @param [Boolean] is_plugin Whether the Deployment is a plugin. # @return [DeploymentInstance] Created DeploymentInstance def create( - build_sid: :unset + build_sid: :unset, + is_plugin: :unset ) data = Twilio::Values.of({ 'BuildSid' => build_sid, + 'IsPlugin' => is_plugin, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })