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.
- Source
Methods
(static) updateAccount(accountId, data, options)
Updates an account in Current Finances with new data.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
accountId | string | The ID of the account to be updated. | ||||||
data | Object | The new data for the account. | ||||||
options | Object | Options for the update.Properties
|
- Source
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:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
options | Object | Options for the export.Properties
|
- Source
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:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
newState | Object | The new Current Finances state. | ||||||
options | Object | Options for the update.Properties
|
- Source
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:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
newPlans | Object | The new plans data. | ||||||
options | Object | Options for the update.Properties
|
- Source
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:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
newProgress | Object | The new progress data. | ||||||
options | Object | Options for the update.Properties
|
- Source
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:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
newSettings | Object | The new settings data. | ||||||
options | Object | Options for the update.Properties
|
- Source
Throws:
- If the API key is invalid or missing, or if 'newSettings' is incorrect.
- Type
- Error
Example
window.projectionlabPluginAPI.restoreSettings({ ... }, { key: 'api-key' })