1.0.5 • Published 1 year ago

@kaana/kaana-services-js v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

🚀 Kaana Services

Kaana Services is a JavaScript library for building apps that integrate with the Kaana ecosystem. It provides an API gateway for authenticating users and making requests to Kaana services, as well as a set of data classes for working with the app's database.

Installation

To install Kaana Services in your project, simply run the following command in your terminal:

npm install kaana-services

Usage

To get started with Kaana Services, import the functions or classes you need in your JavaScript file:

import { login, logout, fetchData } from "kaana-services";

// Login to Kaana
login("username", "password")
  .then((token) => {
    // Do something with the session token
  })
  .catch((error) => {
    // Handle errors here
  });

// Get data from Kaana
fetchData("/v1/data")
  .then((data) => {
    // Do something with the retrieved data
  })
  .catch((error) => {
    // Handle errors here
  });

// Logout from Kaana
logout()
  .then(() => {
    // The session has been closed
  })
  .catch((error) => {
    // Handle errors here
  });

You can also use the Data and DataCollection classes to interact with the application's database:

import { Data, DataCollection } from "kaana-services";

// Create an instance of the Data class
const data = new Data();

// Get all data
data
  .getAll()
  .then((allData) => {
    // Use all data here
  })
  .catch((error) => {
    // Handle errors here
  });

// Create an instance of the DataCollection class
const collectionName = "myCollection";
const collection = new DataCollection(collectionName);

// Get all data from the collection
collection
  .getAll()
  .then((allData) => {
    // Use all data here
  })
  .catch((error) => {
    // Handle errors here
  });

Contributing

If you want to contribute to Kaana Services, that would be great! Check out CONTRIBUTING.md to learn more about how you can help improve the library.

License

Kaana Services is distributed under the MIT license. See the LICENSE file for more information.

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago