2019-12-05 18:21:35 +00:00
|
|
|
package form
|
2019-06-09 02:37:02 +00:00
|
|
|
|
2020-01-15 03:04:33 +00:00
|
|
|
// PhotoSearch represents search form fields for "/api/v1/labels".
|
2019-12-05 18:21:35 +00:00
|
|
|
type LabelSearch struct {
|
2020-01-15 18:59:25 +00:00
|
|
|
Query string `form:"q"`
|
2019-06-09 02:37:02 +00:00
|
|
|
Slug string `form:"slug"`
|
|
|
|
Name string `form:"name"`
|
2019-12-17 06:13:09 +00:00
|
|
|
All bool `form:"all"`
|
2019-06-09 02:37:02 +00:00
|
|
|
Favorites bool `form:"favorites"`
|
2020-01-15 18:59:25 +00:00
|
|
|
Count int `form:"count" binding:"required"`
|
|
|
|
Offset int `form:"offset"`
|
|
|
|
Order string `form:"order"`
|
2019-06-09 02:37:02 +00:00
|
|
|
}
|
|
|
|
|
2020-01-15 03:04:33 +00:00
|
|
|
func (f *LabelSearch) GetQuery() string {
|
|
|
|
return f.Query
|
|
|
|
}
|
2019-06-09 02:37:02 +00:00
|
|
|
|
2020-01-15 03:04:33 +00:00
|
|
|
func (f *LabelSearch) SetQuery(q string) {
|
|
|
|
f.Query = q
|
|
|
|
}
|
2019-06-09 02:37:02 +00:00
|
|
|
|
2020-01-15 03:04:33 +00:00
|
|
|
func (f *LabelSearch) ParseQueryString() error {
|
|
|
|
return ParseQueryString(f)
|
2019-06-09 02:37:02 +00:00
|
|
|
}
|
2020-01-28 19:59:02 +00:00
|
|
|
|
|
|
|
func NewLabelSearch(query string) LabelSearch {
|
|
|
|
return LabelSearch{Query: query}
|
|
|
|
}
|