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

Id channel subscribed to

broadcasterLogin : Json.Decode.Decoder String

Login channel subscribed to

broadcasterName : Json.Decode.Decoder String

Name channel subscribed to

gifterId : Json.Decode.Decoder (Maybe Twitch.Helix.UserId)

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

gifterLogin : Json.Decode.Decoder (Maybe String)

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

gifterName : Json.Decode.Decoder (Maybe String)

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

isGift : Json.Decode.Decoder Basics.Bool

Whether the sub is a gift

tier : Json.Decode.Decoder String

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

planName : Json.Decode.Decoder String

Name of the sub tier

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

Id of the user subscribed

userName : Json.Decode.Decoder String

Name of the user subscribed

userLogin : Json.Decode.Decoder String

Login of the user subscribed

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

sampleSubscription : String

Sample data for subscriptions