Discovery Engine V1BETA API - Class Google::Cloud::DiscoveryEngine::V1beta::SessionService::Client (v0.21.0)

Reference documentation and code samples for the Discovery Engine V1BETA API class Google::Cloud::DiscoveryEngine::V1beta::SessionService::Client.

Client for the SessionService service.

Service for managing Sessions and Session-related resources.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the SessionService 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 SessionService clients
::Google::Cloud::DiscoveryEngine::V1beta::SessionService::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the SessionService 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_session

def create_session(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::Session
def create_session(parent: nil, session: nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::Session

Creates a Session.

If the Session to create already exists, an ALREADY_EXISTS error is returned.

Overloads
def create_session(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::Session
Pass arguments to create_session via a request object, either of type CreateSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DiscoveryEngine::V1beta::CreateSessionRequest, ::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_session(parent: nil, session: nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::Session
Pass arguments to create_session 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. Full resource name of parent data store. Format: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}
  • session (::Google::Cloud::DiscoveryEngine::V1beta::Session, ::Hash) — Required. The session to create.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/discovery_engine/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DiscoveryEngine::V1beta::SessionService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DiscoveryEngine::V1beta::CreateSessionRequest.new

# Call the create_session method.
result = client.create_session request

# The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::Session.
p result

#delete_session

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

Deletes a Session.

If the Session to delete does not exist, a NOT_FOUND error is returned.

Overloads
def delete_session(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_session via a request object, either of type DeleteSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DiscoveryEngine::V1beta::DeleteSessionRequest, ::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_session(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_session 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 resource name of the Session to delete. Format: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/discovery_engine/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DiscoveryEngine::V1beta::SessionService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DiscoveryEngine::V1beta::DeleteSessionRequest.new

# Call the delete_session method.
result = client.delete_session request

# The returned object is of type Google::Protobuf::Empty.
p result

#get_session

def get_session(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::Session
def get_session(name: nil, include_answer_details: nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::Session

Gets a Session.

Overloads
def get_session(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::Session
Pass arguments to get_session via a request object, either of type GetSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DiscoveryEngine::V1beta::GetSessionRequest, ::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_session(name: nil, include_answer_details: nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::Session
Pass arguments to get_session 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
  • name (::String) — Required. The resource name of the Session to get. Format: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}
  • include_answer_details (::Boolean) — Optional. If set to true, the full session including all answer details will be returned.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/discovery_engine/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DiscoveryEngine::V1beta::SessionService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DiscoveryEngine::V1beta::GetSessionRequest.new

# Call the get_session method.
result = client.get_session request

# The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::Session.
p result

#initialize

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

Create a new SessionService client object.

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

# Create a client using a custom configuration
client = ::Google::Cloud::DiscoveryEngine::V1beta::SessionService::Client.new do |config|
  config.timeout = 10.0
end

#list_sessions

def list_sessions(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Session>
def list_sessions(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Session>

Lists all Sessions by their parent DataStore.

Overloads
def list_sessions(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Session>
Pass arguments to list_sessions via a request object, either of type ListSessionsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DiscoveryEngine::V1beta::ListSessionsRequest, ::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_sessions(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Session>
Pass arguments to list_sessions 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 data store resource name. Format: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store_id}
  • page_size (::Integer) — Maximum number of results to return. If unspecified, defaults to 50. Max allowed value is 1000.
  • page_token (::String) — A page token, received from a previous ListSessions call. Provide this to retrieve the subsequent page.
  • filter (::String) — A comma-separated list of fields to filter by, in EBNF grammar. The supported fields are:

    • user_pseudo_id
    • state
    • display_name
    • starred
    • is_pinned
    • labels
    • create_time
    • update_time

    Examples: "user_pseudo_id = some_id" "display_name = \"some_name\"" "starred = true" "is_pinned=true AND (NOT labels:hidden)" "create_time > \"1970-01-01T12:00:00Z\""

  • order_by (::String) —

    A comma-separated list of fields to order by, sorted in ascending order. Use "desc" after a field name for descending. Supported fields:

    • update_time
    • create_time
    • session_name
    • is_pinned

    Example:

    • "update_time desc"
    • "create_time"
    • "is_pinned desc,update_time desc": list sessions by is_pinned first, then by update_time.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/discovery_engine/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DiscoveryEngine::V1beta::SessionService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DiscoveryEngine::V1beta::ListSessionsRequest.new

# Call the list_sessions method.
result = client.list_sessions 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::DiscoveryEngine::V1beta::Session.
  p item
end

#location_client

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

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

Returns
  • (Google::Cloud::Location::Locations::Client)

#logger

def logger() -> Logger

The logger used for request/response debug logging.

Returns
  • (Logger)

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_session

def update_session(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::Session
def update_session(session: nil, update_mask: nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::Session

Updates a Session.

Session action type cannot be changed. If the Session to update does not exist, a NOT_FOUND error is returned.

Overloads
def update_session(request, options = nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::Session
Pass arguments to update_session via a request object, either of type UpdateSessionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::DiscoveryEngine::V1beta::UpdateSessionRequest, ::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_session(session: nil, update_mask: nil) -> ::Google::Cloud::DiscoveryEngine::V1beta::Session
Pass arguments to update_session 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
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/discovery_engine/v1beta"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::DiscoveryEngine::V1beta::SessionService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::DiscoveryEngine::V1beta::UpdateSessionRequest.new

# Call the update_session method.
result = client.update_session request

# The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::Session.
p result