{"_id":"@apidaze/node","_rev":"2-36b3d2bbd1ab67c6afe8ab313e3e0193","name":"@apidaze/node","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@apidaze/node","version":"0.1.0","description":"Node bindings for the APIdaze API","main":"index.js","scripts":{"lint":"eslint ./lib ./test ./examples","test":"ava","test:coverage":"nyc npm test","test:watch":"npm test -- --watch","docs:generate":"jsdoc -c ./jsdoc.json -R README.md"},"dependencies":{"form-data":"^3.0.0","got":"^10.7.0","xml":"^1.0.1"},"devDependencies":{"ava":"^3.13.0","dotenv":"^8.2.0","eslint":"^6.8.0","eslint-config-google":"^0.14.0","eslint-config-prettier":"^6.10.0","eslint-plugin-prettier":"^3.1.2","jsdoc":"^3.6.3","minami":"^1.2.3","nock":"^12.0.2","nyc":"^15.0.0","prettier":"1.19.1"},"repository":{"type":"git","url":"git+https://github.com/apidaze/sdk-node.git"},"contributors":[{"name":"apidaze-node contributors","url":"https://github.com/apidaze/apidaze-node/graphs/contributors"}],"bugs":{"url":"https://github.com/apidaze/sdk-node/issues"},"keywords":["cpaas","telecommunication","call","sms","api"],"homepage":"https://github.com/apidaze/sdk-node#readme","ava":{"files":["test/**/*"],"verbose":true},"nyc":{"all":true,"check-coverage":true,"reporter":["lcov","text"],"include":["lib/**/*"],"branches":90,"lines":90,"functions":90,"statements":90},"gitHead":"f9113e58a35556842175628813a711e92cfa9594","_id":"@apidaze/node@0.1.0","_nodeVersion":"14.16.1","_npmVersion":"7.10.0","dist":{"integrity":"sha512-gEd0d8rCh6HfxMjgwYpSFz6gFLGbt2TDFjDZyO4Tj5dGekL2ZayCkHYXzED4VRiJyuO+qY5MX7JELUgj9bv6dQ==","shasum":"9803335137f59cb382d7a1378e68929588ff481a","tarball":"https://registry.npmjs.org/@apidaze/node/-/node-0.1.0.tgz","fileCount":34,"unpackedSize":45422,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgj6iwCRA9TVsSAnZWagAAU2YQAJ4tbTiplT2Af/dq+LSs\n33CNYSg6xNRokVN4TCzKtm93a8b3cAPkljY+aiUvXLRpFYpjBkwvRVeOnhcL\nOsqYA3PBCAY8dHy5/s5PkyK/x7vXKc+SLJ28BarzZ03X4CjKPMvZMc7hvGi7\n7T6DXOT/r1pOVZxS7Lsg6JKCDOC2NhUkqy+Sy8YQ2BYhSGdkBMwFI83EF+A5\n/HwDasfQRczuI4wZrD43n9cNAPjMHv/qvtOv/eLk/Pf58XfxBObdXNIpXQYg\nJNlZ8UIe0QWfQRki2RDEl1uAyfSgwQrZkEJkWGEOXy9ub858u31G2RMa6fd4\nQM3fW20VOqTHVWx96kEwRf2c0atwliExWpB/modXgHACJFRvuFLNnMwtzjed\ng79orvB+fUxr311XtRyhewS2U2FRjcTRH2X+/8KQ3pYZrRorLgsxYWhuIMsB\nznEoo3ClYUgoeFY04XbnARAzUpWqUgv84dM680q6GBxEFW5x8JjoLcISrYuu\nuB/UNk7q4axxwFZW4pYT4m1W+ScTFIfQ71Vx2jsqQRzePmOoidmlyHp3+/aX\nBkNxXyQ6iWrYoqoq8kOUwjkmKg52c93rNED3rv3EIME/t72C5pPz6M2fccM7\nRi7Njw+R8nQBaD4zagBB0wxCmF2oGO81RZ1pHc2Al7aaH5Qd+/FCXeYDQeMW\na8TI\r\n=oDzy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC5d0Ctna67VtYAmAQurbvQ5I/4Kdhwf9bag9GVPjUNxAIhALYvuVE50V0l93ouUaF0SjZmpHCDV0kctWgfD2576KPF"}]},"_npmUser":{"name":"barinali","email":"ali.barin53@gmail.com"},"directories":{},"maintainers":[{"name":"barinali","email":"ali.barin53@gmail.com"},{"name":"joea_vi","email":"joea@voipinnovations.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node_0.1.0_1620027568363_0.13128490179201613"},"_hasShrinkwrap":false}},"time":{"created":"2021-05-03T07:39:28.098Z","0.1.0":"2021-05-03T07:39:28.503Z","modified":"2022-04-04T14:35:01.211Z"},"maintainers":[{"email":"joea@voipinnovations.com","name":"joea_vi"}],"description":"Node bindings for the APIdaze API","homepage":"https://github.com/apidaze/sdk-node#readme","keywords":["cpaas","telecommunication","call","sms","api"],"repository":{"type":"git","url":"git+https://github.com/apidaze/sdk-node.git"},"contributors":[{"name":"apidaze-node contributors","url":"https://github.com/apidaze/apidaze-node/graphs/contributors"}],"bugs":{"url":"https://github.com/apidaze/sdk-node/issues"},"readme":"# Apidaze Node.js SDK\n\n[![Node.js CI](https://github.com/apidaze/sdk-node/workflows/Node.js%20CI/badge.svg)](https://github.com/apidaze/sdk-node/actions?query=workflow%3A%22Node.js+CI%22)\n\nApidaze Node.js SDK contains a client for Apidaze REST API as well as an XML script builder. The SDK allows you to leverage all Apidaze platform features such as making calls, sending text messages, serving IVR systems, and many others in your application. The SDK also includes examples that demonstrate how to use the SDK.\n\n## Supported Node.js Versions\n\n- Node.js 10\n- Node.js 12\n\n## Installation\n\nTo install Apidaze Node.JS SDK as a dependency from the current master branch, type the following;\n\n`npm install apidaze/sdk-node`\n\n## Quickstart\n\n### Instantiation\n\nFirst, we need to instantiate an Apidaze client;\n\n```javascript\nconst { Apidaze } = require('apidaze');\n\nconst client = new Apidaze('API_KEY', 'API_SECRET');\n```\n\nThe first and the second argument in `Apidaze` class must be replaced with the real ones from your Apidaze application.\n\n### Update the external script\n\nIf one needs to update an Apidaze application's external script URL, the following snippet may be used;\n\n```javascript\nconst response = await client.externalScripts.update('script_id', {\n    url: 'https://example.com/script',\n});\n```\n\n### Send an SMS\n\n```javascript\nconst destination = '14125423968';\nconst origin = '14125423968';\nconst message = 'Hello world!';\n\nconst response = await ApidazeClient.messages.send(origin, destination, message);\n```\n\n### Place a call\n\n```javascript\nconst callerId = '14125423968';\nconst origin = '1234567890';\nconst destination = '1234567890';\nconst type = 'number';\n\nconst response = await ApidazeClient.calls.make({\n  callerId,\n  destination,\n  origin,\n  type\n});\n```\n\n### Script builder\n\nThe script builder is used to build XML instructions described in [the XML Scripting Reference](https://apidocs.voipinnovations.com). To build an instruction which echo back received audio to the caller with some delay use the following code.\n\n```javascript\nconst { ScriptBuilder, ScriptNodes } = require('apidaze');\nconst { Answer, Speak, Echo } = ScriptNodes;\n\nconst script = new ScriptBuilder();\n\nconst answer = new Answer();\nconst speak = new Speak('Thank you for trying our demo. Have an wonderful day!');\nconst echo = new Echo(500);\n\nconst xmlDocument = script\n  .add(answer)\n  .add(speak)\n  .add(echo)\n  .toString();\n```\n\nThe code above will produce the following XML;\n\n```xml\n<document>\n  <work>\n    <answer>\n    </answer>\n    <speak>Thank you for trying our demo. Have an wonderful day!</speak>\n    <echo>500</echo>\n  </work>\n</document>\n```\n\n### Extending the HTTP agent\n\nThe SDK is using [got](https://github.com/sindresorhus/got) for HTTP requests. To benefit from got's capabilities, one may use the following function signature;\n\n```javascript\nconst options = {\n  requestOptions: {}\n};\nconst client = new Apidaze('API_KEY', 'API_SECRET', options);\n```\n\n`options.requestOptions` represents the `options` that would be passed to `got` instance. So, for further information, got's [documentation](https://github.com/sindresorhus/got) may be checked.\n\n## More examples\n\nCheck out [examples](examples) in JavaScript for possible implementations and quick demonstrations. For the examples, one may benefit from [dotenv](npmjs.com/package/dotenv) to have a smoother experience in usage.\n\n## Testing\n\nAll tests can be run with the following command;\n\n`npm test`\n\nIf a coverage report is desired, the following command would be suitable;\n\n`npm run test:coverage`\n\nTo run specific test files, run `npm test` with a JavaScript regular expression matching the file names, like;\n\n`npm test ./test/rest/M*`","readmeFilename":"README.md"}