-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
event.go
55 lines (49 loc) · 1.61 KB
/
event.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
package main
import (
"encoding/json"
"net/http"
)
type Event struct {
ConferenceURL string `json:"conference_url"`
Date string `json:"date"`
Description string `json:"description"`
FrontendLink string `json:"frontend_link"`
GUID string `json:"guid"`
Length int64 `json:"length"`
Link string `json:"link"`
OriginalLanguage string `json:"original_language"`
Persons []string `json:"persons"`
PosterURL string `json:"poster_url"`
ReleaseDate string `json:"release_date"`
Slug string `json:"slug"`
Subtitle string `json:"subtitle"`
Tags []string `json:"tags"`
ThumbURL string `json:"thumb_url"`
Title string `json:"title"`
UpdatedAt string `json:"updated_at"`
URL string `json:"url"`
}
type Events struct {
Acronym string `json:"acronym"`
AspectRatio string `json:"aspect_ratio"`
Events []Event `json:"events"`
ImagesURL string `json:"images_url"`
LogoURL string `json:"logo_url"`
RecordingsURL string `json:"recordings_url"`
ScheduleURL string `json:"schedule_url"`
Slug string `json:"slug"`
Title string `json:"title"`
UpdatedAt string `json:"updated_at"`
URL string `json:"url"`
WebgenLocation string `json:"webgen_location"`
}
func findEvents(url string) (Events, error) {
event := Events{}
r, err := http.Get(url)
if err != nil {
return event, err
}
defer r.Body.Close()
err = json.NewDecoder(r.Body).Decode(&event)
return event, err
}