From 589209864d443087a062c0130cf9613070824094 Mon Sep 17 00:00:00 2001 From: Carl Kittelberger Date: Sun, 28 May 2023 16:21:38 +0200 Subject: [PATCH] Add models for vods.speedrun.club API. --- vod/pkg/vodsspeedrunclub/api.go | 5 +++ vod/pkg/vodsspeedrunclub/events.go | 30 +++++++++++++++++ vod/pkg/vodsspeedrunclub/runs.go | 53 ++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 vod/pkg/vodsspeedrunclub/api.go create mode 100644 vod/pkg/vodsspeedrunclub/events.go create mode 100644 vod/pkg/vodsspeedrunclub/runs.go diff --git a/vod/pkg/vodsspeedrunclub/api.go b/vod/pkg/vodsspeedrunclub/api.go new file mode 100644 index 0000000..6d06999 --- /dev/null +++ b/vod/pkg/vodsspeedrunclub/api.go @@ -0,0 +1,5 @@ +package vodsspeedrunclub + +// https://vods.speedrun.club/api/v1/gdq/runs?event=agdq2023 +// https://vods.speedrun.club/api/v1/gdq/events +const baseURL = "https://vods.speedrun.club" diff --git a/vod/pkg/vodsspeedrunclub/events.go b/vod/pkg/vodsspeedrunclub/events.go new file mode 100644 index 0000000..6cdb0ae --- /dev/null +++ b/vod/pkg/vodsspeedrunclub/events.go @@ -0,0 +1,30 @@ +package vodsspeedrunclub + +import "time" + +type Event struct { + ID int `json:"id"` + Short string `json:"short"` + Name string `json:"name"` + Hashtag string `json:"hashtag"` + CharityName string `json:"charityName"` + TargetAmount float64 `json:"targetAmount"` + MinimumDonation float64 `json:"minimumDonation"` + PaypalCurrency string `json:"paypalCurrency"` + StartTime time.Time `json:"startTime"` + EndTime any `json:"endTime"` + TimeStatus string `json:"timeStatus"` + Timezone string `json:"timezone"` + Locked bool `json:"locked"` + AllowDonations bool `json:"allowDonations"` + CanonicalURL string `json:"canonicalUrl"` + Public string `json:"public"` + Amount float64 `json:"amount"` + Count int `json:"count"` + Max float64 `json:"max"` + Avg float64 `json:"avg"` + HoraroEvent any `json:"horaroEvent"` + HoraroSchedule any `json:"horaroSchedule"` + DonationURL string `json:"donationUrl"` + ScheduleURL string `json:"scheduleUrl"` +} diff --git a/vod/pkg/vodsspeedrunclub/runs.go b/vod/pkg/vodsspeedrunclub/runs.go new file mode 100644 index 0000000..0e78133 --- /dev/null +++ b/vod/pkg/vodsspeedrunclub/runs.go @@ -0,0 +1,53 @@ +package vodsspeedrunclub + +import "time" + +type Run struct { + GamesDoneQuickID int `json:"gdqId"` + HoraroID any `json:"horaroId"` + Event int `json:"event"` + Name string `json:"name"` + DisplayName string `json:"displayName"` + TwitchName string `json:"twitchName"` + Console string `json:"console"` + Commentators []any `json:"commentators"` + Hosts []Hosts `json:"hosts"` + Description string `json:"description"` + StartTime time.Time `json:"startTime"` + EndTime time.Time `json:"endTime"` + Order int `json:"order"` + RunTime string `json:"runTime"` + SetupTime string `json:"setupTime"` + CoOp bool `json:"coop"` + Category string `json:"category"` + ReleaseYear any `json:"releaseYear"` + Runners []Runner `json:"runners"` + RunnersAsString string `json:"runnersAsString"` + Bids []any `json:"bids"` + VODs []VOD `json:"vods"` + Source any `json:"src"` + TimeStatus string `json:"timeStatus"` +} + +type Hosts struct { + Name string `json:"name"` + Pronouns string `json:"pronouns"` + Public string `json:"public"` +} +type Runner struct { + Name string `json:"name"` + Stream string `json:"stream"` + Twitter string `json:"twitter"` + Youtube string `json:"youtube"` + Pronouns string `json:"pronouns"` + Public string `json:"public"` + URL string `json:"url"` +} + +type VOD struct { + Type string `json:"type"` + VideoID string `json:"videoId"` + Timestamp string `json:"timestamp"` + URL string `json:"url"` + ContributorID any `json:"contributorId"` +}