Used to check for browser translation.
用于检测浏览器翻译。
ブラウザの翻訳を検出する
API Reference

Publishing & Projects


These queries allow you to manage and retrieve information about publishing projects, their releases, and associated resources on a Blocklet Server. They are essential for blocklet development and distribution workflows.

For creating or modifying these resources, see the Mutations > Publishing & Projects section.


getProjects#

Retrieves a paginated list of publishing projects associated with a specific blocklet or component.

Parameters#

The getProjects method accepts an input object with the following fields:

Name

Type

Description

did

string

Required. The DID of the blocklet that owns the projects.

paging

PagingInput

Optional. Pagination parameters for the list.

componentDid

string

Optional. Filter projects by a specific component DID.

tenantScope

string

Optional. Filter projects by tenant scope.

Example Usage#

import BlockletServerClient from '@blocklet/server-js';

const client = new BlockletServerClient();

try {
const response = await client.getProjects({
input: {
did: 'z8iZp329WnfurpWNoG6GCBC72WbgrAY2T9ztb',
paging: { page: 1, pageSize: 10 },
},
});
console.log('Projects:', response.projects);
console.log('Paging Info:', response.paging);
} catch (error) {
console.error('Error fetching projects:', error);
}

Example Response#

{
"code": "ok",
"projects": [
{
"id": "zd...",
"type": "resource",
"blockletDid": "z8iZp329WnfurpWNoG6GCBC72WbgrAY2T9ztb",
"blockletTitle": "My Awesome Blocklet",
"componentDid": "z8iZP...",
"createdAt": "2023-10-27T10:00:00.000Z",
"updatedAt": "2023-10-27T10:00:00.000Z",
"connectedStores": []
}
],
"paging": {
"page": 1,
"pageSize": 10,
"total": 1,
"pageCount": 1
}
}


getProject#

Fetches details for a single publishing project by its unique ID.

Parameters#

The getProject method accepts an input object with the following fields:

Name

Type

Description

did

string

Required. The DID of the owner blocklet.

projectId

string

Required. The unique identifier of the project to retrieve.

messageId

string

Optional. A message identifier, typically used in specific workflows like connecting via Studio.

Example Usage#

import BlockletServerClient from '@blocklet/server-js';

const client = new BlockletServerClient();

try {
const response = await client.getProject({
input: {
did: 'z8iZp329WnfurpWNoG6GCBC72WbgrAY2T9ztb',
projectId: 'zd...',
},
});
console.log('Project Details:', response.project);
} catch (error) {
console.error('Error fetching project:', error);
}

Example Response#

{
"code": "ok",
"project": {
"id": "zd...",
"type": "resource",
"blockletDid": "z8iZp329WnfurpWNoG6GCBC72WbgrAY2T9ztb",
"blockletTitle": "My Awesome Blocklet",
"blockletDescription": "A blocklet that does awesome things.",
"blockletLogo": "https://example.com/logo.png",
"createdAt": "2023-10-27T10:00:00.000Z",
"updatedAt": "2023-10-27T10:00:00.000Z",
"lastReleaseId": "rel_...",
"connectedStores": []
}
}


getReleases#

Retrieves a paginated list of all releases within a specific publishing project.

Parameters#

The getReleases method accepts an input object with the following fields:

Name

Type

Description

did

string

Required. The DID of the owner blocklet.

projectId

string

Required. The ID of the project whose releases are to be fetched.

paging

PagingInput

Optional. Pagination parameters for the list.

Example Usage#

import BlockletServerClient from '@blocklet/server-js';

const client = new BlockletServerClient();

try {
const response = await client.getReleases({
input: {
did: 'z8iZp329WnfurpWNoG6GCBC72WbgrAY2T9ztb',
projectId: 'zd...',
paging: { page: 1, pageSize: 5 },
},
});
console.log('Releases:', response.releases);
} catch (error) {
console.error('Error fetching releases:', error);
}

Example Response#

{
"code": "ok",
"releases": [
{
"id": "rel_...",
"projectId": "zd...",
"blockletVersion": "1.2.0",
"blockletTitle": "My Awesome Blocklet v1.2.0",
"note": "Added new features and bug fixes.",
"status": "published",
"createdAt": "2023-10-28T12:00:00.000Z"
}
],
"paging": {
"page": 1,
"pageSize": 5,
"total": 1,
"pageCount": 1
}
}


getRelease#

Fetches details for a single release by its unique ID within a project.

Parameters#

The getRelease method accepts an input object with the following fields:

Name

Type

Description

did

string

Required. The DID of the owner blocklet.

projectId

string

Required. The ID of the project containing the release.

releaseId

string

Required. The unique identifier of the release to retrieve.

Example Usage#

import BlockletServerClient from '@blocklet/server-js';

const client = new BlockletServerClient();

try {
const response = await client.getRelease({
input: {
did: 'z8iZp329WnfurpWNoG6GCBC72WbgrAY2T9ztb',
projectId: 'zd...',
releaseId: 'rel_...',
},
});
console.log('Release Details:', response.release);
} catch (error) {
console.error('Error fetching release:', error);
}

Example Response#

{
"code": "ok",
"release": {
"id": "rel_...",
"projectId": "zd...",
"blockletDid": "z8iZp329WnfurpWNoG6GCBC72WbgrAY2T9ztb",
"blockletVersion": "1.2.0",
"blockletTitle": "My Awesome Blocklet v1.2.0",
"note": "Added new features and bug fixes.",
"status": "published",
"createdAt": "2023-10-28T12:00:00.000Z",
"files": ["/path/to/resource.zip"],
"blockletComponents": []
}
}


getSelectedResources#

Fetches the list of selected resources for a specific component within a release. This is used when a blocklet publishes resources that other blocklets can consume.

Parameters#

The getSelectedResources method accepts an input object with the following fields:

Name

Type

Description

did

string

Required. The DID of the owner blocklet.

projectId

string

Required. The ID of the project.

releaseId

string

Required. The ID of the release.

componentDid

string

Required. The DID of the component whose selected resources are being queried.

Example Usage#

import BlockletServerClient from '@blocklet/server-js';

const client = new BlockletServerClient();

try {
const response = await client.getSelectedResources({
input: {
did: 'z8iZp329WnfurpWNoG6GCBC72WbgrAY2T9ztb',
projectId: 'zd...',
releaseId: 'rel_...',
componentDid: 'z8iZP...',
},
});
console.log('Selected Resources:', response.resources);
} catch (error) {
console.error('Error fetching selected resources:', error);
}

Example Response#

{
"code": "ok",
"resources": ["/resource/a.txt", "/resource/b.json"]
}

This section provides the read-only operations for managing your blocklet publishing lifecycle. To create, update, or delete these entities, proceed to the Mutations documentation.