infogare-api.js
Advanced tools
Comparing version 1.0.8 to 1.0.9
{ | ||
"name": "infogare-api.js", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"main": "src/core/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -7,11 +7,2 @@ const InfoGareApp = require('../modules/App'); | ||
// Initialize the app globally | ||
initializeApp = (appId) => { | ||
return new InfoGareApp(appId); | ||
} | ||
getApp = () => { | ||
return InfoGareApp; | ||
} | ||
module.exports = { | ||
@@ -23,5 +14,3 @@ InfoGareApp, | ||
UserNotFoundException, | ||
StationNotFoundException, | ||
initializeApp, | ||
getApp | ||
StationNotFoundException | ||
}; |
@@ -89,2 +89,21 @@ const User = require('./User'); | ||
/** | ||
* Get user public profile | ||
* @param {string} uid The UID of the user | ||
* @return {PublicProfile} The public profile | ||
*/ | ||
async getPublicProfile(uid) { | ||
if (!uid) { | ||
throw new Error('uid is required'); | ||
} | ||
if (!this.appId) { | ||
throw new Error('appId is required'); | ||
} | ||
const response = await fetch(`${App.apiEndpoint}/user/${uid}/publicProfile?appId=${this.appId}`); | ||
if (!response.ok) { | ||
throw new UserException(response, 'publicProfile'); | ||
} | ||
return await response.json(); | ||
} | ||
/** | ||
* Get a station | ||
@@ -91,0 +110,0 @@ * @param {string} uid The UID of the user |
19829
9
639
11