@zcatalyst/zia
Version:
ZOHO CATALYST SDK for JavaScript zia for Node.js and Browser.
215 lines (156 loc) • 4.74 kB
Markdown
# @zcatalyst/zia
ZOHO CATALYST SDK for JavaScript zia for Node.js and Browser.
<p></p>
## Installing
To install this package, simply type add or install @zcatalyst/zia
using your favorite package manager:
- `npm install @zcatalyst/zia`
- `yarn add @zcatalyst/zia`
- `pnpm add @zcatalyst/zia`
## Getting Started
### Import
The Catalyst SDK is modulized by Components.
To send a request, you only need to import the `zia`:
```js
// ES5 example
const { zia } = require("@zcatalyst/zia");
```
```ts
// ES6+ example
import { zia } from "@zcatalyst/zia";
```
### Usage
To send a request, you:
- Create a zia Instance.
- Call the zia operation with input parameters.
```js
const zia = new zia();
```
#### Async/await
We recommend using [await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await)
operator to wait for the promise returned by send operation as follows:
```js
// async/await.
try {
const data = await zia.scanBarcode(fs.createReadStream('sam/barcode.png'));
// process data.
} catch (error) {
// error handling.
} finally {
// finally.
}
```
Async-await is clean, concise, intuitive, easy to debug and has better error handling
as compared to using Promise chains or callbacks.
#### Promises
You can also use [Promise chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises#chaining)
to execute send operation.
```js
zia.scanBarcode(fs.createReadStream('sam/barcode.png')).then(
(data) => {
// process data.
},
(error) => {
// error handling.
}
);
```
Promises can also be called using `.catch()` and `.finally()` as follows:
```js
zia
.scanBarcode(fs.createReadStream('sam/barcode.png'))
.then((data) => {
// process data.
})
.catch((error) => {
// error handling.
})
.finally(() => {
// finally.
});
```
### Troubleshooting
When the service returns an exception, the error will include the exception information,
as well as response metadata (e.g. request id).
```js
try {
const data = await zia.scanBarcode(fs.createReadStream('sam/barcode.png'));
// process data.
} catch (error) {
const message = error.message;
const status = error.statusCode;
console.log({ message, status });
}
```
## Contributing
Contributions to this library are always welcome and highly encouraged.
See [CONTRIBUTING](../../CONTRIBUTING.md) for more information on how to get started.
## License
This SDK is distributed under the Apache License 2.0. See [LICENSE](../../LICENCE) file for more information.
## Zia operations
<details>
<summary>
detectObject
</summary>
<!-- [SDK Samples](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/file-store/retrieve-folder-details/)[API References]() -->
</details>
<details>
<summary>
extractAadhaarCharacters
</summary>
<!-- [SDK Samples](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/file-store/retrieve-folder-details/)[API References]() -->
</details>
<details>
<summary>
scanBarcode
</summary>
<!-- [SDK Samples](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/file-store/retrieve-folder-details/)[API References]() -->
</details>
<details>
<summary>
moderateImage
</summary>
<!-- [SDK Samples](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/file-store/retrieve-folder-details/)[API References]() -->
</details>
<details>
<summary>
analyseFace
</summary>
<!-- [SDK Samples](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/file-store/retrieve-folder-details/)[API References]() -->
</details>
<details>
<summary>
compareFace
</summary>
<!-- [SDK Samples](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/file-store/retrieve-folder-details/)[API References]() -->
</details>
<details>
<summary>
automl
</summary>
<!-- [SDK Samples](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/file-store/retrieve-folder-details/)[API References]() -->
</details>
<details>
<summary>
getSentimentAnalysis
</summary>
<!-- [SDK Samples](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/file-store/retrieve-folder-details/)[API References]() -->
</details>
<details>
<summary>
getKeywordExtraction
</summary>
<!-- [SDK Samples](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/file-store/retrieve-folder-details/)[API References]() -->
</details>
<details>
<summary>
getNERPrediction
</summary>
<!-- [SDK Samples](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/file-store/retrieve-folder-details/)[API References]() -->
</details>
<details>
<summary>
getTextAnalytics
</summary>
<!-- [SDK Samples](https://docs.catalyst.zoho.com/en/sdk/nodejs/v2/cloud-scale/file-store/retrieve-folder-details/)[API References]() -->
</details>