Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const getClient = function(config) {
if (!config) {
throw new Error('Unable to configure ZenDesk client without a config');
}
const options = {
username: config.username,
token: config.token,
remoteUri: buildHelpCenterUri(config.url),
helpcenter: true, // In order to use Help Center APIs, this varialbe must be set to `true` AND `remoteUri` must be set to the Help Center endpoint
disableGlobalState: true // Run as Library only - not scriptrunner
};
const client = zendesk.createClient(options);
return new ZendeskClientWrapper(client);
};
function createZendeskClient_(opts) {
opts = _.defaults(opts || {}, {
username: 'username',
remoteUri: 'uri',
helpcenter: true,
disableGlobalState: true
});
const nodeZendesk = zendesk.createClient(opts);
return new ZendeskClientWrapper(nodeZendesk);
}
before(() => {
this.zendeskStub = zendesk.createClient({
username: 'username',
token: 'token',
remoteUri: 'uri',
helpcenter: true,
disableGlobalState: true
});
});
'use strict'
const zendesk = require('node-zendesk')
const logger = require('../../utils/logger')(__filename)
const zendeskConfig = require('../../../config/zendesk')
const zendeskClient = zendesk.createClient({
username: process.env.ZENDESK_USER,
token: process.env.ZENDESK_API_KEY,
remoteUri: process.env.ZENDESK_URL,
proxy: process.env.http_proxy
})
module.exports = {
createTicket: opts => {
return new Promise(function (resolve, reject) {
zendeskClient.tickets.create({
ticket: {
requester: {
email: opts.email,
name: opts.name
},