func WrapAPIErrors(err error, rErrs []ResponseError) error {
	var es []string
	for _, e := range rErrs {
		es = append(es, e.Error())
	}
	rErrors := strings.Join(es, ",")
	return errors.Wrap(err, rErrors)
}
WrapAPIErrors transforms an api error response into one wrapped error
package engine
import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"mime/multipart"
	"net/http"
	"net/url"
	"os"
	"strings"
	"github.com/pkg/errors"
)
const (
	accessKeyHeader = "X-ACCESS-KEY"
	indexKeyHeader = "X-INDEX-KEY"
)
var (
	errSearch = errors.New("there was an error performing your search")
	errDownloadingFile = errors.New("could not download file")
	ErrUnauthorized = errors.New("you are not authorized to perform this command against the connected server")
)
type Engine struct {
	Client      *http.Client
	APIEndpoint string
	IndexKey    string
	AccessKey   string
}
type SearchResponse struct {
	Distances []float32      `json:"distances"`
	Documents []SearchResult `json:"documents"`
}
type SearchResult struct {
	Path         string  `json:"path"`
	DocumentName string  `json:"name"`
	DownloadURL  string  `json:"downloadURL"`
	Text         string  `json:"text"`
	Rank         float32 `json:"rel"`
}
type Response struct {
	Results interface{}     `json:"results"`
	Errors  []ResponseError `json:"errors,omitempty"`
}
type ResponseError struct {
	Message string `json:"message"`
}
func (a ResponseError) Error() string {
	return a.Message
}