Skip to content

A local-first personal finance app

Add API docs for getLocalbudgets() and getRemoteBudgets(). (#377)

Robert Dyeraef82dee24d7
diff --git a/docs/api/reference.md b/docs/api/reference.md
index 3e0d421a51..3484cd962a 100644
--- a/docs/api/reference.md
+++ b/docs/api/reference.md
@@ -69,12 +69,14 @@ This is the documentation of all available API methods. The API has not been rel
]} />
<APIList title="Misc" sections={[
+"BudgetFile",
"initConfig",
"init",
"shutdown",
"sync",
"runBankSync",
"runImport",
+"getBudgets",
"loadBudget",
"downloadBudget",
"batchBudgetUpdates",
@@ -522,6 +524,10 @@ Delete a rule.
## Misc
+#### BudgetFile
+
+<StructType fields={objects.budgetFile} />
+
#### InitConfig
<StructType fields={objects.initConfig} />
@@ -558,6 +564,12 @@ Run the 3rd party (gocardless, simplefin) bank sync operation. This will downloa
Creates a new budget file with the given name, and then runs the custom importer function to populate it with data.
+#### `getBudgets`
+
+<Method name="getBudgets" args={[]} returns="Promise<BudgetFile[]>" />
+
+Returns a list of all budget files either locally cached or on the remote server. Remote files have a `state` field and local files have an `id` field.
+
#### `loadBudget`
<Method name="loadBudget" args={[{ properties: [{ name: 'syncId', type: 'string' }] }]} returns="Promise<void>" />
diff --git a/docs/api/types.js b/docs/api/types.js
index b94182ff2b..722d5c1124 100644
--- a/docs/api/types.js
+++ b/docs/api/types.js
@@ -288,6 +288,76 @@ export let objects = {
{ name: 'conditions', type: 'ConditionOrAction[]' },
{ name: 'actions', type: 'ConditionOrAction[]' },
],
+
+ budgetFile: [
+ {
+ name: 'name',
+ type: 'string',
+ required: true,
+ description: (
+ <span>
+ The budget's name.
+ </span>
+ ),
+ },
+ {
+ name: 'cloudFileId',
+ type: 'string',
+ required: true,
+ description: (
+ <span>
+ The id for the budget on the server. This is usually a UUID.
+ </span>
+ ),
+ },
+ {
+ name: 'groupId',
+ type: 'string',
+ required: true,
+ description: (
+ <span>
+ The group id for the budget.
+ </span>
+ ),
+ },
+ {
+ name: 'hasKey',
+ type: 'boolean',
+ required: true,
+ description: (
+ <span>
+ If the file has an encryption key.
+ </span>
+ ),
+ },
+ {
+ name: 'encryptKeyId',
+ type: 'string',
+ description: (
+ <span>
+ The encryption key ID for the file, if it is encrypted.
+ </span>
+ ),
+ },
+ {
+ name: 'state',
+ type: 'string',
+ description: (
+ <span>
+ Remote files have this set to "remote".
+ </span>
+ ),
+ },
+ {
+ name: 'id',
+ type: 'string',
+ description: (
+ <span>
+ The local budget file's local ID.
+ </span>
+ ),
+ },
+ ],
};
function Table({ style, headers, className, children }) {