Queries
The @blocklet/server-js
library provides a comprehensive set of query methods to fetch data from your Blocklet Server. These methods allow you to retrieve information about blocklets, users, server status, routing configurations, and more. All query methods are asynchronous and return a Promise
that resolves with the requested data.
For methods that modify data, see the Mutations section. For a detailed breakdown of all data structures, refer to the Types reference.
Basic Usage#
To make a query, first instantiate the BlockletServerClient
. Then, you can call any of the available query methods. Here is a basic example of fetching the server's information:
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
async function fetchServerInfo() {
try {
const { info } = await client.getNodeInfo();
console.log(`Server Name: ${info.name}`);
console.log(`Version: ${info.version}`);
} catch (error) {
console.error('Failed to fetch server info:', error);
}
}
fetchServerInfo();
Query Categories#
Queries are grouped by their functionality. Select a category below to see detailed references, including parameters, return types, and usage examples for each method.
Complete Query List#
Below is a complete list of all available query methods for quick reference.
Method | Description |
---|---|
| Fetches detailed information about a specific Blocklet. |
| Retrieves Blocklet metadata from a given URL. |
| Compares local Blocklet files with a remote version. |
| Retrieves a list of all installed Blocklets on the server. |
| Fetches historical runtime data (CPU/memory) for a Blocklet. |
| Lists available Blocklets from a backup source. |
| Retrieves information about dynamic components. |
| Fetches the current state and configuration of the Blocklet Server itself. |
| Resets the server's status flags. |
| Gets detailed environment information for the server. |
| Checks for available updates to the Blocklet Server software. |
| Retrieves the current delegation state. |
| Fetches historical runtime data for the entire server. |
| Retrieves metadata for a Blocklet from a specified store. |
| Fetches a list of notifications for a user or team. |
| Marks all notifications as read for a receiver. |
| Retrieves logs of sent notifications. |
| Gets a list of notification receivers. |
| Gets components that can send notifications. |
| Resends a specific notification. |
| Retrieves all configured routing sites. |
| Gets a list of saved routing configuration snapshots. |
| Retrieves the sites from a specific routing snapshot. |
| Lists available routing providers (e.g., Nginx). |
| Checks if a given domain is a DID-based domain. |
| Fetches all installed SSL/TLS certificates. |
| Checks the DNS configuration for a list of domains. |
| Finds a specific certificate by its associated domain. |
| Retrieves a list of access keys. |
| Fetches details for a single access key. |
| Retrieves configured webhooks. |
| Gets a list of available webhook sender types. |
| Sends a test message to a webhook for verification. |
| Retrieves details about the current user session. |
| Retrieves a list of all user roles defined within a specific team or application context. |
| Fetches details for a single role. |
| Retrieves all available permissions. |
| Gets a list of pending user invitations. |
| Fetches a paginated list of users associated with a specific team or application. |
| Fetches details for a single user by DID. |
| Retrieves a list of active sessions for a user. |
| Counts the number of active sessions for a user. |
| Gets the total number of users for a team. |
| Gets user counts grouped by role. |
| Retrieves the owner of the server or a specific application. |
| Lists all permissions granted to a specific role. |
| Retrieves passport issuance configurations. |
| Logs out a specific user session. |
| Allows a user to delete their own account. |
| Retrieves a list of users that follow a specified user. |
| Retrieves a list of users that a specified user is following. |
| Gets follower and following counts for users. |
| Checks if a user is following one or more other users. |
| Follows a user. |
| Unfollows a user. |
| Retrieves a list of tags used for organizing users or content. |
| Fetches audit logs for tracking system activities. |
| Retrieves session information from the Blocklet launcher. |
| Lists all backups for a specific Blocklet. |
| Provides a summary of backup activity. |
| Fetches configured space gateway information for a Blocklet. |
| Retrieves traffic and analytics data. |
| Lists all publishing projects. |
| Fetches details for a single publishing project. |
| Lists all releases for a project. |
| Fetches details for a single release. |
| Retrieves resources selected for a specific release. |
| Fetches a single security rule for a Blocklet. |
| Lists all security rules for a Blocklet. |
| Retrieves a response header policy. |
| Lists all response header policies. |
| Fetches a single access policy. |
| Lists all access policies. |
| Retrieves registered webhook endpoints. |
| Fetches a single webhook endpoint. |
| Gets the delivery attempt history for a webhook. |
| Counts passports grouped by role. |
| Retrieves passports for a specific role. |
| Fetches logs related to passport activity. |
| Finds passports related to a given passport. |
| Gets basic information for a Blocklet. |
| Performs a DNS lookup for a domain. |
| Retrieves configured OAuth clients. |
| Creates a new OAuth client. |
| Updates an existing OAuth client. |
| Deletes an OAuth client. |
Now that you have an overview of how to fetch data, you can dive into the specific query categories for detailed examples or proceed to the Mutations section to learn how to create, update, and delete data on the server.