Dialogflow V2 API - Class Google::Cloud::Dialogflow::V2::Contexts::Rest::Client (v0.27.0)

Reference documentation and code samples for the Dialogflow V2 API class Google::Cloud::Dialogflow::V2::Contexts::Rest::Client.

REST 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.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all Contexts clients
::Google::Cloud::Dialogflow::V2::Contexts::Rest::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.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#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.

Overloads
def create_context(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Context
Pass arguments to create_context via a request object, either of type Google::Cloud::Dialogflow::V2::CreateContextRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameters
  • parent (::String) — Required. The session to create a context for. Format: projects/<Project ID>/agent/sessions/<Session ID> or projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.
  • context (::Google::Cloud::Dialogflow::V2::Context, ::Hash) — Required. The context to create.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#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.

Overloads
def delete_all_contexts(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_all_contexts via a request object, either of type DeleteAllContextsRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameter
  • parent (::String) — Required. The name of the session to delete all contexts from. Format: projects/<Project ID>/agent/sessions/<Session ID> or projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>. If Environment ID is not specified we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#delete_context

def delete_context(request, options = nil) -> ::Google::Protobuf::Empty
def delete_context(name: nil) -> ::Google::Protobuf::Empty

Deletes the specified context.

Overloads
def delete_context(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_context via a request object, either of type DeleteContextRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameter
  • name (::String) — Required. The name of the context to delete. Format: projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID> or projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>/contexts/<Context ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#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.

Overloads
def get_context(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Context
Pass arguments to get_context via a request object, either of type GetContextRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameter
  • name (::String) — Required. The name of the context. Format: projects/<Project ID>/agent/sessions/<Session ID>/contexts/<Context ID> or projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>/contexts/<Context ID>. If Environment ID is not specified, we assume default 'draft' environment. If User ID is not specified, we assume default '-' user.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#initialize

def initialize() { |config| ... } -> Client

Create a new Contexts REST client object.

Yields
  • (config) — Configure the Contexts client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Dialogflow::V2::Contexts::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Dialogflow::V2::Contexts::Rest::Client.new do |config|
  config.timeout = 10.0
end

#list_contexts

def list_contexts(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Context>
def list_contexts(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Context>

Returns the list of all contexts in the specified session.

Overloads
def list_contexts(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Context>
Pass arguments to list_contexts via a request object, either of type ListContextsRequest or an equivalent Hash.
Parameters
  • 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::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Context>
Pass arguments to 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).
Parameters
  • parent (::String) — Required. The session to list all contexts from. Format: projects/<Project ID>/agent/sessions/<Session ID> or projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>. If Environment ID is not specified, we assume default 'draft' environment. If User 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.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#location_client

def location_client() -> Google::Cloud::Location::Locations::Rest::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Rest::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.

Overloads
def update_context(request, options = nil) -> ::Google::Cloud::Dialogflow::V2::Context
Pass arguments to update_context via a request object, either of type UpdateContextRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.