2021-09-02 16:12:31 +02:00
|
|
|
package form
|
|
|
|
|
2021-11-26 14:28:50 +01:00
|
|
|
// SearchSubjects represents search form fields for "/api/v1/subjects".
|
|
|
|
type SearchSubjects struct {
|
2021-09-02 16:12:31 +02:00
|
|
|
Query string `form:"q"`
|
2021-12-16 11:42:57 +01:00
|
|
|
UID string `form:"uid"`
|
2021-09-02 16:12:31 +02:00
|
|
|
Type string `form:"type"`
|
|
|
|
Name string `form:"name"`
|
2021-10-06 15:27:17 +02:00
|
|
|
All bool `form:"all"`
|
|
|
|
Hidden string `form:"hidden"`
|
|
|
|
Favorite string `form:"favorite"`
|
|
|
|
Private string `form:"private"`
|
|
|
|
Excluded string `form:"excluded"`
|
2021-09-17 18:51:24 +02:00
|
|
|
Files int `form:"files"`
|
2021-10-01 16:34:29 +02:00
|
|
|
Photos int `form:"photos"`
|
2021-09-02 16:12:31 +02:00
|
|
|
Count int `form:"count" binding:"required" serialize:"-"`
|
|
|
|
Offset int `form:"offset" serialize:"-"`
|
|
|
|
Order string `form:"order" serialize:"-"`
|
|
|
|
}
|
|
|
|
|
2021-11-26 14:28:50 +01:00
|
|
|
func (f *SearchSubjects) GetQuery() string {
|
2021-09-02 16:12:31 +02:00
|
|
|
return f.Query
|
|
|
|
}
|
|
|
|
|
2021-11-26 14:28:50 +01:00
|
|
|
func (f *SearchSubjects) SetQuery(q string) {
|
2021-09-02 16:12:31 +02:00
|
|
|
f.Query = q
|
|
|
|
}
|
|
|
|
|
2021-11-26 14:28:50 +01:00
|
|
|
func (f *SearchSubjects) ParseQueryString() error {
|
2021-09-02 16:12:31 +02:00
|
|
|
return ParseQueryString(f)
|
|
|
|
}
|
|
|
|
|
2021-11-26 14:28:50 +01:00
|
|
|
func NewSubjectSearch(query string) SearchSubjects {
|
|
|
|
return SearchSubjects{Query: query}
|
2021-09-02 16:12:31 +02:00
|
|
|
}
|