func UserAgent() string
UserAgent returns the UserAgent string to use when sending http.Requests.
func Version() string
Version returns the semantic version (see http://semver.org) of the client.
BaseClient is the base client for Translatortext.
type BaseClient struct { autorest.Client }
func New() BaseClient
New creates an instance of the BaseClient client.
func NewWithoutDefaults() BaseClient
NewWithoutDefaults creates an instance of the BaseClient client.
BatchRequest definition for the input batch translation request
type BatchRequest struct { Source *SourceInput `json:"source,omitempty"` // Targets - Location of the destination for the output Targets *[]TargetInput `json:"targets,omitempty"` // StorageType - Possible values include: 'Folder', 'File' StorageType StorageType `json:"storageType,omitempty"` }
BatchStatusDetail job status response
type BatchStatusDetail struct { autorest.Response `json:"-"` // ID - Id of the operation. ID *uuid.UUID `json:"id,omitempty"` // CreatedDateTimeUtc - Operation created date time CreatedDateTimeUtc *date.Time `json:"createdDateTimeUtc,omitempty"` // LastActionDateTimeUtc - Date time in which the operation's status has been updated LastActionDateTimeUtc *date.Time `json:"lastActionDateTimeUtc,omitempty"` // Status - Possible values include: 'NotStarted', 'Running', 'Succeeded', 'Failed', 'Cancelled', 'Cancelling' Status Status `json:"status,omitempty"` Summary *StatusSummary `json:"summary,omitempty"` }
BatchStatusResponse document Status Response
type BatchStatusResponse struct { autorest.Response `json:"-"` // Value - The summary status of individual operation Value *[]BatchStatusDetail `json:"value,omitempty"` // NextLink - Url for the next page. Null if no more pages available NextLink *string `json:"@nextLink,omitempty"` }
BatchSubmissionRequest job submission batch request
type BatchSubmissionRequest struct { // Inputs - The input list of documents or folders containing documents Inputs *[]BatchRequest `json:"inputs,omitempty"` }
Code enumerates the values for code.
type Code string
const ( // InternalServerError ... InternalServerError Code = "InternalServerError" // InvalidArgument ... InvalidArgument Code = "InvalidArgument" // InvalidRequest ... InvalidRequest Code = "InvalidRequest" // RequestRateTooHigh ... RequestRateTooHigh Code = "RequestRateTooHigh" // ResourceNotFound ... ResourceNotFound Code = "ResourceNotFound" // ServiceUnavailable ... Code = "ServiceUnavailable" // Unauthorized ... Code = "Unauthorized" )
func PossibleCodeValues() []Code
PossibleCodeValues returns an array of possible values for the Code const type.
DocumentFilter ...
type DocumentFilter struct { // Prefix - A case-sensitive prefix string to filter documents in the source path for translation. // For example, when using a Azure storage blob Uri, use the prefix to restrict sub folders for translation. Prefix *string `json:"prefix,omitempty"` // Suffix - A case-sensitive suffix string to filter documents in the source path for translation. // This is most often use for file extensions Suffix *string `json:"suffix,omitempty"` }
DocumentStatusDetail ...
type DocumentStatusDetail struct { autorest.Response `json:"-"` // Path - Location of the document or folder Path *string `json:"path,omitempty"` // CreatedDateTimeUtc - Operation created date time CreatedDateTimeUtc *date.Time `json:"createdDateTimeUtc,omitempty"` // LastActionDateTimeUtc - Date time in which the operation's status has been updated LastActionDateTimeUtc *date.Time `json:"lastActionDateTimeUtc,omitempty"` // Status - Possible values include: 'Status1NotStarted', 'Status1Running', 'Status1Succeeded', 'Status1Failed', 'Status1Cancelled', 'Status1Cancelling' Status Status1 `json:"status,omitempty"` // DetectedLanguage - Detected language of the original document (to be implemented) DetectedLanguage *string `json:"detectedLanguage,omitempty"` // To - To language To *string `json:"to,omitempty"` Error *ErrorV2 `json:"error,omitempty"` // Progress - Progress of the translation if available Progress *float64 `json:"progress,omitempty"` // ID - Document Id ID *uuid.UUID `json:"id,omitempty"` }
DocumentStatusResponse document Status Response
type DocumentStatusResponse struct { autorest.Response `json:"-"` // Value - The detail status of individual documents Value *[]DocumentStatusDetail `json:"value,omitempty"` // NextLink - Url for the next page. Null if no more pages available NextLink *string `json:"@nextLink,omitempty"` }
ErrorResponseV2 contains unified error information used for HTTP responses across any Cognitive Service. Instances can be created either through Microsoft.CloudAI.Containers.HttpStatusExceptionV2 or by returning it directly from a controller.
type ErrorResponseV2 struct { Error *ErrorV2 `json:"error,omitempty"` }
ErrorV2 this contains an outer error with error code, message, details, target and an inner error with more descriptive details.
type ErrorV2 struct { // Code - Possible values include: 'InvalidRequest', 'InvalidArgument', 'InternalServerError', 'ServiceUnavailable', 'ResourceNotFound', 'Unauthorized', 'RequestRateTooHigh' Code Code `json:"code,omitempty"` // Message - READ-ONLY; Gets high level error message. Message *string `json:"message,omitempty"` // Target - READ-ONLY; Gets the source of the error. // For example it would be "documents" or "document id" in case of invalid document. Target *string `json:"target,omitempty"` InnerError *InnerErrorV2 `json:"innerError,omitempty"` }
func (ev ErrorV2) MarshalJSON() ([]byte, error)
MarshalJSON is the custom marshaler for ErrorV2.
FileFormat ...
type FileFormat struct { // Format - Name of the format Format *string `json:"format,omitempty"` // FileExtensions - Supported file extension for this format FileExtensions *[]string `json:"fileExtensions,omitempty"` // ContentTypes - Supported Content-Types for this format ContentTypes *[]string `json:"contentTypes,omitempty"` // Versions - Supported Version Versions *[]string `json:"versions,omitempty"` }
FileFormatListResult base type for List return in our api
type FileFormatListResult struct { autorest.Response `json:"-"` // Value - list of objects Value *[]FileFormat `json:"value,omitempty"` }
Glossary glossary / translation memory for the request
type Glossary struct { // GlossaryURL - Location of the glossary. // We will use the file extension to extract the formating if the format parameter is not supplied. // // If the translation language pair is not present in the glossary, it will not be applied GlossaryURL *string `json:"glossaryUrl,omitempty"` // Format - Format Format *string `json:"format,omitempty"` // Version - Version Version *string `json:"version,omitempty"` }
InnerErrorV2 new Inner Error format which conforms to Cognitive Services API Guidelines which is available at https://microsoft.sharepoint.com/%3Aw%3A/t/CognitiveServicesPMO/EUoytcrjuJdKpeOKIK_QRC8BPtUYQpKBi8JsWyeDMRsWlQ?e=CPq8ow. This contains required properties ErrorCode, message and optional properties target, details(key value pair), inner error(this can be nested).
type InnerErrorV2 struct { // Code - READ-ONLY; Gets detailed error code. Code *int32 `json:"code,omitempty"` // Error - READ-ONLY; Gets detailed error string. Error *string `json:"error,omitempty"` // Message - READ-ONLY; Gets high level error message. Message *string `json:"message,omitempty"` // Target - READ-ONLY; Gets the source of the error. // For example it would be "documents" or "document id" in case of invalid document. Target *string `json:"target,omitempty"` InnerError *InnerErrorV2 `json:"innerError,omitempty"` }
func (iev InnerErrorV2) MarshalJSON() ([]byte, error)
MarshalJSON is the custom marshaler for InnerErrorV2.
SourceInput source of the input documents
type SourceInput struct { // SourceURL - Location of the folder / container or single file with your documents SourceURL *string `json:"sourceUrl,omitempty"` Filter *DocumentFilter `json:"filter,omitempty"` // Language - Language code // If none is specified, we will perform auto detect on the document Language *string `json:"language,omitempty"` // StorageSource - Possible values include: 'AzureBlob' StorageSource StorageSource `json:"storageSource,omitempty"` }
Status enumerates the values for status.
type Status string
const ( // Cancelled ... Cancelled Status = "Cancelled" // Cancelling ... Cancelling Status = "Cancelling" // Failed ... Failed Status = "Failed" // NotStarted ... NotStarted Status = "NotStarted" // Running ... Running Status = "Running" // Succeeded ... Succeeded Status = "Succeeded" )
func PossibleStatusValues() []Status
PossibleStatusValues returns an array of possible values for the Status const type.
Status1 enumerates the values for status 1.
type Status1 string
const ( // Status1Cancelled ... Status1Cancelled Status1 = "Cancelled" // Status1Cancelling ... Status1Cancelling Status1 = "Cancelling" // Status1Failed ... Status1Failed Status1 = "Failed" // Status1NotStarted ... Status1NotStarted Status1 = "NotStarted" // Status1Running ... Status1Running Status1 = "Running" // Status1Succeeded ... Status1Succeeded Status1 = "Succeeded" )
func PossibleStatus1Values() []Status1
PossibleStatus1Values returns an array of possible values for the Status1 const type.
StatusSummary ...
type StatusSummary struct { // Total - Total count Total *int32 `json:"total,omitempty"` // Failed - Failed count Failed *int32 `json:"failed,omitempty"` // Success - Number of Success Success *int32 `json:"success,omitempty"` // InProgress - Number of in progress InProgress *int32 `json:"inProgress,omitempty"` // NotYetStarted - Count of not yet started NotYetStarted *int32 `json:"notYetStarted,omitempty"` // Cancelled - Number of cancelled Cancelled *int32 `json:"cancelled,omitempty"` }
StorageSource enumerates the values for storage source.
type StorageSource string
const ( // AzureBlob ... AzureBlob StorageSource = "AzureBlob" )
func PossibleStorageSourceValues() []StorageSource
PossibleStorageSourceValues returns an array of possible values for the StorageSource const type.
StorageSource1 enumerates the values for storage source 1.
type StorageSource1 string
const ( // StorageSource1AzureBlob ... StorageSource1AzureBlob StorageSource1 = "AzureBlob" )
func PossibleStorageSource1Values() []StorageSource1
PossibleStorageSource1Values returns an array of possible values for the StorageSource1 const type.
StorageSourceListResult base type for List return in our api
type StorageSourceListResult struct { autorest.Response `json:"-"` // Value - list of objects Value *[]string `json:"value,omitempty"` }
StorageType enumerates the values for storage type.
type StorageType string
const ( // File ... File StorageType = "File" // Folder ... Folder StorageType = "Folder" )
func PossibleStorageTypeValues() []StorageType
PossibleStorageTypeValues returns an array of possible values for the StorageType const type.
TargetInput destination for the finished translated documents
type TargetInput struct { // TargetURL - Location of the folder / container with your documents TargetURL *string `json:"targetUrl,omitempty"` // Category - Category / custom system for translation request Category *string `json:"category,omitempty"` // Language - Target Language Language *string `json:"language,omitempty"` // Glossaries - List of Glossary Glossaries *[]Glossary `json:"glossaries,omitempty"` // StorageSource - Possible values include: 'StorageSource1AzureBlob' StorageSource StorageSource1 `json:"storageSource,omitempty"` }
TranslationClient is the client for the Translation methods of the Translatortext service.
type TranslationClient struct { BaseClient }
func NewTranslationClient() TranslationClient
NewTranslationClient creates an instance of the TranslationClient client.
func (client TranslationClient) CancelOperation(ctx context.Context, endpoint string, ID uuid.UUID) (result BatchStatusDetail, err error)
CancelOperation cancel a currently processing or queued operation. An operation will not be cancelled if it is already completed or failed or cancelling. A bad request will be returned. All documents that have completed translation will not be cancelled and will be charged. All pending documents will be cancelled if possible. Parameters: endpoint - supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). ID - format - uuid. The operation-id
func (client TranslationClient) CancelOperationPreparer(ctx context.Context, endpoint string, ID uuid.UUID) (*http.Request, error)
CancelOperationPreparer prepares the CancelOperation request.
func (client TranslationClient) CancelOperationResponder(resp *http.Response) (result BatchStatusDetail, err error)
CancelOperationResponder handles the response to the CancelOperation request. The method always closes the http.Response Body.
func (client TranslationClient) CancelOperationSender(req *http.Request) (*http.Response, error)
CancelOperationSender sends the CancelOperation request. The method will close the http.Response Body if it receives an error.
func (client TranslationClient) GetDocumentFormats(ctx context.Context, endpoint string) (result FileFormatListResult, err error)
GetDocumentFormats the list of supported document formats supported by our service. The list will include the common file extension used and supported as well as the content-type if using the upload API. Parameters: endpoint - supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).
func (client TranslationClient) GetDocumentFormatsPreparer(ctx context.Context, endpoint string) (*http.Request, error)
GetDocumentFormatsPreparer prepares the GetDocumentFormats request.
func (client TranslationClient) GetDocumentFormatsResponder(resp *http.Response) (result FileFormatListResult, err error)
GetDocumentFormatsResponder handles the response to the GetDocumentFormats request. The method always closes the http.Response Body.
func (client TranslationClient) GetDocumentFormatsSender(req *http.Request) (*http.Response, error)
GetDocumentFormatsSender sends the GetDocumentFormats request. The method will close the http.Response Body if it receives an error.
func (client TranslationClient) GetDocumentStatus(ctx context.Context, endpoint string, ID uuid.UUID, documentID uuid.UUID) (result DocumentStatusDetail, err error)
GetDocumentStatus returns the status of the translation of the document. Parameters: endpoint - supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). ID - format - uuid. The batch id documentID - format - uuid. The document id
func (client TranslationClient) GetDocumentStatusPreparer(ctx context.Context, endpoint string, ID uuid.UUID, documentID uuid.UUID) (*http.Request, error)
GetDocumentStatusPreparer prepares the GetDocumentStatus request.
func (client TranslationClient) GetDocumentStatusResponder(resp *http.Response) (result DocumentStatusDetail, err error)
GetDocumentStatusResponder handles the response to the GetDocumentStatus request. The method always closes the http.Response Body.
func (client TranslationClient) GetDocumentStatusSender(req *http.Request) (*http.Response, error)
GetDocumentStatusSender sends the GetDocumentStatus request. The method will close the http.Response Body if it receives an error.
func (client TranslationClient) GetDocumentStorageSource(ctx context.Context, endpoint string) (result StorageSourceListResult, err error)
GetDocumentStorageSource the list of storage sources supported by our service. Parameters: endpoint - supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).
func (client TranslationClient) GetDocumentStorageSourcePreparer(ctx context.Context, endpoint string) (*http.Request, error)
GetDocumentStorageSourcePreparer prepares the GetDocumentStorageSource request.
func (client TranslationClient) GetDocumentStorageSourceResponder(resp *http.Response) (result StorageSourceListResult, err error)
GetDocumentStorageSourceResponder handles the response to the GetDocumentStorageSource request. The method always closes the http.Response Body.
func (client TranslationClient) GetDocumentStorageSourceSender(req *http.Request) (*http.Response, error)
GetDocumentStorageSourceSender sends the GetDocumentStorageSource request. The method will close the http.Response Body if it receives an error.
func (client TranslationClient) GetGlossaryFormats(ctx context.Context, endpoint string) (result FileFormatListResult, err error)
GetGlossaryFormats the list of supported glossary formats supported by our service. The list will include the common file extension used. Parameters: endpoint - supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).
func (client TranslationClient) GetGlossaryFormatsPreparer(ctx context.Context, endpoint string) (*http.Request, error)
GetGlossaryFormatsPreparer prepares the GetGlossaryFormats request.
func (client TranslationClient) GetGlossaryFormatsResponder(resp *http.Response) (result FileFormatListResult, err error)
GetGlossaryFormatsResponder handles the response to the GetGlossaryFormats request. The method always closes the http.Response Body.
func (client TranslationClient) GetGlossaryFormatsSender(req *http.Request) (*http.Response, error)
GetGlossaryFormatsSender sends the GetGlossaryFormats request. The method will close the http.Response Body if it receives an error.
func (client TranslationClient) GetOperationDocumentsStatus(ctx context.Context, endpoint string, ID uuid.UUID, top *int32, skip *int32) (result DocumentStatusResponse, err error)
GetOperationDocumentsStatus returns the status of the list of documents translation operation by a given operation id.
If the number of documents exceed our paging limit, server side paging will be used. Paginated responses will indicate a partial result by including a continuation token in the response. The absence of a continuation token means that no additional pages are available.
Clients MAY use $top and $skip query parameters to specify a number of results to return and an offset into the collection. The server will honor the values specified by the client; however, clients MUST be prepared to handle responses that contain a different page size or contain a continuation token. When both $top and $skip are given by a client, the server SHOULD first apply $skip and then $top on the collection. Note: If the server can't honor $top and/or $skip, the server MUST return an error to the client informing about it instead of just ignoring the query options. This will avoid the risk of the client making assumptions about the data returned. Parameters: endpoint - supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). ID - format - uuid. The operation id top - take the $top entries in the collection When both $top and $skip are supplied, $skip is applied first skip - skip the $skip entries in the collection When both $top and $skip are supplied, $skip is applied first
func (client TranslationClient) GetOperationDocumentsStatusPreparer(ctx context.Context, endpoint string, ID uuid.UUID, top *int32, skip *int32) (*http.Request, error)
GetOperationDocumentsStatusPreparer prepares the GetOperationDocumentsStatus request.
func (client TranslationClient) GetOperationDocumentsStatusResponder(resp *http.Response) (result DocumentStatusResponse, err error)
GetOperationDocumentsStatusResponder handles the response to the GetOperationDocumentsStatus request. The method always closes the http.Response Body.
func (client TranslationClient) GetOperationDocumentsStatusSender(req *http.Request) (*http.Response, error)
GetOperationDocumentsStatusSender sends the GetOperationDocumentsStatus request. The method will close the http.Response Body if it receives an error.
func (client TranslationClient) GetOperationStatus(ctx context.Context, endpoint string, ID uuid.UUID) (result BatchStatusDetail, err error)
GetOperationStatus returns the status of the translation batch operation. The status will include the overall job status as well as a summary of the current progress of all the documents being translated. Parameters: endpoint - supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). ID - format - uuid. The operation id
func (client TranslationClient) GetOperationStatusPreparer(ctx context.Context, endpoint string, ID uuid.UUID) (*http.Request, error)
GetOperationStatusPreparer prepares the GetOperationStatus request.
func (client TranslationClient) GetOperationStatusResponder(resp *http.Response) (result BatchStatusDetail, err error)
GetOperationStatusResponder handles the response to the GetOperationStatus request. The method always closes the http.Response Body.
func (client TranslationClient) GetOperationStatusSender(req *http.Request) (*http.Response, error)
GetOperationStatusSender sends the GetOperationStatus request. The method will close the http.Response Body if it receives an error.
func (client TranslationClient) GetOperations(ctx context.Context, endpoint string, top *int32, skip *int32) (result BatchStatusResponse, err error)
GetOperations returns the list of status of the translation batch operation. The list will consist only of the batch request submitted by the user (based on their subscription)
If the number of operations exceed our paging limit, server side paging will be used. Paginated responses will indicate a partial result by including a continuation token in the response. The absence of a continuation token means that no additional pages are available.
Clients MAY use $top and $skip query parameters to specify a number of results to return and an offset into the collection. The server will honor the values specified by the client; however, clients MUST be prepared to handle responses that contain a different page size or contain a continuation token. When both $top and $skip are given by a client, the server SHOULD first apply $skip and then $top on the collection. Note: If the server can't honor $top and/or $skip, the server MUST return an error to the client informing about it instead of just ignoring the query options. This will avoid the risk of the client making assumptions about the data returned. Parameters: endpoint - supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). top - take the $top entries in the collection When both $top and $skip are supplied, $skip is applied first skip - skip the $skip entries in the collection When both $top and $skip are supplied, $skip is applied first
func (client TranslationClient) GetOperationsPreparer(ctx context.Context, endpoint string, top *int32, skip *int32) (*http.Request, error)
GetOperationsPreparer prepares the GetOperations request.
func (client TranslationClient) GetOperationsResponder(resp *http.Response) (result BatchStatusResponse, err error)
GetOperationsResponder handles the response to the GetOperations request. The method always closes the http.Response Body.
func (client TranslationClient) GetOperationsSender(req *http.Request) (*http.Response, error)
GetOperationsSender sends the GetOperations request. The method will close the http.Response Body if it receives an error.
func (client TranslationClient) SubmitBatchRequest(ctx context.Context, endpoint string, body *BatchSubmissionRequest) (result autorest.Response, err error)
SubmitBatchRequest submit a batch request to the document translation service.
Each request can consists of multiple inputs. Each input will contains both a source and destination container for source and target language pair.
The prefix and suffix filter (if supplied) will be used to filter the folders. The prefix will be applied to the subpath after the container name
Glossaries / Translation memory can be supplied and will be applied when the document is being translated. If the glossary is invalid or unreachable during translation time. An error will be indicated in the document status.
If the file with the same name already exists in the destination, it will be overwritten. TargetUrl for each target language needs to be unique. Parameters: endpoint - supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). body - request details
func (client TranslationClient) SubmitBatchRequestPreparer(ctx context.Context, endpoint string, body *BatchSubmissionRequest) (*http.Request, error)
SubmitBatchRequestPreparer prepares the SubmitBatchRequest request.
func (client TranslationClient) SubmitBatchRequestResponder(resp *http.Response) (result autorest.Response, err error)
SubmitBatchRequestResponder handles the response to the SubmitBatchRequest request. The method always closes the http.Response Body.
func (client TranslationClient) SubmitBatchRequestSender(req *http.Request) (*http.Response, error)
SubmitBatchRequestSender sends the SubmitBatchRequest request. The method will close the http.Response Body if it receives an error.
Name | Synopsis |
---|---|
.. | |
translatortextapi |