JustinLove/elm-twitch-api/7.0.0

Twitch.Helix.Stream

JSON Decoders for Helix Stream responses

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

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


streams : Decoder (List Stream)
streams = User.response stream


stream : Decoder Stream
stream =
  succeed Stream
    |> map2 (|>) Stream.id
    |> map2 (|>) Stream.userId
    |> map2 (|>) Stream.userName
    |> map2 (|>) Stream.gameId
    |> map2 (|>) Stream.viewerCount
    |> map2 (|>) Stream.thumbnailUrl
    |> map2 (|>) Stream.title

Field decoders

id : Decoder StreamId

Id of the stream

userId : Decoder UserId

Id of the channel the stream is on

userLogin : Decoder String

Login of the channel the stream is on

userName : Decoder String

Name of the channel the stream is on

gameId : Decoder GameId

Id of the game currently listed on the stream

gameName : Decoder String

Name of the game currently listed on the stream

title : Decoder String

Title of the stream

viewerCount : Decoder Int

Viewer count

startedAt : Decoder Posix

Time the stream started

language : Decoder String

Language code listed on the stream

thumbnailUrl : Decoder String

Current thumbnail image

tagIds : Decoder (List String)

List of tag ids

Response decoder

response : Decoder a -> Decoder (List a)

Decode individual records from the api response using the specified decoder

Sample Data

sampleStream : String

Sample data for streams