Created
March 18, 2017 03:20
-
-
Save P1xt/f139643e509bedec9f2bdc7b0e8339c3 to your computer and use it in GitHub Desktop.
Services to read Twitch.tv API data from the FCC proxy on gomix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { Http, Headers, Response, Jsonp, URLSearchParams } from '@angular/http'; | |
@Injectable() | |
export class GetTwitchService { | |
constructor(private json: Jsonp) { } | |
getStreamer = (streamer) => { | |
let params = new URLSearchParams(); | |
params.set('callback', 'JSONP_CALLBACK'); | |
let apiUrl: string = 'https://wind-bow.gomix.me/twitch-api/users/'+streamer; | |
return this.json | |
.get(apiUrl, { search: params }) | |
.map(response => response.json()); | |
} | |
getStream = (streamer) => { | |
let params = new URLSearchParams(); | |
params.set('callback', 'JSONP_CALLBACK'); | |
let apiUrl: string = 'https://wind-bow.gomix.me/twitch-api/streams/'+streamer; | |
return this.json | |
.get(apiUrl, { search: params }) | |
.map(response => response.json()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment