Reference documentation and code samples for the Dialogflow V2 API class Google::Cloud::Dialogflow::V2::KnowledgeBases::Rest::Client.
REST client for the KnowledgeBases service.
Service for managing KnowledgeBases.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the KnowledgeBases Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all KnowledgeBases clients ::Google::Cloud::Dialogflow::V2::KnowledgeBases::Rest::Client.configure do |config| config.timeout = 10.0 end
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the KnowledgeBases Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#create_knowledge_base
def create_knowledge_base(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::KnowledgeBase
def create_knowledge_base(parent: nil, knowledge_base: nil) -> ::Google::Cloud::Dialogflow::V2::KnowledgeBase
Creates a knowledge base.
def create_knowledge_base(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::KnowledgeBase
create_knowledge_base
via a request object, either of type
CreateKnowledgeBaseRequest or an equivalent Hash.
- request (::Google::Cloud::Dialogflow::V2::CreateKnowledgeBaseRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_knowledge_base(parent: nil, knowledge_base: nil) -> ::Google::Cloud::Dialogflow::V2::KnowledgeBase
create_knowledge_base
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The project to create a knowledge base for.
Format:
projects/<Project ID>/locations/<Location ID>
. - knowledge_base (::Google::Cloud::Dialogflow::V2::KnowledgeBase, ::Hash) — Required. The knowledge base to create.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Dialogflow::V2::KnowledgeBase)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/dialogflow/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Dialogflow::V2::KnowledgeBases::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Dialogflow::V2::CreateKnowledgeBaseRequest.new # Call the create_knowledge_base method. result = client.create_knowledge_base request # The returned object is of type Google::Cloud::Dialogflow::V2::KnowledgeBase. p result
#delete_knowledge_base
def delete_knowledge_base(request, options = nil) -> ::Google::Protobuf::Empty
def delete_knowledge_base(name: nil, force: nil) -> ::Google::Protobuf::Empty
Deletes the specified knowledge base.
def delete_knowledge_base(request, options = nil) -> ::Google::Protobuf::Empty
delete_knowledge_base
via a request object, either of type
DeleteKnowledgeBaseRequest or an equivalent Hash.
- request (::Google::Cloud::Dialogflow::V2::DeleteKnowledgeBaseRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete_knowledge_base(name: nil, force: nil) -> ::Google::Protobuf::Empty
delete_knowledge_base
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. The name of the knowledge base to delete.
Format:
projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>
. - force (::Boolean) — Optional. Force deletes the knowledge base. When set to true, any documents in the knowledge base are also deleted.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Protobuf::Empty)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/dialogflow/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Dialogflow::V2::KnowledgeBases::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Dialogflow::V2::DeleteKnowledgeBaseRequest.new # Call the delete_knowledge_base method. result = client.delete_knowledge_base request # The returned object is of type Google::Protobuf::Empty. p result
#get_knowledge_base
def get_knowledge_base(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::KnowledgeBase
def get_knowledge_base(name: nil) -> ::Google::Cloud::Dialogflow::V2::KnowledgeBase
Retrieves the specified knowledge base.
def get_knowledge_base(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::KnowledgeBase
get_knowledge_base
via a request object, either of type
GetKnowledgeBaseRequest or an equivalent Hash.
- request (::Google::Cloud::Dialogflow::V2::GetKnowledgeBaseRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_knowledge_base(name: nil) -> ::Google::Cloud::Dialogflow::V2::KnowledgeBase
get_knowledge_base
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. The name of the knowledge base to retrieve.
Format
projects/<Project ID>/locations/<Location ID>/knowledgeBases/<Knowledge Base ID>
.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Dialogflow::V2::KnowledgeBase)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/dialogflow/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Dialogflow::V2::KnowledgeBases::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Dialogflow::V2::GetKnowledgeBaseRequest.new # Call the get_knowledge_base method. result = client.get_knowledge_base request # The returned object is of type Google::Cloud::Dialogflow::V2::KnowledgeBase. p result
#initialize
def initialize() { |config| ... } -> Client
Create a new KnowledgeBases REST client object.
- (config) — Configure the KnowledgeBases client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Dialogflow::V2::KnowledgeBases::Rest::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Dialogflow::V2::KnowledgeBases::Rest::Client.new do |config| config.timeout = 10.0 end
#list_knowledge_bases
def list_knowledge_bases(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::KnowledgeBase>
def list_knowledge_bases(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::KnowledgeBase>
Returns the list of all knowledge bases of the specified agent.
def list_knowledge_bases(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::KnowledgeBase>
list_knowledge_bases
via a request object, either of type
ListKnowledgeBasesRequest or an equivalent Hash.
- request (::Google::Cloud::Dialogflow::V2::ListKnowledgeBasesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_knowledge_bases(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::KnowledgeBase>
list_knowledge_bases
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. The project to list of knowledge bases for.
Format:
projects/<Project ID>/locations/<Location ID>
. - page_size (::Integer) — The maximum number of items to return in a single page. By default 10 and at most 100.
- page_token (::String) — The next_page_token value returned from a previous list request.
-
filter (::String) — The filter expression used to filter knowledge bases returned by the list
method. The expression has the following syntax:
The following fields and operators are supported:
- display_name with has(:) operator
- language_code with equals(=) operator
Examples:
- 'language_code=en-us' matches knowledge bases with en-us language code.
- 'display_name:articles' matches knowledge bases whose display name contains "articles".
- 'display_name:"Best Articles"' matches knowledge bases whose display name contains "Best Articles".
- 'language_code=en-gb AND display_name=articles' matches all knowledge bases whose display name contains "articles" and whose language code is "en-gb".
Note: An empty filter string (i.e. "") is a no-op and will result in no filtering.
For more information about filtering, see API Filtering.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::KnowledgeBase>)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::KnowledgeBase>)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/dialogflow/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Dialogflow::V2::KnowledgeBases::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Dialogflow::V2::ListKnowledgeBasesRequest.new # Call the list_knowledge_bases method. result = client.list_knowledge_bases request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::Dialogflow::V2::KnowledgeBase. p item end
#location_client
def location_client() -> Google::Cloud::Location::Locations::Rest::Client
Get the associated client for mix-in of the Locations.
- (Google::Cloud::Location::Locations::Rest::Client)
#logger
def logger() -> Logger
The logger used for request/response debug logging.
- (Logger)
#universe_domain
def universe_domain() -> String
The effective universe domain
- (String)
#update_knowledge_base
def update_knowledge_base(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::KnowledgeBase
def update_knowledge_base(knowledge_base: nil, update_mask: nil) -> ::Google::Cloud::Dialogflow::V2::KnowledgeBase
Updates the specified knowledge base.
def update_knowledge_base(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::KnowledgeBase
update_knowledge_base
via a request object, either of type
UpdateKnowledgeBaseRequest or an equivalent Hash.
- request (::Google::Cloud::Dialogflow::V2::UpdateKnowledgeBaseRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_knowledge_base(knowledge_base: nil, update_mask: nil) -> ::Google::Cloud::Dialogflow::V2::KnowledgeBase
update_knowledge_base
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- knowledge_base (::Google::Cloud::Dialogflow::V2::KnowledgeBase, ::Hash) — Required. The knowledge base to update.
-
update_mask (::Google::Protobuf::FieldMask, ::Hash) — Optional. Not specified means
update all
. Currently, onlydisplay_name
can be updated, an InvalidArgument will be returned for attempting to update other fields.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Dialogflow::V2::KnowledgeBase)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/dialogflow/v2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Dialogflow::V2::KnowledgeBases::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Dialogflow::V2::UpdateKnowledgeBaseRequest.new # Call the update_knowledge_base method. result = client.update_knowledge_base request # The returned object is of type Google::Cloud::Dialogflow::V2::KnowledgeBase. p result