@boelensman1/tinderclient
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -30,5 +30,5 @@ "use strict"; | ||
get() { | ||
return this.tinderClient.getPhotoStream(this.url).then((r) => (r.data)); | ||
return this.tinderClient.getPhotoStream(this.url); | ||
} | ||
} | ||
exports.Photo = Photo; |
import { Suggestion } from '../classes'; | ||
import { UserMetaData } from '../interfaces'; | ||
/** | ||
@@ -24,2 +25,6 @@ * The main class containing all the functions | ||
/** | ||
* Get your own meta data (swipes left, people seen, etc..) | ||
*/ | ||
getMeta(): Promise<UserMetaData>; | ||
/** | ||
* Get photo stream | ||
@@ -26,0 +31,0 @@ */ |
@@ -53,2 +53,18 @@ "use strict"; | ||
/** | ||
* Get your own meta data (swipes left, people seen, etc..) | ||
*/ | ||
getMeta() { | ||
if (!this.authToken) { | ||
throw new Error('Authenticate first!'); | ||
} | ||
return this.client.get('/meta').then((result) => { | ||
if (result.data.status !== 200) { | ||
console.log(result); | ||
throw new Error('Error while getting results'); | ||
} | ||
delete result.data.status; | ||
return result.data; | ||
}); | ||
} | ||
/** | ||
* Get photo stream | ||
@@ -60,5 +76,8 @@ */ | ||
} | ||
return this.client.get(url, { baseURL: null, responseType: 'stream' }); | ||
return this.client.get(url, { | ||
baseURL: null, | ||
responseType: 'stream', | ||
}).then((result) => (result.data)); | ||
} | ||
} | ||
exports.TinderClient = TinderClient; |
@@ -7,1 +7,4 @@ export { Instagram } from './instagram'; | ||
export { SpotifyThemeTrack } from './spotifyThemeTrack'; | ||
export { Interest } from './interest'; | ||
export { User } from './user'; | ||
export { UserMetaData } from './userMetaData'; |
{ | ||
"name": "@boelensman1/tinderclient", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Wrapper for the tinder api", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -65,3 +65,3 @@ import { IncomingMessage } from 'http'; | ||
public get(): Promise<IncomingMessage> { | ||
return this.tinderClient.getPhotoStream(this.url).then((r) => (r.data)); | ||
return this.tinderClient.getPhotoStream(this.url); | ||
} | ||
@@ -68,0 +68,0 @@ } |
import axios from 'axios'; | ||
import { IncomingMessage } from 'http'; | ||
import { Suggestion, Photo } from '../classes'; | ||
import { UserMetaData } from '../interfaces'; | ||
@@ -73,8 +75,27 @@ const clientConfig = { | ||
/** | ||
* Get your own meta data (swipes left, people seen, etc..) | ||
*/ | ||
public getMeta(): Promise<UserMetaData> { | ||
if (!this.authToken) { throw new Error('Authenticate first!'); } | ||
return this.client.get('/meta').then((result) => { | ||
if (result.data.status !== 200) { | ||
console.log(result); | ||
throw new Error('Error while getting results'); | ||
} | ||
delete result.data.status; | ||
return result.data; | ||
}); | ||
} | ||
/** | ||
* Get photo stream | ||
*/ | ||
private getPhotoStream(url: string): Promise<any> { | ||
private getPhotoStream(url: string): Promise<IncomingMessage> { | ||
if (!this.authToken) { throw new Error('Authenticate first!'); } | ||
return this.client.get(url, { baseURL: null, responseType: 'stream' }); | ||
return this.client.get(url, { | ||
baseURL: null, | ||
responseType: 'stream', | ||
}).then((result) => (result.data)); | ||
} | ||
@@ -81,0 +102,0 @@ } |
@@ -7,1 +7,4 @@ export { Instagram } from './instagram'; | ||
export { SpotifyThemeTrack } from './spotifyThemeTrack'; | ||
export { Interest } from './interest'; | ||
export { User } from './user'; | ||
export { UserMetaData } from './userMetaData'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
778159
71
16071