JustinLove / elm-twitch-api / 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 : Json.Decode.Decoder Twitch.Helix.ClipId

Slug id for the clip

url : Json.Decode.Decoder String

Url to view the clip

embedUrl : Json.Decode.Decoder String

Url to embend the clip

broadcasterId : Json.Decode.Decoder Twitch.Helix.UserId

User id of the channel where the clip is from

broadcasterName : Json.Decode.Decoder String

User name of the channel where the clip is from

creatorId : Json.Decode.Decoder Twitch.Helix.UserId

User id who clipped it

creatorName : Json.Decode.Decoder String

User name who clipped it

videoId : Json.Decode.Decoder Twitch.Helix.VideoId

Id of the video from which the clip was created

gameId : Json.Decode.Decoder Twitch.Helix.GameId

Id of the game on record when the clip was created

language : Json.Decode.Decoder String

Language code of the stream

title : Json.Decode.Decoder String

Title of the clip

viewCount : Json.Decode.Decoder Basics.Int

Times the clip was viewed

createdAt : Json.Decode.Decoder Time.Posix

Time the clip was created

thumbnailUrl : Json.Decode.Decoder String

Thumbnail url

Response decoder

response : Json.Decode.Decoder a -> Json.Decode.Decoder (List a)

Decode individual records from the api response using the specified decoder

Sample Data

sampleClip : String

sample data for bootstrapping and testing