func (c *Collection) searchFaces(input *SDK.SearchFacesInput) (*SearchFacesResponse, error) {
	svc := c.service
	op, err := svc.client.SearchFaces(input)
	if err != nil {
		svc.Errorf("error on `SearchFaces` operation; collection=%s; error=%s;", c.nameWithPrefix, err.Error())
		return nil, err
	}
	return NewSearchFacesResponseFromAWSOutput(op), nil
}
searchFaces executes `SearchFaces` operation and gets faces in a collection.
package rekognition
import (
	"io/ioutil"
	SDK "github.com/aws/aws-sdk-go/service/rekognition"
	"github.com/evalphobia/aws-sdk-go-wrapper/private/pointers"
)
const emptyThreshold = -1.0
type Collection struct {
	service *Rekognition
	name           string
	nameWithPrefix string
	limit          int64
}
func NewCollection(svc *Rekognition, name string) *Collection {
	collectionName := svc.prefix + name
	return &Collection{
		service:        svc,
		name:           name,
		nameWithPrefix: collectionName,
	}
}
func (c *Collection) SetLimit(limit int64) {
	c.limit = limit
}
func (c *Collection) ListAllFaces() ([]*Face, error) {
	const defaultMaxResult = 1000  
	limit := c.limit
	if limit == 0 {
		limit = defaultMaxResult
	}
	var nextToken *string
	faces := make([]*Face, 0, limit)
	hasNextToken := true
	for hasNextToken {
		list, token, err := c.listFaces(&SDK.ListFacesInput{
			CollectionId: pointers.String(c.nameWithPrefix),
			MaxResults:   pointers.Long64(limit),
			NextToken:    nextToken,
		})
		if err != nil {
			return nil, err
		}
		faces = append(faces, list...)
		hasNextToken = (token != "")
		if hasNextToken {
			nextToken = &token
		}
	}
	return faces, nil
}
func (c *Collection) listFaces(input *SDK.ListFacesInput) (faces []*Face, nextToken string, err error) {
	svc := c.service
	op, err := svc.client.ListFaces(input)
	if err != nil {
		svc.Errorf("error on `ListFaces` operation; collection=%s; error=%s;", c.nameWithPrefix, err.Error())
		return nil, "", err
	}
	faces = make([]*Face, len(op.Faces))
	for i, f := range op.Faces {
		faces[i] = NewFaceFromAWSFace(f)
	}
	if op.NextToken != nil {
		nextToken = *op.NextToken
	}
	return faces, nextToken, nil
}
func (c *Collection) DeleteFaces(faceIDs []string) ([]string, error) {
	svc := c.service
	ids := make([]*string, len(faceIDs))
	for i, id := range faceIDs {
		id := id
		ids[i] = &id
	}
	op, err := svc.client.DeleteFaces(&SDK.DeleteFacesInput{
		CollectionId: pointers.String(c.nameWithPrefix),
		FaceIds:      ids,
	})
	if err != nil {
		svc.Errorf("error on `DeleteFaces` operation; collection=%s; error=%s;", c.nameWithPrefix, err.Error())
		return nil, err
	}
	result := make([]string, 0, len(op.DeletedFaces))
	for _, f := range op.DeletedFaces {
		if f != nil {
			result = append(result, *f)
		}
	}
	return result, nil
}
func (c *Collection) IndexFacesFromLocalFile(filepath string) (*IndexFacesResponse, error) {
	return c.IndexFacesFromLocalFileWithExternalImageID("", filepath)
}
func (c *Collection) IndexFacesFromLocalFileWithExternalImageID(externalID string, filepath string) (*IndexFacesResponse, error) {
	byt, err := ioutil.ReadFile(filepath)
	if err != nil {
		return nil, err
	}
	return c.IndexFacesByBytesWithExternalImageID(externalID, byt)
}
func (c *Collection) IndexFacesFromURL(url string) (*IndexFacesResponse, error) {
	return c.IndexFacesFromURLWithExternalImageID("", url)
}
func (c *Collection) IndexFacesFromURLWithExternalImageID(externalID string, url string) (*IndexFacesResponse, error) {
	byt, err := c.service.getImageFromURL(url)
	if err != nil {
		return nil, err
	}
	return c.IndexFacesByBytesWithExternalImageID(externalID, byt)
}
func (c *Collection) IndexFacesByBytes(byt []byte) (*IndexFacesResponse, error) {
	return c.IndexFacesByBytesWithExternalImageID("", byt)
}
func (c *Collection) IndexFacesByBytesWithExternalImageID(externalID string, byt []byte) (*IndexFacesResponse, error) {
	input := &SDK.IndexFacesInput{
		CollectionId: pointers.String(c.nameWithPrefix),
		Image: &SDK.Image{
			Bytes: byt,
		},
	}
	if externalID != "" {
		input.ExternalImageId = pointers.String(externalID)
	}
	return c.indexFaces(input)
}
func (c *Collection) IndexFacesByS3Object(bucket, name string, version ...string) (*IndexFacesResponse, error) {
	return c.IndexFacesByS3ObjectWithExternalImageID("", bucket, name, version...)
}
func (c *Collection) IndexFacesByS3ObjectWithExternalImageID(externalID string, bucket, name string, version ...string) (*IndexFacesResponse, error) {
	input := &SDK.IndexFacesInput{
		CollectionId: pointers.String(c.nameWithPrefix),
		Image: &SDK.Image{
			S3Object: createS3Object(bucket, name, version...),
		},
	}
	if externalID != "" {
		input.ExternalImageId = pointers.String(externalID)
	}
	return c.indexFaces(input)
}
func (c *Collection) indexFaces(input *SDK.IndexFacesInput) (*IndexFacesResponse, error) {
	svc := c.service
	op, err := svc.client.IndexFaces(input)
	if err != nil {
		svc.Errorf("error on `IndexFaces` operation; collection=%s; error=%s;", c.nameWithPrefix, err.Error())
		return nil, err
	}
	return NewIndexFacesResponseFromAWSOutput(op), nil
}
func (c *Collection) SearchFacesByFaceID(faceID string, threshold ...float64) (*SearchFacesResponse, error) {
	input := &SDK.SearchFacesInput{
		CollectionId: pointers.String(c.nameWithPrefix),
		FaceId:       pointers.String(faceID),
	}
	if len(threshold) == 1 {
		input.FaceMatchThreshold = &threshold[0]
	}
	if c.limit != 0 {
		input.MaxFaces = pointers.Long64(c.limit)
	}
	return c.searchFaces(input)
}