-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathskill.go
31 lines (27 loc) · 789 Bytes
/
skill.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
package go5e
type Skill struct {
Id string `json:"_id"`
Index string `json:"index"`
Name string `json:"name"`
Desc []string `json:"desc"`
AbilityScore NamedAPIResource `json:"ability_score"`
Url string `json:"url"`
}
func GetSkill(index string) (Skill, error) {
var ret Skill
err := doRequestAndUnmarshal("skills/"+index, &ret)
if err != nil {
return ret, err
}
return ret, nil
}
func GetSkillByUrl(url string) (Skill, error) {
var ret Skill
err := doRequestRawAndUnmarshal(url, ret)
return ret, err
}
func SearchSkillByName(query string) (NamedAPIResourceList, error) {
var ret NamedAPIResourceList
err := doRequestAndUnmarshal("skills/?name="+query, &ret)
return ret, err
}