import React from 'react'; export let types = { id: { name: 'id', type: 'string', description: ( UUID ), }, month: { name: 'month', type: 'string', description: YYYY-MM, }, date: { name: 'date', type: 'string', description: YYYY-MM-DD, }, amount: { name: 'amount', type: 'integer', description: ( A currency amount is an integer representing the value without any decimal places. Usually it{"'"}s value * 100, but it depends on your currency. For example, a USD amount of{' '} $120.30 would be 12030. ), }, }; export let objects = { transaction: [ { name: 'id', type: types.id, }, { name: 'account', type: types.id, required: true }, { name: 'date', type: 'date', required: true }, { name: 'amount', type: types.amount }, { name: 'payee', type: types.id, description: ( In a create request, this overrides{' '} payee_name. ), }, { name: 'payee_name', type: 'string', description: (
If given, a payee will be created with this name. If this matches an already existing payee, it will use it.
* Only available in a create request
), }, { name: 'imported_payee', type: 'string', description: 'This can be anything. Meant to represent the raw description when importing, allowing the user to see the original value.', }, { name: 'category', type: types.id }, { name: 'notes', type: 'string' }, { name: 'imported_id', type: 'string', description: 'A unique id usually given by the bank, if importing. Use this is avoid duplicate transactions.', }, { name: 'transfer_id', type: 'string', description: ( If a transfer, the id of the transaction in the other account for the transfer. See transfers. ), }, { name: 'cleared', type: 'boolean', description: ( A flag indicating if the transaction has cleared or not. ), }, { name: 'subtransactions', type: 'Transaction[]', description: (
An array of subtransactions for a split transaction. See{' '} split transactions.
* Only available in a get or{' '} create request
), }, ], account: [ { name: 'id', type: types.id }, { name: 'name', type: 'string', required: true }, { name: 'type', type: 'string', required: true, description: 'Must be a valid type. See notes below.', }, { name: 'offbudget', type: 'bool', description: ( Defaults to false ), }, { name: 'closed', type: 'bool', description: ( Defaults to false ), }, ], category: [ { name: 'id', type: types.id }, { name: 'name', type: 'string', required: true }, { name: 'group_id', type: types.id, required: true }, { name: 'is_income', type: 'bool', description: ( Defaults to false ), }, ], categoryGroup: [ { name: 'id', type: types.id }, { name: 'name', type: 'string', required: true }, { name: 'is_income', type: 'bool', description: ( Defaults to false ), }, { name: 'categories', type: 'Category[]', description: (
An array of categories in this group. Not valid when creating or updating a category group
Only available in a get.
), }, ], payee: [ { name: 'id', type: types.id }, { name: 'name', type: 'string', required: true }, { name: 'category', type: types.id }, { name: 'transfer_acct', type: types.id, description: ( The id of the account this payee transfers to/from, if this is a transfer payee. ), }, ], payeeRule: [ { name: 'id', type: types.id }, { name: 'payee_id', type: types.id, required: true }, { name: 'type', type: 'string', required: true, description: ( Must be one of equals or contains ), }, { name: 'value', type: 'string', description: 'Value to match imported payee names on', }, ], }; function Table({ style, headers, className, children }) { return ( {headers.map(header => ( ))} {children}
{header}
); } export function PrimitiveTypeList() { return ( {Object.keys(types).map(name => { return ( ); })}
); } export function PrimitiveType({ name, type, description }) { return ( {name} {type} {description} ); } export function StructType({ name, fields }) { return (
{fields.map(field => { return ( ); })}
{field.name} {typeof field.type === 'string' ? field.type : field.type.name} {field.required ? 'yes' : 'no'} {field.description}
); } function Argument({ arg }) { if (arg.properties) { return ( {arg.name ? arg.name + ': ' : ''} {'{ '} {arg.properties.map(prop => ).map(insertCommas)} {' }'} ); } return ( {arg.type} {arg.name} ); } function insertCommas(element, i, arr) { if (i === arr.length - 1) { return element; } return [element, ', ']; } export function Method({ name, args, returns = 'Promise', children }) { return (

{name}({args.map(arg => ).map(insertCommas)}){' '} → {returns}
{children && React.cloneElement(children, {})}

); } export function MethodBox({ children }) { return
{children}
; }