6.3 KiB
\TranslateAPI
All URIs are relative to https://api.hanzo.ai
| Method | HTTP request | Description |
|---|---|---|
| GetTranslateMemory | Get /v1/translate/memory | Returns the org's own translation-memory entries, newest first, optionally narrowed to one target language and/or one position on the review ladder. |
| PostTranslate | Post /v1/translate | Translate a string or a batch into one target language |
| PutTranslateMemory | Put /v1/translate/memory | Records a human decision on one translation-memory entry, and returns the entry as stored. |
GetTranslateMemory
TranslateMemoryPage GetTranslateMemory(ctx).Target(target).State(state).Limit(limit).Execute()
Returns the org's own translation-memory entries, newest first, optionally narrowed to one target language and/or one position on the review ladder.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
target := "target_example" // string | Target narrows to one target language tag (BCP-47, e.g. \"es\" or \"pt-BR\"). (optional)
state := "state_example" // string | State narrows to one position on the review ladder: machine, suggested, approved or published. (optional)
limit := int64(789) // int64 | Limit caps the rows returned. Non-positive or unparseable means the server default (200); the ceiling is 1000. (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.TranslateAPI.GetTranslateMemory(context.Background()).Target(target).State(state).Limit(limit).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `TranslateAPI.GetTranslateMemory``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetTranslateMemory`: TranslateMemoryPage
fmt.Fprintf(os.Stdout, "Response from `TranslateAPI.GetTranslateMemory`: %v\n", resp)
}
Path Parameters
Other Parameters
Other parameters are passed through a pointer to a apiGetTranslateMemoryRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| target | string | Target narrows to one target language tag (BCP-47, e.g. "es" or "pt-BR"). | |
| state | string | State narrows to one position on the review ladder: machine, suggested, approved or published. | |
| limit | int64 | Limit caps the rows returned. Non-positive or unparseable means the server default (200); the ceiling is 1000. |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, application/problem+json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
PostTranslate
Delivery PostTranslate(ctx).Brief(brief).Execute()
Translate a string or a batch into one target language
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
brief := *openapiclient.NewBrief("Target_example") // Brief | (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.TranslateAPI.PostTranslate(context.Background()).Brief(brief).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `TranslateAPI.PostTranslate``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PostTranslate`: Delivery
fmt.Fprintf(os.Stdout, "Response from `TranslateAPI.PostTranslate`: %v\n", resp)
}
Path Parameters
Other Parameters
Other parameters are passed through a pointer to a apiPostTranslateRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| brief | Brief |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
PutTranslateMemory
TranslateMemoryEntry PutTranslateMemory(ctx).TranslateReviewRequest(translateReviewRequest).Execute()
Records a human decision on one translation-memory entry, and returns the entry as stored.
Example
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/hanzoai/go-sdk/v8"
)
func main() {
translateReviewRequest := *openapiclient.NewTranslateReviewRequest() // TranslateReviewRequest |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.TranslateAPI.PutTranslateMemory(context.Background()).TranslateReviewRequest(translateReviewRequest).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `TranslateAPI.PutTranslateMemory``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PutTranslateMemory`: TranslateMemoryEntry
fmt.Fprintf(os.Stdout, "Response from `TranslateAPI.PutTranslateMemory`: %v\n", resp)
}
Path Parameters
Other Parameters
Other parameters are passed through a pointer to a apiPutTranslateMemoryRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|---|---|---|
| translateReviewRequest | TranslateReviewRequest |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json, application/problem+json
[Back to top] [Back to API list] [Back to Model list] [Back to README]