+ Instagram Service EndPoint request method
This commit is contained in:
1 parent
9851f856e3
commit
1e03cd012a
1 file changed
+18
-2
@@ -1,9 +1,25 @@
|
||||
import request from 'request-promise';
|
||||
|
||||
export default class EndPoint{
|
||||
constructor(client) {
|
||||
constructor(client, token) {
|
||||
this.client = client;
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
method(name){
|
||||
return this.client[name];
|
||||
}
|
||||
}
|
||||
|
||||
request(method, path, data=null) {
|
||||
let buildPath = path => `https://api.instagram.com/v1${path}`;
|
||||
let options = {
|
||||
method: method,
|
||||
uri: buildPath(path),
|
||||
headers: {}
|
||||
};
|
||||
|
||||
if(data) options.body = data;
|
||||
return request(options)
|
||||
.then(i => JSON.parse(i));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user