func (c *Client) TranslateReader(ctx context.Context, input io.Reader, t Translator, src, dst string) (io.ReadCloser, error) {
	return c.call(ctx, input, "POST", fmt.Sprintf("/translate/all/%s/%s/%s", t, src, dst), nil)
}
TranslateReader translates the given input from src language to dst language using t.
It returns the translated document as a reader. If an error occurs, the reader is nil, else, the reader
must be closed by the caller after usage.
package tika
import (
	"context"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"reflect"
	"strings"
	"golang.org/x/net/context/ctxhttp"
)
type ClientError struct {
	StatusCode int
}
func (e ClientError) Error() string {
	return fmt.Sprintf("response code %d", e.StatusCode)
}
type Client struct {
	url string
	httpClient *http.Client
}
func NewClient(httpClient *http.Client, urlString string) *Client {
	return &Client{httpClient: httpClient, url: urlString}
}
type Parser struct {
	Name           string
	Decorated      bool
	Composite      bool
	Children       []Parser
	SupportedTypes []string
}
type MIMEType struct {
	Alias     []string
	SuperType string
}
type Detector struct {
	Name      string
	Composite bool
	Children  []Detector
}
type Translator string
const (
	Lingo24Translator   Translator = "org.apache.tika.language.translate.Lingo24Translator"
	GoogleTranslator    Translator = "org.apache.tika.language.translate.GoogleTranslator"
	MosesTranslator     Translator = "org.apache.tika.language.translate.MosesTranslator"
	JoshuaTranslator    Translator = "org.apache.tika.language.translate.JoshuaTranslator"
	MicrosoftTranslator Translator = "org.apache.tika.language.translate.MicrosoftTranslator"
	YandexTranslator    Translator = "org.apache.tika.language.translate.YandexTranslator"
)
const XTIKAContent = "X-TIKA:content"
func (c *Client) call(ctx context.Context, input io.Reader, method, path string, header http.Header) (io.ReadCloser, error) {
	if c.httpClient == nil {
		c.httpClient = http.DefaultClient
	}
	req, err := http.NewRequest(method, c.url+path, input)
	if err != nil {
		return nil, err
	}
	req.Header = header
	resp, err := ctxhttp.Do(ctx, c.httpClient, req)
	if err != nil {
		return nil, err
	}
	if resp.StatusCode != http.StatusOK {
		resp.Body.Close()
		return nil, ClientError{resp.StatusCode}
	}
	return resp.Body, nil
}
func (c *Client) callString(ctx context.Context, input io.Reader, method, path string) (string, error) {
	body, err := c.call(ctx, input, method, path, nil)
	if err != nil {
		return "", err
	}
	defer body.Close()
	b := &strings.Builder{}
	if _, err := io.Copy(b, body); err != nil {
		return "", err
	}
	return b.String(), nil
}
func (c *Client) Parse(ctx context.Context, input io.Reader) (string, error) {
	return c.callString(ctx, input, "PUT", "/tika")
}
func (c *Client) ParseReader(ctx context.Context, input io.Reader) (io.ReadCloser, error) {
	return c.call(ctx, input, "PUT", "/tika", nil)
}
func (c *Client) ParseRecursive(ctx context.Context, input io.Reader) ([]string, error) {
	m, err := c.MetaRecursive(ctx, input)
	if err != nil {
		return nil, err
	}
	var r []string
	for _, d := range m {
		if content := d[XTIKAContent]; len(content) > 0 {
			r = append(r, content[0])
		}
	}
	return r, nil
}
func (c *Client) Meta(ctx context.Context, input io.Reader) (string, error) {
	return c.callString(ctx, input, "PUT", "/meta")
}
func (c *Client) MetaField(ctx context.Context, input io.Reader, field string) (string, error) {
	return c.callString(ctx, input, "PUT", fmt.Sprintf("/meta/%v", field))
}
func (c *Client) Detect(ctx context.Context, input io.Reader) (string, error) {
	return c.callString(ctx, input, "PUT", "/detect/stream")
}
func (c *Client) Language(ctx context.Context, input io.Reader) (string, error) {
	return c.callString(ctx, input, "PUT", "/language/stream")
}
func (c *Client) LanguageString(ctx context.Context, input string) (string, error) {
	r := strings.NewReader(input)
	return c.callString(ctx, r, "PUT", "/language/string")
}
func (c *Client) MetaRecursive(ctx context.Context, input io.Reader) ([]map[string][]string, error) {
	return c.MetaRecursiveType(ctx, input, "text")
}
func (c *Client) MetaRecursiveType(ctx context.Context, input io.Reader, contentType string) ([]map[string][]string, error) {
	path := "/rmeta"
	if contentType != "" {
		path = fmt.Sprintf("/rmeta/%s", contentType)
	}
	body, err := c.call(ctx, input, "PUT", path, nil)
	if err != nil {
		return nil, err
	}
	defer body.Close()
	var m []map[string]interface{}
	if err := json.NewDecoder(body).Decode(&m); err != nil {
		return nil, err
	}
	var r []map[string][]string
	for _, d := range m {
		doc := make(map[string][]string)
		r = append(r, doc)
		for k, v := range d {
			switch vt := v.(type) {
			case string:
				doc[k] = []string{vt}
			case []interface{}:
				for _, i := range vt {
					s, ok := i.(string)
					if !ok {
						return nil, fmt.Errorf("field %q has value %v and type %T, expected a string or []string", k, v, vt)
					}
					doc[k] = append(doc[k], s)
				}
			default:
				return nil, fmt.Errorf("field %q has value %v and type %v, expected a string or []string", k, v, reflect.TypeOf(v))
			}
		}
	}
	return r, nil
}
func (c *Client) Translate(ctx context.Context, input io.Reader, t Translator, src, dst string) (string, error) {
	return c.callString(ctx, input, "POST", fmt.Sprintf("/translate/all/%s/%s/%s", t, src, dst))
}