Documentation ¶
Overview ¶
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 godoc.org/cloud.google.com/go.
Index ¶
- func DefaultAuthScopes() []string
- type BlurbIterator
- type EchoCallOptions
- type EchoClient
- func (c *EchoClient) Block(ctx context.Context, req *genprotopb.BlockRequest, opts ...gax.CallOption) (*genprotopb.BlockResponse, error)
- func (c *EchoClient) Chat(ctx context.Context, opts ...gax.CallOption) (genprotopb.Echo_ChatClient, error)
- func (c *EchoClient) Close() error
- func (c *EchoClient) Collect(ctx context.Context, opts ...gax.CallOption) (genprotopb.Echo_CollectClient, error)
- func (c *EchoClient) Connection() *grpc.ClientConn
- func (c *EchoClient) Echo(ctx context.Context, req *genprotopb.EchoRequest, opts ...gax.CallOption) (*genprotopb.EchoResponse, error)
- func (c *EchoClient) Expand(ctx context.Context, req *genprotopb.ExpandRequest, opts ...gax.CallOption) (genprotopb.Echo_ExpandClient, error)
- func (c *EchoClient) PagedExpand(ctx context.Context, req *genprotopb.PagedExpandRequest, ...) *EchoResponseIterator
- func (c *EchoClient) Wait(ctx context.Context, req *genprotopb.WaitRequest, opts ...gax.CallOption) (*WaitOperation, error)
- func (c *EchoClient) WaitOperation(name string) *WaitOperation
- type EchoResponseIterator
- type IdentityCallOptions
- type IdentityClient
- func (c *IdentityClient) Close() error
- func (c *IdentityClient) Connection() *grpc.ClientConn
- func (c *IdentityClient) CreateUser(ctx context.Context, req *genprotopb.CreateUserRequest, opts ...gax.CallOption) (*genprotopb.User, error)
- func (c *IdentityClient) DeleteUser(ctx context.Context, req *genprotopb.DeleteUserRequest, opts ...gax.CallOption) error
- func (c *IdentityClient) GetUser(ctx context.Context, req *genprotopb.GetUserRequest, opts ...gax.CallOption) (*genprotopb.User, error)
- func (c *IdentityClient) ListUsers(ctx context.Context, req *genprotopb.ListUsersRequest, opts ...gax.CallOption) *UserIterator
- func (c *IdentityClient) UpdateUser(ctx context.Context, req *genprotopb.UpdateUserRequest, opts ...gax.CallOption) (*genprotopb.User, error)
- type MessagingCallOptions
- type MessagingClient
- func (c *MessagingClient) Close() error
- func (c *MessagingClient) Connect(ctx context.Context, opts ...gax.CallOption) (genprotopb.Messaging_ConnectClient, error)
- func (c *MessagingClient) Connection() *grpc.ClientConn
- func (c *MessagingClient) CreateBlurb(ctx context.Context, req *genprotopb.CreateBlurbRequest, ...) (*genprotopb.Blurb, error)
- func (c *MessagingClient) CreateRoom(ctx context.Context, req *genprotopb.CreateRoomRequest, opts ...gax.CallOption) (*genprotopb.Room, error)
- func (c *MessagingClient) DeleteBlurb(ctx context.Context, req *genprotopb.DeleteBlurbRequest, ...) error
- func (c *MessagingClient) DeleteRoom(ctx context.Context, req *genprotopb.DeleteRoomRequest, opts ...gax.CallOption) error
- func (c *MessagingClient) GetBlurb(ctx context.Context, req *genprotopb.GetBlurbRequest, opts ...gax.CallOption) (*genprotopb.Blurb, error)
- func (c *MessagingClient) GetRoom(ctx context.Context, req *genprotopb.GetRoomRequest, opts ...gax.CallOption) (*genprotopb.Room, error)
- func (c *MessagingClient) ListBlurbs(ctx context.Context, req *genprotopb.ListBlurbsRequest, opts ...gax.CallOption) *BlurbIterator
- func (c *MessagingClient) ListRooms(ctx context.Context, req *genprotopb.ListRoomsRequest, opts ...gax.CallOption) *RoomIterator
- func (c *MessagingClient) SearchBlurbs(ctx context.Context, req *genprotopb.SearchBlurbsRequest, ...) (*SearchBlurbsOperation, error)
- func (c *MessagingClient) SearchBlurbsOperation(name string) *SearchBlurbsOperation
- func (c *MessagingClient) SendBlurbs(ctx context.Context, opts ...gax.CallOption) (genprotopb.Messaging_SendBlurbsClient, error)
- func (c *MessagingClient) StreamBlurbs(ctx context.Context, req *genprotopb.StreamBlurbsRequest, ...) (genprotopb.Messaging_StreamBlurbsClient, error)
- func (c *MessagingClient) UpdateBlurb(ctx context.Context, req *genprotopb.UpdateBlurbRequest, ...) (*genprotopb.Blurb, error)
- func (c *MessagingClient) UpdateRoom(ctx context.Context, req *genprotopb.UpdateRoomRequest, opts ...gax.CallOption) (*genprotopb.Room, error)
- type RoomIterator
- type SearchBlurbsOperation
- func (op *SearchBlurbsOperation) Done() bool
- func (op *SearchBlurbsOperation) Metadata() (*genprotopb.SearchBlurbsMetadata, error)
- func (op *SearchBlurbsOperation) Name() string
- func (op *SearchBlurbsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*genprotopb.SearchBlurbsResponse, error)
- func (op *SearchBlurbsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*genprotopb.SearchBlurbsResponse, error)
- type SessionIterator
- type TestIterator
- type TestingCallOptions
- type TestingClient
- func (c *TestingClient) Close() error
- func (c *TestingClient) Connection() *grpc.ClientConn
- func (c *TestingClient) CreateSession(ctx context.Context, req *genprotopb.CreateSessionRequest, ...) (*genprotopb.Session, error)
- func (c *TestingClient) DeleteSession(ctx context.Context, req *genprotopb.DeleteSessionRequest, ...) error
- func (c *TestingClient) DeleteTest(ctx context.Context, req *genprotopb.DeleteTestRequest, opts ...gax.CallOption) error
- func (c *TestingClient) GetSession(ctx context.Context, req *genprotopb.GetSessionRequest, opts ...gax.CallOption) (*genprotopb.Session, error)
- func (c *TestingClient) ListSessions(ctx context.Context, req *genprotopb.ListSessionsRequest, ...) *SessionIterator
- func (c *TestingClient) ListTests(ctx context.Context, req *genprotopb.ListTestsRequest, opts ...gax.CallOption) *TestIterator
- func (c *TestingClient) ReportSession(ctx context.Context, req *genprotopb.ReportSessionRequest, ...) (*genprotopb.ReportSessionResponse, error)
- func (c *TestingClient) VerifyTest(ctx context.Context, req *genprotopb.VerifyTestRequest, opts ...gax.CallOption) (*genprotopb.VerifyTestResponse, error)
- type UserIterator
- type WaitOperation
- func (op *WaitOperation) Done() bool
- func (op *WaitOperation) Metadata() (*genprotopb.WaitMetadata, error)
- func (op *WaitOperation) Name() string
- func (op *WaitOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*genprotopb.WaitResponse, error)
- func (op *WaitOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*genprotopb.WaitResponse, error)
Examples ¶
- EchoClient.Block
- EchoClient.Chat
- EchoClient.Echo
- EchoClient.PagedExpand
- EchoClient.Wait
- IdentityClient.CreateUser
- IdentityClient.DeleteUser
- IdentityClient.GetUser
- IdentityClient.ListUsers
- IdentityClient.UpdateUser
- MessagingClient.Connect
- MessagingClient.CreateBlurb
- MessagingClient.CreateRoom
- MessagingClient.DeleteBlurb
- MessagingClient.DeleteRoom
- MessagingClient.GetBlurb
- MessagingClient.GetRoom
- MessagingClient.ListBlurbs
- MessagingClient.ListRooms
- MessagingClient.SearchBlurbs
- MessagingClient.UpdateBlurb
- MessagingClient.UpdateRoom
- NewEchoClient
- NewIdentityClient
- NewMessagingClient
- NewTestingClient
- TestingClient.CreateSession
- TestingClient.DeleteSession
- TestingClient.DeleteTest
- TestingClient.GetSession
- TestingClient.ListSessions
- TestingClient.ListTests
- TestingClient.ReportSession
- TestingClient.VerifyTest
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 BlurbIterator ¶
type BlurbIterator 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 []*genprotopb.Blurb, nextPageToken string, err error) // contains filtered or unexported fields }
BlurbIterator manages a stream of *genprotopb.Blurb.
func (*BlurbIterator) Next ¶
func (it *BlurbIterator) Next() (*genprotopb.Blurb, 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 (*BlurbIterator) PageInfo ¶
func (it *BlurbIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type EchoCallOptions ¶
type EchoCallOptions struct { Echo []gax.CallOption Expand []gax.CallOption Collect []gax.CallOption Chat []gax.CallOption PagedExpand []gax.CallOption Wait []gax.CallOption Block []gax.CallOption }
EchoCallOptions contains the retry settings for each method of EchoClient.
type EchoClient ¶
type EchoClient struct { // LROClient is used internally to handle longrunning operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // The call options for this service. CallOptions *EchoCallOptions // contains filtered or unexported fields }
EchoClient is a client for interacting with .
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewEchoClient ¶
func NewEchoClient(ctx context.Context, opts ...option.ClientOption) (*EchoClient, error)
NewEchoClient creates a new echo client.
This service is used showcase the four main types of rpcs - unary, server side streaming, client side streaming, and bidirectional streaming. This service also exposes methods that explicitly implement server delay, and paginated calls. Set the ‘showcase-trailer’ metadata key on any method to have the values echoed in the response trailers.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" ) func main() { ctx := context.Background() c, err := client.NewEchoClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c }
Output:
func (*EchoClient) Block ¶ added in v0.3.0
func (c *EchoClient) Block(ctx context.Context, req *genprotopb.BlockRequest, opts ...gax.CallOption) (*genprotopb.BlockResponse, error)
Block this method will block (wait) for the requested amount of time and then return the response or error. This method showcases how a client handles delays or retries.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewEchoClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.BlockRequest{ // TODO: Fill request struct fields. } resp, err := c.Block(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*EchoClient) Chat ¶
func (c *EchoClient) Chat(ctx context.Context, opts ...gax.CallOption) (genprotopb.Echo_ChatClient, error)
Chat this method, upon receiving a request on the stream, the same content will be passed back on the stream. This method showcases bidirectional streaming rpcs.
Example ¶
package main import ( "context" "io" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewEchoClient(ctx) if err != nil { // TODO: Handle error. } stream, err := c.Chat(ctx) if err != nil { // TODO: Handle error. } go func() { reqs := []*genprotopb.EchoRequest{ // TODO: Create requests. } for _, req := range reqs { if err := stream.Send(req); err != nil { // TODO: Handle error. } } stream.CloseSend() }() for { resp, err := stream.Recv() if err == io.EOF { break } if err != nil { // TODO: handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*EchoClient) Close ¶
func (c *EchoClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*EchoClient) Collect ¶
func (c *EchoClient) Collect(ctx context.Context, opts ...gax.CallOption) (genprotopb.Echo_CollectClient, error)
Collect this method will collect the words given to it. When the stream is closed by the client, this method will return the a concatenation of the strings passed to it. This method showcases client-side streaming rpcs.
func (*EchoClient) Connection ¶
func (c *EchoClient) Connection() *grpc.ClientConn
Connection returns the client's connection to the API service.
func (*EchoClient) Echo ¶
func (c *EchoClient) Echo(ctx context.Context, req *genprotopb.EchoRequest, opts ...gax.CallOption) (*genprotopb.EchoResponse, error)
Echo this method simply echos the request. This method is showcases unary rpcs.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewEchoClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.EchoRequest{ // TODO: Fill request struct fields. } resp, err := c.Echo(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*EchoClient) Expand ¶
func (c *EchoClient) Expand(ctx context.Context, req *genprotopb.ExpandRequest, opts ...gax.CallOption) (genprotopb.Echo_ExpandClient, error)
Expand this method split the given content into words and will pass each word back through the stream. This method showcases server-side streaming rpcs.
func (*EchoClient) PagedExpand ¶
func (c *EchoClient) PagedExpand(ctx context.Context, req *genprotopb.PagedExpandRequest, opts ...gax.CallOption) *EchoResponseIterator
PagedExpand this is similar to the Expand method but instead of returning a stream of expanded words, this method returns a paged list of expanded words.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" "google.golang.org/api/iterator" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := client.NewEchoClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.PagedExpandRequest{ // TODO: Fill request struct fields. } it := c.PagedExpand(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*EchoClient) Wait ¶
func (c *EchoClient) Wait(ctx context.Context, req *genprotopb.WaitRequest, opts ...gax.CallOption) (*WaitOperation, error)
Wait this method will wait the requested amount of and then return. This method showcases how a client handles a request timing out.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewEchoClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.WaitRequest{ // TODO: Fill request struct fields. } op, err := c.Wait(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*EchoClient) WaitOperation ¶
func (c *EchoClient) WaitOperation(name string) *WaitOperation
WaitOperation returns a new WaitOperation from a given name. The name must be that of a previously created WaitOperation, possibly from a different process.
type EchoResponseIterator ¶
type EchoResponseIterator 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 []*genprotopb.EchoResponse, nextPageToken string, err error) // contains filtered or unexported fields }
EchoResponseIterator manages a stream of *genprotopb.EchoResponse.
func (*EchoResponseIterator) Next ¶
func (it *EchoResponseIterator) Next() (*genprotopb.EchoResponse, 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 (*EchoResponseIterator) PageInfo ¶
func (it *EchoResponseIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type IdentityCallOptions ¶
type IdentityCallOptions struct { CreateUser []gax.CallOption GetUser []gax.CallOption UpdateUser []gax.CallOption DeleteUser []gax.CallOption ListUsers []gax.CallOption }
IdentityCallOptions contains the retry settings for each method of IdentityClient.
type IdentityClient ¶
type IdentityClient struct { // The call options for this service. CallOptions *IdentityCallOptions // contains filtered or unexported fields }
IdentityClient is a client for interacting with .
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewIdentityClient ¶
func NewIdentityClient(ctx context.Context, opts ...option.ClientOption) (*IdentityClient, error)
NewIdentityClient creates a new identity client.
A simple identity service.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" ) func main() { ctx := context.Background() c, err := client.NewIdentityClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c }
Output:
func (*IdentityClient) Close ¶
func (c *IdentityClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*IdentityClient) Connection ¶
func (c *IdentityClient) Connection() *grpc.ClientConn
Connection returns the client's connection to the API service.
func (*IdentityClient) CreateUser ¶
func (c *IdentityClient) CreateUser(ctx context.Context, req *genprotopb.CreateUserRequest, opts ...gax.CallOption) (*genprotopb.User, error)
CreateUser creates a user.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewIdentityClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.CreateUserRequest{ // TODO: Fill request struct fields. } resp, err := c.CreateUser(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*IdentityClient) DeleteUser ¶
func (c *IdentityClient) DeleteUser(ctx context.Context, req *genprotopb.DeleteUserRequest, opts ...gax.CallOption) error
DeleteUser deletes a user, their profile, and all of their authored messages.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { ctx := context.Background() c, err := client.NewIdentityClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.DeleteUserRequest{ // TODO: Fill request struct fields. } err = c.DeleteUser(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*IdentityClient) GetUser ¶
func (c *IdentityClient) GetUser(ctx context.Context, req *genprotopb.GetUserRequest, opts ...gax.CallOption) (*genprotopb.User, error)
GetUser retrieves the User with the given uri.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewIdentityClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.GetUserRequest{ // TODO: Fill request struct fields. } resp, err := c.GetUser(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*IdentityClient) ListUsers ¶
func (c *IdentityClient) ListUsers(ctx context.Context, req *genprotopb.ListUsersRequest, opts ...gax.CallOption) *UserIterator
ListUsers lists all users.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" "google.golang.org/api/iterator" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := client.NewIdentityClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.ListUsersRequest{ // TODO: Fill request struct fields. } it := c.ListUsers(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*IdentityClient) UpdateUser ¶
func (c *IdentityClient) UpdateUser(ctx context.Context, req *genprotopb.UpdateUserRequest, opts ...gax.CallOption) (*genprotopb.User, error)
UpdateUser updates a user.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewIdentityClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.UpdateUserRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateUser(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type MessagingCallOptions ¶
type MessagingCallOptions struct { CreateRoom []gax.CallOption GetRoom []gax.CallOption UpdateRoom []gax.CallOption DeleteRoom []gax.CallOption ListRooms []gax.CallOption CreateBlurb []gax.CallOption GetBlurb []gax.CallOption UpdateBlurb []gax.CallOption DeleteBlurb []gax.CallOption ListBlurbs []gax.CallOption SearchBlurbs []gax.CallOption StreamBlurbs []gax.CallOption SendBlurbs []gax.CallOption Connect []gax.CallOption }
MessagingCallOptions contains the retry settings for each method of MessagingClient.
type MessagingClient ¶
type MessagingClient struct { // LROClient is used internally to handle longrunning operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // The call options for this service. CallOptions *MessagingCallOptions // contains filtered or unexported fields }
MessagingClient is a client for interacting with .
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewMessagingClient ¶
func NewMessagingClient(ctx context.Context, opts ...option.ClientOption) (*MessagingClient, error)
NewMessagingClient creates a new messaging client.
A simple messaging service that implements chat rooms and profile posts.
This messaging service showcases the features that API clients generated by gapic-generators implement.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" ) func main() { ctx := context.Background() c, err := client.NewMessagingClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c }
Output:
func (*MessagingClient) Close ¶
func (c *MessagingClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*MessagingClient) Connect ¶
func (c *MessagingClient) Connect(ctx context.Context, opts ...gax.CallOption) (genprotopb.Messaging_ConnectClient, error)
Connect this method starts a bidirectional stream that receives all blurbs that are being created after the stream has started and sends requests to create blurbs. If an invalid blurb is requested to be created, the stream will close with an error.
Example ¶
package main import ( "context" "io" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewMessagingClient(ctx) if err != nil { // TODO: Handle error. } stream, err := c.Connect(ctx) if err != nil { // TODO: Handle error. } go func() { reqs := []*genprotopb.ConnectRequest{ // TODO: Create requests. } for _, req := range reqs { if err := stream.Send(req); err != nil { // TODO: Handle error. } } stream.CloseSend() }() for { resp, err := stream.Recv() if err == io.EOF { break } if err != nil { // TODO: handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*MessagingClient) Connection ¶
func (c *MessagingClient) Connection() *grpc.ClientConn
Connection returns the client's connection to the API service.
func (*MessagingClient) CreateBlurb ¶
func (c *MessagingClient) CreateBlurb(ctx context.Context, req *genprotopb.CreateBlurbRequest, opts ...gax.CallOption) (*genprotopb.Blurb, error)
CreateBlurb creates a blurb. If the parent is a room, the blurb is understood to be a message in that room. If the parent is a profile, the blurb is understood to be a post on the profile.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewMessagingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.CreateBlurbRequest{ // TODO: Fill request struct fields. } resp, err := c.CreateBlurb(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*MessagingClient) CreateRoom ¶
func (c *MessagingClient) CreateRoom(ctx context.Context, req *genprotopb.CreateRoomRequest, opts ...gax.CallOption) (*genprotopb.Room, error)
CreateRoom creates a room.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewMessagingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.CreateRoomRequest{ // TODO: Fill request struct fields. } resp, err := c.CreateRoom(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*MessagingClient) DeleteBlurb ¶
func (c *MessagingClient) DeleteBlurb(ctx context.Context, req *genprotopb.DeleteBlurbRequest, opts ...gax.CallOption) error
DeleteBlurb deletes a blurb.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { ctx := context.Background() c, err := client.NewMessagingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.DeleteBlurbRequest{ // TODO: Fill request struct fields. } err = c.DeleteBlurb(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*MessagingClient) DeleteRoom ¶
func (c *MessagingClient) DeleteRoom(ctx context.Context, req *genprotopb.DeleteRoomRequest, opts ...gax.CallOption) error
DeleteRoom deletes a room and all of its blurbs.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { ctx := context.Background() c, err := client.NewMessagingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.DeleteRoomRequest{ // TODO: Fill request struct fields. } err = c.DeleteRoom(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*MessagingClient) GetBlurb ¶
func (c *MessagingClient) GetBlurb(ctx context.Context, req *genprotopb.GetBlurbRequest, opts ...gax.CallOption) (*genprotopb.Blurb, error)
GetBlurb retrieves the Blurb with the given resource name.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewMessagingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.GetBlurbRequest{ // TODO: Fill request struct fields. } resp, err := c.GetBlurb(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*MessagingClient) GetRoom ¶
func (c *MessagingClient) GetRoom(ctx context.Context, req *genprotopb.GetRoomRequest, opts ...gax.CallOption) (*genprotopb.Room, error)
GetRoom retrieves the Room with the given resource name.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewMessagingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.GetRoomRequest{ // TODO: Fill request struct fields. } resp, err := c.GetRoom(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*MessagingClient) ListBlurbs ¶
func (c *MessagingClient) ListBlurbs(ctx context.Context, req *genprotopb.ListBlurbsRequest, opts ...gax.CallOption) *BlurbIterator
ListBlurbs lists blurbs for a specific chat room or user profile depending on the parent resource name.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" "google.golang.org/api/iterator" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := client.NewMessagingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.ListBlurbsRequest{ // TODO: Fill request struct fields. } it := c.ListBlurbs(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*MessagingClient) ListRooms ¶
func (c *MessagingClient) ListRooms(ctx context.Context, req *genprotopb.ListRoomsRequest, opts ...gax.CallOption) *RoomIterator
ListRooms lists all chat rooms.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" "google.golang.org/api/iterator" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := client.NewMessagingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.ListRoomsRequest{ // TODO: Fill request struct fields. } it := c.ListRooms(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*MessagingClient) SearchBlurbs ¶
func (c *MessagingClient) SearchBlurbs(ctx context.Context, req *genprotopb.SearchBlurbsRequest, opts ...gax.CallOption) (*SearchBlurbsOperation, error)
SearchBlurbs this method searches through all blurbs across all rooms and profiles for blurbs containing to words found in the query. Only posts that contain an exact match of a queried word will be returned.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewMessagingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.SearchBlurbsRequest{ // TODO: Fill request struct fields. } op, err := c.SearchBlurbs(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*MessagingClient) SearchBlurbsOperation ¶
func (c *MessagingClient) SearchBlurbsOperation(name string) *SearchBlurbsOperation
SearchBlurbsOperation returns a new SearchBlurbsOperation from a given name. The name must be that of a previously created SearchBlurbsOperation, possibly from a different process.
func (*MessagingClient) SendBlurbs ¶
func (c *MessagingClient) SendBlurbs(ctx context.Context, opts ...gax.CallOption) (genprotopb.Messaging_SendBlurbsClient, error)
SendBlurbs this is a stream to create multiple blurbs. If an invalid blurb is requested to be created, the stream will close with an error.
func (*MessagingClient) StreamBlurbs ¶
func (c *MessagingClient) StreamBlurbs(ctx context.Context, req *genprotopb.StreamBlurbsRequest, opts ...gax.CallOption) (genprotopb.Messaging_StreamBlurbsClient, error)
StreamBlurbs this returns a stream that emits the blurbs that are created for a particular chat room or user profile.
func (*MessagingClient) UpdateBlurb ¶
func (c *MessagingClient) UpdateBlurb(ctx context.Context, req *genprotopb.UpdateBlurbRequest, opts ...gax.CallOption) (*genprotopb.Blurb, error)
UpdateBlurb updates a blurb.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewMessagingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.UpdateBlurbRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateBlurb(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*MessagingClient) UpdateRoom ¶
func (c *MessagingClient) UpdateRoom(ctx context.Context, req *genprotopb.UpdateRoomRequest, opts ...gax.CallOption) (*genprotopb.Room, error)
UpdateRoom updates a room.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewMessagingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.UpdateRoomRequest{ // TODO: Fill request struct fields. } resp, err := c.UpdateRoom(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type RoomIterator ¶
type RoomIterator 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 []*genprotopb.Room, nextPageToken string, err error) // contains filtered or unexported fields }
RoomIterator manages a stream of *genprotopb.Room.
func (*RoomIterator) Next ¶
func (it *RoomIterator) Next() (*genprotopb.Room, 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 (*RoomIterator) PageInfo ¶
func (it *RoomIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type SearchBlurbsOperation ¶
type SearchBlurbsOperation struct {
// contains filtered or unexported fields
}
SearchBlurbsOperation manages a long-running operation from SearchBlurbs.
func (*SearchBlurbsOperation) Done ¶
func (op *SearchBlurbsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*SearchBlurbsOperation) Metadata ¶
func (op *SearchBlurbsOperation) Metadata() (*genprotopb.SearchBlurbsMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*SearchBlurbsOperation) Name ¶
func (op *SearchBlurbsOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*SearchBlurbsOperation) Poll ¶
func (op *SearchBlurbsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*genprotopb.SearchBlurbsResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*SearchBlurbsOperation) Wait ¶
func (op *SearchBlurbsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*genprotopb.SearchBlurbsResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
type SessionIterator ¶
type SessionIterator 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 []*genprotopb.Session, nextPageToken string, err error) // contains filtered or unexported fields }
SessionIterator manages a stream of *genprotopb.Session.
func (*SessionIterator) Next ¶
func (it *SessionIterator) Next() (*genprotopb.Session, 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 (*SessionIterator) PageInfo ¶
func (it *SessionIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type TestIterator ¶
type TestIterator 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 []*genprotopb.Test, nextPageToken string, err error) // contains filtered or unexported fields }
TestIterator manages a stream of *genprotopb.Test.
func (*TestIterator) Next ¶
func (it *TestIterator) Next() (*genprotopb.Test, 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 (*TestIterator) PageInfo ¶
func (it *TestIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type TestingCallOptions ¶
type TestingCallOptions struct { CreateSession []gax.CallOption GetSession []gax.CallOption ListSessions []gax.CallOption DeleteSession []gax.CallOption ReportSession []gax.CallOption ListTests []gax.CallOption DeleteTest []gax.CallOption VerifyTest []gax.CallOption }
TestingCallOptions contains the retry settings for each method of TestingClient.
type TestingClient ¶
type TestingClient struct { // The call options for this service. CallOptions *TestingCallOptions // contains filtered or unexported fields }
TestingClient is a client for interacting with .
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewTestingClient ¶
func NewTestingClient(ctx context.Context, opts ...option.ClientOption) (*TestingClient, error)
NewTestingClient creates a new testing client.
A service to facilitate running discrete sets of tests against Showcase.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" ) func main() { ctx := context.Background() c, err := client.NewTestingClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c }
Output:
func (*TestingClient) Close ¶
func (c *TestingClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*TestingClient) Connection ¶
func (c *TestingClient) Connection() *grpc.ClientConn
Connection returns the client's connection to the API service.
func (*TestingClient) CreateSession ¶
func (c *TestingClient) CreateSession(ctx context.Context, req *genprotopb.CreateSessionRequest, opts ...gax.CallOption) (*genprotopb.Session, error)
CreateSession creates a new testing session.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewTestingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.CreateSessionRequest{ // TODO: Fill request struct fields. } resp, err := c.CreateSession(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*TestingClient) DeleteSession ¶
func (c *TestingClient) DeleteSession(ctx context.Context, req *genprotopb.DeleteSessionRequest, opts ...gax.CallOption) error
DeleteSession delete a test session.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { ctx := context.Background() c, err := client.NewTestingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.DeleteSessionRequest{ // TODO: Fill request struct fields. } err = c.DeleteSession(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*TestingClient) DeleteTest ¶
func (c *TestingClient) DeleteTest(ctx context.Context, req *genprotopb.DeleteTestRequest, opts ...gax.CallOption) error
DeleteTest explicitly decline to implement a test.
This removes the test from subsequent ListTests calls, and attempting to do the test will error.
This method will error if attempting to delete a required test.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { ctx := context.Background() c, err := client.NewTestingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.DeleteTestRequest{ // TODO: Fill request struct fields. } err = c.DeleteTest(ctx, req) if err != nil { // TODO: Handle error. } }
Output:
func (*TestingClient) GetSession ¶
func (c *TestingClient) GetSession(ctx context.Context, req *genprotopb.GetSessionRequest, opts ...gax.CallOption) (*genprotopb.Session, error)
GetSession gets a testing session.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewTestingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.GetSessionRequest{ // TODO: Fill request struct fields. } resp, err := c.GetSession(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*TestingClient) ListSessions ¶
func (c *TestingClient) ListSessions(ctx context.Context, req *genprotopb.ListSessionsRequest, opts ...gax.CallOption) *SessionIterator
ListSessions lists the current test sessions.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" "google.golang.org/api/iterator" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := client.NewTestingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.ListSessionsRequest{ // TODO: Fill request struct fields. } it := c.ListSessions(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*TestingClient) ListTests ¶
func (c *TestingClient) ListTests(ctx context.Context, req *genprotopb.ListTestsRequest, opts ...gax.CallOption) *TestIterator
ListTests list the tests of a sessesion.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" "google.golang.org/api/iterator" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" // import "google.golang.org/api/iterator" ctx := context.Background() c, err := client.NewTestingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.ListTestsRequest{ // TODO: Fill request struct fields. } it := c.ListTests(ctx, req) for { resp, err := it.Next() if err == iterator.Done { break } if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp } }
Output:
func (*TestingClient) ReportSession ¶
func (c *TestingClient) ReportSession(ctx context.Context, req *genprotopb.ReportSessionRequest, opts ...gax.CallOption) (*genprotopb.ReportSessionResponse, error)
ReportSession report on the status of a session. This generates a report detailing which tests have been completed, and an overall rollup.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewTestingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.ReportSessionRequest{ // TODO: Fill request struct fields. } resp, err := c.ReportSession(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
func (*TestingClient) VerifyTest ¶
func (c *TestingClient) VerifyTest(ctx context.Context, req *genprotopb.VerifyTestRequest, opts ...gax.CallOption) (*genprotopb.VerifyTestResponse, error)
VerifyTest register a response to a test.
In cases where a test involves registering a final answer at the end of the test, this method provides the means to do so.
Example ¶
package main import ( "context" client "github.com/googleapis/gapic-showcase/client" genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ) func main() { // import genprotopb "github.com/googleapis/gapic-showcase/server/genproto" ctx := context.Background() c, err := client.NewTestingClient(ctx) if err != nil { // TODO: Handle error. } req := &genprotopb.VerifyTestRequest{ // TODO: Fill request struct fields. } resp, err := c.VerifyTest(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp }
Output:
type UserIterator ¶
type UserIterator 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 []*genprotopb.User, nextPageToken string, err error) // contains filtered or unexported fields }
UserIterator manages a stream of *genprotopb.User.
func (*UserIterator) Next ¶
func (it *UserIterator) Next() (*genprotopb.User, 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 (*UserIterator) PageInfo ¶
func (it *UserIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type WaitOperation ¶
type WaitOperation struct {
// contains filtered or unexported fields
}
WaitOperation manages a long-running operation from Wait.
func (*WaitOperation) Done ¶
func (op *WaitOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*WaitOperation) Metadata ¶
func (op *WaitOperation) Metadata() (*genprotopb.WaitMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*WaitOperation) Name ¶
func (op *WaitOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*WaitOperation) Poll ¶
func (op *WaitOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*genprotopb.WaitResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*WaitOperation) Wait ¶
func (op *WaitOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*genprotopb.WaitResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.