-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateActivity.js
30 lines (27 loc) · 1.37 KB
/
createActivity.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const Authenticator = require('./lib/authenticator');
const configFile = require('./config');
const ActivityCreator = require('./lib/activityCreator');
const fs = require('fs');
const handlebar = require('handlebars');
const logger = require('./lib/logger');
const postActivityTemplateFileContent = fs.readFileSync('./templates/payloads/postActivityExportToFBX.hbs', 'utf8');
const postActivityTemplate = handlebar.compile(postActivityTemplateFileContent);
const authenticator = new Authenticator(configFile.forge.clientId, configFile.forge.clientSecret);
authenticator.getForgeOAuth2TwoLeggedObject((err, forgeOAuth2TwoLegged) => {
if (err) {
logger.log('Error while initializing forgeOAuth2TwoLegged object: ', err);
process.exit(1);
}
const ExportToFBXRunnerInstance = new ActivityCreator(forgeOAuth2TwoLegged, configFile);
ExportToFBXRunnerInstance.createActivity({
nickname: configFile.forge.nickname,
appId: configFile.designAutomation.appId,
appAlias: configFile.designAutomation.appAlias,
activityId: configFile.designAutomation.activityId,
activityAlias: configFile.designAutomation.activityAlias,
engineId: configFile.designAutomation.engineId,
clientId: configFile.forge.clientId,
clientSecret: configFile.forge.clientSecret,
activityPayloadTemplate: postActivityTemplate
});
});