Welcome to the ProjectionLab Plugin API docs. After you enable support for plugins within your ProjectionLab Account Settings page, you can access the community plugin methods documented below in your browser via window.projectionlabPluginAPI.

Methods

(static) updateAccount(accountId, data, options)

Updates an account in Current Finances with new data.
Parameters:
NameTypeDescription
accountIdstringThe ID of the account to be updated.
dataObjectThe new data for the account.
optionsObjectOptions for the update.
Properties
NameTypeDescription
keystringYour Plugin API Key from Account Settings. * @param {string} options.force - Allow assignment of new properties to account objects.
Throws:
If the API key is invalid or missing, or if parameters are incorrect.
Type
Error
Example
window.projectionlabPluginAPI.updateAccount('12345', { balance: 1000 }, { key: 'api-key' })

(async, static) exportData(options) → {Promise.<Object>}

Exports all data based on the current state.
Parameters:
NameTypeDescription
optionsObjectOptions for the export.
Properties
NameTypeDescription
keystringYour Plugin API Key from Account Settings.
Throws:
If the API key is invalid or missing.
Type
Error
Returns:
A promise that resolves with the exported data.
Type: 
Promise.<Object>
Example
window.projectionlabPluginAPI.exportData({ key: 'api-key' })
  .then(data => log.info(data))

(static) restoreCurrentFinances(newState, options)

Replaces the Current Finances state with new data. Be careful: this allows you to overwrite important data structures, and it is your responsibility to ensure the data you pass is well-formed.
Parameters:
NameTypeDescription
newStateObjectThe new Current Finances state.
optionsObjectOptions for the update.
Properties
NameTypeDescription
keystringYour Plugin API Key from Account Settings.
Throws:
If the API key is invalid or missing, or if 'newToday' is incorrect.
Type
Error
Example
window.projectionlabPluginAPI.restoreCurrentFinances({ ... }, { key: 'api-key' })

(static) restorePlans(newPlans, options)

Replaces all Plans with a new set of plans. Be careful: this allows you to overwrite important data structures, and it is your responsibility to ensure the data you pass is well-formed.
Parameters:
NameTypeDescription
newPlansObjectThe new plans data.
optionsObjectOptions for the update.
Properties
NameTypeDescription
keystringYour Plugin API Key from Account Settings.
Throws:
If the API key is invalid or missing, or if 'newPlans' is incorrect.
Type
Error
Example
window.projectionlabPluginAPI.restorePlans([{ name: 'Example Plan', ... }], { key: 'api-key' })

(static) restoreProgress(newProgress, options)

Replaces the Progress state with new data. Be careful: this allows you to overwrite important data structures, and it is your responsibility to ensure the data you pass is well-formed.
Parameters:
NameTypeDescription
newProgressObjectThe new progress data.
optionsObjectOptions for the update.
Properties
NameTypeDescription
keystringYour Plugin API Key from Account Settings.
Throws:
If the API key is invalid or missing, or if 'newProgress' is incorrect.
Type
Error
Example
window.projectionlabPluginAPI.restoreProgress({ data: [...] }, { key: 'api-key' })

(static) restoreSettings(newSettings, options)

Replaces Settings state with new data. Be careful: this allows you to overwrite important data structures, and it is your responsibility to ensure the data you pass is well-formed.
Parameters:
NameTypeDescription
newSettingsObjectThe new settings data.
optionsObjectOptions for the update.
Properties
NameTypeDescription
keystringYour Plugin API Key from Account Settings.
Throws:
If the API key is invalid or missing, or if 'newSettings' is incorrect.
Type
Error
Example
window.projectionlabPluginAPI.restoreSettings({ ... }, { key: 'api-key' })