photoprism/internal/form/search_albums.go

39 lines
1.2 KiB
Go
Raw Normal View History

package form
2019-06-17 21:45:06 +02:00
// SearchAlbums represents search form fields for "/api/v1/albums".
type SearchAlbums struct {
Query string `form:"q"`
UID string `form:"uid"`
Type string `form:"type"`
Location string `form:"location"`
Category string `form:"category"`
Slug string `form:"slug"`
Title string `form:"title"`
Country string `json:"country"`
Year string `form:"year" example:"year:1990|2003" notes:"Year Number, OR search with |"`
Month string `form:"month" example:"month:7|10" notes:"Month (1-12), OR search with |"`
Day string `form:"day" example:"day:3|13" notes:"Day of Month (1-31), OR search with |"`
Favorite bool `form:"favorite"`
Public bool `form:"public"`
Private bool `form:"private"`
Count int `form:"count" binding:"required" serialize:"-"`
Offset int `form:"offset" serialize:"-"`
Order string `form:"order" serialize:"-"`
2019-06-17 21:45:06 +02:00
}
func (f *SearchAlbums) GetQuery() string {
return f.Query
}
2019-06-17 21:45:06 +02:00
func (f *SearchAlbums) SetQuery(q string) {
f.Query = q
}
2019-06-17 21:45:06 +02:00
func (f *SearchAlbums) 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) SearchAlbums {
return SearchAlbums{Query: query}
2020-01-27 16:53:09 +01:00
}