box-node-sdk

FileClassificationsManager

Get classification on file

Retrieves the classification metadata instance that has been applied to a file.

This API can also be called by including the enterprise ID in the URL explicitly, for example /files/:id//enterprise_12345/securityClassification-6VMVochwUWo.

This operation is performed by calling function getClassificationOnFile.

See the endpoint docs at API Reference.

await client.fileClassifications.getClassificationOnFile(file.id);

Arguments

Returns

This function returns a value of type Classification.

Returns an instance of the securityClassification metadata template, which contains a Box__Security__Classification__Key field that lists all the classifications available to this enterprise.

Add classification to file

Adds a classification to a file by specifying the label of the classification to add.

This API can also be called by including the enterprise ID in the URL explicitly, for example /files/:id//enterprise_12345/securityClassification-6VMVochwUWo.

This operation is performed by calling function addClassificationToFile.

See the endpoint docs at API Reference.

await client.fileClassifications.addClassificationToFile(file.id, {
  requestBody: {
    boxSecurityClassificationKey: classification.key,
  } satisfies AddClassificationToFileRequestBody,
} satisfies AddClassificationToFileOptionalsInput);

Arguments

Returns

This function returns a value of type Classification.

Returns the classification template instance that was applied to the file.

Update classification on file

Updates a classification on a file.

The classification can only be updated if a classification has already been applied to the file before. When editing classifications, only values are defined for the enterprise will be accepted.

This operation is performed by calling function updateClassificationOnFile.

See the endpoint docs at API Reference.

await client.fileClassifications.updateClassificationOnFile(file.id, [
  new UpdateClassificationOnFileRequestBody({
    value: secondClassification.key,
  }),
]);

Arguments

Returns

This function returns a value of type Classification.

Returns the updated classification metadata template instance.

Remove classification from file

Removes any classifications from a file.

This API can also be called by including the enterprise ID in the URL explicitly, for example /files/:id//enterprise_12345/securityClassification-6VMVochwUWo.

This operation is performed by calling function deleteClassificationFromFile.

See the endpoint docs at API Reference.

await client.fileClassifications.deleteClassificationFromFile(file.id);

Arguments

Returns

This function returns a value of type undefined.

Returns an empty response when the classification is successfully deleted.