Services


The @blocklet/js-sdk is organized into several service classes, each responsible for a specific domain of functionality. These services act as dedicated clients for different Blocklet API endpoints, providing a structured and intuitive way to interact with the platform's features.

Most core services are pre-initialized and available as properties on the main BlockletSDK instance, which you can obtain using the getBlockletSDK() function.

Accessing a Service

import { getBlockletSDK } from '@blocklet/js-sdk';

const sdk = getBlockletSDK();

// Access the AuthService to get user info
async function getUserProfile() {
  const profile = await sdk.user.getProfile();
  console.log(profile);
}

// Access the BlockletService to get blocklet info
async function getBlockletMeta() {
  const meta = await sdk.blocklet.getMeta();
  console.log(meta);
}

The diagram below illustrates the structure of the BlockletSDK instance and its relationship with the core services.


Below is a complete list of the available services. Click on any service to view its detailed API reference.

Each service provides a focused set of methods for a specific part of the Blocklet platform. To understand the data structures and types returned by these services, please see the Types reference.