Reference documentation and code samples for the Dialogflow V2 API class Google::Cloud::Dialogflow::V2::Contexts::Client.
Client for the Contexts service.
Service for managing Contexts.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the Contexts Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all Contexts clients ::Google::Cloud::Dialogflow::V2::Contexts::Client.configure do |config| config.timeout = 10.0 end
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the Contexts 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_context
def create_context(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Context
def create_context(parent: nil, context: nil) -> ::Google::Cloud::Dialogflow::V2::Context
Creates a context.
If the specified context already exists, overrides the context.
def create_context(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Context
create_context
via a request object, either of type
Google::Cloud::Dialogflow::V2::CreateContextRequest or an equivalent Hash.
- request (::Google::Cloud::Dialogflow::V2::CreateContextRequest, ::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_context(parent: nil, context: nil) -> ::Google::Cloud::Dialogflow::V2::Context
create_context
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 session to create a context for.
Format:
projects/<Project ID>/agent/sessions/<Session ID>
orprojects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>
. IfEnvironment ID
is not specified, we assume default 'draft' environment. IfUser ID
is not specified, we assume default '-' user. - context (::Google::Cloud::Dialogflow::V2::Context, ::Hash) — Required. The context to create.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Dialogflow::V2::Context)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC 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::Contexts::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Dialogflow::V2::CreateContextRequest.new # Call the create_context method. result = client.create_context request # The returned object is of type Google::Cloud::Dialogflow::V2::Context. p result
#delete_all_contexts
def delete_all_contexts(request, options = nil) -> ::Google::Protobuf::Empty
def delete_all_contexts(parent: nil) -> ::Google::Protobuf::Empty
Deletes all active contexts in the specified session.
def delete_all_contexts(request, options = nil) -> ::Google::Protobuf::Empty
delete_all_contexts
via a request object, either of type
DeleteAllContextsRequest or an equivalent Hash.
- request (::Google::Cloud::Dialogflow::V2::DeleteAllContextsRequest, ::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_all_contexts(parent: nil) -> ::Google::Protobuf::Empty
delete_all_contexts
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 name of the session to delete all contexts from. Format:
projects/<Project ID>/agent/sessions/<Session ID>
orprojects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>
. IfEnvironment ID
is not specified we assume default 'draft' environment. IfUser ID
is not specified, we assume default '-' user.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC 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::Contexts::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Dialogflow::V2::DeleteAllContextsRequest.new # Call the delete_all_contexts method. result = client.delete_all_contexts request # The returned object is of type Google::Protobuf::Empty. p result
#delete_context
def delete_context(request, options = nil) -> ::Google::Protobuf::Empty
def delete_context(name: nil) -> ::Google::Protobuf::Empty
Deletes the specified context.
def delete_context(request, options = nil) -> ::Google::Protobuf::Empty
delete_context
via a request object, either of type
DeleteContextRequest or an equivalent Hash.
- request (::Google::Cloud::Dialogflow::V2::DeleteContextRequest, ::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_context(name: nil) -> ::Google::Protobuf::Empty
delete_context
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 context to delete. Format:
projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>
orprojects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>/contexts/<Context ID>
. IfEnvironment ID
is not specified, we assume default 'draft' environment. IfUser ID
is not specified, we assume default '-' user.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Protobuf::Empty)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC 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::Contexts::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Dialogflow::V2::DeleteContextRequest.new # Call the delete_context method. result = client.delete_context request # The returned object is of type Google::Protobuf::Empty. p result
#get_context
def get_context(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Context
def get_context(name: nil) -> ::Google::Cloud::Dialogflow::V2::Context
Retrieves the specified context.
def get_context(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Context
get_context
via a request object, either of type
GetContextRequest or an equivalent Hash.
- request (::Google::Cloud::Dialogflow::V2::GetContextRequest, ::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_context(name: nil) -> ::Google::Cloud::Dialogflow::V2::Context
get_context
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 context. Format:
projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID>
orprojects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>/contexts/<Context ID>
. IfEnvironment ID
is not specified, we assume default 'draft' environment. IfUser ID
is not specified, we assume default '-' user.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Dialogflow::V2::Context)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC 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::Contexts::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Dialogflow::V2::GetContextRequest.new # Call the get_context method. result = client.get_context request # The returned object is of type Google::Cloud::Dialogflow::V2::Context. p result
#initialize
def initialize() { |config| ... } -> Client
Create a new Contexts client object.
- (config) — Configure the Contexts client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Dialogflow::V2::Contexts::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Dialogflow::V2::Contexts::Client.new do |config| config.timeout = 10.0 end
#list_contexts
def list_contexts(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Context>
def list_contexts(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Context>
Returns the list of all contexts in the specified session.
def list_contexts(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Context>
list_contexts
via a request object, either of type
ListContextsRequest or an equivalent Hash.
- request (::Google::Cloud::Dialogflow::V2::ListContextsRequest, ::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_contexts(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Context>
list_contexts
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 session to list all contexts from.
Format:
projects/<Project ID>/agent/sessions/<Session ID>
orprojects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>
. IfEnvironment ID
is not specified, we assume default 'draft' environment. IfUser ID
is not specified, we assume default '-' user. - page_size (::Integer) — Optional. The maximum number of items to return in a single page. By default 100 and at most 1000.
- page_token (::String) — Optional. The next_page_token value returned from a previous list request.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Context>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Context>)
- (::Google::Cloud::Error) — if the RPC 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::Contexts::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Dialogflow::V2::ListContextsRequest.new # Call the list_contexts method. result = client.list_contexts 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::Context. p item end
#location_client
def location_client() -> Google::Cloud::Location::Locations::Client
Get the associated client for mix-in of the Locations.
- (Google::Cloud::Location::Locations::Client)
#update_context
def update_context(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Context
def update_context(context: nil, update_mask: nil) -> ::Google::Cloud::Dialogflow::V2::Context
Updates the specified context.
def update_context(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Context
update_context
via a request object, either of type
UpdateContextRequest or an equivalent Hash.
- request (::Google::Cloud::Dialogflow::V2::UpdateContextRequest, ::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_context(context: nil, update_mask: nil) -> ::Google::Cloud::Dialogflow::V2::Context
update_context
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).
- context (::Google::Cloud::Dialogflow::V2::Context, ::Hash) — Required. The context to update.
- update_mask (::Google::Protobuf::FieldMask, ::Hash) — Optional. The mask to control which fields get updated.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Dialogflow::V2::Context)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC 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::Contexts::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Dialogflow::V2::UpdateContextRequest.new # Call the update_context method. result = client.update_context request # The returned object is of type Google::Cloud::Dialogflow::V2::Context. p result