Class: ObjectNotification

ObjectNotification()

Model for loading and saving notification subscriptions for a single DataONE object identifier.

Constructor

new ObjectNotification()

Since:
  • 2.37.0
Source:

Extends

  • Backbone.Model

Methods

asString(value) → {string}

Convert any value to a string.
Parameters:
Name Type Description
value * Value to convert.
Source:
Returns:
String value.
Type
string

defaults() → {object}

Default model attributes.
Source:
Returns:
Model defaults.
Type
object

ensureClient() → {Promise.<object>}

Ensure a NotificationClient instance is available.
Source:
Returns:
NotificationClient instance.
Type
Promise.<object>

filterSupportedResourceTypes(resourceTypes) → {Array.<string>}

Filter resource type names to supported values in configured order.
Parameters:
Name Type Description
resourceTypes Array.<string> Resource type names.
Source:
Returns:
Supported resource type names.
Type
Array.<string>

getAccountSettingsUrl() → {string}

Get the user's account settings URL.
Source:
Returns:
Account settings URL.
Type
string

getApiVersion() → {string|false|undefined}

Retrieve the Notification Service API version.
Source:
Returns:
Configured API version.
Type
string | false | undefined

getAppModel() → {Backbone.Model}

Get the configured AppModel.
Source:
Returns:
App model.
Type
Backbone.Model

getDatasetTitle() → {string}

Get a dataset title from attributes, model, or PID.
Source:
Returns:
Dataset title.
Type
string

getEmailAddress() → {string}

Get the email address the notification service will use.
Source:
Returns:
Email address.
Type
string

getPrefixUrl() → {string|null}

Retrieve the Notification Service base URL.
Source:
Returns:
URL or null.
Type
string | null

getResourceTypeNames() → {Array.<string>}

Get configured resource type names.
Source:
Returns:
Resource type names.
Type
Array.<string>

getResourceTypes() → {Array.<{type: string, label: string, description: string}>}

Retrieve configured resource types.
Source:
Returns:
Resource type display options.
Type
Array.<{type: string, label: string, description: string}>

getSetupError() → {string|null}

Return a setup error code that blocks loading or saving.
Source:
Returns:
Error code or null.
Type
string | null

getSubscriptionChanges(selectedResourceTypes) → {Object}

Diff selected types against the last saved types.
Parameters:
Name Type Description
selectedResourceTypes Array.<string> Current selected resource types.
Source:
Returns:
Resource type changes.
Type
Object

getUserModel() → {Backbone.Model}

Get the configured user model.
Source:
Returns:
User model.
Type
Backbone.Model

initialize(_attrsopt, optionsopt)

Parameters:
Name Type Attributes Description
_attrs object <optional>
Initial model attributes.
options object <optional>
Model options.
Properties
Name Type Attributes Description
appModel Backbone.Model <optional>
App model override.
userModel Backbone.Model <optional>
User model override.
NotificationClient function <optional>
NotificationClient constructor override.
Source:

loadSubscriptions() → {Promise.<Array.<string>>}

Fetch the current subscriptions for this PID.
Source:
Returns:
Saved resource type names.
Type
Promise.<Array.<string>>

refreshResourceTypes() → {Array.<{type: string, label: string, description: string}>}

Retrieve and store configured resource types.
Source:
Returns:
Resource type display options.
Type
Array.<{type: string, label: string, description: string}>

resetClient()

Reset the cached NotificationClient and loaded state
Source:

saveSubscriptions(selectedResourceTypes) → {Promise.<{changed: boolean, resourceTypes: Array.<string>, stale: (boolean|undefined)}>}

Save selected resource types by subscribing and unsubscribing as needed.
Parameters:
Name Type Description
selectedResourceTypes Array.<string> Selected resource type names.
Source:
Returns:
Save result.
Type
Promise.<{changed: boolean, resourceTypes: Array.<string>, stale: (boolean|undefined)}>

setSavedResourceTypes(resourceTypes) → {Array.<string>}

Set the last saved subscription state.
Parameters:
Name Type Description
resourceTypes Array.<string> Resource type names returned by the service.
Source:
Returns:
Supported saved resource type names.
Type
Array.<string>

validatePid(pid) → {boolean}

Validate that a PID has been provided.
Parameters:
Name Type Description
pid string PID to validate.
Source:
Returns:
True when the PID is non-empty.
Type
boolean