From f9792aa84781b893c9b589202caacd7325cdb347 Mon Sep 17 00:00:00 2001 From: bytedream Date: Sun, 19 Jun 2022 00:54:30 +0200 Subject: [PATCH] Add extra file for common in different places used elements --- common.go | 39 +++++++++++++++++++++++++++++++++++++++ episode.go | 38 +------------------------------------- 2 files changed, 40 insertions(+), 37 deletions(-) create mode 100644 common.go diff --git a/common.go b/common.go new file mode 100644 index 0000000..91e1312 --- /dev/null +++ b/common.go @@ -0,0 +1,39 @@ +package crunchyroll + +type Panel struct { + Title string `json:"title"` + PromoTitle string `json:"promo_title"` + Slug string `json:"slug"` + Playback string `json:"playback"` + PromoDescription string `json:"promo_description"` + Images struct { + Thumbnail [][]struct { + Height int `json:"height"` + Source string `json:"source"` + Type string `json:"type"` + Width int `json:"width"` + } `json:"thumbnail"` + PosterTall [][]struct { + Width int `json:"width"` + Height int `json:"height"` + Type string `json:"type"` + Source string `json:"source"` + } `json:"poster_tall"` + PosterWide [][]struct { + Width int `json:"width"` + Height int `json:"height"` + Type string `json:"type"` + Source string `json:"source"` + } `json:"poster_wide"` + } `json:"images"` + ID string `json:"id"` + Description string `json:"description"` + ChannelID string `json:"channel_id"` + Type WatchlistEntryType `json:"type"` + ExternalID string `json:"external_id"` + SlugTitle string `json:"slug_title"` + // not null if Type is WATCHLISTENTRYEPISODE + EpisodeMetadata *Episode `json:"episode_metadata"` + // not null if Type is WATCHLISTENTRYSERIES + SeriesMetadata *Series `json:"series_metadata"` +} diff --git a/episode.go b/episode.go index d0e9b14..f97de31 100644 --- a/episode.go +++ b/episode.go @@ -102,43 +102,7 @@ const ( // WatchlistEntry contains information about an entry on the watchlist. type WatchlistEntry struct { - Panel struct { - Title string `json:"title"` - PromoTitle string `json:"promo_title"` - Slug string `json:"slug"` - Playback string `json:"playback"` - PromoDescription string `json:"promo_description"` - Images struct { - Thumbnail [][]struct { - Height int `json:"height"` - Source string `json:"source"` - Type string `json:"type"` - Width int `json:"width"` - } `json:"thumbnail"` - PosterTall [][]struct { - Width int `json:"width"` - Height int `json:"height"` - Type string `json:"type"` - Source string `json:"source"` - } `json:"poster_tall"` - PosterWide [][]struct { - Width int `json:"width"` - Height int `json:"height"` - Type string `json:"type"` - Source string `json:"source"` - } `json:"poster_wide"` - } `json:"images"` - ID string `json:"id"` - Description string `json:"description"` - ChannelID string `json:"channel_id"` - Type WatchlistEntryType `json:"type"` - ExternalID string `json:"external_id"` - SlugTitle string `json:"slug_title"` - // not null if Type is WATCHLISTENTRYEPISODE - EpisodeMetadata *Episode `json:"episode_metadata"` - // not null if Type is WATCHLISTENTRYSERIES - SeriesMetadata *Series `json:"series_metadata"` - } + Panel Panel `json:"panel"` New bool `json:"new"` NewContent bool `json:"new_content"`