SDK (javascript)
Overview
Labii SDK for JavaScript is a software development kit (SDK) that provides a set of tools and libraries for developing web applications using the Labii platform. The Labii platform is a cloud-based platform that allows researchers to manage their research data and workflow, including data collection, storage, analysis, and sharing.
The Labii SDK for JavaScript allows developers to integrate Labii's features and functionality into their web applications. It includes a variety of APIs that allow developers to access and manipulate data stored on the Labii platform, such as data entry forms, project management tools, and reporting features.
The SDK includes a JavaScript library that provides a high-level interface for interacting with the Labii API. It also includes a set of documentation and examples to help developers get started with using the SDK and integrating it into their applications.
Installation
To use the Labii SDK in your JavaScript project, you can install it using npm. Run the following command in your terminal (coming soon):
npm install labii-sdk
Quick start
Here's a quick start documentation for the Labii SDK:
Importing the Labii SDK: After installing the Labii SDK, you can import it into your JavaScript code using the following syntax:
import Labii from 'labii-sdk';
Listing Rows: To list rows from a Labii project, you can use the
list()
method of theRow
object. Thelist()
method takes a configuration object as its argument, which specifies various options for the query.
Syntax
Labii SDK syntax follows the pattern of Labii.[Object].[method]({props})
.
Labii
This is the main object of the Labii SDK. It provides access to all of the other objects and methods in the SDK.
Object
This refers to one of the objects available in the Labii SDK, such as Project
, Table
, or Row
. Each object represents a different type of entity in the Labii platform, and provides a set of methods for interacting with that entity.
Please refer to Objects for a list of Labii objects.
Method
This is a function or action that can be performed on an object in the Labii platform. Each object in the Labii SDK has its own set of methods that can be used to perform various actions, such as creating a new project, adding a new experiment, or listing rows of data.
list()
: This method is used to retrieve a list of entities from the Labii platform, such as projects, experiments, or rows. The method takes a configuration object as its argument, which can be used to specify the filter, sorting, and pagination options for the list. The method returns a Promise that resolves with the list of entities when the request is successful.create()
: This method is used to create a new entity in the Labii platform, such as a new project, experiment, or row. The method takes a configuration object as its argument, which should contain the properties of the new entity to be created. The method returns a Promise that resolves with the newly created entity when the request is successful.retrieve()
: This method is used to retrieve a single entity from the Labii platform, based on its ID or other identifying information. The method takes a configuration object as its argument, which should contain the ID or other identifying information of the entity to be retrieved. The method returns a Promise that resolves with the retrieved entity when the request is successful.modify()
: This method is used to modify an existing entity in the Labii platform, based on its ID or other identifying information. The method takes a configuration object as its argument, which should contain the properties of the entity to be modified. The method returns a Promise that resolves with the modified entity when the request is successful.delete()
: This method is used to delete an existing entity from the Labii platform, based on its ID or other identifying information. The method takes a configuration object as its argument, which should contain the ID or other identifying information of the entity to be deleted. The method returns a Promise that resolves with the deleted entity when the request is successful.
Props
These are the properties or options that can be passed to a method when it is called. Props are used to configure the behavior of a method or to provide additional information to the Labii platform. For example, when calling the Project.create()
method, you might pass props such as the project name, description, and owner.
callback_success (func, optional). This props specifies a callback function to be called when the request is successful. The function receives the response data as its argument
callback_fail (func, optional). This option specifies a callback function to be called when the request fails. The function receives the error object as its argument
Examples
Last updated