Helpers for sending Http requests to the Twitch Kraken ("V5") endpoints.
send : { clientId : String, auth : Maybe String, decoder : Json.Decode.Decoder a, tagger : Result Http.Error a -> msg, url : String } -> Platform.Cmd.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.
fetchHostsUrl : String -> String
fetchHostsUrl id =
"https://api.twitch.tv/kraken/channels/"++id++"/hosts"
fetchHosts : String -> Cmd Msg
fetchHosts id =
Twitch.Kraken.Request.send <|
{ clientId = TwitchId.clientId
, auth = Nothing
, decoder = hostsDecoder
, tagger = Hosts
, url = (fetchHostsUrl id)
}
Useful if you need to make your own Http call with additional headers.
twitchHeaders : String -> Maybe String -> List Http.Header
Creates the client-id and outh headers.
Twitch.Kraken.Request.twitchHeaders clientId auth
authHeaders : Maybe String -> List Http.Header
Creates the oauth header, given an oauth token.