v1

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

General documentation

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

Example usage

To get started with this package, create a client.

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := v1.NewStakingClient(ctx)
if err != nil {
	// TODO: Handle error.
}
defer c.Close()

The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.

Using the Client

The following is an example of making an API call with the newly created client.

ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := v1.NewStakingClient(ctx)
if err != nil {
	// TODO: Handle error.
}
defer c.Close()

req := &stakingpb.ListProtocolsRequest{
	// TODO: Fill request struct fields.
	// See https://pkg.go.dev/github.com/coinbase/staking-client-library-go/gen/go/coinbase/staking/orchestration/v1#ListProtocolsRequest.
}
resp, err := c.ListProtocols(ctx, req)
if err != nil {
	// TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Use of Context

The ctx passed to NewStakingClient 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.

Index

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 StakingCallOptions

type StakingCallOptions struct {
	ListProtocols       []gax.CallOption
	ListNetworks        []gax.CallOption
	ListStakingTargets  []gax.CallOption
	ListActions         []gax.CallOption
	CreateWorkflow      []gax.CallOption
	GetWorkflow         []gax.CallOption
	ListWorkflows       []gax.CallOption
	PerformWorkflowStep []gax.CallOption
	ViewStakingContext  []gax.CallOption
}

StakingCallOptions contains the retry settings for each method of StakingClient.

type StakingClient

type StakingClient struct {

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

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

StakingService manages staking related resources such as protocols, networks, validators and workflows.

func NewStakingClient

func NewStakingClient(ctx context.Context, opts ...option.ClientOption) (*StakingClient, error)

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

StakingService manages staking related resources such as protocols, networks, validators and workflows.

func NewStakingRESTClient

func NewStakingRESTClient(ctx context.Context, opts ...option.ClientOption) (*StakingClient, error)

NewStakingRESTClient creates a new staking service rest client.

StakingService manages staking related resources such as protocols, networks, validators and workflows.

func (*StakingClient) Close

func (c *StakingClient) Close() error

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

func (*StakingClient) Connection deprecated

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

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*StakingClient) CreateWorkflow

CreateWorkflow create a workflow to perform an action.

func (*StakingClient) GetWorkflow

GetWorkflow get the current state of an active workflow.

func (*StakingClient) ListActions

ListActions list supported actions for a given protocol and network.

func (*StakingClient) ListNetworks

ListNetworks list supported staking networks for a given protocol.

func (*StakingClient) ListProtocols

ListProtocols list supported protocols.

func (*StakingClient) ListStakingTargets

ListStakingTargets list supported staking targets for a given protocol and network.

func (*StakingClient) ListWorkflows

ListWorkflows list all workflows in a project.

func (*StakingClient) PerformWorkflowStep

func (c *StakingClient) PerformWorkflowStep(ctx context.Context, req *stakingpb.PerformWorkflowStepRequest, opts ...gax.CallOption) (*stakingpb.Workflow, error)

PerformWorkflowStep perform the next step in a workflow.

func (*StakingClient) ViewStakingContext

ViewStakingContext view Staking context information given a specific network address.

type StakingTargetIterator

type StakingTargetIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*stakingpb.StakingTarget, nextPageToken string, err error)
	// contains filtered or unexported fields
}

StakingTargetIterator manages a stream of *stakingpb.StakingTarget.

func (*StakingTargetIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*StakingTargetIterator) PageInfo

func (it *StakingTargetIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type WorkflowIterator

type WorkflowIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*stakingpb.Workflow, nextPageToken string, err error)
	// contains filtered or unexported fields
}

WorkflowIterator manages a stream of *stakingpb.Workflow.

func (*WorkflowIterator) Next

func (it *WorkflowIterator) Next() (*stakingpb.Workflow, error)

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*WorkflowIterator) PageInfo

func (it *WorkflowIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL