Welcome
User Guide
Developer guide
Reference Guide
Frequently Asked Questions
Pricing policy
Data retention policy
Draft: Default Space How to upgrade by payment?
How to re-subscribe to an expired DID Space
Connecting to the DID Space using the Gateway Address
Switch the DID Space bound to NFT Blender.
The automatic backup of Blocklet is stuck, how can it be quickly restored?
Fix CORS error when connecting DID Space
Change log
Draft: Purchase DID Space
DID Spaces v0.6.0: OAuth Integration in DID Spaces
DID Spaces v0.5.83: OAuth integrated DID Space
Prod Spaces data retention policy updated
DID Spaces v0.4.26 released: subscription fully adopts pay-as-you-go & supports paid upgrade Default Space
DID Spaces v0.3.75 released: Supports reading and writing component spaces
DID Spaces v1.0.48: 支持预览 post/bookmark/blog/doc
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.