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

GetPreviewObjectCommand


API Documentation#

GetPreviewObjectCommand interface is designed to retrieve detailed information about a preview object. By providing a key for a specified path, this interface returns the corresponding preview template data.

Parameter Type#

Parameter Name

Parameter Type

Essential

Default Value

Parameter Description

key

string

Y

None

The folder path must begin with

 / 

Conclusion

Return Type#

The return type is CommandOutput<PreviewTemplate>, encompassing detailed information about the preview template object.

Field Name

Field Type

Essential

statusCode

number

Y

statusMessage

string

N

data

PreviewTemplate

Y

Code Example#

The following is a sample code using GetPreviewObjectCommand that demonstrates how to invoke this interface to acquire a preview object and manage the returned result.

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);
}

In this example, the function readPreviewObject utilizes GetPreviewObjectCommand to obtain a preview object from the specified path (/test-nft/), checks the response status code, and takes appropriate action based on the outcome.

你获得 0 积分