cce-unified-config
Advanced tools
Comparing version 0.9.0 to 0.9.1
44
index.js
@@ -0,1 +1,2 @@ | ||
const request = require('request-promise-native') | ||
const axios = require('axios') | ||
@@ -77,18 +78,23 @@ const parseXmlString = require('./parse-xml') | ||
async get(type, id, q) { | ||
// pass params from input | ||
const params = {q} | ||
try { | ||
return await axios.get(`${this.url}${type.toLowerCase()}/${id}`, body, {auth: this.auth, params}) | ||
} catch (e) { | ||
throw e | ||
} | ||
async get(type, id) { | ||
return request({ | ||
url: `${this.url}${type.toLowerCase()}/${id}`, | ||
headers: { | ||
'Accept': 'application/json' | ||
}, | ||
auth: { | ||
user: this.auth.username, | ||
pass: this.auth.password | ||
}, | ||
json: true | ||
}) | ||
} | ||
async modify(type, body, q) { | ||
// pass params from input | ||
const params = {q} | ||
async modify(type, id, body) { | ||
try { | ||
const response = await axios.put(`https://${this.host}${body.refURL}`, body, {auth: this.auth, params}) | ||
return response | ||
const url = `${this.url}${type.toLowerCase()}/${id}` | ||
console.log('trying to PUT url', url) | ||
const response = await axios.put(url, body, {auth: this.auth}) | ||
// console.log(response) | ||
return response.data | ||
} catch (e) { | ||
@@ -99,8 +105,8 @@ throw e | ||
async create(type, body, q) { | ||
// pass params from input | ||
const params = {q} | ||
async create(type, body) { | ||
try { | ||
const response = await axios.post(this.url + type.toLowerCase(), body, {auth: this.auth, params}) | ||
return response | ||
const url = this.url + type.toLowerCase() | ||
const response = await axios.post(url, body, {auth: this.auth}) | ||
// console.log('cce-unified-config create success response:', response) | ||
return response.headers.location | ||
} catch (e) { | ||
@@ -120,2 +126,4 @@ throw e | ||
// 'Content-Type' | ||
// don't change this to application/json because some types like precisionqueue | ||
// will return a 406 | ||
'Accept': 'application/xml' | ||
@@ -122,0 +130,0 @@ } |
{ | ||
"name": "cce-unified-config", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "JavaScript library for Cisco Contact Center Enterprise APIs", | ||
"main": "index.js", | ||
"scripts": { | ||
"start": "node index", | ||
"start": "NODE_TLS_REJECT_UNAUTHORIZED=0 node index", | ||
"test": "NODE_TLS_REJECT_UNAUTHORIZED=0 mocha" | ||
@@ -27,4 +27,6 @@ }, | ||
"axios": "^0.16.2", | ||
"request": "^2.87.0", | ||
"request-promise-native": "^1.0.5", | ||
"xml2js": "^0.4.19" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14091
8
427
4
+ Addedrequest@^2.87.0
+ Addedajv@6.12.6(transitive)
+ Addedasn1@0.2.6(transitive)
+ Addedassert-plus@1.0.0(transitive)
+ Addedasynckit@0.4.0(transitive)
+ Addedaws-sign2@0.7.0(transitive)
+ Addedaws4@1.13.2(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedcaseless@0.12.0(transitive)
+ Addedcombined-stream@1.0.8(transitive)
+ Addedcore-util-is@1.0.2(transitive)
+ Addeddashdash@1.14.1(transitive)
+ Addeddelayed-stream@1.0.0(transitive)
+ Addedecc-jsbn@0.1.2(transitive)
+ Addedextend@3.0.2(transitive)
+ Addedextsprintf@1.3.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedforever-agent@0.6.1(transitive)
+ Addedform-data@2.3.3(transitive)
+ Addedgetpass@0.1.7(transitive)
+ Addedhar-schema@2.0.0(transitive)
+ Addedhar-validator@5.1.5(transitive)
+ Addedhttp-signature@1.2.0(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedisstream@0.1.2(transitive)
+ Addedjsbn@0.1.1(transitive)
+ Addedjson-schema@0.4.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedjsprim@1.4.2(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedoauth-sign@0.9.0(transitive)
+ Addedperformance-now@2.1.0(transitive)
+ Addedpsl@1.10.0(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedqs@6.5.3(transitive)
+ Addedrequest@2.88.2(transitive)
+ Addedrequest-promise-core@1.1.4(transitive)
+ Addedrequest-promise-native@1.0.9(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsshpk@1.18.0(transitive)
+ Addedstealthy-require@1.1.1(transitive)
+ Addedtough-cookie@2.5.0(transitive)
+ Addedtunnel-agent@0.6.0(transitive)
+ Addedtweetnacl@0.14.5(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedverror@1.10.0(transitive)