2019-12-05 19:21:35 +01:00
|
|
|
package form
|
2019-06-17 21:45:06 +02:00
|
|
|
|
2020-01-15 04:04:33 +01:00
|
|
|
// AlbumSearch represents search form fields for "/api/v1/albums".
|
2019-12-05 19:21:35 +01:00
|
|
|
type AlbumSearch struct {
|
2020-01-15 19:59:25 +01:00
|
|
|
Query string `form:"q"`
|
2020-01-30 18:19:26 +01:00
|
|
|
ID string `form:"id"`
|
2019-06-17 21:45:06 +02:00
|
|
|
Slug string `form:"slug"`
|
|
|
|
Name string `form:"name"`
|
|
|
|
Favorites bool `form:"favorites"`
|
2020-01-15 19:59:25 +01:00
|
|
|
Count int `form:"count" binding:"required"`
|
|
|
|
Offset int `form:"offset"`
|
|
|
|
Order string `form:"order"`
|
2019-06-17 21:45:06 +02:00
|
|
|
}
|
|
|
|
|
2020-01-15 04:04:33 +01:00
|
|
|
func (f *AlbumSearch) GetQuery() string {
|
|
|
|
return f.Query
|
|
|
|
}
|
2019-06-17 21:45:06 +02:00
|
|
|
|
2020-01-15 04:04:33 +01:00
|
|
|
func (f *AlbumSearch) SetQuery(q string) {
|
|
|
|
f.Query = q
|
|
|
|
}
|
2019-06-17 21:45:06 +02:00
|
|
|
|
2020-01-15 04:04:33 +01:00
|
|
|
func (f *AlbumSearch) ParseQueryString() error {
|
|
|
|
return ParseQueryString(f)
|
2019-06-17 21:45:06 +02:00
|
|
|
}
|
2020-01-27 16:53:09 +01:00
|
|
|
|
|
|
|
func NewAlbumSearch(query string) AlbumSearch {
|
|
|
|
return AlbumSearch{Query: query}
|
|
|
|
}
|