Bundle Notifications

A BundleNotification is an E-Mail sent out to users when certain actions are performed on or within a shared set of files and folders.

SDK Method

BundleNotification.list()

Return Object

BundleNotification[]

Authorization Requirement

Available to all authenticated keys or sessions.

Method Arguments

ArgumentDescription
user_id
int64
User ID. Provide a value of 0 to operate the current session's user.
bundle_id
int64
Bundle ID

Additional Arguments

Example Request

import BundleNotification from 'files.com/lib/models/BundleNotification';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  const bundleNotifications = await BundleNotification.list({
    user_id: 1,
  });
  for (const bundleNotification of bundleNotifications) {
    // Operate on bundleNotification
  }
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

SDK Method

BundleNotification.find()

Return Object

BundleNotification

Authorization Requirement

Available to all authenticated keys or sessions.

Method Arguments

ArgumentDescription
id
int64
Required
Bundle Notification ID.

Example Request

import BundleNotification from 'files.com/lib/models/BundleNotification';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  const bundleNotification = await BundleNotification.find(id);
  // Operate on bundleNotification
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

SDK Method

BundleNotification.create()

Return Object

BundleNotification

Authorization Requirement

Available to all authenticated keys or sessions.

Method Arguments

ArgumentDefaultDescription
user_id
int64
User ID. Provide a value of 0 to operate the current session's user.
bundle_id
int64
Required
Bundle ID to notify on
notify_user_id
int64
The id of the user to notify.
notify_on_registration
boolean
falseTriggers bundle notification when a registration action occurs for it.
notify_on_upload
boolean
falseTriggers bundle notification when a upload action occurs for it.

Example Request

import BundleNotification from 'files.com/lib/models/BundleNotification';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  const bundleNotification = await BundleNotification.create({
    bundle_id: 1,
  });
  // Operate on bundleNotification
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

SDK Method

bundleNotification.update()

Return Object

BundleNotification

Authorization Requirement

Available to all authenticated keys or sessions.

Method Arguments

ArgumentDescription
notify_on_registration
boolean
Triggers bundle notification when a registration action occurs for it.
notify_on_upload
boolean
Triggers bundle notification when a upload action occurs for it.

Example Request

import BundleNotification from 'files.com/lib/models/BundleNotification';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  // Find the bundleNotification object by its id.
  const bundleNotification = await BundleNotification.find(id);
  await bundleNotification.update({
    notify_on_registration: true,
  });
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

SDK Method

bundleNotification.delete()

Return Object

No return value.

Authorization Requirement

Available to all authenticated keys or sessions.

Example Request

import BundleNotification from 'files.com/lib/models/BundleNotification';
import * as FilesErrors from 'files.com/lib/Errors';

try {
  // Find the bundleNotification object by its id.
  const bundleNotification = await BundleNotification.find(id);
  await bundleNotification.delete();
} catch (err) {
  if (err instanceof FilesErrors.NotAuthenticatedError) {
    console.error(`Authentication Error Occurred (${err.constructor.name}): ${err.error}`);
  } else if (err instanceof FilesErrors.FilesError) {
    console.error(`Unknown Error Occurred (${err.constructor.name}): ${err.error}`);
  } else {
    throw err;
  }
}

The BundleNotification Object

Some of the methods above return a BundleNotification object. The attributes of this object are listed below.

AttributeDescription
bundle_id
int64
Bundle ID to notify on
id
int64
Bundle Notification ID
notify_on_registration
boolean
Triggers bundle notification when a registration action occurs for it.
notify_on_upload
boolean
Triggers bundle notification when a upload action occurs for it.
notify_current_user
boolean
Is the current user the user to notify?
notify_user_id
int64
The id of the user to notify.
workspace_id
int64
Workspace ID. 0 means the default workspace.