self.app.post( basePath + '/installed', verifyInstallation(self), function (req, res) { ... }
var httpClient = self.httpClient(req);--
You received this message because you are subscribed to the Google Groups "Atlassian Connect Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to atlassian-connec...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
var listeners = require('./listeners')listeners(app, addon); self.settings.set('clientInfo', settings, settings.clientKey).then(function (data) {
var httpClient = hostRequest(self, req.body, req.body.clientKey);
// API calls here
self.logger.info("Saved tenant details for " + settings.clientKey + " to database\n" + util.inspect(data));
self.emit('host_settings_saved', settings.clientKey, data);
res.status(204).end();postInstallPage, I was going to add it to the config page instead but this sounds much better. module.exports = function (app, addon) { addon.on('host_settings_saved', function (clientKey, settings) {
var httpClient = addon.httpClient(settings);
createIssueType(httpClient, settings, 'st', stIssueTypeData).then(function (stRes){ console.log("st: " + stRes.id); createIssueType(httpClient, settings, 'us', usIssueTypeData).then(function (usRes){ console.log("us: " + usRes.id); {"errorMessages":["You are not authenticated. Authentication required to perform this operation."],"errors":{}}
var createIssueType = function (httpClient, settings, key, data){ var promise = new RSVP.Promise(function (resolve, reject) { httpClient.post({ url : '/rest/api/2/issuetype', headers: { 'X-Atlassian-Token': 'nocheck', 'Content-Type': 'application/json', 'Accept': 'application/json' }, json: data }, function(err, res, body) { if (err) { console.log("rejecting promise"); reject(err); } else { console.log("resovling promise, sending: " + JSON.stringify(body)); resolve(body); } }); }); return promise; };if (req.body.eventType = "enabled") { addon.emit('registered_with_jira', req.body.clientKey, req.body);}