dataqna

package
Version: v0.84.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package dataqna is an auto-generated package for the Data QnA API.

Data QnA is a natural language question and answer service for BigQuery data.

NOTE: This package is in alpha. It is not stable, and is likely to change.

Use of Context

The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.

To close the open connection, use the Close() method.

For information about setting deadlines, reusing contexts, and more please visit https://pkg.go.dev/cloud.google.com/go.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

Types

type AutoSuggestionCallOptions

type AutoSuggestionCallOptions struct {
	SuggestQueries []gax.CallOption
}

AutoSuggestionCallOptions contains the retry settings for each method of AutoSuggestionClient.

type AutoSuggestionClient

type AutoSuggestionClient struct {

	// The call options for this service.
	CallOptions *AutoSuggestionCallOptions
	// contains filtered or unexported fields
}

AutoSuggestionClient is a client for interacting with Data QnA API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

This stateless API provides automatic suggestions for natural language queries for the data sources in the provided project and location.

The service provides a resourceless operation suggestQueries that can be called to get a list of suggestions for a given incomplete query and scope (or list of scopes) under which the query is to be interpreted.

There are two types of suggestions, ENTITY for single entity suggestions and TEMPLATE for full sentences. By default, both types are returned.

Example Request:

The service will retrieve information based on the given scope(s) and give suggestions based on that (e.g. “top item” for “top it” if “item” is a known dimension for the provided scope).

func NewAutoSuggestionClient

func NewAutoSuggestionClient(ctx context.Context, opts ...option.ClientOption) (*AutoSuggestionClient, error)

NewAutoSuggestionClient creates a new auto suggestion service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

This stateless API provides automatic suggestions for natural language queries for the data sources in the provided project and location.

The service provides a resourceless operation suggestQueries that can be called to get a list of suggestions for a given incomplete query and scope (or list of scopes) under which the query is to be interpreted.

There are two types of suggestions, ENTITY for single entity suggestions and TEMPLATE for full sentences. By default, both types are returned.

Example Request:

The service will retrieve information based on the given scope(s) and give suggestions based on that (e.g. “top item” for “top it” if “item” is a known dimension for the provided scope).

Example
package main

import (
	"context"

	dataqna "cloud.google.com/go/dataqna/apiv1alpha"
)

func main() {
	ctx := context.Background()
	c, err := dataqna.NewAutoSuggestionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}
Output:

func (*AutoSuggestionClient) Close

func (c *AutoSuggestionClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*AutoSuggestionClient) Connection

func (c *AutoSuggestionClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated.

func (*AutoSuggestionClient) SuggestQueries

SuggestQueries gets a list of suggestions based on a prefix string. AutoSuggestion tolerance should be less than 1 second.

Example
package main

import (
	"context"

	dataqna "cloud.google.com/go/dataqna/apiv1alpha"
	dataqnapb "google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha"
)

func main() {
	ctx := context.Background()
	c, err := dataqna.NewAutoSuggestionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataqnapb.SuggestQueriesRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.SuggestQueries(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

type QuestionCallOptions

type QuestionCallOptions struct {
	GetQuestion        []gax.CallOption
	CreateQuestion     []gax.CallOption
	ExecuteQuestion    []gax.CallOption
	GetUserFeedback    []gax.CallOption
	UpdateUserFeedback []gax.CallOption
}

QuestionCallOptions contains the retry settings for each method of QuestionClient.

type QuestionClient

type QuestionClient struct {

	// The call options for this service.
	CallOptions *QuestionCallOptions
	// contains filtered or unexported fields
}

QuestionClient is a client for interacting with Data QnA API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Service to interpret natural language queries. The service allows to create Question resources that are interpreted and are filled with one or more interpretations if the question could be interpreted. Once a Question resource is created and has at least one interpretation, an interpretation can be chosen for execution, which triggers a query to the backend (for BigQuery, it will create a job). Upon successful execution of that interpretation, backend specific information will be returned so that the client can retrieve the results from the backend.

The Question resources are named projects/*/locations/*/questions/*.

The Question resource has a singletion sub-resource UserFeedback named projects/*/locations/*/questions/*/userFeedback, which allows access to user feedback.

func NewQuestionClient

func NewQuestionClient(ctx context.Context, opts ...option.ClientOption) (*QuestionClient, error)

NewQuestionClient creates a new question service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Service to interpret natural language queries. The service allows to create Question resources that are interpreted and are filled with one or more interpretations if the question could be interpreted. Once a Question resource is created and has at least one interpretation, an interpretation can be chosen for execution, which triggers a query to the backend (for BigQuery, it will create a job). Upon successful execution of that interpretation, backend specific information will be returned so that the client can retrieve the results from the backend.

The Question resources are named projects/*/locations/*/questions/*.

The Question resource has a singletion sub-resource UserFeedback named projects/*/locations/*/questions/*/userFeedback, which allows access to user feedback.

Example
package main

import (
	"context"

	dataqna "cloud.google.com/go/dataqna/apiv1alpha"
)

func main() {
	ctx := context.Background()
	c, err := dataqna.NewQuestionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}
Output:

func (*QuestionClient) Close

func (c *QuestionClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*QuestionClient) Connection

func (c *QuestionClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated.

func (*QuestionClient) CreateQuestion

CreateQuestion creates a question.

Example
package main

import (
	"context"

	dataqna "cloud.google.com/go/dataqna/apiv1alpha"
	dataqnapb "google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha"
)

func main() {
	ctx := context.Background()
	c, err := dataqna.NewQuestionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataqnapb.CreateQuestionRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.CreateQuestion(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*QuestionClient) ExecuteQuestion

ExecuteQuestion executes an interpretation.

Example
package main

import (
	"context"

	dataqna "cloud.google.com/go/dataqna/apiv1alpha"
	dataqnapb "google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha"
)

func main() {
	ctx := context.Background()
	c, err := dataqna.NewQuestionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataqnapb.ExecuteQuestionRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.ExecuteQuestion(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*QuestionClient) GetQuestion

GetQuestion gets a previously created question.

Example
package main

import (
	"context"

	dataqna "cloud.google.com/go/dataqna/apiv1alpha"
	dataqnapb "google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha"
)

func main() {
	ctx := context.Background()
	c, err := dataqna.NewQuestionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataqnapb.GetQuestionRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetQuestion(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*QuestionClient) GetUserFeedback

GetUserFeedback gets previously created user feedback.

Example
package main

import (
	"context"

	dataqna "cloud.google.com/go/dataqna/apiv1alpha"
	dataqnapb "google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha"
)

func main() {
	ctx := context.Background()
	c, err := dataqna.NewQuestionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataqnapb.GetUserFeedbackRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.GetUserFeedback(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*QuestionClient) UpdateUserFeedback

UpdateUserFeedback updates user feedback. This creates user feedback if there was none before (upsert).

Example
package main

import (
	"context"

	dataqna "cloud.google.com/go/dataqna/apiv1alpha"
	dataqnapb "google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha"
)

func main() {
	ctx := context.Background()
	c, err := dataqna.NewQuestionClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &dataqnapb.UpdateUserFeedbackRequest{
		// TODO: Fill request struct fields.
	}
	resp, err := c.UpdateUserFeedback(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto