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

DeletePreviewObjectCommand


Interface Description#

DeletePreviewObjectCommand The interface is designed to delete a preview object located at a specified path. This command utilizes the given path to identify and remove the targeted object.

Parameter Type#

#

The parameter type is DeletePreviewObjectCommandInput. Below are the details:

Name

Type

Essential

Default Value

Instructions

key

string

Y

None

The folder path must begin with

 / 

Conclusion

Return Type#

The return type is DeletePreviewObjectCommandOutput, and it is described as follows:

Field Name

Type

Essential

Instructions

statusCode

number

Y

HTTP Status Codes

statusMessage

string

N

Status Message

Code Example#

#

The following code example demonstrates how to use the DeletePreviewObjectCommand interface to delete a preview object:

async function deletePreviewObject(req, res) {
const { spaceEndpoint } = await spacesEndpointRepository.readUser(req.user.did);

const spaceClient = new SpaceClient({
endpoint: spaceEndpoint,
wallet,
});

const output = await spaceClient.send(
new DeletePreviewObjectCommand({
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 deletePreviewObject takes in the request and response objects, uses the spaceEndpoint obtained from the repository to create a space client, spaceClient, and then issues a DeletePreviewObjectCommand command to remove the preview object at the specified path. If the deletion operation fails, it logs the error and returns the appropriate status code and message in the response.

你获得 0 积分