- Client interface and MockClient for testing - Service layer with IndexPhoto and SearchFaces methods - CacheService interface and MemoryCache implementation - Configuration with environment variable support - Error types and user-facing messages - Unit tests for service layer Co-Authored-By: Paperclip <noreply@paperclip.ing>
36 lines
1.0 KiB
Go
36 lines
1.0 KiB
Go
package face
|
|
|
|
import "time"
|
|
|
|
// FaceSearchResult represents the result of a face search
|
|
type FaceSearchResult struct {
|
|
Matches []FaceMatch `json:"matches"`
|
|
PhotoCount int `json:"photoCount"`
|
|
SearchTime time.Duration `json:"searchTime"`
|
|
CacheHit bool `json:"cacheHit"`
|
|
}
|
|
|
|
// CollectionInfo represents information about a face collection
|
|
type CollectionInfo struct {
|
|
CollectionID string `json:"collectionId"`
|
|
FaceCount int `json:"faceCount"`
|
|
CreationDate time.Time `json:"creationDate"`
|
|
LastUpdated time.Time `json:"lastUpdated"`
|
|
}
|
|
|
|
// SearchRequest represents a face search request
|
|
type SearchRequest struct {
|
|
ImageBytes []byte `json:"-"`
|
|
ImageURL string `json:"imageUrl,omitempty"`
|
|
MaxFaces int `json:"maxFaces,omitempty"`
|
|
Threshold float64 `json:"threshold,omitempty"`
|
|
}
|
|
|
|
// IndexRequest represents a face indexing request
|
|
type IndexRequest struct {
|
|
PhotoID string `json:"photoId"`
|
|
SpaceID string `json:"spaceId"`
|
|
ImageBytes []byte `json:"-"`
|
|
ImageURL string `json:"imageUrl,omitempty"`
|
|
}
|