Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// $ExpectType ProjectsApi
const projectsApi = new ProjectsApi();
// $ExpectType Promise
projectsApi.getHubProjects('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
projectsApi.getProject('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
projectsApi.getProjectHub('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
projectsApi.getProjectTopFolders('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
projectsApi.postStorage('', {}, authClientTwoLegged, authToken);
// $ExpectType UserProfileApi
const userProfileApi = new UserProfileApi();
// $ExpectType Promise
userProfileApi.getUserProfile(authClientTwoLegged, authToken);
// $ExpectType VersionsApi
const versionsApi = new VersionsApi();
// $ExpectType Promise
versionsApi.getVersion('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
versionsApi.getVersionItem('', '', authClientTwoLegged, authToken);
// $ExpectType Promise
versionsApi.getVersionRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
versionsApi.getVersionRelationshipsRefs('', '', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
versionsApi.postVersion('', {}, authClientTwoLegged, authToken);
// $ExpectType Promise
router.get('/api/forge/profile', function (req, res) {
var token = new Credentials(req.session);
var credentials = token.getForgeCredentials();
if (credentials === undefined) {
res.status(401).end();
return;
}
var forge3legged = new forgeSDK.AuthClientThreeLegged(
config.forge.credentials.client_id,
config.forge.credentials.client_secret,
config.forge.callbackURL,
config.forge.scope,
true);
var user = new forgeSDK.UserProfileApi();
user.getUserProfile(forge3legged, token.getForgeCredentials())
.then(function (profile) {
token.setAutodeskId(profile.body.userId);
// This feature is not GDPR compliant
//stats.userProfile(profile.body);
res.json({
name: profile.body.firstName + ' ' + profile.body.lastName,
picture: profile.body.profileImages.sizeX40,
id: profile.body.userId
});
})
.catch(function (error) {
console.log(error);
res.status(401).end()
})
});
router.get('/user/v1/profile', async (req, res) => {
const oauth = new OAuth(req.session);
const internalToken = await oauth.getInternalToken();
const user = new UserProfileApi();
const profile = await user.getUserProfile(oauth.getClient(), internalToken);
res.json({
name: profile.body.firstName + ' ' + profile.body.lastName,
picture: profile.body.profileImages.sizeX40
});
});
router.get('/user/profile', async (req, res) => {
const oauth = new OAuth(req.session);
const internalToken = await oauth.getInternalToken();
const user = new UserProfileApi();
const profile = await user.getUserProfile(oauth.getClient(), internalToken);
res.json({
name: profile.body.firstName + ' ' + profile.body.lastName,
picture: profile.body.profileImages.sizeX40
});
});
.then((oa3Legged) => {
let oa3Info = new ForgeAPI.UserProfileApi();
return (oa3Info.getUserProfile(oa3Legged, oa3Legged.credentials));
})
.then((profile) => {