-
Notifications
You must be signed in to change notification settings - Fork 8
/
metadata.go
38 lines (31 loc) · 925 Bytes
/
metadata.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
package opendota
import (
"net/http"
"github.com/dghubble/sling"
)
func newMetadataService(sling *sling.Sling) *MetadataService {
return &MetadataService{
sling: sling.Path("metadata"),
}
}
// MetadataService provides a method for accesing OpenDota's metadata.
type MetadataService struct {
sling *sling.Sling
}
// Metadata represents site metadata for OpenDota.
type Metadata struct {
Banner string `json:"banner"`
Cheese Cheese `json:"cheese"`
}
type Cheese struct {
Cheese string `json:"cheese"`
Goal string `json:"goal"`
}
// Metadata returns a collection of metadata for the OpenDota site.
// https://docs.opendota.com/#tag/metadata%2Fpaths%2F~1metadata%2Fget
func (s *MetadataService) Metadata() (Metadata, *http.Response, error) {
metadata := new(Metadata)
apiError := new(APIError)
resp, err := s.sling.New().Receive(metadata, apiError)
return *metadata, resp, relevantError(err, *apiError)
}