JustinLove / elm-twitch-api / Twitch.Helix.User

JSON Decoders for Helix User responses

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

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

users : Decoder (List User)
users = User.response user

user : Decoder User
user =
  map3 User
    User.id
    User.login
    User.displayName

Field decoders

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

Id of the user

login : Json.Decode.Decoder String

Login of the user

displayName : Json.Decode.Decoder String

Name of the user

userType : Json.Decode.Decoder String

Type of the user, e.g. staff

broadcasterType : Json.Decode.Decoder String

Broadcaster type of the user, e.g. affiliate/partner

description : Json.Decode.Decoder String

User's profile description

profileImageUrl : Json.Decode.Decoder String

Profile image url

offlineImageUrl : Json.Decode.Decoder String

Channel offline image

viewCount : Json.Decode.Decoder Basics.Int

Channel view count

email : Json.Decode.Decoder (Maybe String)

Users's email, if the request had appropriate scope to read it

createdAt : Json.Decode.Decoder Time.Posix

Time account created

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

sampleUser : String

Sample data for a user