JustinLove/elm-twitch-api/7.0.0

Twitch.Helix.Clip

JSON Decoders for Helix Clips responses.

Use these pieces to pull out the parts your application needs.

import Twitch.Helix.Clip as Clip
import Json.Decode exposing (..)


clips : Decoder (List Clip)
clips = Clip.response clip


clip : Decoder Clip
clip =
  succeed Clip
    |> map2 (|>) Clip.id
    |> map2 (|>) Clip.url
    |> map2 (|>) Clip.embedUrl
    |> map2 (|>) Clip.broadcasterId
    |> map2 (|>) Clip.thumbnailUrl

Field decoders

id : Decoder ClipId

Slug id for the clip

url : Decoder String

Url to view the clip

embedUrl : Decoder String

Url to embend the clip

broadcasterId : Decoder UserId

User id of the channel where the clip is from

broadcasterName : Decoder String

User name of the channel where the clip is from

creatorId : Decoder UserId

User id who clipped it

creatorName : Decoder String

User name who clipped it

videoId : Decoder VideoId

Id of the video from which the clip was created

gameId : Decoder GameId

Id of the game on record when the clip was created

language : Decoder String

Language code of the stream

title : Decoder String

Title of the clip

viewCount : Decoder Int

Times the clip was viewed

createdAt : Decoder Posix

Time the clip was created

thumbnailUrl : Decoder String

Thumbnail url

Response decoder

response : Decoder a -> Decoder (List a)

Decode individual records from the api response using the specified decoder

Sample Data

sampleClip : String

sample data for bootstrapping and testing