Cloud
Trash

Cloud Trash

Cloud Trash is a service that allows you to recover files and folders that have been deleted from your cloud.

By default the node is removed from the trash after 30 days. You can change this time with this function app.updateSettings().


Get the client

import { getSecrecyClient } from '@secrecy/lib';
 
// Get the client
const client = getSecrecyClient('prod');

deletedNodes()

Get the list of nodes that are in the trash.

const response = await client.cloud.deletedNodes();
 
if (!response) {
  throw new Error(`Error`);
}
 
switch (response.__typename) {
  case 'ErrorAccessDenied':
    throw new Error(`Access Denied`);
  case 'SuccessResponse': {
    const nodes = response.data;
    // Do something with the deleted nodes
  }
}

deleteNodeCloudTrash()

Delete a nodes from the cloud trash.

const response = await client.cloud.deleteNodeCloudTrash({
  ids: ['NODE_ID_1', 'NODE_ID_2'],
});
 
if (!response) {
  throw new Error(`Error`);
}
 
switch (response.__typename) {
  case 'ErrorAccessDenied':
    throw new Error(`Access Denied`);
  case 'SuccessResponse': {
    const boolean = response.data;
    // Do something with the boolean
  }
}

emptyTrash()

Definitively delete all the trash.

const response = await client.mail.emptyTrash();
 
if (!response) {
  throw new Error(`Error`);
}
 
switch (response.__typename) {
  case 'ErrorAccessDenied':
    throw new Error(`Access Denied`);
  case 'SuccessResponse': {
    const boolean = response.data;
    // Do something with the boolean
  }
}

recoverNode()

Recover a node from the trash.

const response = await client.cloud.recoverNode('NODE_ID');
 
if (!response) {
  throw new Error(`Error`);
}
 
switch (response.__typename) {
  case 'ErrorAccessDenied':
    throw new Error(`Access Denied`);
  case 'SuccessResponse': {
    const boolean = response.data;
    // Do something with the boolean
  }
}