JustinLove/elm-twitch-api/4.1.0

NOTE: the latest version is 7.0.0

Twitch.Kraken

Helpers for sending Http requests to the Twitch Kraken ("V5") endpoints.

Send a Request

{ clientId : String
, auth : Maybe String
, decoder : Decoder a
, tagger : Result Error a -> msg
, url : String
}
-> Cmd msg

Send a basic request to the Twitch Kraken ("V5") endpoints. Lightweight wrapper around Http, so you can go back to basics if something else is needed. Auth is a token received from an oauth loop.

fetchCommunityByNameUrl : String -> String
fetchCommunityByNameUrl login =
  "https://api.twitch.tv/kraken/communities?name=" ++ name


fetchCommunityByName : String -> Cmd Msg
fetchCommunityByName name =
  Twitch.Kraken.send <|
    { clientId = TwitchId.clientId
    , auth = Nothing
    , decoder = Twitch.Kraken.Decode.community
    , tagger = Community
    , url = (fetchCommunityByNameUrl login)
    }

Header Helpers

Useful if you need to make your own Http call with additional headers.

twitchHeaders : String -> Maybe String -> List Header

Creates the client-id and outh headers.

Twitch.Kraken.twitchHeaders clientId auth
authHeaders : Maybe String -> List Header

Creates the oauth header, given an oauth token.