0.1.31 • Published 9 months ago

@onhand-bi-dev/sdk v0.1.31

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

SDK ONHANDBI

Downloads Libraries.io dependency status for latest release Build Size Version

Installation

npm i @onhand-bi-dev/sdk
# or
# yarn add @onhand-bi-dev/sdk

Import

import OHBI from "@onhand-bi-dev/sdk";

Examples

Auth

const accessToken = "<your access token>"
const OHBI_SDK = await OHBI.newClient(accessToken);

Get List Report

This method retrieves a list of reports.

Parameters:

page (number, optional): The page number of the report list. Default is 1. searchText (string, optional): The search text to filter reports. Default is an empty string. Returns:

A Promise that resolves to an array of Report objects representing the reports.

Example:

OHBI_SDK.getReports(1, 'search text')
  .then((reports) => {
    // Process the list of reports
    console.log('Reports:', reports)
  })
  .catch((error) => {
    console.log('Error retrieving reports:', error)
  })

Get Report

This method retrieves a specific report by its ID.

Parameters:

reportId (number): The ID of the report. isOwner (boolean, optional): Indicates whether the client is the owner of the report. Default is false. Returns:

A Promise that resolves to a Report object representing the report, or null if the report is not found.

Example:

const reportId = 12345

OHBI_SDK.getReport(reportId)
  .then((report) => {
    if (report) {
      // Process the report
      console.log('Report:', report)
    } else {
      console.log('Report not found')
    }
  })
  .catch((error) => {
    console.log('Error retrieving report:', error)
  })

Load Report

This method loads a report into an HTML element identified by the specified tag ID.

Parameters:

reportId (number): The ID of the report to load. tagId (string): The ID of the HTML element where the report should be loaded. isOwner (boolean, optional): Indicates whether the client is the owner of the report. Default is false. Example:

const reportId = 12345
const tagId = 'report-container'

OHBI_SDK.loadReport(reportId, tagId, true)

Load App

This method loads an app into an HTML element identified by the specified tag ID.

Parameters:

appId (number): The ID of the app to load. tagId (string): The ID of the HTML element where the app should be loaded. isOwner (boolean, optional): Indicates whether the client is the owner of the app. Default is false.

Example:

const appId = 54321
const tagId = 'app-container'

client.loadApp(appId, tagId, false)

Get App

This method retrieves a specific app by its ID.

Parameters:

appId (number): The ID of the app. isOwner (boolean, optional): Indicates whether the client is the owner of the app. Default is false.

Returns:

A Promise that resolves to an AppModel object representing the app, or null if the app is not found.

Example:

const appId = 54321

OHBI_SDK.getApp(appId)
  .then((app) => {
    if (app) {
      // Process the app
      console.log('App:', app)
    } else {
      console.log('App not found')
    }
  })
  .catch((error) => {
    console.log('Error retrieving app:', error)
  })

Get List App

This method retrieves a list of apps.

Parameters:

page (number, optional): The page number of the app list. Default is 1. searchText (string, optional): The search text to filter apps. Default is an empty string. isOwner (boolean, optional): Indicates whether the client is the owner of the app. Default is false.

Returns:

A Promise that resolves to an array of AppModel objects representing the apps.

Example:

OHBI_SDK.getApps(1, 'search text', false)
  .then((apps) => {
    // Process the list of apps
    console.log('Apps:', apps)
  })
  .catch((error) => {
    console.log('Error retrieving apps:', error)
  })
0.1.31

9 months ago

0.1.29

10 months ago

0.1.28

10 months ago

0.1.27

10 months ago

0.1.20

10 months ago

0.1.21

10 months ago

0.1.22

10 months ago

0.1.23

10 months ago

0.1.24

10 months ago

0.1.25

10 months ago

0.1.26

10 months ago

0.1.19

10 months ago

0.1.14

1 year ago

0.1.15

12 months ago

0.1.16

12 months ago

0.1.17

11 months ago

0.1.18

11 months ago

0.1.13

1 year ago

0.1.12

1 year ago

0.1.11

1 year ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.1

2 years ago

0.1.2

2 years ago