JustinLove/elm-twitch-api/7.0.0

Twitch.Helix.Subscription

JSON Decoders for Helix Subscription responses

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

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


subs : Decoder (List Sub)
subs = Follow.response sub


sub : Decoder Sub
sub =
  map3 Sub
    Subscription.userId
    Subscription.userName
    (map planPoints Subscription.tier)

Field decoders

broadcasterId : Decoder UserId

Id channel subscribed to

broadcasterLogin : Decoder String

Login channel subscribed to

broadcasterName : Decoder String

Name channel subscribed to

gifterId : Decoder (Maybe UserId)

Id person who gifted the sub, if this is a gift sub

gifterLogin : Decoder (Maybe String)

Login person who gifted the sub, if this is a gift sub

gifterName : Decoder (Maybe String)

Name person who gifted the sub, if this is a gift sub

isGift : Decoder Bool

Whether the sub is a gift

tier : Decoder String

Sub tier, as received from Twitch; we don't do any further translation.

planName : Decoder String

Name of the sub tier

userId : Decoder UserId

Id of the user subscribed

userName : Decoder String

Name of the user subscribed

userLogin : Decoder String

Login of the user subscribed

Response decoder

response : Decoder a -> Decoder (List a)

Decode individual records from the api response using the specified decoder

Sample Data

Sample data for subscriptions