Socket
Socket
Sign inDemoInstall

okra-node

Package Overview
Dependencies
6
Maintainers
7
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    okra-node

Okra JS Node Module


Version published
Maintainers
7
Install size
584 kB
Created

Readme

Source

okra-node

This is a npm module that abstracts the complexity of using okra with node.

USAGE

1. Install the module

Install with yarn:

yarn add okra-node

but you can use npm if you like:

npm install --save okra-node

2. Import the module

In your app.js or any module where the component would be used:

import * as okra_client from "okra-node";

3. Implementation

Okra Node exposes all the API endpoint that are available in Okra docs (https://docs.okra.ng/reference/). Please find the parameters you can pass to the endpoints in the API refenece mentioned above.

4. Okra Classes

The Okra Node Client is devided to classes that can be consumed sepratley as it's necessary for you. The classes are inheriting Okra Client class, so you'll need to pass the enviornment and Okra Secret (found here: https://dash.okra.ng/settings/api-keys) to each class you implement.

Each function of the class will intake an options object as argument. The object can contain different parameters that you would like to return, for example, you can pass the object: {id: "1234567890"} to Auth.get() and it will point that request to the correct endpoint.

Examples
  • list accounts:
const accounts = new Accounts(okraSecret, env);
const getAccounts = accounts.get()
  • get account by id:
const accountId = { id: 'bb11189898kll' }
const accounts = new Accounts(okraSecret, env);
const getAccounts = accounts.get(accountId);
  • check balance:
const options = {account_id: "bbb118989kll", record_id: "ccc1144090987"}
const balances = new Balance(okraSecret, env);
const checkBalance = balances.check(options)

5. Pagination

If pagination is available, you can call the next and previous page via the .nextPage() or .prevPage() derivited from the resposne object.

Example:

const reports = new Reports(okraSecret, env);

const getReports = reports.get();
const getNextPage = getReports.nextPage();
  • Auth: Allows you to get information on extisting authentication.

Available options:

For more information checkout okra's documentation

Contributing

Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.

License

The MIT License (MIT). Please see License File for more information.

Keywords

FAQs

Last updated on 01 Jun 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc