-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathappearance.go
142 lines (138 loc) · 3.2 KB
/
appearance.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
package wowapi
import (
"encoding/json"
"fmt"
)
type Appearance struct {
Customizations []struct {
Option struct {
Name string `json:"name"`
Id float64 `json:"id"`
} `json:"option"`
Choice struct {
Id float64 `json:"id"`
DisplayOrder float64 `json:"display_order"`
} `json:"choice"`
} `json:"customizations"`
PlayableClass struct {
Key struct {
Href string `json:"href"`
} `json:"key"`
Name string `json:"name"`
Id float64 `json:"id"`
} `json:"playable_class"`
Gender struct {
Type string `json:"type"`
Name string `json:"name"`
} `json:"gender"`
PlayableRace struct {
Key struct {
Href string `json:"href"`
} `json:"key"`
Name string `json:"name"`
Id float64 `json:"id"`
} `json:"playable_race"`
ActiveSpec struct {
Key struct {
Href string `json:"href"`
} `json:"key"`
Name string `json:"name"`
Id float64 `json:"id"`
} `json:"active_spec"`
Faction struct {
Type string `json:"type"`
Name string `json:"name"`
} `json:"faction"`
GuildCrest struct {
Emblem struct {
Id float64 `json:"id"`
Media struct {
Key struct {
Href string `json:"href"`
} `json:"key"`
Id float64 `json:"id"`
} `json:"media"`
Color struct {
Id float64 `json:"id"`
Rgba struct {
B float64 `json:"b"`
A float64 `json:"a"`
R float64 `json:"r"`
G float64 `json:"g"`
} `json:"rgba"`
} `json:"color"`
} `json:"emblem"`
Border struct {
Id float64 `json:"id"`
Media struct {
Key struct {
Href string `json:"href"`
} `json:"key"`
Id float64 `json:"id"`
} `json:"media"`
Color struct {
Rgba struct {
B float64 `json:"b"`
A float64 `json:"a"`
R float64 `json:"r"`
G float64 `json:"g"`
} `json:"rgba"`
Id float64 `json:"id"`
} `json:"color"`
} `json:"border"`
Background struct {
Color struct {
Id float64 `json:"id"`
Rgba struct {
R float64 `json:"r"`
G float64 `json:"g"`
B float64 `json:"b"`
A float64 `json:"a"`
} `json:"rgba"`
} `json:"color"`
} `json:"background"`
} `json:"guild_crest"`
Items []struct {
Subclass float64 `json:"subclass"`
Id float64 `json:"id"`
Slot struct {
Name string `json:"name"`
Type string `json:"type"`
} `json:"slot"`
Enchant float64 `json:"enchant"`
ItemAppearanceModifierId float64 `json:"item_appearance_modifier_id"`
InternalSlotId float64 `json:"internal_slot_id"`
} `json:"items"`
Links struct {
Self struct {
Href string `json:"href"`
} `json:"self"`
} `json:"_links"`
Character struct {
Realm struct {
Key struct {
Href string `json:"href"`
} `json:"key"`
Name string `json:"name"`
Id float64 `json:"id"`
Slug string `json:"slug"`
} `json:"realm"`
Key struct {
Href string `json:"href"`
} `json:"key"`
Name string `json:"name"`
Id float64 `json:"id"`
} `json:"character"`
}
func (req RequestFunc) CharacterAppearance(realm string, name string) (s Appearance, err error) {
url := fmt.Sprintf("/profile/wow/character/%s/%s/appearance", realm, name)
body, err := req(url)
if err != nil {
return
}
err = json.Unmarshal(body, &s)
if err != nil {
return
}
return
}