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

GetPreviewObjectCommand


接口说明#

GetPreviewObjectCommand 接口用于获取预览对象的具体信息。通过提供指定路径的 key,该接口将返回与之对应的预览模板数据。

参数类型#

参数名称

参数类型

必要

默认值

参数说明

key

string

Y

文件夹的路径,必须以

 / 

结尾

返回类型#

返回类型为 CommandOutput<PreviewTemplate>,其中包含预览模板对象的详细信息。

字段名称

字段类型

必要

statusCode

number

Y

statusMessage

string

N

data

PreviewTemplate

Y

代码示例#

以下是一个使用 GetPreviewObjectCommand 的示例代码,展示如何调用此接口来获取预览对象并处理返回结果。

async function readPreviewObject(req, res) {
const { spaceEndpoint } = await spacesEndpointRepository.readUser(req.user.did);
const spaceClient = new SpaceClient({
endpoint: spaceEndpoint,
wallet,
});

const output = await spaceClient.send(
new GetPreviewObjectCommand({
key: '/test-nft/',
})
);
if (output.statusCode !== 200) {
logger.error(output);
return res.status(output.statusCode).send(output.statusMessage);
}

return res.send(output);
}

在这个示例中,函数 readPreviewObject 使用 GetPreviewObjectCommand 从给定路径 (/test-nft/) 获取预览对象,验证响应状态码,并根据结果进行相应的响应。

你获得 0 积分