photoprism/internal/form/search_labels.go
2021-12-16 11:42:57 +01:00

30 lines
744 B
Go

package form
// SearchLabels represents search form fields for "/api/v1/labels".
type SearchLabels struct {
Query string `form:"q"`
UID string `form:"uid"`
Slug string `form:"slug"`
Name string `form:"name"`
All bool `form:"all"`
Favorite bool `form:"favorite"`
Count int `form:"count" binding:"required" serialize:"-"`
Offset int `form:"offset" serialize:"-"`
Order string `form:"order" serialize:"-"`
}
func (f *SearchLabels) GetQuery() string {
return f.Query
}
func (f *SearchLabels) SetQuery(q string) {
f.Query = q
}
func (f *SearchLabels) ParseQueryString() error {
return ParseQueryString(f)
}
func NewLabelSearch(query string) SearchLabels {
return SearchLabels{Query: query}
}