Package talent is an auto-generated package for the Cloud Talent Solution API.
Cloud Talent Solution provides the capability to create, read, update, and delete job postings, as well as search jobs based on keywords and filters.
General documentation
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage
To get started with this package, create a client.
// go get cloud.google.com/go/talent/apiv4@latest 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 := talent.NewCompanyClient(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, mentioned above.
req := &talentpb.CreateCompanyRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/talent/apiv4/talentpb#CreateCompanyRequest. } resp, err := c.CreateCompany(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context
The ctx passed to NewCompanyClient 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.
Functions
func DefaultAuthScopes
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
BatchCreateJobsOperation
type BatchCreateJobsOperation struct {
// contains filtered or unexported fields
}
BatchCreateJobsOperation manages a long-running operation from BatchCreateJobs.
func (*BatchCreateJobsOperation) Done
func (op *BatchCreateJobsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BatchCreateJobsOperation) Metadata
func (op *BatchCreateJobsOperation) Metadata() (*talentpb.BatchOperationMetadata, 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 (*BatchCreateJobsOperation) Name
func (op *BatchCreateJobsOperation) 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 (*BatchCreateJobsOperation) Poll
func (op *BatchCreateJobsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*talentpb.BatchCreateJobsResponse, 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 (*BatchCreateJobsOperation) Wait
func (op *BatchCreateJobsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*talentpb.BatchCreateJobsResponse, 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.
BatchDeleteJobsOperation
type BatchDeleteJobsOperation struct {
// contains filtered or unexported fields
}
BatchDeleteJobsOperation manages a long-running operation from BatchDeleteJobs.
func (*BatchDeleteJobsOperation) Done
func (op *BatchDeleteJobsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BatchDeleteJobsOperation) Metadata
func (op *BatchDeleteJobsOperation) Metadata() (*talentpb.BatchOperationMetadata, 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 (*BatchDeleteJobsOperation) Name
func (op *BatchDeleteJobsOperation) 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 (*BatchDeleteJobsOperation) Poll
func (op *BatchDeleteJobsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*talentpb.BatchDeleteJobsResponse, 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 (*BatchDeleteJobsOperation) Wait
func (op *BatchDeleteJobsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*talentpb.BatchDeleteJobsResponse, 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.
BatchUpdateJobsOperation
type BatchUpdateJobsOperation struct {
// contains filtered or unexported fields
}
BatchUpdateJobsOperation manages a long-running operation from BatchUpdateJobs.
func (*BatchUpdateJobsOperation) Done
func (op *BatchUpdateJobsOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BatchUpdateJobsOperation) Metadata
func (op *BatchUpdateJobsOperation) Metadata() (*talentpb.BatchOperationMetadata, 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 (*BatchUpdateJobsOperation) Name
func (op *BatchUpdateJobsOperation) 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 (*BatchUpdateJobsOperation) Poll
func (op *BatchUpdateJobsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*talentpb.BatchUpdateJobsResponse, 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 (*BatchUpdateJobsOperation) Wait
func (op *BatchUpdateJobsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*talentpb.BatchUpdateJobsResponse, 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.
CompanyCallOptions
type CompanyCallOptions struct {
CreateCompany []gax.CallOption
GetCompany []gax.CallOption
UpdateCompany []gax.CallOption
DeleteCompany []gax.CallOption
ListCompanies []gax.CallOption
GetOperation []gax.CallOption
}
CompanyCallOptions contains the retry settings for each method of CompanyClient.
CompanyClient
type CompanyClient struct {
// The call options for this service.
CallOptions *CompanyCallOptions
// contains filtered or unexported fields
}
CompanyClient is a client for interacting with Cloud Talent Solution API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
A service that handles company management, including CRUD and enumeration.
func NewCompanyClient
func NewCompanyClient(ctx context.Context, opts ...option.ClientOption) (*CompanyClient, error)
NewCompanyClient creates a new company service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
A service that handles company management, including CRUD and enumeration.
Example
package main
import (
"context"
talent "cloud.google.com/go/talent/apiv4"
)
func main() {
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 := talent.NewCompanyClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewCompanyRESTClient
func NewCompanyRESTClient(ctx context.Context, opts ...option.ClientOption) (*CompanyClient, error)
NewCompanyRESTClient creates a new company service rest client.
A service that handles company management, including CRUD and enumeration.
Example
package main
import (
"context"
talent "cloud.google.com/go/talent/apiv4"
)
func main() {
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 := talent.NewCompanyRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*CompanyClient) Close
func (c *CompanyClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*CompanyClient) Connection (deprecated)
func (c *CompanyClient) 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 (*CompanyClient) CreateCompany
func (c *CompanyClient) CreateCompany(ctx context.Context, req *talentpb.CreateCompanyRequest, opts ...gax.CallOption) (*talentpb.Company, error)
CreateCompany creates a new company entity.
Example
package main
import (
"context"
talent "cloud.google.com/go/talent/apiv4"
talentpb "cloud.google.com/go/talent/apiv4/talentpb"
)
func main() {
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 := talent.NewCompanyClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &talentpb.CreateCompanyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/talent/apiv4/talentpb#CreateCompanyRequest.
}
resp, err := c.CreateCompany(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CompanyClient) DeleteCompany
func (c *CompanyClient) DeleteCompany(ctx context.Context, req *talentpb.DeleteCompanyRequest, opts ...gax.CallOption) error
DeleteCompany deletes specified company. Prerequisite: The company has no jobs associated with it.
Example
package main
import (
"context"
talent "cloud.google.com/go/talent/apiv4"
talentpb "cloud.google.com/go/talent/apiv4/talentpb"
)
func main() {
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 := talent.NewCompanyClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &talentpb.DeleteCompanyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/talent/apiv4/talentpb#DeleteCompanyRequest.
}
err = c.DeleteCompany(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*CompanyClient) GetCompany
func (c *CompanyClient) GetCompany(ctx context.Context, req *talentpb.GetCompanyRequest, opts ...gax.CallOption) (*talentpb.Company, error)
GetCompany retrieves specified company.
Example
package main
import (
"context"
talent "cloud.google.com/go/talent/apiv4"
talentpb "cloud.google.com/go/talent/apiv4/talentpb"
)
func main() {
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 := talent.NewCompanyClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &talentpb.GetCompanyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/talent/apiv4/talentpb#GetCompanyRequest.
}
resp, err := c.GetCompany(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CompanyClient) GetOperation
func (c *CompanyClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
talent "cloud.google.com/go/talent/apiv4"
)
func main() {
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 := talent.NewCompanyClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*CompanyClient) ListCompanies
func (c *CompanyClient) ListCompanies(ctx context.Context, req *talentpb.ListCompaniesRequest, opts ...gax.CallOption) *CompanyIterator
ListCompanies lists all companies associated with the project.
Examples
package main
import (
"context"
talent "cloud.google.com/go/talent/apiv4"
talentpb "cloud.google.com/go/talent/apiv4/talentpb"
"google.golang.org/api/iterator"
)
func main() {
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 := talent.NewCompanyClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &talentpb.ListCompaniesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/talent/apiv4/talentpb#ListCompaniesRequest.
}
it := c.ListCompanies(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*talentpb.ListCompaniesResponse)
}
}
all
package main
import (
"context"
talent "cloud.google.com/go/talent/apiv4"
talentpb "cloud.google.com/go/talent/apiv4/talentpb"
)
func main() {
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 := talent.NewCompanyClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &talentpb.ListCompaniesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/talent/apiv4/talentpb#ListCompaniesRequest.
}
for resp, err := range c.ListCompanies(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*CompanyClient) UpdateCompany
func (c *CompanyClient) UpdateCompany(ctx context.Context, req *talentpb.UpdateCompanyRequest, opts ...gax.CallOption) (*talentpb.Company, error)
UpdateCompany updates specified company.
Example
package main
import (
"context"
talent "cloud.google.com/go/talent/apiv4"
talentpb "cloud.google.com/go/talent/apiv4/talentpb"
)
func main() {
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 := talent.NewCompanyClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &talentpb.UpdateCompanyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/talent/apiv4/talentpb#UpdateCompanyRequest.
}
resp, err := c.UpdateCompany(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
CompanyIterator
type CompanyIterator 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 []*talentpb.Company, nextPageToken string, err error)
// contains filtered or unexported fields
}
CompanyIterator manages a stream of *talentpb.Company.
func (*CompanyIterator) All
func (it *CompanyIterator) All() iter.Seq2[*talentpb.Company, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*CompanyIterator) Next
func (it *CompanyIterator) Next() (*talentpb.Company, 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 (*CompanyIterator) PageInfo
func (it *CompanyIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
CompletionCallOptions
type CompletionCallOptions struct {
CompleteQuery []gax.CallOption
GetOperation []gax.CallOption
}
CompletionCallOptions contains the retry settings for each method of CompletionClient.
CompletionClient
type CompletionClient struct {
// The call options for this service.
CallOptions *CompletionCallOptions
// contains filtered or unexported fields
}
CompletionClient is a client for interacting with Cloud Talent Solution API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
A service handles auto completion.
func NewCompletionClient
func NewCompletionClient(ctx context.Context, opts ...option.ClientOption) (*CompletionClient, error)
NewCompletionClient creates a new completion client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
A service handles auto completion.
Example
package main
import (
"context"
talent "cloud.google.com/go/talent/apiv4"
)
func main() {
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 := talent.NewCompletionClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewCompletionRESTClient
func NewCompletionRESTClient(ctx context.Context, opts ...option.ClientOption) (*CompletionClient, error)
NewCompletionRESTClient creates a new completion rest client.
A service handles auto completion.
Example
package main
import (
"context"
talent "cloud.google.com/go/talent/apiv4"
)
func main() {
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 := talent.NewCompletionRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*CompletionClient) Close
func (c *CompletionClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*CompletionClient) CompleteQuery
func (c *