mirror of
https://github.com/Xevion/banner.git
synced 2025-12-10 08:06:35 -06:00
Specify 'offset' as page number in GetTerms() definition
This commit is contained in:
15
api.go
15
api.go
@@ -30,21 +30,22 @@ func (term BannerTerm) Archived() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetTerms retrieves and parses the term information for a given search term.
|
// GetTerms retrieves and parses the term information for a given search term.
|
||||||
// Ensure that the offset is greater than 0.
|
// Page number must be at least 1.
|
||||||
func GetTerms(search string, offset int, max int) ([]BannerTerm, error) {
|
func GetTerms(search string, page int, max int) ([]BannerTerm, error) {
|
||||||
// Ensure offset is valid
|
// Ensure offset is valid
|
||||||
if offset <= 0 {
|
if page <= 0 {
|
||||||
return nil, errors.New("offset must be greater than 0")
|
return nil, errors.New("offset must be greater than 0")
|
||||||
}
|
}
|
||||||
|
|
||||||
req := BuildRequest("GET", "/classSearch/getTerms", map[string]string{
|
req := BuildRequest("GET", "/classSearch/getTerms", map[string]string{
|
||||||
"searchTerm": search,
|
"searchTerm": search,
|
||||||
"offset": strconv.Itoa(offset),
|
// Page vs Offset is not a mistake here, the API uses "offset" as the page number
|
||||||
"max": strconv.Itoa(max),
|
"offset": strconv.Itoa(page),
|
||||||
"_": Nonce(),
|
"max": strconv.Itoa(max),
|
||||||
|
"_": Nonce(),
|
||||||
})
|
})
|
||||||
|
|
||||||
if offset <= 0 {
|
if page <= 0 {
|
||||||
return nil, errors.New("Offset must be greater than 0")
|
return nil, errors.New("Offset must be greater than 0")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user