This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const functions = require('firebase-functions'); | |
var load = require('./display-data/load'); | |
exports.load = functions.https.onRequest((req, res) => { | |
load.handler(req, res); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sfAuth = require('../fetch-data/sf-auth'); | |
const sfQuery = require('../fetch-data/sf-query'); | |
const sendRes = require('../fetch-data/send-res'); | |
exports.handler = function (req, res) { | |
if (req.method !== "GET") { | |
console.log("✘ Request was not GET"); | |
sendRes(res, 405, "Not Allowed"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendRes(res, status, data) { | |
console.log("✔ Sending response"); | |
res.set({ | |
'content-type': 'application/json', | |
'Access-Control-Allow-Origin': '*' | |
}).status(status) | |
.send(JSON.stringify({ | |
"status": status, | |
"data": data | |
})).end(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sfQuery(conn) { | |
return new Promise((resolve, reject) => { | |
console.log("🛈 Querying Salesforce"); | |
var queryString = "SELECT Id FROM Contact WHERE Name LIKE 'A%' AND MailingCity = 'California'"; | |
conn.query(contactQueryString, function (e, data) { | |
if (e) { | |
console.log(e); | |
reject(e); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jsforce = require('jsforce'); | |
var username = "XXXXXXXXXXXXXXXXX"; | |
var password = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; | |
function sfAuth() { | |
return new Promise((resolve, reject) => { | |
console.log("✔ Connecting to Salesforce"); | |
var conn = new jsforce.Connection({ | |
loginUrl: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var soap = require('soap'); | |
var wsdl = '/home/user/your-project/xmlfaz.wsdl'; | |
var args = { | |
_xml: | |
'<r20:getAdomList>' + | |
'<servicePass>' + | |
'<userID>apiuser@domain.com</userID>' + | |
'<password>apiuserpassword</password>' + | |
'</servicePass>' + | |
'<detail>true</detail>' + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var soap = require('soap'); | |
var url = '/home/user/your-project/xmlfaz.wsdl'; | |
var args = { | |
_xml: | |
'<r20:getDeviceList>' + | |
'<servicePass>' + | |
'<userID>apiuser@domain.com</userID>' + | |
'<password>apiuserpassword</password>' + | |
'</servicePass>' + | |
'<adom>root</adom>' + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var soap = require('soap'); | |
var url = '/home/user/your-project/xmlfaz.wsdl'; | |
var args = { | |
_xml: | |
'<r20:getDeviceVdomList>' + | |
'<servicePass>' + | |
'<userID>apiuser@domain.com</userID>' + | |
'<password>apiuserpassword</password>' + | |
'</servicePass>' + | |
'</r20:getDeviceVdomList>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var soap = require('soap'); | |
var url = '/home/user/your-project/xmlfaz.wsdl'; | |
var args = { | |
_xml: | |
'<r20:listFazGeneratedReports>' + | |
'<servicePass>' + | |
'<userID>apiuser@domain.com</userID>' + | |
'<password>apiuserpassword</password>' + | |
'</servicePass>' + | |
'<adom>root</adom>' + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var soap = require('soap'); | |
var url = '/home/user/your-project/xmlfaz.wsdl'; | |
var args = { | |
_xml: | |
'<r20:runFazReport>' + | |
'<servicePass>' + | |
'<userID>apiuser@domain.com</userID>' + | |
'<password>apiuserpassword</password>' + | |
'</servicePass>' + | |
'<adom>root</adom>' + |
OlderNewer