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