-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeature.go
33 lines (29 loc) · 864 Bytes
/
feature.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package go5e
type Feature struct {
Id string `json:"_id"`
Index string `json:"index"`
Name string `json:"name"`
Level int `json:"level"`
Class NamedAPIResource `json:"class"`
Subclass NamedAPIResource `json:"subclass"`
Desc []string `json:"desc"`
Url string `json:"url"`
}
func GetFeature(index string) (Feature, error) {
var ret Feature
err := doRequestAndUnmarshal("features/"+index, &ret)
if err != nil {
return ret, err
}
return ret, nil
}
func GetFeatureByUrl(url string) (Feature, error) {
var ret Feature
err := doRequestRawAndUnmarshal(url, ret)
return ret, err
}
func SearchFeatureByName(query string) (NamedAPIResourceList, error) {
var ret NamedAPIResourceList
err := doRequestAndUnmarshal("features/?name="+query, &ret)
return ret, err
}