forio Toggle navigation

Thin wrapper around Data API for managing settings. Meant to be used in conjunction with the Settings Manager.

Constructor options

Required? Name Type Description
Yes opts.run AccountAPIServiceOptions Parameters passed on to run service
  opts.settings object
  opts.settings.collection string
  opts.settings.collection `object / function(): object function(): Promise.`

Methods

getDefaults()

Evaluates and returns default settings.

Parameters

None

getAll([options])

Parameters

Required? Name Type Description
  options {"excludeDrafts":["boolean"]}

getCurrentActive()

Returns currently active settings, or undefined if there are none.

Parameters

None

getMostRecent()

Returns most recent settings; creates a new draft if none exist. Use to show current state on settings screen.

Parameters

None

createDraft(options)

Creates new draft settings. Usually used when there's already 'active' settings, and you want to start with a new set without affecting existing runs.

Parameters

Required? Name Type Description
Yes options {"useDefaults":["boolean"]} If useDefaults is set, a draft is created with the default settings, else it clones the last available settings (either draft or active)

resetDraft()

Resets draft to defaults. If you need to reset to previous settings, use createDraft instead.

Parameters

None

updateDraft(settings)

Updates current draft with provided settings. Creates draft if none exist.

Parameters

Required? Name Type Description
Yes settings Object

updateActive(newSettings)

Updates current active settings.

Parameters

Required? Name Type Description
Yes newSettings Object

saveAndActivate(settings)

Activates the current settings, and makes it so it can no longer be modified; this will be applied to new runs (if you use the settings strategy)

Parameters

Required? Name Type Description
Yes settings Object