このセクションでは、Blocklet内でユーザー、ロール、権限、招待、およびアクセスキーを管理するためのミューテーションに関する詳細なリファレンスを提供します。これらの操作は、アプリケーションでのアクセス制御とID管理に不可欠です。
ユーザーおよびアクセス制御データを取得するには、ユーザーとアクセスの管理クエリのドキュメントを参照してください。
ユーザー管理
ユーザー、プロファイル、属性の作成、更新、削除、管理を行うためのミューテーション。
ロールと権限の管理
ロールを定義し、リソースへのアクセスを制御するための詳細な権限を割り当てる操作。
招待管理
チームへの参加や所有権の移転をユーザーに招待するための作成および管理メソッド。
アクセスキー管理
プログラムによるアクセスのためのAPIアクセスキーの作成、更新、削除を行う関数。
タグ管理
ユーザーを整理するために使用されるタグの作成、更新、削除を行うミューテーション。
パスポート管理
検証可能な資格情報(パスポート)の発行と設定に関連する操作。
ユーザー管理
これらのミューテーションにより、ユーザーアカウントの包括的な管理が可能になります。
removeUser
チームからユーザーを永久に削除します。
パラメーター
- input
RequestTeamUserInput(required) — teamDidとユーザーのdidを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - user
UserInfoInput(required) — ユーザー情報。 - did
string(required) — 削除するユーザーのDID。
例
removeUser
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { user } = await client.removeUser({
input: {
teamDid: 'zdfw...',
user: {
did: 'z8...',
},
},
});
console.log('ユーザーが削除されました:', user.did);
} catch (error) {
console.error('ユーザーの削除中にエラーが発生しました:', error);
}レスポンス
削除されたユーザーの詳細を含む ResponseUser オブジェクトを返します。
Response
{
"removeUser": {
"code": "ok",
"user": {
"did": "z8...",
"fullName": "John Doe"
}
}
}updateUserTags
特定のユーザーに関連付けられたタグを更新します。
パラメーター
- input
RequestUpdateUserTagsInput(required) — teamDid、ユーザーのdid、およびタグIDの配列を含むオブジェクト。 - teamDid
string(required) — チームのDID。 - did
string(required) — ユーザーのDID。 - tags
number[](required) — ユーザーに関連付けるタグIDの配列。
例
updateUserTags
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { user } = await client.updateUserTags({
input: {
teamDid: 'zdfw...',
did: 'z8...',
tags: [1, 3],
},
});
console.log('ユーザーのタグが更新されました:', user.tags);
} catch (error) {
console.error('ユーザーのタグの更新中にエラーが発生しました:', error);
}レスポンス
ユーザーの更新された情報を含む ResponseUser オブジェクトを返します。
Response
{
"updateUserTags": {
"code": "ok",
"user": {
"did": "z8...",
"tags": [
{ "id": 1, "title": "Developer" },
{ "id": 3, "title": "Early Adopter" }
]
}
}
}updateUserExtra
ユーザーの remark および extra (JSON文字列) フィールドを更新します。
パラメーター
- input
RequestUpdateUserExtraInput(required) — teamDid、ユーザーDID、および追加データを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - did
string(required) — 更新するユーザーのDID。 - remark
string— ユーザーの新しい備考。 - extra
string— カスタムデータを含むJSON文字列。
例
updateUserExtra
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { user } = await client.updateUserExtra({
input: {
teamDid: 'zdfw...',
did: 'z8...',
remark: 'Internal user account',
extra: JSON.stringify({ department: 'Engineering' }),
},
});
console.log('ユーザーの追加データが更新されました:', user.extra);
} catch (error) {
console.error('ユーザーの追加データの更新中にエラーが発生しました:', error);
}レスポンス
更新されたユーザーの詳細を含む ResponseUser オブジェクトを返します。
Response
{
"updateUserExtra": {
"code": "ok",
"user": {
"did": "z8...",
"remark": "Internal user account",
"extra": {
"department": "Engineering"
}
}
}
}updateUserApproval
ユーザーの承認ステータスを設定します。
パラメーター
- input
RequestTeamUserInput(required) — teamDidと、didおよび新しい承認ステータスを含むユーザー詳細を含むオブジェクト。 - teamDid
string(required) — チームのDID。 - user
UserInfoInput(required) — ユーザー情報。 - did
string(required) — ユーザーのDID。 - approved
boolean(required) — 新しい承認ステータス。
例
updateUserApproval
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { user } = await client.updateUserApproval({
input: {
teamDid: 'zdfw...',
user: {
did: 'z8...',
approved: true,
},
},
});
console.log('ユーザーの承認ステータス:', user.approved);
} catch (error) {
console.error('ユーザーの承認ステータスの更新中にエラーが発生しました:', error);
}レスポンス
更新された承認ステータスを含む ResponseUser オブジェクトを返します。
Response
{
"updateUserApproval": {
"code": "ok",
"user": {
"did": "z8...",
"approved": true
}
}
}issuePassportToUser
ユーザーに新しいパスポート(検証可能な資格情報)を発行し、通常はロールを割り当てます。
パラメーター
- input
RequestIssuePassportToUserInput(required) — teamDid、userDid、role、および表示詳細を含むオブジェクト。 - teamDid
string(required) — チームのDID。 - userDid
string(required) — パスポートを受け取るユーザーのDID。 - role
string(required) — このパスポートで割り当てるロール。 - display
PassportDisplayInput— パスポートの表示情報。 - type
string(required) — 表示タイプ(例:'text')。 - content
string(required) — 表示するコンテンツ。 - notify
boolean— ユーザーに通知を送信するかどうか。
例
issuePassportToUser
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { user } = await client.issuePassportToUser({
input: {
teamDid: 'zdfw...',
userDid: 'z8...',
role: 'guest',
display: {
type: 'text',
content: 'Guest Access Pass',
},
notify: true,
},
});
console.log('パスポートがユーザーに発行されました:', user.did);
} catch (error) {
console.error('パスポートの発行中にエラーが発生しました:', error);
}レスポンス
ResponseUser オブジェクトを返します。これには、ユーザーの passports 配列に新しく発行されたパスポートが含まれる場合があります。
Response
{
"issuePassportToUser": {
"code": "ok",
"user": {
"did": "z8...",
"passports": [
{
"id": "...",
"role": "guest"
}
]
}
}
}revokeUserPassport
以前に発行されたパスポートをユーザーから取り消します。
パラメーター
- input
RequestRevokeUserPassportInput(required) — teamDid、userDid、および取り消すpassportIdを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - userDid
string(required) — ユーザーのDID。 - passportId
string(required) — 取り消すパスポートのID。
例
revokeUserPassport
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { user } = await client.revokeUserPassport({
input: {
teamDid: 'zdfw...',
userDid: 'z8...',
passportId: 'z...',
},
});
console.log('ユーザーパスポートが取り消されました。');
} catch (error) {
console.error('パスポートの取り消し中にエラーが発生しました:', error);
}レスポンス
ユーザーのパスポートの変更を反映した ResponseUser オブジェクトを返します。
Response
{
"revokeUserPassport": {
"code": "ok",
"user": {
"did": "z8..."
}
}
}enableUserPassport
以前に取り消されたパスポートを再度有効にします。
パラメーター
- input
RequestRevokeUserPassportInput(required) — teamDid、userDid、および有効にするpassportIdを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - userDid
string(required) — ユーザーのDID。 - passportId
string(required) — 再度有効にするパスポートのID。
例
enableUserPassport
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { user } = await client.enableUserPassport({
input: {
teamDid: 'zdfw...',
userDid: 'z8...',
passportId: 'z...',
},
});
console.log('ユーザーパスポートが再度有効になりました。');
} catch (error) {
console.error('パスポートの有効化中にエラーが発生しました:', error);
}レスポンス
ユーザーの更新されたパスポートステータスを含む ResponseUser オブジェクトを返します。
Response
{
"enableUserPassport": {
"code": "ok",
"user": {
"did": "z8..."
}
}
}removeUserPassport
ユーザーの記録からパスポートを永久に削除します。
パラメーター
- input
RequestRevokeUserPassportInput(required) — teamDid、userDid、および削除するpassportIdを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - userDid
string(required) — ユーザーのDID。 - passportId
string(required) — 削除するパスポートのID。
例
removeUserPassport
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
await client.removeUserPassport({
input: {
teamDid: 'zdfw...',
userDid: 'z8...',
passportId: 'z...',
},
});
console.log('ユーザーパスポートが永久に削除されました。');
} catch (error) {
console.error('パスポートの削除中にエラーが発生しました:', error);
}レスポンス
成功または失敗を示す GeneralResponse オブジェクトを返します。
Response
{
"removeUserPassport": {
"code": "ok"
}
}updateUserInfo
ユーザーの一般情報(fullName、email、avatarなど)を更新します。
パラメーター
- input
RequestUpdateUserInfoInput(required) — teamDidと、更新するフィールドを含むユーザーオブジェクトを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - user
UserInfoInput(required) — 更新するユーザーフィールドを含むオブジェクト。 - did
string(required) — ユーザーのDID。 - fullName
string— ユーザーのフルネーム。 - email
string— ユーザーのメールアドレス。
例
updateUserInfo
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { user } = await client.updateUserInfo({
input: {
teamDid: 'zdfw...',
user: {
did: 'z8...',
fullName: 'Johnathan Doe',
email: 'john.doe.new@example.com',
},
},
});
console.log('ユーザー情報が更新されました:', user.fullName);
} catch (error) {
console.error('ユーザー情報の更新中にエラーが発生しました:', error);
}レスポンス
更新されたユーザー情報を含む ResponseUser オブジェクトを返します。
Response
{
"updateUserInfo": {
"code": "ok",
"user": {
"did": "z8...",
"fullName": "Johnathan Doe",
"email": "john.doe.new@example.com"
}
}
}ロールと権限の管理
これらのミューテーションは、ロールを定義し、それらに関連付けられた権限を管理するために使用されます。
createRole
チーム内に新しいロールを作成します。
パラメーター
- input
RequestCreateRoleInput(required) — teamDid、name、title、およびオプションでpermissionsを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - name
string(required) — ロールの一意な名前(例:'editor')。 - title
string(required) — ロールの人間が読みやすいタイトル(例:'Editor')。 - description
string— ロールの簡単な説明。 - permissions
string[]— このロールに付与する権限名の配列。
例
createRole
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { role } = await client.createRole({
input: {
teamDid: 'zdfw...',
name: 'editor',
title: 'Editor',
description: 'Can create and edit content',
permissions: ['content:create', 'content:edit'],
},
});
console.log('ロールが作成されました:', role.name);
} catch (error) {
console.error('ロールの作成中にエラーが発生しました:', error);
}レスポンス
新しく作成されたロールの詳細を含む ResponseRole オブジェクトを返します。
Response
{
"createRole": {
"code": "ok",
"role": {
"name": "editor",
"title": "Editor",
"grants": ["content:create", "content:edit"]
}
}
}updateRole
既存のロールの詳細を更新します。
パラメーター
- input
RequestTeamRoleInput(required) — teamDidと、更新するフィールドを含むロールオブジェクトを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - role
RoleUpdateInput(required) — 更新するロールフィールドを含むオブジェクト。 - name
string(required) — 更新するロールの名前。 - title
string— ロールの新しいタイトル。 - description
string— ロールの新しい説明。
例
updateRole
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { role } = await client.updateRole({
input: {
teamDid: 'zdfw...',
role: {
name: 'editor',
title: 'Content Editor',
},
},
});
console.log('ロールが更新されました:', role.title);
} catch (error) {
console.error('ロールの更新中にエラーが発生しました:', error);
}レスポンス
更新されたロール情報を含む ResponseRole オブジェクトを返します。
Response
{
"updateRole": {
"code": "ok",
"role": {
"name": "editor",
"title": "Content Editor"
}
}
}deleteRole
ロールを永久に削除します。
パラメーター
- input
RequestDeleteRoleInput(required) — teamDidと削除するロールの名前を含むオブジェクト。 - teamDid
string(required) — チームのDID。 - name
string(required) — 削除するロールの名前。
例
deleteRole
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
await client.deleteRole({
input: {
teamDid: 'zdfw...',
name: 'editor',
},
});
console.log('ロール "editor" が削除されました。');
} catch (error) {
console.error('ロールの削除中にエラーが発生しました:', error);
}レスポンス
成功または失敗を示す GeneralResponse オブジェクトを返します。
Response
{
"deleteRole": {
"code": "ok"
}
}createPermission
ロールに付与できる新しい権限を作成します。
パラメーター
- input
RequestCreatePermissionInput(required) — teamDid、name、およびdescriptionを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - name
string(required) — 権限の一意な名前(例:'content')。 - description
string— 権限の簡単な説明。
例
createPermission
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { permission } = await client.createPermission({
input: {
teamDid: 'zdfw...',
name: 'content:publish',
description: 'Allows publishing content',
},
});
console.log('権限が作成されました:', permission.name);
} catch (error) {
console.error('権限の作成中にエラーが発生しました:', error);
}レスポンス
新しい権限の詳細を含む ResponsePermission オブジェクトを返します。
Response
{
"createPermission": {
"code": "ok",
"permission": {
"name": "content:publish",
"description": "Allows publishing content"
}
}
}updatePermission
既存の権限の説明を更新します。
パラメーター
- input
RequestTeamPermissionInput(required) — teamDidと更新する権限の詳細を含むオブジェクト。 - teamDid
string(required) — チームのDID。 - permission
PermissionInput(required) — 権限名と新しい説明を含むオブジェクト。 - name
string(required) — 更新する権限の名前。 - description
string(required) — 権限の新しい説明。
例
updatePermission
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { permission } = await client.updatePermission({
input: {
teamDid: 'zdfw...',
permission: {
name: 'content:publish',
description: 'Allows publishing content to the live site.',
},
},
});
console.log('権限が更新されました:', permission.description);
} catch (error) {
console.error('権限の更新中にエラーが発生しました:', error);
}レスポンス
更新された権限の詳細を含む ResponsePermission オブジェクトを返します。
Response
{
"updatePermission": {
"code": "ok",
"permission": {
"name": "content:publish",
"description": "Allows publishing content to the live site."
}
}
}deletePermission
権限を永久に削除します。これにより、その権限を持つすべてのロールからも取り消されます。
パラメーター
- input
RequestDeletePermissionInput(required) — teamDidと削除する権限の名前を含むオブジェクト。 - teamDid
string(required) — チームのDID。 - name
string(required) — 削除する権限の名前。
例
deletePermission
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
await client.deletePermission({
input: {
teamDid: 'zdfw...',
name: 'content:publish',
},
});
console.log('権限が削除されました。');
} catch (error) {
console.error('権限の削除中にエラーが発生しました:', error);
}レスポンス
成功または失敗を示す GeneralResponse オブジェクトを返します。
Response
{
"deletePermission": {
"code": "ok"
}
}grantPermissionForRole
特定の権限をロールに付与します。
パラメーター
- input
RequestGrantPermissionForRoleInput(required) — teamDid、roleName、およびgrantName(権限)を含むオブジェクト。 - teamDid
string(required) — チームのDID。 - roleName
string(required) — ロールの名前。 - grantName
string(required) — 付与する権限の名前。
例
grantPermissionForRole
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
await client.grantPermissionForRole({
input: {
teamDid: 'zdfw...',
roleName: 'editor',
grantName: 'content:publish',
},
});
console.log('権限が付与されました。');
} catch (error) {
console.error('権限の付与中にエラーが発生しました:', error);
}レスポンス
成功または失敗を示す GeneralResponse オブジェクトを返します。
Response
{
"grantPermissionForRole": {
"code": "ok"
}
}revokePermissionFromRole
特定の権限をロールから取り消します。
パラメーター
- input
RequestRevokePermissionFromRoleInput(required) — teamDid、roleName、およびgrantName(権限)を含むオブジェクト。 - teamDid
string(required) — チームのDID。 - roleName
string(required) — ロールの名前。 - grantName
string(required) — 取り消す権限の名前。
例
revokePermissionFromRole
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
await client.revokePermissionFromRole({
input: {
teamDid: 'zdfw...',
roleName: 'editor',
grantName: 'content:publish',
},
});
console.log('権限が取り消されました。');
} catch (error) {
console.error('権限の取り消し中にエラーが発生しました:', error);
}レスポンス
成功または失敗を示す GeneralResponse オブジェクトを返します。
Response
{
"revokePermissionFromRole": {
"code": "ok"
}
}updatePermissionsForRole
ロールの権限の完全なリストを設定し、既存の権限を置き換えます。
パラメーター
- input
RequestUpdatePermissionsForRoleInput(required) — teamDid、roleName、および権限名の配列を含むオブジェクト。 - teamDid
string(required) — チームのDID。 - roleName
string(required) — ロールの名前。 - grantNames
string[](required) — ロールに設定する権限名の配列。
例
updatePermissionsForRole
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { role } = await client.updatePermissionsForRole({
input: {
teamDid: 'zdfw...',
roleName: 'editor',
grantNames: ['content:create', 'content:edit', 'content:delete'],
},
});
console.log('ロールの権限が更新されました:', role.grants);
} catch (error) {
console.error('ロールの権限の更新中にエラーが発生しました:', error);
}レスポンス
更新された権限のリストを含む ResponseRole オブジェクトを返します。
Response
{
"updatePermissionsForRole": {
"code": "ok",
"role": {
"name": "editor",
"grants": ["content:create", "content:edit", "content:delete"]
}
}
}招待管理
これらのミューテーションは、ユーザーの招待を管理するために使用されます。
createMemberInvitation
新しいメンバーが特定のロールでチームに参加するための招待を作成します。
パラメーター
- input
RequestCreateInvitationInput(required) — teamDid、role、およびその他の招待詳細を含むオブジェクト。 - teamDid
string(required) — チームのDID。 - role
string(required) — 招待されたメンバーに割り当てるロール。 - remark
string— 招待に関する備考またはメモ。
例
createMemberInvitation
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { inviteInfo } = await client.createMemberInvitation({
input: {
teamDid: 'zdfw...',
role: 'guest',
remark: 'Invitation for new team member',
},
});
console.log('招待が作成されました:', inviteInfo.inviteId);
} catch (error) {
console.error('招待の作成中にエラーが発生しました:', error);
}レスポンス
作成された招待に関する詳細を含む ResponseCreateInvitation オブジェクトを返します。
Response
{
"createMemberInvitation": {
"code": "ok",
"inviteInfo": {
"inviteId": "...",
"role": "guest"
}
}
}createTransferInvitation
ノードの所有権を移転するための招待を作成します。
パラメーター
- input
RequestCreateTransferNodeInvitationInput(required) — teamDidとremarkを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - remark
string— 移転招待の備考。
例
createTransferInvitation
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { inviteInfo } = await client.createTransferInvitation({
input: {
teamDid: 'zdfw...',
remark: 'Transferring node ownership',
},
});
console.log('移転招待が作成されました:', inviteInfo.inviteId);
} catch (error) {
console.error('移転招待の作成中にエラーが発生しました:', error);
}レスポンス
招待の詳細を含む ResponseCreateTransferNodeInvitation オブジェクトを返します。
Response
{
"createTransferInvitation": {
"code": "ok",
"inviteInfo": {
"inviteId": "...",
"role": "owner"
}
}
}deleteInvitation
招待を永久に削除します。
パラメーター
- input
RequestDeleteInvitationInput(required) — teamDidと削除するinviteIdを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - inviteId
string(required) — 削除する招待のID。
例
deleteInvitation
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
await client.deleteInvitation({
input: {
teamDid: 'zdfw...',
inviteId: '...',
},
});
console.log('招待が削除されました。');
} catch (error) {
console.error('招待の削除中にエラーが発生しました:', error);
}レスポンス
成功または失敗を示す GeneralResponse オブジェクトを返します。
Response
{
"deleteInvitation": {
"code": "ok"
}
}アクセスキー管理
これらのミューテーションは、プログラムによるアクセスのためのAPIアクセスキーを管理するために使用されます。
createAccessKey
新しいアクセスキーを作成します。
パラメーター
- input
RequestCreateAccessKeyInput(required) — teamDid、remark、およびその他のキー詳細を含むオブジェクト。 - teamDid
string(required) — チームのDID。 - remark
string— キーの目的を識別するための備考。 - authType
string— 認証タイプ(例:'role')。
例
createAccessKey
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { data } = await client.createAccessKey({
input: {
teamDid: 'zdfw...',
remark: 'Key for CI/CD pipeline',
authType: 'role',
},
});
console.log('アクセスキーが作成されました:', data.accessKeyId);
console.log('シークレット:', data.accessKeySecret); // このシークレットを安全に保存してください
} catch (error) {
console.error('アクセスキーの作成中にエラーが発生しました:', error);
}レスポンス
新しいキーのIDとシークレットを含む ResponseCreateAccessKey オブジェクトを返します。シークレットは作成時にのみ返されます。
Response
{
"createAccessKey": {
"code": "ok",
"data": {
"accessKeyId": "...",
"accessKeySecret": "...",
"remark": "Key for CI/CD pipeline"
}
}
}updateAccessKey
既存のアクセスキーの詳細(備考や有効期限など)を更新します。
パラメーター
- input
RequestUpdateAccessKeyInput(required) — teamDid、accessKeyId、および更新するフィールドを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - accessKeyId
string(required) — 更新するアクセスキーのID。 - remark
string— キーの新しい備考。
例
updateAccessKey
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { data } = await client.updateAccessKey({
input: {
teamDid: 'zdfw...',
accessKeyId: '...',
remark: 'Updated remark for CI/CD pipeline',
},
});
console.log('アクセスキーが更新されました:', data.remark);
} catch (error) {
console.error('アクセスキーの更新中にエラーが発生しました:', error);
}レスポンス
更新されたキーの詳細を含む ResponseUpdateAccessKey オブジェクトを返します。
Response
{
"updateAccessKey": {
"code": "ok",
"data": {
"accessKeyId": "...",
"remark": "Updated remark for CI/CD pipeline"
}
}
}deleteAccessKey
アクセスキーを永久に削除します。
パラメーター
- input
RequestDeleteAccessKeyInput(required) — teamDidと削除するaccessKeyIdを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - accessKeyId
string(required) — 削除するアクセスキーのID。
例
deleteAccessKey
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
await client.deleteAccessKey({
input: {
teamDid: 'zdfw...',
accessKeyId: '...',
},
});
console.log('アクセスキーが削除されました。');
} catch (error) {
console.error('アクセスキーの削除中にエラーが発生しました:', error);
}レスポンス
成功または失敗を示す ResponseDeleteAccessKey オブジェクトを返します。
Response
{
"deleteAccessKey": {
"code": "ok"
}
}verifyAccessKey
アクセスキーが有効で、特定のリソースにアクセスできるかどうかを確認します。
パラメーター
- input
RequestVerifyAccessKeyInput(required) — teamDid、accessKeyId、およびリソースの詳細を含むオブジェクト。 - teamDid
string(required) — チームのDID。 - accessKeyId
string(required) — 確認するアクセスキーのID。 - resourceType
string— リソースのタイプ(例:'blocklet')。 - resourceId
string— リソースのID。 - componentDid
string— リソースに関連付けられたコンポーネントのDID。
例
verifyAccessKey
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { data } = await client.verifyAccessKey({
input: {
teamDid: 'zdfw...',
accessKeyId: '...',
},
});
console.log('アクセスキーは有効です:', data);
} catch (error) {
console.error('アクセスキーの確認に失敗しました:', error);
}レスポンス
確認が成功した場合、キーの詳細を含む ResponseAccessKey オブジェクトを返します。
Response
{
"verifyAccessKey": {
"code": "ok",
"data": {
"accessKeyId": "...",
"remark": "Key for CI/CD pipeline"
}
}
}タグ管理
これらのミューテーションは、ユーザータグを管理するために使用されます。
createTag
新しいタグを作成します。
パラメーター
- input
RequestTagInput(required) — teamDidと作成するタグの詳細を含むオブジェクト。 - teamDid
string(required) — チームのDID。 - tag
TagInput(required) — タグの詳細を含むオブジェクト。 - title
string(required) — タグのタイトル。 - description
string— タグの説明。 - color
string— タグの16進数カラーコード。
例
createTag
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { tag } = await client.createTag({
input: {
teamDid: 'zdfw...',
tag: {
title: 'VIP',
description: 'Very Important Person',
color: '#FFD700',
},
},
});
console.log('タグが作成されました:', tag.title);
} catch (error) {
console.error('タグの作成中にエラーが発生しました:', error);
}レスポンス
新しく作成されたタグの詳細を含む ResponseTag オブジェクトを返します。
Response
{
"createTag": {
"code": "ok",
"tag": {
"id": 4,
"title": "VIP",
"color": "#FFD700"
}
}
}updateTag
既存のタグを更新します。
パラメーター
- input
RequestTagInput(required) — teamDidと、idおよび更新するフィールドを含むタグオブジェクトを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - tag
TagInput(required) — タグIDと更新するフィールドを含むオブジェクト。 - id
number(required) — 更新するタグのID。 - title
string— タグの新しいタイトル。 - color
string— タグの新しい色。
例
updateTag
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { tag } = await client.updateTag({
input: {
teamDid: 'zdfw...',
tag: {
id: 4,
color: '#E5C100',
},
},
});
console.log('タグが更新されました:', tag.color);
} catch (error) {
console.error('タグの更新中にエラーが発生しました:', error);
}レスポンス
更新されたタグ情報を含む ResponseTag オブジェクトを返します。
Response
{
"updateTag": {
"code": "ok",
"tag": {
"id": 4,
"title": "VIP",
"color": "#E5C100"
}
}
}deleteTag
タグを永久に削除します。
パラメーター
- input
RequestTagInput(required) — teamDidと削除するタグIDを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - tag
TagInput(required) — 削除するタグのIDを含むオブジェクト。 - id
number(required) — 削除するタグのID。
例
deleteTag
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
await client.deleteTag({
input: {
teamDid: 'zdfw...',
tag: {
id: 4,
},
},
});
console.log('タグが削除されました。');
} catch (error) {
console.error('タグの削除中にエラーが発生しました:', error);
}レスポンス
削除されたタグの ResponseTag オブジェクトを返します。
Response
{
"deleteTag": {
"code": "ok",
"tag": {
"id": 4
}
}
}パスポート管理
これらのミューテーションは、パスポートの発行と信頼設定を管理するために使用されます。
createPassportIssuance
チームの新しいパスポート発行設定を作成します。
パラメーター
- input
RequestCreatePassportIssuanceInput(required) — teamDid、ownerDid、name、および表示詳細を含むオブジェクト。 - teamDid
string(required) — チームのDID。 - ownerDid
string(required) — この発行の所有者のDID。 - name
string(required) — パスポート発行の名前。 - display
PassportDisplayInput— パスポートの表示情報。 - type
string(required) — 表示タイプ。 - content
string(required) — 表示コンテンツ。
例
createPassportIssuance
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
const { info } = await client.createPassportIssuance({
input: {
teamDid: 'zdfw...',
ownerDid: 'z8...',
name: 'Community Contributor',
display: {
type: 'text',
content: 'Community Contributor Badge',
},
},
});
console.log('パスポート発行が作成されました:', info.id);
} catch (error) {
console.error('パスポート発行の作成中にエラーが発生しました:', error);
}レスポンス
新しい発行設定の詳細を含む ResponseCreatePassportIssuance オブジェクトを返します。
Response
{
"createPassportIssuance": {
"code": "ok",
"info": {
"id": "...",
"name": "Community Contributor"
}
}
}deletePassportIssuance
パスポート発行設定を削除します。
パラメーター
- input
RequestDeleteTeamSessionInput(required) — teamDidと削除するsessionId(発行ID)を含むオブジェクト。 - teamDid
string(required) — チームのDID。 - sessionId
string(required) — 削除するパスポート発行のID。
例
deletePassportIssuance
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
await client.deletePassportIssuance({
input: {
teamDid: 'zdfw...',
sessionId: '...',
},
});
console.log('パスポート発行が削除されました。');
} catch (error) {
console.error('パスポート発行の削除中にエラーが発生しました:', error);
}レスポンス
成功または失敗を示す GeneralResponse オブジェクトを返します。
Response
{
"deletePassportIssuance": {
"code": "ok"
}
}configPassportIssuance
チームのパスポート発行を有効または無効にします。
パラメーター
- input
RequestConfigPassportIssuanceInput(required) — teamDidとブール値のenableフラグを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - enable
boolean(required) — 有効にするにはtrue、無効にするにはfalseに設定します。
例
configPassportIssuance
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
await client.configPassportIssuance({
input: {
teamDid: 'zdfw...',
enable: true,
},
});
console.log('パスポート発行が有効になりました。');
} catch (error) {
console.error('パスポート発行の設定中にエラーが発生しました:', error);
}レスポンス
成功または失敗を示す GeneralResponse オブジェクトを返します。
Response
{
"configPassportIssuance": {
"code": "ok"
}
}configTrustedPassports
信頼できるパスポート発行者とそのロールマッピングのリストを設定します。
パラメーター
- input
RequestConfigTrustedPassportsInput(required) — teamDidと信頼できるパスポートのリストを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - trustedPassports
TrustedPassportInput[](required) — 信頼できるパスポート設定の配列。 - issuerDid
string(required) — 信頼できる発行者のDID。 - mappings
TrustedPassportMappingInput[](required) — ロールマッピングのルール。 - from
TrustedPassportMappingFromInput(required) — ソースパスポートの詳細。 - passport
string(required) — ソースパスポートの名前またはタイプ。 - to
TrustedPassportMappingToInput(required) — ターゲットロールの詳細。 - role
string(required) — マッピング先のローカルロール。
例
configTrustedPassports
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
await client.configTrustedPassports({
input: {
teamDid: 'zdfw...',
trustedPassports: [
{
issuerDid: 'z...', // 別の信頼できるblockletのDID
mappings: [
{
from: { passport: 'developer_badge' },
to: { role: 'developer' },
},
],
},
],
},
});
console.log('信頼できるパスポートが設定されました。');
} catch (error) {
console.error('信頼できるパスポートの設定中にエラーが発生しました:', error);
}レスポンス
成功または失敗を示す GeneralResponse オブジェクトを返します。
Response
{
"configTrustedPassports": {
"code": "ok"
}
}configTrustedFactories
信頼できるNFTファクトリーのリストを設定します。
パラメーター
- input
RequestConfigTrustedFactoriesInput(required) — teamDidと信頼できるファクトリーのリストを含むオブジェクト。 - teamDid
string(required) — チームのDID。 - trustedFactories
TrustedFactoryInput[](required) — 信頼できるファクトリー設定の配列。 - factoryAddress
string(required) — NFTファクトリーのアドレス。 - remark
string— ファクトリーの備考。
例
configTrustedFactories
import BlockletServerClient from '@blocklet/server-js';
const client = new BlockletServerClient();
try {
await client.configTrustedFactories({
input: {
teamDid: 'zdfw...',
trustedFactories: [
{
factoryAddress: '0x...',
remark: 'Official Community NFT Factory',
},
],
},
});
console.log('信頼できるファクトリーが設定されました。');
} catch (error) {
console.error('信頼できるファクトリーの設定中にエラーが発生しました:', error);
}レスポンス
成功または失敗を示す GeneralResponse オブジェクトを返します。
Response
{
"configTrustedFactories": {
"code": "ok"
}
}