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

Types


The @blocklet/server-js API uses a variety of data structures to represent resources and inputs. This section serves as a complete reference for all the types you will encounter when making requests or handling responses. Understanding these structures is key to effectively using Queries and Mutations.

On This Page#


Data Structures#

These types represent the objects returned by the API in queries and mutations.

AccessKey#

Field

Type

Description

accessKeyId

string

The unique identifier for the access key.

accessKeyPublic

string

The public part of the access key.

remark

string

A user-provided remark for the access key.

passport

string

The passport associated with this key.

createdAt

number

Timestamp of when the key was created.

updatedAt

number

Timestamp of the last update.

lastUsedAt

number

Timestamp of the last time the key was used.

createdBy

string

The DID of the user who created the key.

updatedBy

string

The DID of the user who last updated the key.

authType

string

The authentication type.

componentDid

string

The DID of the component this key is associated with.

resourceType

string

The type of resource this key can access.

resourceId

string

The ID of the resource this key can access.

createdVia

string

The method or source through which the key was created.

expireAt

number

Timestamp when the key will expire.

AigneConfig#

Field

Type

Description

provider

string

The AI service provider (e.g., 'openai').

model

string

The specific model used (e.g., 'gpt-4').

key

string

The API key for the AI service.

url

string

The base URL for the AI service API.

accessKeyId

string

Access Key ID for providers like AWS Bedrock.

secretAccessKey

string

Secret Access Key for providers like AWS Bedrock.

validationResult

string

The result of the last connection validation.

AuditLog#

Field

Type

Description

id

string

Unique identifier for the audit log entry.

scope

string

The scope of the action (e.g., 'node', 'blocklet').

category

string

The category of the action (e.g., 'security', 'management').

action

string

The specific action performed (e.g., 'login', 'update_config').

content

string

Detailed content or payload of the log entry.

actor

AuditLogActor

Information about the user or system that performed the action.

env

AuditLogEnv

Environmental details like browser and OS.

createdAt

number

Timestamp of when the event occurred.

ip

string

The IP address from which the action was initiated.

ua

string

The User-Agent string of the client.

AutoBackup#

Field

Type

Description

enabled

boolean

Indicates if automatic backups are enabled.

BlockletState#

Field

Type

Description

meta

BlockletMeta

The metadata of the blocklet.

status

BlockletStatus

The current operational status of the blocklet.

createdAt

number

Timestamp when the blocklet was first created.

installedAt

number

Timestamp when the blocklet was installed.

startedAt

number

Timestamp when the blocklet was last started.

stoppedAt

number

Timestamp when the blocklet was last stopped.

updatedAt

number

Timestamp when the blocklet was last updated.

environments

ConfigEntry[]

A list of environment variables for the blocklet.

configs

ConfigEntry[]

A list of configuration entries for the blocklet.

diskInfo

DiskInfo

Information about the blocklet's disk usage.

runtimeInfo

RuntimeInfo

Information about the blocklet's runtime performance.

source

BlockletSource

The source from which the blocklet was installed.

port

number

The port number the blocklet is running on.

engine

BlockletEngine

The engine running the blocklet.

children

ComponentState[]

A list of child components associated with this blocklet.

settings

BlockletSettings

The settings configured for this blocklet.

appDid

string

The application DID of the blocklet.

site

RoutingSite

The routing site information for the blocklet.

Certificate#

Field

Type

Description

name

string

A user-friendly name for the certificate.

domain

string

The primary domain this certificate is for.

id

string

The unique identifier for the certificate.

meta

CertificateMeta

Detailed metadata about the certificate.

createdAt

number

Timestamp of when the certificate was created.

updatedAt

number

Timestamp of the last update.

status

string

The current status of the certificate (e.g., 'valid', 'expired').

GeneralResponse#

Field

Type

Description

code

StatusCode

The status code of the response.

NodeState#

Field

Type

Description

did

string

The DID of the Blocklet Server node.

pk

string

The public key of the Blocklet Server node.

version

string

The current version of the Blocklet Server software.

name

string

The user-defined name of the node.

description

string

The user-defined description of the node.

initialized

boolean

Whether the node has been initialized.

nodeOwner

WalletInfo

Wallet information for the node owner.

createdAt

number

Timestamp of when the node was created.

startedAt

number

Timestamp of when the node was last started.

uptime

number

The uptime of the node in seconds.

autoUpgrade

boolean

Whether automatic upgrades are enabled.

OauthClient#

Field

Type

Description

redirectUris

string[]

An array of allowed redirect URIs.

tokenEndpointAuthMethod

string

The token endpoint authentication method.

grantTypes

string[]

An array of allowed grant types.

responseTypes

string[]

An array of allowed response types.

clientName

string

The name of the client application.

clientId

string

The unique identifier for the OAuth client.

clientSecret

string

The client secret.

createdAt

number

Timestamp when the client was created.

updatedAt

number

Timestamp when the client was last updated.

Passport#

Field

Type

Description

id

string

The unique identifier for the passport.

name

string

The name associated with the passport.

title

string

A title for the passport.

issuer

Issuer

Information about the issuer of the passport.

issuanceDate

number

Timestamp of when the passport was issued.

expirationDate

number

Timestamp of when the passport expires.

status

string

The current status of the passport (e.g., 'active', 'revoked').

role

string

The role assigned by this passport.

userDid

string

The DID of the user who holds the passport.

Project#

Field

Type

Description

id

string

The unique identifier for the project.

type

PublishType

The type of the project (e.g., 'resource', 'pack').

blockletDid

string

The DID of the blocklet associated with the project.

blockletTitle

string

The title of the associated blocklet.

createdAt

string

Timestamp of when the project was created.

updatedAt

string

Timestamp of the last update.

connectedStores

ConnectedStore[]

A list of stores this project is connected to.

connectedEndpoints

ConnectedEndpoint[]

A list of endpoints this project is connected to.

Release#

Field

Type

Description

id

string

The unique identifier for the release.

projectId

string

The ID of the project this release belongs to.

blockletVersion

string

The version of the blocklet for this release.

note

string

Release notes.

status

ReleaseStatus

The status of the release (e.g., 'draft', 'published').

createdAt

string

Timestamp of when the release was created.

updatedAt

string

Timestamp of the last update.

UserInfo#

Field

Type

Description

did

string

The user's decentralized identifier.

pk

string

The user's public key.

role

string

The role of the user.

avatar

string

URL to the user's avatar image.

fullName

string

The user's full name.

email

string

The user's email address.

approved

boolean

Whether the user has been approved.

createdAt

number

Timestamp of when the user account was created.

lastLoginAt

number

Timestamp of the user's last login.


Input Objects#

These types are used to provide arguments for mutations and queries.

AigneConfigInput#

Used for configuring AI service integrations.

Field

Type

Description

provider

string

The AI service provider (e.g., 'openai').

model

string

The specific model to use.

key

string

The API key for the service.

url

string

The base URL for the service's API.

BlockletAccessPolicyInput#

Used for creating or updating a blocklet access policy.

Field

Type

Description

id

string

Unique identifier for the policy.

name

string

A user-friendly name for the policy.

description

string

A description of the policy.

roles

any

The roles that this policy applies to.

reverse

boolean

If true, the policy logic is reversed.

NodeInfoInput#

Used for updating the node's general information.

Field

Type

Description

name

string

The new name for the node.

description

string

The new description for the node.

autoUpgrade

boolean

Enable or disable automatic upgrades.

webWalletUrl

string

The URL of the web wallet to be used with this node.

PagingInput#

Used to specify pagination for list queries.

Field

Type

Description

page

number

The page number to retrieve.

pageSize

number

The number of items to retrieve per page.

RequestCreateAccessKeyInput#

Used to create a new access key.

Field

Type

Description

teamDid

string

The DID of the team this key belongs to.

remark

string

A note or description for the key.

authType

string

The authentication type for the key.

expireAt

number

Timestamp for when the key should expire.

UserInfoInput#

Used for creating or updating user information.

Field

Type

Description

did

string

The user's decentralized identifier.

role

string

The new role for the user.

fullName

string

The user's full name.

email

string

The user's email address.

approved

boolean

Set the approval status for the user.


Enumerations#

These types represent a fixed set of named values.

BackendServiceType#

Defines the type of backend service for a routing rule.

Value

Description

daemon

The Blocklet Server's core daemon service.

blocklet

A specific blocklet service.

redirect

Redirect to a different URL.

component

A specific component within a blocklet.

BlockletStatus#

Represents the lifecycle status of a blocklet.

Value

Description

running

The blocklet is currently running.

stopped

The blocklet is stopped.

installing

The blocklet is being installed.

error

The blocklet has encountered an error.

restarting

The blocklet is restarting.

StatusCode#

Represents the status of an API response.

Value

Description

ok

The request was successful.

forbidden

The request is not authorized.

internal

An internal server error occurred.

timeout

The request timed out.


Scalars#

These are the basic, indivisible data types used throughout the API.

Type

Description

String

A UTF-8 character sequence.

Int / Int32 / Uint32

A signed or unsigned 32-bit integer.

Int64 / Uint64

A signed or unsigned 64-bit integer.

Float / Float32

A floating-point number.

Boolean

A true or false value.

Any

A flexible type that can hold any JSON-serializable value.

Bytes

A sequence of bytes.