JSON Decoders for Helix Video responses
Use these pieces to pull out the parts your application needs.
import Twitch.Helix.Video as Video
import Json.Decode exposing (..)
events : Decoder (List Event)
events =
Video.response video
|> map (List.filterMap (\(videoType, ev) -> if videoType == Video.Archive then Just ev else Nothing))
video : Decoder (Video.VideoType, Event)
video =
map2 Tuple.pair
Video.videoType
event
event : Decoder Event
event =
map2 Event
Video.createdAt
Video.durationId of the channel the video is from
Login of the channel the video is from
Name of the channel the video is from
Title of the video
Description of the video
Time the video was created
Time the video was published
Url to view the video
Thumbnail
Language code
Enumerted type for the viewable status
Number of views on the video
Enumerated type for video_type attribute, does include an escape hatch in case other types are added in the future.
Number of milliseconds, with second accuracy
Decode individual records from the api response using the specified decoder
Sample response for a video
Id of the video