1.1.0: fixing sentenceToCamelCase function to work on words that are uppercase acronyms like MAC and converts them to i.e. mac instead of mAC
.1.0: fixing sentenceToCamelCase function to work on words that are uppercase acronyms like MAC and converts them to i.e. mac instead of mAC
.1.0: fixing sentenceToCamelCase function to work on words that are uppercase acronyms like MAC and converts them to i.e. mac instead of mAC
Changelog:
- Added
setDebug(boolean)function to the OCIConenction class. This will output the command XML and response XML whencommand()is called. - Copied the
isError()function from theOCIConnectionclass to theBroadsoftDataUtilityclass. In the next version, that function will be removed from theOCIConnectionclass, causing a possible breaking change for some.
An example of the arguments would be from a response like ServiceProviderServicePackGetUtilizationListResponse:
const commandResponse = ServiceProviderServicePackGetUtilizationListResponse
.BroadsoftDocument
.command[0]
const table = commandResponse.serviceUtilizationTable
const names = commandResponse.servicePackNames
const tableData = BroadsoftDataUtility.parseOciTable(table, names)
// Example format for output:
let response = [
{
"name": "ServicePack1",
"items": [
{
"group": "GROUP_ONE",
"totalPacks": "3",
"assigned": "3"
},
{
"group": "GROUP_THREE",
"totalPacks": "3",
"assigned": "3"
}
]
},
{
"name": "ServicePack2",
"items": [
{
"group": "GROUP_TWO",
"totalPacks": "10",
"assigned": "10"
}
]
}
]1.0.12: Added dotenv and jest to test Broadsoft data utility and main class function calls for better development. Planning to add easy docker deployment to this project for 1.0.13.
Easy Setup for project using dotenv and ociconnection:
.env File Setup:
BROADSOFT_TEST_HOST=<IP ADDRESS/HOST NAME OF OCI SERVER HERE>
BROADSOFT_TEST_PORT=<PORT FOR APPLICATION SERVER API>
BROADSOFT_TEST_USERNAME=<OCI_USERNAME_HERE>
BROADSOFT_TEST_PASSWORD=<OCI_PASSWORD_HERE>index.ts Minimal File Setup:
import { OCIConnection } from 'ociconnection'
const main = async () => {
const ociConnection = new OCIConnection(
<string>process.env.BROADSOFT_TEST_HOST,
<string>process.env.BROADSOFT_TEST_PORT,
<string>process.env.BROADSOFT_TEST_USERNAME,
<string>process.env.BROADSOFT_TEST_PASSWORD
)
await ociConnection.login()
}
main()- Added OCITable helper static function
BroadsoftDataUtility.parseOciTableto convert e.g.ociResponse.BroadsoftDocument.command[0].userTable[0]from
import { OCIConnection } from 'ociconnection'
import BroadsoftDataUtility from 'ociconnection'
const ociConnection = new OCIConnection('1.1.1.1', '3333', 'broadworks_user', 'broadworks_password')
await ociConnection.login()
/*
Or instead of `await ociConnection.login()`:
const loggedIn = ociConnection.login()
loggedIn
.then(() => {
/ * code that happens after successful response from server * /
})
.catch(() => {
/ * code that happens after failed response from server * /
})
*/
const ociResponse = await ociConnection.command('UserGetListInServiceProviderRequest', {
serviceProviderId: <string>enterpriseId
})
/*
Or instead of using `await` here:
const ociResponse = ociConnection.command(...)
ociResponse
.then(response => / * Deal with XML/object response here * /)
.catch(serverError => / * Deal with server error here * /)
*/
const table = BroadsoftDataUtility.parseOciTable(ociResponse.BroadsoftDocument.command[0].userTable[0])
console.log(table) Hi! And welcome. ociconnection is a module used to connect to a Broadsoft/BroadWorks Application Server. This package is available at npmjs.org