package translate
import "cloud.google.com/go/translate/apiv3"
Package translate is an auto-generated package for the Cloud Translation API.
Integrates text translation into your website or application.
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/translate/apiv3@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 := translate.NewTranslationClient(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 := &translatepb.AdaptiveMtTranslateRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#AdaptiveMtTranslateRequest. } resp, err := c.AdaptiveMtTranslate(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context
The ctx passed to NewTranslationClient 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 ¶
- func DefaultAuthScopes() []string
- type AdaptiveMtDatasetIterator
- func (it *AdaptiveMtDatasetIterator) All() iter.Seq2[*translatepb.AdaptiveMtDataset, error]
- func (it *AdaptiveMtDatasetIterator) Next() (*translatepb.AdaptiveMtDataset, error)
- func (it *AdaptiveMtDatasetIterator) PageInfo() *iterator.PageInfo
- type AdaptiveMtFileIterator
- func (it *AdaptiveMtFileIterator) All() iter.Seq2[*translatepb.AdaptiveMtFile, error]
- func (it *AdaptiveMtFileIterator) Next() (*translatepb.AdaptiveMtFile, error)
- func (it *AdaptiveMtFileIterator) PageInfo() *iterator.PageInfo
- type AdaptiveMtSentenceIterator
- func (it *AdaptiveMtSentenceIterator) All() iter.Seq2[*translatepb.AdaptiveMtSentence, error]
- func (it *AdaptiveMtSentenceIterator) Next() (*translatepb.AdaptiveMtSentence, error)
- func (it *AdaptiveMtSentenceIterator) PageInfo() *iterator.PageInfo
- type BatchTranslateDocumentOperation
- func (op *BatchTranslateDocumentOperation) Done() bool
- func (op *BatchTranslateDocumentOperation) Metadata() (*translatepb.BatchTranslateDocumentMetadata, error)
- func (op *BatchTranslateDocumentOperation) Name() string
- func (op *BatchTranslateDocumentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.BatchTranslateDocumentResponse, error)
- func (op *BatchTranslateDocumentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.BatchTranslateDocumentResponse, error)
- type BatchTranslateTextOperation
- func (op *BatchTranslateTextOperation) Done() bool
- func (op *BatchTranslateTextOperation) Metadata() (*translatepb.BatchTranslateMetadata, error)
- func (op *BatchTranslateTextOperation) Name() string
- func (op *BatchTranslateTextOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.BatchTranslateResponse, error)
- func (op *BatchTranslateTextOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.BatchTranslateResponse, error)
- type CreateDatasetOperation
- func (op *CreateDatasetOperation) Done() bool
- func (op *CreateDatasetOperation) Metadata() (*translatepb.CreateDatasetMetadata, error)
- func (op *CreateDatasetOperation) Name() string
- func (op *CreateDatasetOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.Dataset, error)
- func (op *CreateDatasetOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.Dataset, error)
- type CreateGlossaryOperation
- func (op *CreateGlossaryOperation) Done() bool
- func (op *CreateGlossaryOperation) Metadata() (*translatepb.CreateGlossaryMetadata, error)
- func (op *CreateGlossaryOperation) Name() string
- func (op *CreateGlossaryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.Glossary, error)
- func (op *CreateGlossaryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.Glossary, error)
- type CreateModelOperation
- func (op *CreateModelOperation) Done() bool
- func (op *CreateModelOperation) Metadata() (*translatepb.CreateModelMetadata, error)
- func (op *CreateModelOperation) Name() string
- func (op *CreateModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.Model, error)
- func (op *CreateModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.Model, error)
- type DatasetIterator
- func (it *DatasetIterator) All() iter.Seq2[*translatepb.Dataset, error]
- func (it *DatasetIterator) Next() (*translatepb.Dataset, error)
- func (it *DatasetIterator) PageInfo() *iterator.PageInfo
- type DeleteDatasetOperation
- func (op *DeleteDatasetOperation) Done() bool
- func (op *DeleteDatasetOperation) Metadata() (*translatepb.DeleteDatasetMetadata, error)
- func (op *DeleteDatasetOperation) Name() string
- func (op *DeleteDatasetOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *DeleteDatasetOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type DeleteGlossaryOperation
- func (op *DeleteGlossaryOperation) Done() bool
- func (op *DeleteGlossaryOperation) Metadata() (*translatepb.DeleteGlossaryMetadata, error)
- func (op *DeleteGlossaryOperation) Name() string
- func (op *DeleteGlossaryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.DeleteGlossaryResponse, error)
- func (op *DeleteGlossaryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.DeleteGlossaryResponse, error)
- type DeleteModelOperation
- func (op *DeleteModelOperation) Done() bool
- func (op *DeleteModelOperation) Metadata() (*translatepb.DeleteModelMetadata, error)
- func (op *DeleteModelOperation) Name() string
- func (op *DeleteModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *DeleteModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type ExampleIterator
- func (it *ExampleIterator) All() iter.Seq2[*translatepb.Example, error]
- func (it *ExampleIterator) Next() (*translatepb.Example, error)
- func (it *ExampleIterator) PageInfo() *iterator.PageInfo
- type ExportDataOperation
- func (op *ExportDataOperation) Done() bool
- func (op *ExportDataOperation) Metadata() (*translatepb.ExportDataMetadata, error)
- func (op *ExportDataOperation) Name() string
- func (op *ExportDataOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *ExportDataOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type GlossaryEntryIterator
- func (it *GlossaryEntryIterator) All() iter.Seq2[*translatepb.GlossaryEntry, error]
- func (it *GlossaryEntryIterator) Next() (*translatepb.GlossaryEntry, error)
- func (it *GlossaryEntryIterator) PageInfo() *iterator.PageInfo
- type GlossaryIterator
- func (it *GlossaryIterator) All() iter.Seq2[*translatepb.Glossary, error]
- func (it *GlossaryIterator) Next() (*translatepb.Glossary, error)
- func (it *GlossaryIterator) PageInfo() *iterator.PageInfo
- type ImportDataOperation
- func (op *ImportDataOperation) Done() bool
- func (op *ImportDataOperation) Metadata() (*translatepb.ImportDataMetadata, error)
- func (op *ImportDataOperation) Name() string
- func (op *ImportDataOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *ImportDataOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type LocationIterator
- func (it *LocationIterator) All() iter.Seq2[*locationpb.Location, error]
- func (it *LocationIterator) Next() (*locationpb.Location, error)
- func (it *LocationIterator) PageInfo() *iterator.PageInfo
- type ModelIterator
- func (it *ModelIterator) All() iter.Seq2[*translatepb.Model, error]
- func (it *ModelIterator) Next() (*translatepb.Model, error)
- func (it *ModelIterator) PageInfo() *iterator.PageInfo
- type OperationIterator
- func (it *OperationIterator) All() iter.Seq2[*longrunningpb.Operation, error]
- func (it *OperationIterator) Next() (*longrunningpb.Operation, error)
- func (it *OperationIterator) PageInfo() *iterator.PageInfo
- type TranslationCallOptions
- type TranslationClient
- func NewTranslationClient(ctx context.Context, opts ...option.ClientOption) (*TranslationClient, error)
- func NewTranslationRESTClient(ctx context.Context, opts ...option.ClientOption) (*TranslationClient, error)
- func (c *TranslationClient) AdaptiveMtTranslate(ctx context.Context, req *translatepb.AdaptiveMtTranslateRequest, opts ...gax.CallOption) (*translatepb.AdaptiveMtTranslateResponse, error)
- func (c *TranslationClient) BatchTranslateDocument(ctx context.Context, req *translatepb.BatchTranslateDocumentRequest, opts ...gax.CallOption) (*BatchTranslateDocumentOperation, error)
- func (c *TranslationClient) BatchTranslateDocumentOperation(name string) *BatchTranslateDocumentOperation
- func (c *TranslationClient) BatchTranslateText(ctx context.Context, req *translatepb.BatchTranslateTextRequest, opts ...gax.CallOption) (*BatchTranslateTextOperation, error)
- func (c *TranslationClient) BatchTranslateTextOperation(name string) *BatchTranslateTextOperation
- func (c *TranslationClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
- func (c *TranslationClient) Close() error
- func (c *TranslationClient) Connection() *grpc.ClientConn
- func (c *TranslationClient) CreateAdaptiveMtDataset(ctx context.Context, req *translatepb.CreateAdaptiveMtDatasetRequest, opts ...gax.CallOption) (*translatepb.AdaptiveMtDataset, error)
- func (c *TranslationClient) CreateDataset(ctx context.Context, req *translatepb.CreateDatasetRequest, opts ...gax.CallOption) (*CreateDatasetOperation, error)
- func (c *TranslationClient) CreateDatasetOperation(name string) *CreateDatasetOperation
- func (c *TranslationClient) CreateGlossary(ctx context.Context, req *translatepb.CreateGlossaryRequest, opts ...gax.CallOption) (*CreateGlossaryOperation, error)
- func (c *TranslationClient) CreateGlossaryEntry(ctx context.Context, req *translatepb.CreateGlossaryEntryRequest, opts ...gax.CallOption) (*translatepb.GlossaryEntry, error)
- func (c *TranslationClient) CreateGlossaryOperation(name string) *CreateGlossaryOperation
- func (c *TranslationClient) CreateModel(ctx context.Context, req *translatepb.CreateModelRequest, opts ...gax.CallOption) (*CreateModelOperation, error)
- func (c *TranslationClient) CreateModelOperation(name string) *CreateModelOperation
- func (c *TranslationClient) DeleteAdaptiveMtDataset(ctx context.Context, req *translatepb.DeleteAdaptiveMtDatasetRequest, opts ...gax.CallOption) error
- func (c *TranslationClient) DeleteAdaptiveMtFile(ctx context.Context, req *translatepb.DeleteAdaptiveMtFileRequest, opts ...gax.CallOption) error
- func (c *TranslationClient) DeleteDataset(ctx context.Context, req *translatepb.DeleteDatasetRequest, opts ...gax.CallOption) (*DeleteDatasetOperation, error)
- func (c *TranslationClient) DeleteDatasetOperation(name string) *DeleteDatasetOperation
- func (c *TranslationClient) DeleteGlossary(ctx context.Context, req *translatepb.DeleteGlossaryRequest, opts ...gax.CallOption) (*DeleteGlossaryOperation, error)
- func (c *TranslationClient) DeleteGlossaryEntry(ctx context.Context, req *translatepb.DeleteGlossaryEntryRequest, opts ...gax.CallOption) error
- func (c *TranslationClient) DeleteGlossaryOperation(name string) *DeleteGlossaryOperation
- func (c *TranslationClient) DeleteModel(ctx context.Context, req *translatepb.DeleteModelRequest, opts ...gax.CallOption) (*DeleteModelOperation, error)
- func (c *TranslationClient) DeleteModelOperation(name string) *DeleteModelOperation
- func (c *TranslationClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
- func (c *TranslationClient) DetectLanguage(ctx context.Context, req *translatepb.DetectLanguageRequest, opts ...gax.CallOption) (*translatepb.DetectLanguageResponse, error)
- func (c *TranslationClient) ExportData(ctx context.Context, req *translatepb.ExportDataRequest, opts ...gax.CallOption) (*ExportDataOperation, error)
- func (c *TranslationClient) ExportDataOperation(name string) *ExportDataOperation
- func (c *TranslationClient) GetAdaptiveMtDataset(ctx context.Context, req *translatepb.GetAdaptiveMtDatasetRequest, opts ...gax.CallOption) (*translatepb.AdaptiveMtDataset, error)
- func (c *TranslationClient) GetAdaptiveMtFile(ctx context.Context, req *translatepb.GetAdaptiveMtFileRequest, opts ...gax.CallOption) (*translatepb.AdaptiveMtFile, error)
- func (c *TranslationClient) GetDataset(ctx context.Context, req *translatepb.GetDatasetRequest, opts ...gax.CallOption) (*translatepb.Dataset, error)
- func (c *TranslationClient) GetGlossary(ctx context.Context, req *translatepb.GetGlossaryRequest, opts ...gax.CallOption) (*translatepb.Glossary, error)
- func (c *TranslationClient) GetGlossaryEntry(ctx context.Context, req *translatepb.GetGlossaryEntryRequest, opts ...gax.CallOption) (*translatepb.GlossaryEntry, error)
- func (c *TranslationClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
- func (c *TranslationClient) GetModel(ctx context.Context, req *translatepb.GetModelRequest, opts ...gax.CallOption) (*translatepb.Model, error)
- func (c *TranslationClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
- func (c *TranslationClient) GetSupportedLanguages(ctx context.Context, req *translatepb.GetSupportedLanguagesRequest, opts ...gax.CallOption) (*translatepb.SupportedLanguages, error)
- func (c *TranslationClient) ImportAdaptiveMtFile(ctx context.Context, req *translatepb.ImportAdaptiveMtFileRequest, opts ...gax.CallOption) (*translatepb.ImportAdaptiveMtFileResponse, error)
- func (c *TranslationClient) ImportData(ctx context.Context, req *translatepb.ImportDataRequest, opts ...gax.CallOption) (*ImportDataOperation, error)
- func (c *TranslationClient) ImportDataOperation(name string) *ImportDataOperation
- func (c *TranslationClient) ListAdaptiveMtDatasets(ctx context.Context, req *translatepb.ListAdaptiveMtDatasetsRequest, opts ...gax.CallOption) *AdaptiveMtDatasetIterator
- func (c *TranslationClient) ListAdaptiveMtFiles(ctx context.Context, req *translatepb.ListAdaptiveMtFilesRequest, opts ...gax.CallOption) *AdaptiveMtFileIterator
- func (c *TranslationClient) ListAdaptiveMtSentences(ctx context.Context, req *translatepb.ListAdaptiveMtSentencesRequest, opts ...gax.CallOption) *AdaptiveMtSentenceIterator
- func (c *TranslationClient) ListDatasets(ctx context.Context, req *translatepb.ListDatasetsRequest, opts ...gax.CallOption) *DatasetIterator
- func (c *TranslationClient) ListExamples(ctx context.Context, req *translatepb.ListExamplesRequest, opts ...gax.CallOption) *ExampleIterator
- func (c *TranslationClient) ListGlossaries(ctx context.Context, req *translatepb.ListGlossariesRequest, opts ...gax.CallOption) *GlossaryIterator
- func (c *TranslationClient) ListGlossaryEntries(ctx context.Context, req *translatepb.ListGlossaryEntriesRequest, opts ...gax.CallOption) *GlossaryEntryIterator
- func (c *TranslationClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
- func (c *TranslationClient) ListModels(ctx context.Context, req *translatepb.ListModelsRequest, opts ...gax.CallOption) *ModelIterator
- func (c *TranslationClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
- func (c *TranslationClient) RomanizeText(ctx context.Context, req *translatepb.RomanizeTextRequest, opts ...gax.CallOption) (*translatepb.RomanizeTextResponse, error)
- func (c *TranslationClient) TranslateDocument(ctx context.Context, req *translatepb.TranslateDocumentRequest, opts ...gax.CallOption) (*translatepb.TranslateDocumentResponse, error)
- func (c *TranslationClient) TranslateText(ctx context.Context, req *translatepb.TranslateTextRequest, opts ...gax.CallOption) (*translatepb.TranslateTextResponse, error)
- func (c *TranslationClient) UpdateGlossary(ctx context.Context, req *translatepb.UpdateGlossaryRequest, opts ...gax.CallOption) (*UpdateGlossaryOperation, error)
- func (c *TranslationClient) UpdateGlossaryEntry(ctx context.Context, req *translatepb.UpdateGlossaryEntryRequest, opts ...gax.CallOption) (*translatepb.GlossaryEntry, error)
- func (c *TranslationClient) UpdateGlossaryOperation(name string) *UpdateGlossaryOperation
- func (c *TranslationClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
- type UpdateGlossaryOperation
- func (op *UpdateGlossaryOperation) Done() bool
- func (op *UpdateGlossaryOperation) Metadata() (*translatepb.UpdateGlossaryMetadata, error)
- func (op *UpdateGlossaryOperation) Name() string
- func (op *UpdateGlossaryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.Glossary, error)
- func (op *UpdateGlossaryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.Glossary, error)
Examples ¶
- NewTranslationClient
- NewTranslationRESTClient
- TranslationClient.AdaptiveMtTranslate
- TranslationClient.BatchTranslateDocument
- TranslationClient.BatchTranslateText
- TranslationClient.CancelOperation
- TranslationClient.CreateAdaptiveMtDataset
- TranslationClient.CreateDataset
- TranslationClient.CreateGlossary
- TranslationClient.CreateGlossaryEntry
- TranslationClient.CreateModel
- TranslationClient.DeleteAdaptiveMtDataset
- TranslationClient.DeleteAdaptiveMtFile
- TranslationClient.DeleteDataset
- TranslationClient.DeleteGlossary
- TranslationClient.DeleteGlossaryEntry
- TranslationClient.DeleteModel
- TranslationClient.DeleteOperation
- TranslationClient.DetectLanguage
- TranslationClient.ExportData
- TranslationClient.GetAdaptiveMtDataset
- TranslationClient.GetAdaptiveMtFile
- TranslationClient.GetDataset
- TranslationClient.GetGlossary
- TranslationClient.GetGlossaryEntry
- TranslationClient.GetLocation
- TranslationClient.GetModel
- TranslationClient.GetOperation
- TranslationClient.GetSupportedLanguages
- TranslationClient.ImportAdaptiveMtFile
- TranslationClient.ImportData
- TranslationClient.ListAdaptiveMtDatasets
- TranslationClient.ListAdaptiveMtDatasets (All)
- TranslationClient.ListAdaptiveMtFiles
- TranslationClient.ListAdaptiveMtFiles (All)
- TranslationClient.ListAdaptiveMtSentences
- TranslationClient.ListAdaptiveMtSentences (All)
- TranslationClient.ListDatasets
- TranslationClient.ListDatasets (All)
- TranslationClient.ListExamples
- TranslationClient.ListExamples (All)
- TranslationClient.ListGlossaries
- TranslationClient.ListGlossaries (All)
- TranslationClient.ListGlossaryEntries
- TranslationClient.ListGlossaryEntries (All)
- TranslationClient.ListLocations
- TranslationClient.ListLocations (All)
- TranslationClient.ListModels
- TranslationClient.ListModels (All)
- TranslationClient.ListOperations
- TranslationClient.ListOperations (All)
- TranslationClient.RomanizeText
- TranslationClient.TranslateDocument
- TranslationClient.TranslateText
- TranslationClient.UpdateGlossary
- TranslationClient.UpdateGlossaryEntry
- TranslationClient.WaitOperation
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type AdaptiveMtDatasetIterator ¶
type AdaptiveMtDatasetIterator 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 []*translatepb.AdaptiveMtDataset, nextPageToken string, err error) // contains filtered or unexported fields }
AdaptiveMtDatasetIterator manages a stream of *translatepb.AdaptiveMtDataset.
func (*AdaptiveMtDatasetIterator) All ¶
func (it *AdaptiveMtDatasetIterator) All() iter.Seq2[*translatepb.AdaptiveMtDataset, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*AdaptiveMtDatasetIterator) Next ¶
func (it *AdaptiveMtDatasetIterator) Next() (*translatepb.AdaptiveMtDataset, 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 (*AdaptiveMtDatasetIterator) PageInfo ¶
func (it *AdaptiveMtDatasetIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type AdaptiveMtFileIterator ¶
type AdaptiveMtFileIterator 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 []*translatepb.AdaptiveMtFile, nextPageToken string, err error) // contains filtered or unexported fields }
AdaptiveMtFileIterator manages a stream of *translatepb.AdaptiveMtFile.
func (*AdaptiveMtFileIterator) All ¶
func (it *AdaptiveMtFileIterator) All() iter.Seq2[*translatepb.AdaptiveMtFile, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*AdaptiveMtFileIterator) Next ¶
func (it *AdaptiveMtFileIterator) Next() (*translatepb.AdaptiveMtFile, 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 (*AdaptiveMtFileIterator) PageInfo ¶
func (it *AdaptiveMtFileIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type AdaptiveMtSentenceIterator ¶
type AdaptiveMtSentenceIterator 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 []*translatepb.AdaptiveMtSentence, nextPageToken string, err error) // contains filtered or unexported fields }
AdaptiveMtSentenceIterator manages a stream of *translatepb.AdaptiveMtSentence.
func (*AdaptiveMtSentenceIterator) All ¶
func (it *AdaptiveMtSentenceIterator) All() iter.Seq2[*translatepb.AdaptiveMtSentence, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*AdaptiveMtSentenceIterator) Next ¶
func (it *AdaptiveMtSentenceIterator) Next() (*translatepb.AdaptiveMtSentence, 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 (*AdaptiveMtSentenceIterator) PageInfo ¶
func (it *AdaptiveMtSentenceIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type BatchTranslateDocumentOperation ¶
type BatchTranslateDocumentOperation struct {
// contains filtered or unexported fields
}
BatchTranslateDocumentOperation manages a long-running operation from BatchTranslateDocument.
func (*BatchTranslateDocumentOperation) Done ¶
func (op *BatchTranslateDocumentOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BatchTranslateDocumentOperation) Metadata ¶
func (op *BatchTranslateDocumentOperation) Metadata() (*translatepb.BatchTranslateDocumentMetadata, 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 (*BatchTranslateDocumentOperation) Name ¶
func (op *BatchTranslateDocumentOperation) 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 (*BatchTranslateDocumentOperation) Poll ¶
func (op *BatchTranslateDocumentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.BatchTranslateDocumentResponse, 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 (*BatchTranslateDocumentOperation) Wait ¶
func (op *BatchTranslateDocumentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.BatchTranslateDocumentResponse, 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 BatchTranslateTextOperation ¶
type BatchTranslateTextOperation struct {
// contains filtered or unexported fields
}
BatchTranslateTextOperation manages a long-running operation from BatchTranslateText.
func (*BatchTranslateTextOperation) Done ¶
func (op *BatchTranslateTextOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BatchTranslateTextOperation) Metadata ¶
func (op *BatchTranslateTextOperation) Metadata() (*translatepb.BatchTranslateMetadata, 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 (*BatchTranslateTextOperation) Name ¶
func (op *BatchTranslateTextOperation) 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 (*BatchTranslateTextOperation) Poll ¶
func (op *BatchTranslateTextOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.BatchTranslateResponse, 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 (*BatchTranslateTextOperation) Wait ¶
func (op *BatchTranslateTextOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.BatchTranslateResponse, 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 CreateDatasetOperation ¶
type CreateDatasetOperation struct {
// contains filtered or unexported fields
}
CreateDatasetOperation manages a long-running operation from CreateDataset.
func (*CreateDatasetOperation) Done ¶
func (op *CreateDatasetOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateDatasetOperation) Metadata ¶
func (op *CreateDatasetOperation) Metadata() (*translatepb.CreateDatasetMetadata, 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 (*CreateDatasetOperation) Name ¶
func (op *CreateDatasetOperation) 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 (*CreateDatasetOperation) Poll ¶
func (op *CreateDatasetOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.Dataset, 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 (*CreateDatasetOperation) Wait ¶
func (op *CreateDatasetOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.Dataset, 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 CreateGlossaryOperation ¶
type CreateGlossaryOperation struct {
// contains filtered or unexported fields
}
CreateGlossaryOperation manages a long-running operation from CreateGlossary.
func (*CreateGlossaryOperation) Done ¶
func (op *CreateGlossaryOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateGlossaryOperation) Metadata ¶
func (op *CreateGlossaryOperation) Metadata() (*translatepb.CreateGlossaryMetadata, 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 (*CreateGlossaryOperation) Name ¶
func (op *CreateGlossaryOperation) 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 (*CreateGlossaryOperation) Poll ¶
func (op *CreateGlossaryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.Glossary, 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 (*CreateGlossaryOperation) Wait ¶
func (op *CreateGlossaryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.Glossary, 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 CreateModelOperation ¶
type CreateModelOperation struct {
// contains filtered or unexported fields
}
CreateModelOperation manages a long-running operation from CreateModel.
func (*CreateModelOperation) Done ¶
func (op *CreateModelOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateModelOperation) Metadata ¶
func (op *CreateModelOperation) Metadata() (*translatepb.CreateModelMetadata, 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 (*CreateModelOperation) Name ¶
func (op *CreateModelOperation) 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 (*CreateModelOperation) Poll ¶
func (op *CreateModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.Model, 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 (*CreateModelOperation) Wait ¶
func (op *CreateModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.Model, 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 DatasetIterator ¶
type DatasetIterator 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 []*translatepb.Dataset, nextPageToken string, err error) // contains filtered or unexported fields }
DatasetIterator manages a stream of *translatepb.Dataset.
func (*DatasetIterator) All ¶
func (it *DatasetIterator) All() iter.Seq2[*translatepb.Dataset, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*DatasetIterator) Next ¶
func (it *DatasetIterator) Next() (*translatepb.Dataset, 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 (*DatasetIterator) PageInfo ¶
func (it *DatasetIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type DeleteDatasetOperation ¶
type DeleteDatasetOperation struct {
// contains filtered or unexported fields
}
DeleteDatasetOperation manages a long-running operation from DeleteDataset.
func (*DeleteDatasetOperation) Done ¶
func (op *DeleteDatasetOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteDatasetOperation) Metadata ¶
func (op *DeleteDatasetOperation) Metadata() (*translatepb.DeleteDatasetMetadata, 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 (*DeleteDatasetOperation) Name ¶
func (op *DeleteDatasetOperation) 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 (*DeleteDatasetOperation) Poll ¶
func (op *DeleteDatasetOperation) Poll(ctx context.Context, opts ...gax.CallOption) 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 (*DeleteDatasetOperation) Wait ¶
func (op *DeleteDatasetOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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 DeleteGlossaryOperation ¶
type DeleteGlossaryOperation struct {
// contains filtered or unexported fields
}
DeleteGlossaryOperation manages a long-running operation from DeleteGlossary.
func (*DeleteGlossaryOperation) Done ¶
func (op *DeleteGlossaryOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteGlossaryOperation) Metadata ¶
func (op *DeleteGlossaryOperation) Metadata() (*translatepb.DeleteGlossaryMetadata, 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 (*DeleteGlossaryOperation) Name ¶
func (op *DeleteGlossaryOperation) 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 (*DeleteGlossaryOperation) Poll ¶
func (op *DeleteGlossaryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.DeleteGlossaryResponse, 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 (*DeleteGlossaryOperation) Wait ¶
func (op *DeleteGlossaryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.DeleteGlossaryResponse, 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 DeleteModelOperation ¶
type DeleteModelOperation struct {
// contains filtered or unexported fields
}
DeleteModelOperation manages a long-running operation from DeleteModel.
func (*DeleteModelOperation) Done ¶
func (op *DeleteModelOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteModelOperation) Metadata ¶
func (op *DeleteModelOperation) Metadata() (*translatepb.DeleteModelMetadata, 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 (*DeleteModelOperation) Name ¶
func (op *DeleteModelOperation) 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 (*DeleteModelOperation) Poll ¶
func (op *DeleteModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) 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 (*DeleteModelOperation) Wait ¶
func (op *DeleteModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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 ExampleIterator ¶
type ExampleIterator 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 []*translatepb.Example, nextPageToken string, err error) // contains filtered or unexported fields }
ExampleIterator manages a stream of *translatepb.Example.
func (*ExampleIterator) All ¶
func (it *ExampleIterator) All() iter.Seq2[*translatepb.Example, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ExampleIterator) Next ¶
func (it *ExampleIterator) Next() (*translatepb.Example, 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 (*ExampleIterator) PageInfo ¶
func (it *ExampleIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type ExportDataOperation ¶
type ExportDataOperation struct {
// contains filtered or unexported fields
}
ExportDataOperation manages a long-running operation from ExportData.
func (*ExportDataOperation) Done ¶
func (op *ExportDataOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ExportDataOperation) Metadata ¶
func (op *ExportDataOperation) Metadata() (*translatepb.ExportDataMetadata, 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 (*ExportDataOperation) Name ¶
func (op *ExportDataOperation) 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 (*ExportDataOperation) Poll ¶
func (op *ExportDataOperation) Poll(ctx context.Context, opts ...gax.CallOption) 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 (*ExportDataOperation) Wait ¶
func (op *ExportDataOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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 GlossaryEntryIterator ¶
type GlossaryEntryIterator 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 []*translatepb.GlossaryEntry, nextPageToken string, err error) // contains filtered or unexported fields }
GlossaryEntryIterator manages a stream of *translatepb.GlossaryEntry.
func (*GlossaryEntryIterator) All ¶
func (it *GlossaryEntryIterator) All() iter.Seq2[*translatepb.GlossaryEntry, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*GlossaryEntryIterator) Next ¶
func (it *GlossaryEntryIterator) Next() (*translatepb.GlossaryEntry, 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 (*GlossaryEntryIterator) PageInfo ¶
func (it *GlossaryEntryIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type GlossaryIterator ¶
type GlossaryIterator 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 []*translatepb.Glossary, nextPageToken string, err error) // contains filtered or unexported fields }
GlossaryIterator manages a stream of *translatepb.Glossary.
func (*GlossaryIterator) All ¶
func (it *GlossaryIterator) All() iter.Seq2[*translatepb.Glossary, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*GlossaryIterator) Next ¶
func (it *GlossaryIterator) Next() (*translatepb.Glossary, 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 (*GlossaryIterator) PageInfo ¶
func (it *GlossaryIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type ImportDataOperation ¶
type ImportDataOperation struct {
// contains filtered or unexported fields
}
ImportDataOperation manages a long-running operation from ImportData.
func (*ImportDataOperation) Done ¶
func (op *ImportDataOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*ImportDataOperation) Metadata ¶
func (op *ImportDataOperation) Metadata() (*translatepb.ImportDataMetadata, 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 (*ImportDataOperation) Name ¶
func (op *ImportDataOperation) 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 (*ImportDataOperation) Poll ¶
func (op *ImportDataOperation) Poll(ctx context.Context, opts ...gax.CallOption) 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 (*ImportDataOperation) Wait ¶
func (op *ImportDataOperation) Wait(ctx context.Context, opts ...gax.CallOption) 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 LocationIterator ¶
type LocationIterator 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 []*locationpb.Location, nextPageToken string, err error) // contains filtered or unexported fields }
LocationIterator manages a stream of *locationpb.Location.
func (*LocationIterator) All ¶
func (it *LocationIterator) All() iter.Seq2[*locationpb.Location, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*LocationIterator) Next ¶
func (it *LocationIterator) Next() (*locationpb.Location, 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 (*LocationIterator) PageInfo ¶
func (it *LocationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type ModelIterator ¶
type ModelIterator 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 []*translatepb.Model, nextPageToken string, err error) // contains filtered or unexported fields }
ModelIterator manages a stream of *translatepb.Model.
func (*ModelIterator) All ¶
func (it *ModelIterator) All() iter.Seq2[*translatepb.Model, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*ModelIterator) Next ¶
func (it *ModelIterator) Next() (*translatepb.Model, 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 (*ModelIterator) PageInfo ¶
func (it *ModelIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type OperationIterator ¶
type OperationIterator 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 []*longrunningpb.Operation, nextPageToken string, err error) // contains filtered or unexported fields }
OperationIterator manages a stream of *longrunningpb.Operation.
func (*OperationIterator) All ¶
func (it *OperationIterator) All() iter.Seq2[*longrunningpb.Operation, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*OperationIterator) Next ¶
func (it *OperationIterator) Next() (*longrunningpb.Operation, 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 (*OperationIterator) PageInfo ¶
func (it *OperationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type TranslationCallOptions ¶
type TranslationCallOptions struct { TranslateText []gax.CallOption RomanizeText []gax.CallOption DetectLanguage []gax.CallOption GetSupportedLanguages []gax.CallOption TranslateDocument []gax.CallOption BatchTranslateText []gax.CallOption BatchTranslateDocument []gax.CallOption CreateGlossary []gax.CallOption UpdateGlossary []gax.CallOption ListGlossaries []gax.CallOption GetGlossary []gax.CallOption DeleteGlossary []gax.CallOption GetGlossaryEntry []gax.CallOption ListGlossaryEntries []gax.CallOption CreateGlossaryEntry []gax.CallOption UpdateGlossaryEntry []gax.CallOption DeleteGlossaryEntry []gax.CallOption CreateDataset []gax.CallOption GetDataset []gax.CallOption ListDatasets []gax.CallOption DeleteDataset []gax.CallOption CreateAdaptiveMtDataset []gax.CallOption DeleteAdaptiveMtDataset []gax.CallOption GetAdaptiveMtDataset []gax.CallOption ListAdaptiveMtDatasets []gax.CallOption AdaptiveMtTranslate []gax.CallOption GetAdaptiveMtFile []gax.CallOption DeleteAdaptiveMtFile []gax.CallOption ImportAdaptiveMtFile []gax.CallOption ListAdaptiveMtFiles []gax.CallOption ListAdaptiveMtSentences []gax.CallOption ImportData []gax.CallOption ExportData []gax.CallOption ListExamples []gax.CallOption CreateModel []gax.CallOption ListModels []gax.CallOption GetModel []gax.CallOption DeleteModel []gax.CallOption GetLocation []gax.CallOption ListLocations []gax.CallOption CancelOperation []gax.CallOption DeleteOperation []gax.CallOption GetOperation []gax.CallOption ListOperations []gax.CallOption WaitOperation []gax.CallOption }
TranslationCallOptions contains the retry settings for each method of TranslationClient.
type TranslationClient ¶
type TranslationClient struct { // The call options for this service. CallOptions *TranslationCallOptions // LROClient is used internally to handle long-running operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // contains filtered or unexported fields }
TranslationClient is a client for interacting with Cloud Translation API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Provides natural language translation operations.
func NewTranslationClient ¶
func NewTranslationClient(ctx context.Context, opts ...option.ClientOption) (*TranslationClient, error)
NewTranslationClient creates a new translation service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Provides natural language translation operations.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewTranslationRESTClient ¶
func NewTranslationRESTClient(ctx context.Context, opts ...option.ClientOption) (*TranslationClient, error)
NewTranslationRESTClient creates a new translation service rest client.
Provides natural language translation operations.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
)
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 := translate.NewTranslationRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*TranslationClient) AdaptiveMtTranslate ¶
func (c *TranslationClient) AdaptiveMtTranslate(ctx context.Context, req *translatepb.AdaptiveMtTranslateRequest, opts ...gax.CallOption) (*translatepb.AdaptiveMtTranslateResponse, error)
AdaptiveMtTranslate translate text using Adaptive MT.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.AdaptiveMtTranslateRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#AdaptiveMtTranslateRequest.
}
resp, err := c.AdaptiveMtTranslate(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) BatchTranslateDocument ¶
func (c *TranslationClient) BatchTranslateDocument(ctx context.Context, req *translatepb.BatchTranslateDocumentRequest, opts ...gax.CallOption) (*BatchTranslateDocumentOperation, error)
BatchTranslateDocument translates a large volume of document in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it’s all or nothing) may still be available on the specified output location.
This call returns immediately and you can use
google.longrunning.Operation.name (at http://google.longrunning.Operation.name) to poll the status of the call.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.BatchTranslateDocumentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#BatchTranslateDocumentRequest.
}
op, err := c.BatchTranslateDocument(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) BatchTranslateDocumentOperation ¶
func (c *TranslationClient) BatchTranslateDocumentOperation(name string) *BatchTranslateDocumentOperation
BatchTranslateDocumentOperation returns a new BatchTranslateDocumentOperation from a given name. The name must be that of a previously created BatchTranslateDocumentOperation, possibly from a different process.
func (*TranslationClient) BatchTranslateText ¶
func (c *TranslationClient) BatchTranslateText(ctx context.Context, req *translatepb.BatchTranslateTextRequest, opts ...gax.CallOption) (*BatchTranslateTextOperation, error)
BatchTranslateText translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it’s all or nothing) may still be available on the specified output location.
This call returns immediately and you can
use google.longrunning.Operation.name (at http://google.longrunning.Operation.name) to poll the status of the call.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.BatchTranslateTextRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#BatchTranslateTextRequest.
}
op, err := c.BatchTranslateText(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) BatchTranslateTextOperation ¶
func (c *TranslationClient) BatchTranslateTextOperation(name string) *BatchTranslateTextOperation
BatchTranslateTextOperation returns a new BatchTranslateTextOperation from a given name. The name must be that of a previously created BatchTranslateTextOperation, possibly from a different process.
func (*TranslationClient) CancelOperation ¶
func (c *TranslationClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
translate "cloud.google.com/go/translate/apiv3"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*TranslationClient) Close ¶
func (c *TranslationClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*TranslationClient) Connection ¶
func (c *TranslationClient) 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 (*TranslationClient) CreateAdaptiveMtDataset ¶
func (c *TranslationClient) CreateAdaptiveMtDataset(ctx context.Context, req *translatepb.CreateAdaptiveMtDatasetRequest, opts ...gax.CallOption) (*translatepb.AdaptiveMtDataset, error)
CreateAdaptiveMtDataset creates an Adaptive MT dataset.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.CreateAdaptiveMtDatasetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#CreateAdaptiveMtDatasetRequest.
}
resp, err := c.CreateAdaptiveMtDataset(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) CreateDataset ¶
func (c *TranslationClient) CreateDataset(ctx context.Context, req *translatepb.CreateDatasetRequest, opts ...gax.CallOption) (*CreateDatasetOperation, error)
CreateDataset creates a Dataset.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.CreateDatasetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#CreateDatasetRequest.
}
op, err := c.CreateDataset(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) CreateDatasetOperation ¶
func (c *TranslationClient) CreateDatasetOperation(name string) *CreateDatasetOperation
CreateDatasetOperation returns a new CreateDatasetOperation from a given name. The name must be that of a previously created CreateDatasetOperation, possibly from a different process.
func (*TranslationClient) CreateGlossary ¶
func (c *TranslationClient) CreateGlossary(ctx context.Context, req *translatepb.CreateGlossaryRequest, opts ...gax.CallOption) (*CreateGlossaryOperation, error)
CreateGlossary creates a glossary and returns the long-running operation. Returns
NOT_FOUND, if the project doesn’t exist.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.CreateGlossaryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#CreateGlossaryRequest.
}
op, err := c.CreateGlossary(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) CreateGlossaryEntry ¶
func (c *TranslationClient) CreateGlossaryEntry(ctx context.Context, req *translatepb.CreateGlossaryEntryRequest, opts ...gax.CallOption) (*translatepb.GlossaryEntry, error)
CreateGlossaryEntry creates a glossary entry.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.CreateGlossaryEntryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#CreateGlossaryEntryRequest.
}
resp, err := c.CreateGlossaryEntry(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) CreateGlossaryOperation ¶
func (c *TranslationClient) CreateGlossaryOperation(name string) *CreateGlossaryOperation
CreateGlossaryOperation returns a new CreateGlossaryOperation from a given name. The name must be that of a previously created CreateGlossaryOperation, possibly from a different process.
func (*TranslationClient) CreateModel ¶
func (c *TranslationClient) CreateModel(ctx context.Context, req *translatepb.CreateModelRequest, opts ...gax.CallOption) (*CreateModelOperation, error)
CreateModel creates a Model.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.CreateModelRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#CreateModelRequest.
}
op, err := c.CreateModel(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) CreateModelOperation ¶
func (c *TranslationClient) CreateModelOperation(name string) *CreateModelOperation
CreateModelOperation returns a new CreateModelOperation from a given name. The name must be that of a previously created CreateModelOperation, possibly from a different process.
func (*TranslationClient) DeleteAdaptiveMtDataset ¶
func (c *TranslationClient) DeleteAdaptiveMtDataset(ctx context.Context, req *translatepb.DeleteAdaptiveMtDatasetRequest, opts ...gax.CallOption) error
DeleteAdaptiveMtDataset deletes an Adaptive MT dataset, including all its entries and associated
metadata.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.DeleteAdaptiveMtDatasetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#DeleteAdaptiveMtDatasetRequest.
}
err = c.DeleteAdaptiveMtDataset(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*TranslationClient) DeleteAdaptiveMtFile ¶
func (c *TranslationClient) DeleteAdaptiveMtFile(ctx context.Context, req *translatepb.DeleteAdaptiveMtFileRequest, opts ...gax.CallOption) error
DeleteAdaptiveMtFile deletes an AdaptiveMtFile along with its sentences.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.DeleteAdaptiveMtFileRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#DeleteAdaptiveMtFileRequest.
}
err = c.DeleteAdaptiveMtFile(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*TranslationClient) DeleteDataset ¶
func (c *TranslationClient) DeleteDataset(ctx context.Context, req *translatepb.DeleteDatasetRequest, opts ...gax.CallOption) (*DeleteDatasetOperation, error)
DeleteDataset deletes a dataset and all of its contents.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.DeleteDatasetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#DeleteDatasetRequest.
}
op, err := c.DeleteDataset(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*TranslationClient) DeleteDatasetOperation ¶
func (c *TranslationClient) DeleteDatasetOperation(name string) *DeleteDatasetOperation
DeleteDatasetOperation returns a new DeleteDatasetOperation from a given name. The name must be that of a previously created DeleteDatasetOperation, possibly from a different process.
func (*TranslationClient) DeleteGlossary ¶
func (c *TranslationClient) DeleteGlossary(ctx context.Context, req *translatepb.DeleteGlossaryRequest, opts ...gax.CallOption) (*DeleteGlossaryOperation, error)
DeleteGlossary deletes a glossary, or cancels glossary construction
if the glossary isn’t created yet.
Returns NOT_FOUND, if the glossary doesn’t exist.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.DeleteGlossaryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#DeleteGlossaryRequest.
}
op, err := c.DeleteGlossary(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) DeleteGlossaryEntry ¶
func (c *TranslationClient) DeleteGlossaryEntry(ctx context.Context, req *translatepb.DeleteGlossaryEntryRequest, opts ...gax.CallOption) error
DeleteGlossaryEntry deletes a single entry from the glossary
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.DeleteGlossaryEntryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#DeleteGlossaryEntryRequest.
}
err = c.DeleteGlossaryEntry(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*TranslationClient) DeleteGlossaryOperation ¶
func (c *TranslationClient) DeleteGlossaryOperation(name string) *DeleteGlossaryOperation
DeleteGlossaryOperation returns a new DeleteGlossaryOperation from a given name. The name must be that of a previously created DeleteGlossaryOperation, possibly from a different process.
func (*TranslationClient) DeleteModel ¶
func (c *TranslationClient) DeleteModel(ctx context.Context, req *translatepb.DeleteModelRequest, opts ...gax.CallOption) (*DeleteModelOperation, error)
DeleteModel deletes a model.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.DeleteModelRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#DeleteModelRequest.
}
op, err := c.DeleteModel(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*TranslationClient) DeleteModelOperation ¶
func (c *TranslationClient) DeleteModelOperation(name string) *DeleteModelOperation
DeleteModelOperation returns a new DeleteModelOperation from a given name. The name must be that of a previously created DeleteModelOperation, possibly from a different process.
func (*TranslationClient) DeleteOperation ¶
func (c *TranslationClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error
DeleteOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
translate "cloud.google.com/go/translate/apiv3"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.DeleteOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
}
err = c.DeleteOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*TranslationClient) DetectLanguage ¶
func (c *TranslationClient) DetectLanguage(ctx context.Context, req *translatepb.DetectLanguageRequest, opts ...gax.CallOption) (*translatepb.DetectLanguageResponse, error)
DetectLanguage detects the language of text within a request.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.DetectLanguageRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#DetectLanguageRequest.
}
resp, err := c.DetectLanguage(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) ExportData ¶
func (c *TranslationClient) ExportData(ctx context.Context, req *translatepb.ExportDataRequest, opts ...gax.CallOption) (*ExportDataOperation, error)
ExportData exports dataset’s data to the provided output location.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ExportDataRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ExportDataRequest.
}
op, err := c.ExportData(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*TranslationClient) ExportDataOperation ¶
func (c *TranslationClient) ExportDataOperation(name string) *ExportDataOperation
ExportDataOperation returns a new ExportDataOperation from a given name. The name must be that of a previously created ExportDataOperation, possibly from a different process.
func (*TranslationClient) GetAdaptiveMtDataset ¶
func (c *TranslationClient) GetAdaptiveMtDataset(ctx context.Context, req *translatepb.GetAdaptiveMtDatasetRequest, opts ...gax.CallOption) (*translatepb.AdaptiveMtDataset, error)
GetAdaptiveMtDataset gets the Adaptive MT dataset.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.GetAdaptiveMtDatasetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#GetAdaptiveMtDatasetRequest.
}
resp, err := c.GetAdaptiveMtDataset(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) GetAdaptiveMtFile ¶
func (c *TranslationClient) GetAdaptiveMtFile(ctx context.Context, req *translatepb.GetAdaptiveMtFileRequest, opts ...gax.CallOption) (*translatepb.AdaptiveMtFile, error)
GetAdaptiveMtFile gets and AdaptiveMtFile
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.GetAdaptiveMtFileRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#GetAdaptiveMtFileRequest.
}
resp, err := c.GetAdaptiveMtFile(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) GetDataset ¶
func (c *TranslationClient) GetDataset(ctx context.Context, req *translatepb.GetDatasetRequest, opts ...gax.CallOption) (*translatepb.Dataset, error)
GetDataset gets a Dataset.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.GetDatasetRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#GetDatasetRequest.
}
resp, err := c.GetDataset(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) GetGlossary ¶
func (c *TranslationClient) GetGlossary(ctx context.Context, req *translatepb.GetGlossaryRequest, opts ...gax.CallOption) (*translatepb.Glossary, error)
GetGlossary gets a glossary. Returns NOT_FOUND, if the glossary doesn’t
exist.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.GetGlossaryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#GetGlossaryRequest.
}
resp, err := c.GetGlossary(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) GetGlossaryEntry ¶
func (c *TranslationClient) GetGlossaryEntry(ctx context.Context, req *translatepb.GetGlossaryEntryRequest, opts ...gax.CallOption) (*translatepb.GlossaryEntry, error)
GetGlossaryEntry gets a single glossary entry by the given id.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.GetGlossaryEntryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#GetGlossaryEntryRequest.
}
resp, err := c.GetGlossaryEntry(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) GetLocation ¶
func (c *TranslationClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) GetModel ¶
func (c *TranslationClient) GetModel(ctx context.Context, req *translatepb.GetModelRequest, opts ...gax.CallOption) (*translatepb.Model, error)
GetModel gets a model.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.GetModelRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#GetModelRequest.
}
resp, err := c.GetModel(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) GetOperation ¶
func (c *TranslationClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
translate "cloud.google.com/go/translate/apiv3"
)
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 := translate.NewTranslationClient(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 (*TranslationClient) GetSupportedLanguages ¶
func (c *TranslationClient) GetSupportedLanguages(ctx context.Context, req *translatepb.GetSupportedLanguagesRequest, opts ...gax.CallOption) (*translatepb.SupportedLanguages, error)
GetSupportedLanguages returns a list of supported languages for translation.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.GetSupportedLanguagesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#GetSupportedLanguagesRequest.
}
resp, err := c.GetSupportedLanguages(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) ImportAdaptiveMtFile ¶
func (c *TranslationClient) ImportAdaptiveMtFile(ctx context.Context, req *translatepb.ImportAdaptiveMtFileRequest, opts ...gax.CallOption) (*translatepb.ImportAdaptiveMtFileResponse, error)
ImportAdaptiveMtFile imports an AdaptiveMtFile and adds all of its sentences into the
AdaptiveMtDataset.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ImportAdaptiveMtFileRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ImportAdaptiveMtFileRequest.
}
resp, err := c.ImportAdaptiveMtFile(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) ImportData ¶
func (c *TranslationClient) ImportData(ctx context.Context, req *translatepb.ImportDataRequest, opts ...gax.CallOption) (*ImportDataOperation, error)
ImportData import sentence pairs into translation Dataset.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ImportDataRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ImportDataRequest.
}
op, err := c.ImportData(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*TranslationClient) ImportDataOperation ¶
func (c *TranslationClient) ImportDataOperation(name string) *ImportDataOperation
ImportDataOperation returns a new ImportDataOperation from a given name. The name must be that of a previously created ImportDataOperation, possibly from a different process.
func (*TranslationClient) ListAdaptiveMtDatasets ¶
func (c *TranslationClient) ListAdaptiveMtDatasets(ctx context.Context, req *translatepb.ListAdaptiveMtDatasetsRequest, opts ...gax.CallOption) *AdaptiveMtDatasetIterator
ListAdaptiveMtDatasets lists all Adaptive MT datasets for which the caller has read permission.
Code:play
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
"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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ListAdaptiveMtDatasetsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ListAdaptiveMtDatasetsRequest.
}
it := c.ListAdaptiveMtDatasets(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.(*translatepb.ListAdaptiveMtDatasetsResponse)
}
}
Example (All)¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ListAdaptiveMtDatasetsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ListAdaptiveMtDatasetsRequest.
}
for resp, err := range c.ListAdaptiveMtDatasets(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*TranslationClient) ListAdaptiveMtFiles ¶
func (c *TranslationClient) ListAdaptiveMtFiles(ctx context.Context, req *translatepb.ListAdaptiveMtFilesRequest, opts ...gax.CallOption) *AdaptiveMtFileIterator
ListAdaptiveMtFiles lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
Code:play
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
"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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ListAdaptiveMtFilesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ListAdaptiveMtFilesRequest.
}
it := c.ListAdaptiveMtFiles(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.(*translatepb.ListAdaptiveMtFilesResponse)
}
}
Example (All)¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ListAdaptiveMtFilesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ListAdaptiveMtFilesRequest.
}
for resp, err := range c.ListAdaptiveMtFiles(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*TranslationClient) ListAdaptiveMtSentences ¶
func (c *TranslationClient) ListAdaptiveMtSentences(ctx context.Context, req *translatepb.ListAdaptiveMtSentencesRequest, opts ...gax.CallOption) *AdaptiveMtSentenceIterator
ListAdaptiveMtSentences lists all AdaptiveMtSentences under a given file/dataset.
Code:play
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
"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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ListAdaptiveMtSentencesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ListAdaptiveMtSentencesRequest.
}
it := c.ListAdaptiveMtSentences(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.(*translatepb.ListAdaptiveMtSentencesResponse)
}
}
Example (All)¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ListAdaptiveMtSentencesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ListAdaptiveMtSentencesRequest.
}
for resp, err := range c.ListAdaptiveMtSentences(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*TranslationClient) ListDatasets ¶
func (c *TranslationClient) ListDatasets(ctx context.Context, req *translatepb.ListDatasetsRequest, opts ...gax.CallOption) *DatasetIterator
ListDatasets lists datasets.
Code:play
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
"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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ListDatasetsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ListDatasetsRequest.
}
it := c.ListDatasets(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.(*translatepb.ListDatasetsResponse)
}
}
Example (All)¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ListDatasetsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ListDatasetsRequest.
}
for resp, err := range c.ListDatasets(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*TranslationClient) ListExamples ¶
func (c *TranslationClient) ListExamples(ctx context.Context, req *translatepb.ListExamplesRequest, opts ...gax.CallOption) *ExampleIterator
ListExamples lists sentence pairs in the dataset.
Code:play
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
"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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ListExamplesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ListExamplesRequest.
}
it := c.ListExamples(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.(*translatepb.ListExamplesResponse)
}
}
Example (All)¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ListExamplesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ListExamplesRequest.
}
for resp, err := range c.ListExamples(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*TranslationClient) ListGlossaries ¶
func (c *TranslationClient) ListGlossaries(ctx context.Context, req *translatepb.ListGlossariesRequest, opts ...gax.CallOption) *GlossaryIterator
ListGlossaries lists glossaries in a project. Returns NOT_FOUND, if the project doesn’t
exist.
Code:play
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
"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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ListGlossariesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ListGlossariesRequest.
}
it := c.ListGlossaries(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.(*translatepb.ListGlossariesResponse)
}
}
Example (All)¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ListGlossariesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ListGlossariesRequest.
}
for resp, err := range c.ListGlossaries(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*TranslationClient) ListGlossaryEntries ¶
func (c *TranslationClient) ListGlossaryEntries(ctx context.Context, req *translatepb.ListGlossaryEntriesRequest, opts ...gax.CallOption) *GlossaryEntryIterator
ListGlossaryEntries list the entries for the glossary.
Code:play
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
"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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ListGlossaryEntriesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ListGlossaryEntriesRequest.
}
it := c.ListGlossaryEntries(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.(*translatepb.ListGlossaryEntriesResponse)
}
}
Example (All)¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ListGlossaryEntriesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ListGlossaryEntriesRequest.
}
for resp, err := range c.ListGlossaryEntries(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*TranslationClient) ListLocations ¶
func (c *TranslationClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Code:play
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(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.(*locationpb.ListLocationsResponse)
}
}
Example (All)¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*TranslationClient) ListModels ¶
func (c *TranslationClient) ListModels(ctx context.Context, req *translatepb.ListModelsRequest, opts ...gax.CallOption) *ModelIterator
ListModels lists models.
Code:play
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
"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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ListModelsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ListModelsRequest.
}
it := c.ListModels(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.(*translatepb.ListModelsResponse)
}
}
Example (All)¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.ListModelsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#ListModelsRequest.
}
for resp, err := range c.ListModels(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*TranslationClient) ListOperations ¶
func (c *TranslationClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator
ListOperations is a utility method from google.longrunning.Operations.
Code:play
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
translate "cloud.google.com/go/translate/apiv3"
"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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
it := c.ListOperations(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.(*longrunningpb.ListOperationsResponse)
}
}
Example (All)¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
translate "cloud.google.com/go/translate/apiv3"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.ListOperationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
}
for resp, err := range c.ListOperations(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*TranslationClient) RomanizeText ¶
func (c *TranslationClient) RomanizeText(ctx context.Context, req *translatepb.RomanizeTextRequest, opts ...gax.CallOption) (*translatepb.RomanizeTextResponse, error)
RomanizeText romanize input text written in non-Latin scripts to Latin text.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.RomanizeTextRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#RomanizeTextRequest.
}
resp, err := c.RomanizeText(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) TranslateDocument ¶
func (c *TranslationClient) TranslateDocument(ctx context.Context, req *translatepb.TranslateDocumentRequest, opts ...gax.CallOption) (*translatepb.TranslateDocumentResponse, error)
TranslateDocument translates documents in synchronous mode.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.TranslateDocumentRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#TranslateDocumentRequest.
}
resp, err := c.TranslateDocument(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) TranslateText ¶
func (c *TranslationClient) TranslateText(ctx context.Context, req *translatepb.TranslateTextRequest, opts ...gax.CallOption) (*translatepb.TranslateTextResponse, error)
TranslateText translates input text and returns translated text.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.TranslateTextRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#TranslateTextRequest.
}
resp, err := c.TranslateText(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) UpdateGlossary ¶
func (c *TranslationClient) UpdateGlossary(ctx context.Context, req *translatepb.UpdateGlossaryRequest, opts ...gax.CallOption) (*UpdateGlossaryOperation, error)
UpdateGlossary updates a glossary. A LRO is used since the update can be async if the
glossary’s entry file is updated.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.UpdateGlossaryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#UpdateGlossaryRequest.
}
op, err := c.UpdateGlossary(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) UpdateGlossaryEntry ¶
func (c *TranslationClient) UpdateGlossaryEntry(ctx context.Context, req *translatepb.UpdateGlossaryEntryRequest, opts ...gax.CallOption) (*translatepb.GlossaryEntry, error)
UpdateGlossaryEntry updates a glossary entry.
Code:play
Example¶
package main
import (
"context"
translate "cloud.google.com/go/translate/apiv3"
translatepb "cloud.google.com/go/translate/apiv3/translatepb"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &translatepb.UpdateGlossaryEntryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/translate/apiv3/translatepb#UpdateGlossaryEntryRequest.
}
resp, err := c.UpdateGlossaryEntry(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*TranslationClient) UpdateGlossaryOperation ¶
func (c *TranslationClient) UpdateGlossaryOperation(name string) *UpdateGlossaryOperation
UpdateGlossaryOperation returns a new UpdateGlossaryOperation from a given name. The name must be that of a previously created UpdateGlossaryOperation, possibly from a different process.
func (*TranslationClient) WaitOperation ¶
func (c *TranslationClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
WaitOperation is a utility method from google.longrunning.Operations.
Code:play
Example¶
package main
import (
"context"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
translate "cloud.google.com/go/translate/apiv3"
)
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 := translate.NewTranslationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.WaitOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#WaitOperationRequest.
}
resp, err := c.WaitOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
type UpdateGlossaryOperation ¶
type UpdateGlossaryOperation struct {
// contains filtered or unexported fields
}
UpdateGlossaryOperation manages a long-running operation from UpdateGlossary.
func (*UpdateGlossaryOperation) Done ¶
func (op *UpdateGlossaryOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UpdateGlossaryOperation) Metadata ¶
func (op *UpdateGlossaryOperation) Metadata() (*translatepb.UpdateGlossaryMetadata, 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 (*UpdateGlossaryOperation) Name ¶
func (op *UpdateGlossaryOperation) 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 (*UpdateGlossaryOperation) Poll ¶
func (op *UpdateGlossaryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.Glossary, 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 (*UpdateGlossaryOperation) Wait ¶
func (op *UpdateGlossaryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.Glossary, 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.
Source Files ¶
auxiliary.go auxiliary_go123.go doc.go helpers.go translation_client.go version.go
Directories ¶
Path | Synopsis |
---|---|
apiv3/translatepb |
- Version
- v1.12.3 (latest)
- Published
- Jan 2, 2025
- Platform
- linux/amd64
- Imports
- 30 packages
- Last checked
- 3 days ago –
Tools for package owners.