1.2.3 • Published 4 years ago

logiak-web-sdk v1.2.3

Weekly downloads
46
License
ISC
Repository
-
Last release
4 years ago

Logiak Web SDK

Communication Bridge Between Logiak Platform and Web Apps

Installation

npm install logiak-web-sdk

or

yarn add logiak-web-sdk

Sample Usage

Imports & Initialisation

// es-6
import { auth, data, init, meta } from 'logiak-web-sdk';

or

// common-js
const { auth, data, init, meta } = require('logiak-web-sdk');

// Required config
const config = {
  project: '',
  version: '',
  language: '',
  baseURL: '',
};

// SDK must be initialized before usage
init(config);

Modules

auth

// User authentication
auth.login({ username: '', password: '' }).then().catch(); // Login
auth.loggedInUser().then().catch(); // Get loggedIn user
auth.logout().then().catch(); // Logout

data

// Table Data
data.getTables().then().catch(); // Get all tables data
data.getTable('table-name').then().catch(); // Get data for a single table
data.getTableList().then().catch(); // Get the list of table names

// Object Data
data.getObject('object-name').then().catch();
data.getObject('object-name', sampleQueryFilter).then().catch(); // see the section: `Optional Query Filter`

meta

// App/Project
meta.getApp().then().catch(); // Get project info
meta.getAppInfo().then().catch(); // Get app info

// Metadata
meta.getSchema().then().catch(); // Get all schemas
meta.getSchema('object-name').then().catch(); // Get schema for a single object

Optional Query Filter

(See Firebase Structured Query Language)https://firebase.google.com/docs/firestore/reference/rest/v1/StructuredQuery

const sampleQueryFilter = {
  where: {
    filter: {
      fieldFilter: {
        field: { fieldPath: 'email' },
        op: 'EQUAL',
        value: { stringValue: 'data.collector@ehealthnigeria.org' }
      }
    }
  },
  orderBy: [
    {
      field: { fieldPath: 'batch' },
      direction: 'DESCENDING'
    }],
  startAt: {
    values: [
      { stringValue: 'A009' }
    ]
  },
  endAt: {
    values: [
      { stringValue: 'A004' }
    ]
  }
};
1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

5 years ago

1.0.0

5 years ago