Bkper

This is the main Entry Point of the bkper-node library.

getBook(id:

string

):

Promise

Gets the Book with the specified bookId from url param.

Returns The retrieved Book, for chaining

Parameters:
Name
Description
id

The universal book id - The same bookId param of URL you access at app.bkper.com

getUser():

Promise

Gets the current logged User.

Returns The retrieved User, for chaining

setApiKey(key:

string

):

App

Sets the API key to identify the agent.

Returns The defined App object

deprecated Use setConfig() instead

Parameters:
Name
Description
key

The API key

setConfig(config:

Config

):

void

Sets the API Config object.

Parameters:
Name
Description
config

The Config object

setOAuthTokenProvider(oauthTokenProvider:):

Promise

Sets the provider of the valid OAuth2 access token

deprecated Use setConfig() instead

Account

This class defines an Account of a Book.

It mantains a balance of all amount credited and debited in it by Transactions.

An Account can be grouped by Groups.

addGroup(group:

Group

|

bkper.Group

):

Account

Add a group to the Account.

Returns This Account, for chainning.

create():

Promise

Perform create new account.

deleteProperty(key:

string

):

Account

Delete a custom property

Returns This Account, for chainning.

Parameters:
Name
Description
key

The property key

getBalance():

Amount

Gets the balance based on credit nature of this Account.

Returns The balance of this account.

deprecated Use Book.getBalancesReport instead.

getBalanceRaw():

Amount

Gets the raw balance, no matter credit nature of this Account.

Returns The balance of this account.

deprecated Use Book.getBalancesReport instead.

getGroups():

Promise

Get the Groups of this account.

getId():

string

Gets the account internal id.

getName():

string

Gets the account name.

getNormalizedName():

string

Returns The name of this account without spaces or special characters.

getProperties(): any

Gets the custom properties stored in this Account.

getProperty(keys:

string

[]):

string

Gets the property value for given keys. First property found will be retrieved

Parameters:
Name
Description
keys

The property key

getType():

AccountType

Returns The type for of this account.

hasTransactionPosted():

boolean

Tell if the Account has any transaction already posted.

Accounts with transaction posted, even with zero balance, can only be archived.

isArchived():

boolean

Tell if this account is archived.

isCredit():

boolean

Tell if the account has a Credit nature or Debit otherwise

Credit accounts are just for representation purposes. It increase or decrease the absolute balance. It doesn’t affect the overall balance or the behavior of the system.

The absolute balance of credit accounts increase when it participate as a credit/origin in a transaction. Its usually for Accounts that increase the balance of the assets, like revenue accounts.

        Crediting a credit
  Thus ---------------------> account increases its absolute balance
        Debiting a debit


        Debiting a credit
  Thus ---------------------> account decreases its absolute balance
        Crediting a debit

As a rule of thumb, and for simple understanding, almost all accounts are Debit nature (NOT credit), except the ones that “offers” amount for the books, like revenue accounts.

isInGroup(group:

string

|

Group

):

Promise

Tell if this account is in the Group

Parameters:
Name
Description
group

The Group name, id or object

isPermanent():

boolean

Tell if the account is permanent.

Permanent Accounts are the ones which final balance is relevant and keep its balances over time.

They are also called Real Accounts

Usually represents assets or tangibles, capable of being perceived by the senses or the mind, like bank accounts, money, debts and so on.

Returns True if its a permanent Account

json():

bkper.Account

Returns The wrapped plain json object

remove():

Promise

Perform delete account.

removeGroup(group:

string

|

Group

):

Promise

Remove a group from the Account.

setArchived(archived:

boolean

):

Account

Set account archived/unarchived.

Returns This Account, for chainning.

setGroups(groups:

Group

[] |

bkper.Group

[]):

Account

Sets the groups of the Account.

Returns This Account, for chainning.

setName(name:

string

):

Account

Sets the name of the Account.

Returns This Account, for chainning.

setProperties(properties: any):

Account

Sets the custom properties of the Account

Returns This Account, for chainning.

Parameters:
Name
Description
properties

Object with key/value pair properties

setProperty(key:

string

, value:

string

):

Account

Sets a custom property in the Account.

Returns This Account, for chainning.

Parameters:
Name
Description
key

The property key

value

The property value

setType(type:

AccountType

):

Account

Sets the type of the Account.

Returns This Account, for chainning

update():

Promise

Perform update account, applying pending changes.

Amount

This class defines an Amount for arbitrary-precision decimal arithmetic.

It inherits methods from big.js library

abs():

Amount

Returns an absolute Amount.

cmp(n:

number

|

string

|

Amount

):

-1

|

0

|

1

Compare

div(n:

number

|

string

|

Amount

):

Amount

Divide by

eq(n:

number

|

string

|

Amount

):

boolean

Equals to

gt(n:

number

|

string

|

Amount

):

boolean

Greater than

gte(n:

number

|

string

|

Amount

):

boolean

Greater than or equal

lt(n:

number

|

string

|

Amount

):

boolean

Less than

lte(n:

number

|

string

|

Amount

):

boolean

Less than or equal to

minus(n:

number

|

string

|

Amount

):

Amount

Minus

mod(n:

number

|

string

|

Amount

):

Amount

Modulo - the integer remainder of dividing this Amount by n.

Similar to % operator

plus(n:

number

|

string

|

Amount

):

Amount

Sum

round(dp?:

number

):

Amount

Round to a maximum of dp decimal places.

times(n:

number

|

string

|

Amount

):

Amount

Multiply

toFixed(dp?:

number

):

string

Returns a string representing the value of this Amount in normal notation to a fixed number of decimal places dp.

toNumber():

number

Returns a primitive number representing the value of this Amount.

toString():

string

Returns a string representing the value of this Amount.

App

Defines an App on Bkper.

Apps can be installed on Books by users.

patch():

Promise

Partially update an App, applying pending changes.

setWebhookUrlDev(webhookUrlDev:

string

):

App

Sets the webhook url for development.

Returns This App, for chainning.

Book

A Book represents General Ledger for a company or business, but can also represent a Ledger for a project or department

It contains all Accounts where Transactions are recorded/posted;

audit():

void

Trigger Balances Audit async process.

batchCreateTransactions(transactions:

Transaction

[]):

Promise

Create Transactions on the Book, in batch.

batchTrashTransactions(transactions:

Transaction

[]):

Promise

Trash Transactions on the Book, in batch.

configureTransactions_(transactions:

Transaction

[]):

Transaction

[]

continueTransactionIterator(query:

string

, continuationToken:

string

):

TransactionIterator

Resumes a transaction iteration using a continuation token from a previous iterator.

Returns a collection of transactions that remained in a previous iterator when the continuation token was generated

Parameters:
Name
Description
continuationToken

continuation token from a previous transaction iterator

createIntegration(integration:

bkper.Integration

|

Integration

):

Promise

Creates a new Integration in the Book.

Returns The created Integration object

Parameters:
Name
Description
integration

The Integration object or wrapped plain json

formatDate(date:

Date

, timeZone?:

string

):

string

Formats a date according to date pattern of the Book.

Returns The date formated

Parameters:
Name
Description
date

The date to format as string.

timeZone

The output timezone of the result. Default to script’s timeZone

formatValue(value:

Amount

|

number

|

null

|

undefined

):

string

Formats a value according to DecimalSeparator and fraction digits of the Book.

Returns The value formated

Parameters:
Name
Description
value

The value to be formatted.

getAccount(idOrName:

string

):

Promise

Gets an Account object

Returns The matching Account object

Parameters:
Name
Description
idOrName

The id or name of the Account

getClosingDate():

string

Returns The closing date of the Book in ISO format yyyy-MM-dd

getCollection():

Collection

Returns The collection of this book

getDatePattern():

string

Returns The date pattern of the Book. Current: dd/MM/yyyy MM/dd/yyyy yyyy/MM/dd

getDecimalPlaces():

number

Returns The number of decimal places supported by this Book. Same as getFractionDigits

getDecimalSeparator():

DecimalSeparator

Returns The decimal separator of the Book

getFile(id:

string

):

Promise

Retrieve a file by id

getFractionDigits():

number

Returns The number of fraction digits supported by this Book. Same as getDecimalPlaces

getGroup(idOrName:

string

):

Promise

Gets a Group object

Returns The matching Group object

Parameters:
Name
Description
idOrName

The id or name of the Group

getGroups():

Promise

Gets all Groups of this Book

getGroupsByAccount(accountIdOrName:

string

):

Promise

Get the Groups of a given account.

getId():

string

Same as bookId param

getIntegrations():

Promise

Gets the existing Integrations in the Book.

Returns The existing Integration objects

getLastUpdateMs():

number

Returns The last update date of the book, in in milliseconds

getLockDate():

string

Returns The lock date of the Book in ISO format yyyy-MM-dd

getName():

string

Returns The name of this Book

getOwnerName():

string

Returns The name of the owner of the Book

getPageSize():

number

Returns The transactions pagination page size

getPeriod():

Period

Returns The period slice for balances visualization

getPeriodStartMonth():

Month

Returns The start month when YEAR period set

getPermission():

Permission

Returns The permission for the current user

getProperties(): any

Gets the custom properties stored in this Book

getProperty(keys:

string

[]):

string

Gets the property value for given keys. First property found will be retrieved

Parameters:
Name
Description
keys

The property key

getTimeZone():

string

Returns The time zone of the Book

getTimeZoneOffset():

number

Returns The time zone offset of the book, in minutes

getTransaction(id:

string

):

Promise

Retrieve a transaction by id

getTransactions(query?:

string

):

TransactionIterator

Get Book transactions based on a query.

See Query Guide to learn more

Returns The Transactions result as an iterator.

Example:

var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");

var transactions = book.getTransactions("account:CreditCard after:28/01/2013 before:29/01/2013");

while (transactions.hasNext()) {
 var transaction = transactions.next();
 Logger.log(transaction.getDescription());
}

Parameters:
Name
Description
query

The query string.

json():

bkper.Book

Returns The wrapped plain json object

newAccount():

Account

Instantiate a new Account

Example:

var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");

book.newAccount()
 .setName('Some New Account')
 .setType('INCOMING')
 .addGroup('Revenue').addGroup('Salary')
 .setProperties({prop_a: 'A', prop_b: 'B'})
 .create();

newFile():

File

Instantiate a new [[BkperFile]]

Example:

var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");

book.newFile()
 .setBlob(UrlFetchApp.fetch('https://bkper.com/images/index/integrations4.png').getBlob())
 .create();

newGroup():

Group

Instantiate a new Group

Example:

var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");

book.newGroup()
 .setName('Some New Group')
 .setProperty('key', 'value')
 .create();

newTransaction():

Transaction

Instantiate a new Transaction

Example:

var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");

book.newTransaction()
 .setDate('2013-01-25')
 .setDescription("Filling tank of my truck")
 .from('Credit Card')
 .to('Gas')
 .setAmount(126.50)
 .create();

parseDate(date:

string

):

Date

Parse a date string according to date pattern and timezone of the Book.

Also parse ISO yyyy-mm-dd format.

parseValue(value:

string

):

Amount

Parse a value string according to DecimalSeparator and fraction digits of the Book.

removeGroupCache(group:

Group

):

void

round(value:

Amount

|

number

):

Amount

Rounds a value according to the number of fraction digits of the Book

Returns The value rounded

Parameters:
Name
Description
value

The value to be rounded

setClosingDate(closingDate:

string

):

Book

Sets the closing date of the Book in ISO format yyyy-MM-dd.

Returns This Book, for chainning.

setDatePattern(datePattern:

string

):

Book

Sets the date pattern of the Book. Current: dd/MM/yyyy MM/dd/yyyy yyyy/MM/dd

Returns This Book, for chainning.

setDecimalSeparator(decimalSeparator:

DecimalSeparator

):

Book

Sets the decimal separator of the Book

Returns This Book, for chainning.

setFractionDigits(fractionDigits:

number

):

Book

Sets the number of fraction digits (decimal places) supported by this Book

Returns This Book, for chainning.

setLockDate(lockDate:

string

):

Book

Sets the lock date of the Book in ISO format yyyy-MM-dd.

Returns This Book, for chainning.

setName(name:

string

):

Book

Sets the name of the Book.

Returns This Book, for chainning.

setPageSize(pageSize:

number

):

Book

Sets the transactions pagination page size

Returns This Book, for chainning.

setPeriod(period:

Period

):

Book

Sets the period slice for balances visualization

Returns This Book, for chainning.

setPeriodStartMonth(month:

Month

):

Book

Sets the start month when YEAR period set

Returns This Book, for chainning.

setProperties(properties: any):

Book

Sets the custom properties of the Book

Returns This Book, for chainning.

Parameters:
Name
Description
properties

Object with key/value pair properties

setProperty(key:

string

, value:

string

):

Book

Sets a custom property in the Book.

Returns This Book, for chainning.

Parameters:
Name
Description
key

The property key

value

The property value

setTimeZone(timeZone:

string

):

Book

Sets the time zone of the Book

Returns This Book, for chainning.

update():

Promise

Perform update Book, applying pending changes.

updateIntegration(integration:

bkper.Integration

):

Promise

Updates an existing Integration in the Book.

Returns The updated Integration object

Parameters:
Name
Description
integration

The Integration wrapped plain json

Collection

This class defines a Collection of Books.

getBooks():

Book

[]

Returns All Books of this collection.

getId():

string

Returns The id of this Collection

getName():

string

Returns The name of this Collection

Connection

This class defines a Connection from an User to an external service.

clearTokenProperties():

void

Cleans any token property stored in the Connection.

create():

Promise

Performs create new Connection.

Returns The Connection, for chaining

deleteProperty(key:

string

):

Connection

Deletes a custom property stored in the Connection.

Returns The Connection, for chainning

Parameters:
Name
Description
key

The property key

getAgentId():

string

Gets the agentId of the Connection.

Returns The Connection’s agentId

getEmail():

string

Gets the email of the owner of the Connection.

Returns The Connection owner’s email

getId():

string

Gets the id of the Connection.

Returns The Connection’s id

getIntegrations():

Promise

Gets the existing Integrations on the Connection.

Returns The existing Integration objects

getName():

string

Gets the name of the Connection.

Returns The Connection name

getProperties(): any

Gets the custom properties stored in the Connection

Returns Object with key/value pair properties

getProperty(keys:

string

[]):

string

Gets the property value for given keys. First property found will be retrieved.

Returns The retrieved property value

Parameters:
Name
Description
keys

The property key

getPropertyKeys():

string

[]

Gets the custom properties keys stored in the Connection.

Returns The retrieved property keys

getType(): |

Gets the type of the Connection.

Returns The Connection type

getUUID():

string

Gets the universal unique identifier of this Connection.

Returns The Connection’s universal unique identifier name

json():

bkper.Connection

Gets the wrapped plain json object of the Connection.

Returns The Connection wrapped plain json object

setAgentId(agentId:

string

):

Connection

Sets the Connection agentId.

Returns The Connection, for chainning

Parameters:
Name
Description
agentId

The Connection agentId

setName(name:

string

):

Connection

Sets the name of the Connection.

Returns The Connection, for chainning

Parameters:
Name
Description
name

The name of the Connection

setProperties(properties: any):

Connection

Sets the custom properties of the Connection.

Returns The Connection, for chainning

Parameters:
Name
Description
properties

Object with key/value pair properties

setProperty(key:

string

, value:

string

):

Connection

Sets a custom property in the Connection.

Returns The Connection, for chaining

Parameters:
Name
Description
key

The property key

value

The property value

setType(type: |):

Connection

Sets the Connection type.

Returns The Connection, for chainning

Parameters:
Name
Description
type

The Connection type

setUUID(uuid:

string

):

Connection

Sets the universal unique identifier of the Connection.

Returns The Connection, for chainning

Parameters:
Name
Description
uuid

The universal unique identifier of the Connection

File

This class defines a File uploaded to a Book.

A File can be attached to a Transaction or used to import data.

create():

Promise

Perform create new File.

getContent():

Promise

Gets the file content Base64 encoded

getContentType():

string

Gets the File content type

getId():

string

Gets the File id

getName():

string

Gets the File name

getSize():

number

Gets the file size in bytes

getUrl():

string

Gets the file serving url for accessing via browser

setContent(content:

string

):

File

Sets the File content Base64 encoded.

Returns This File, for chainning.

setContentType(contentType:

string

):

File

Sets the File content type.

Returns This File, for chainning.

setName(name:

string

):

File

Sets the name of the File.

Returns This File, for chainning.

Group

This class defines a Group of Accounts.

Accounts can be grouped by different meaning, like Expenses, Revenue, Assets, Liabilities and so on

Its useful to keep organized and for high level analysis.

create():

Promise

Perform create new group.

deleteProperty(key:

string

):

Group

Delete a custom property

Returns This Group, for chainning.

Parameters:
Name
Description
key

The property key

getAccounts():

Promise

Returns All Accounts of this group.

getId():

string

Returns The id of this Group

getName():

string

Returns The name of this Group

getNormalizedName():

string

Returns The name of this group without spaces and special characters

getParent():

Promise

Returns The parent Group

getProperties(): any

Gets the custom properties stored in this Group

getProperty(keys:

string

[]):

string

Gets the property value for given keys. First property found will be retrieved

Parameters:
Name
Description
keys

The property key

getType():

AccountType

Returns The type for of the accounts of this group. Null if mixed

hasAccounts():

boolean

Returns True if this group has any account in it

isHidden():

boolean

Tell if the Group is hidden on main transactions menu

json():

bkper.Group

Returns The wrapped plain json object

remove():

Promise

Perform delete group.

setHidden(hidden:

boolean

):

Group

Hide/Show group on main menu.

setName(name:

string

):

Group

Sets the name of the Group.

Returns This Group, for chainning.

setParent(group:

Group

|

null

):

Group

Sets the parent Group.

Returns This Group, for chainning.

setProperties(properties: any):

Group

Sets the custom properties of the Group

Returns This Group, for chainning.

Parameters:
Name
Description
properties

Object with key/value pair properties

setProperty(key:

string

, value:

string

):

Group

Sets a custom property in the Group.

Parameters:
Name
Description
key

The property key

value

The property value

update():

Promise

Perform update group, applying pending changes.

Integration

This class defines a Integration from an User to an external service.

deleteProperty(key:

string

):

Integration

Deletes a custom property stored in the Integration.

Returns The Integration, for chainning

Parameters:
Name
Description
key

The property key

getBookId():

string

Gets the Book id of the Integration.

Returns The Integration’s Book id

getId():

string

Gets the id of the Integration.

Returns This Integration’s id

getName():

string

Gets the name of the Integration.

Returns The Integration’s name

getProperties(): any

Gets the custom properties stored in the Integration.

Returns Object with key/value pair properties

getProperty(keys:

string

[]):

string

Gets the property value for given keys. First property found will be retrieved.

Returns The retrieved property value

Parameters:
Name
Description
keys

The property key

json():

bkper.Integration

Gets the wrapped plain json object of the Integration.

Returns The Integration wrapped plain json object

setProperties(properties: any):

Integration

Sets the custom properties of the Integration.

Returns The Integration, for chainning

Parameters:
Name
Description
properties

Object with key/value pair properties

setProperty(key:

string

, value:

string

):

Integration

Sets a custom property in the Integration.

Returns The Integration, for chaining

Parameters:
Name
Description
key

The property key

value

The property value

Transaction

This class defines a Transaction between credit and debit Accounts.

A Transaction is the main entity on the Double Entry Bookkeeping system.

addFile(file:

File

):

Promise

Adds a file attachment to the Transaction.

Files not previously created in the Book will be automatically created.

Returns This Transaction, for chainning.

Parameters:
Name
Description
file

The file to add

addRemoteId(remoteId:

string

):

Transaction

Add a remote id to the Transaction.

Returns This Transaction, for chainning.

Parameters:
Name
Description
remoteId

The remote id to add.

addUrl(url:

string

):

Transaction

Add a url to the Transaction. Url starts with https://

Returns This Transaction, for chainning.

Parameters:
Name
Description
url

The url to add.

check():

Promise

Perform check transaction.

create():

Promise

Perform create new draft transaction.

deleteProperty(key:

string

):

Transaction

Delete a custom property

Returns This Transaction, for chainning.

Parameters:
Name
Description
key

The property key

from(account:

Account

|

bkper.Account

):

Transaction

Sets the credit/origin Account of the Transaction. Same as setCreditAccount().

Returns This Transaction, for chainning.

Parameters:
Name
Description
account

Account id, name or object.

getAccountBalance(raw?:

boolean

):

Promise

Gets the balance that the Account has at that day, when listing transactions of that Account.

Evolved balances is returned when searching for transactions of a permanent Account.

Only comes with the last posted transaction of the day.

Parameters:
Name
Description
raw

True to get the raw balance, no matter the credit nature of the Account.

getAgentId():

string

Returns The id of the agent that created this transaction

getAmount():

Amount

Returns The amount of the transaction.

getCreatedAt():

Date

Returns The date the transaction was created.

getCreatedAtFormatted():

string

Returns The date the transaction was created, formatted according to the date pattern of Book.

getCreditAccount():

Promise

Returns The credit account. The same as origin account.

getCreditAccountName():

Promise

Returns The credit account name.

getCreditAmount(account:

Account

|

string

):

Promise

Get the absolute amount of this transaction if the given account is at the credit side, else null.

Parameters:
Name
Description
account

The account object, id or name.

getDate():

string

Returns The Transaction date, in ISO format yyyy-MM-dd.

getDateFormatted():

string

Returns The Transaction date, formatted on the date pattern of the Book.

getDateObject():

Date

Returns The Transaction Date object, on the time zone of the Book.

getDateValue():

number

Returns The Transaction date number, in format YYYYMMDD.

getDebitAccount():

Promise

Returns The debit account. The same as destination account.

getDebitAccountName():

Promise

Returns The debit account name.

getDebitAmount(account:

Account

|

string

):

Promise

Gets the absolute amount of this transaction if the given account is at the debit side, else null.

Parameters:
Name
Description
account

The account object, id or name.

getDescription():

string

Returns The description of this transaction.

getFiles():

File

[]

Returns The files attached to the transaction.

getId():

string

Returns The id of the Transaction.

getOtherAccount(account:

Account

|

string

):

Promise

Gets the Account at the other side of the transaction given the one in one side.

Parameters:
Name
Description
account

The account object, id or name.

getOtherAccountName(account:

string

|

Account

):

Promise

The account name at the other side of the transaction given the one in one side.

Parameters:
Name
Description
account

The account object, id or name.

getProperties(): any

Gets the custom properties stored in this Transaction.

getProperty(keys:

string

[]):

string

Gets the property value for given keys. First property found will be retrieved

Parameters:
Name
Description
keys

The property key

getPropertyKeys():

string

[]

Gets the custom properties keys stored in this Transaction.

getRemoteIds():

string

[]

Remote ids are used to avoid duplication.

Returns The remote ids of the Transaction.

getTags():

string

[]

Returns All #hashtags used on the transaction.

getUrls():

string

[]

Returns All urls of the transaction.

hasTag(tag:

string

):

boolean

Check if the transaction has the specified tag.

isChecked():

boolean

Returns True if transaction is checked.

isCredit(account:

Account

):

Promise

Tell if the given account is credit on the transaction

Parameters:
Name
Description
account

The account object

isDebit(account:

Account

):

Promise

Tell if the given account is debit on the transaction

Parameters:
Name
Description
account

The account object

isPosted():

boolean

Returns True if transaction was already posted to the accounts. False if is still a Draft.

isTrashed():

boolean

Returns True if transaction is in trash.

json():

bkper.Transaction

Returns The wrapped plain json object

post():

Promise

Perform post transaction, changing credit and debit Account balances.

remove():

Promise

Remove the transaction, sending to trash.

restore():

Promise

Restore the transaction from trash.

setAmount(amount:

Amount

|

number

|

string

):

Transaction

Sets the amount of the Transaction.

Returns This Transaction, for chainning.

setChecked(checked:

boolean

):

Transaction

Set the check state of the Transaction.

Returns This Transaction, for chainning.

Parameters:
Name
Description
checked

The check state.

setCreditAccount(account:

Account

|

bkper.Account

):

Transaction

Sets the credit/origin Account of the Transaction. Same as from().

Returns This Transaction, for chainning.

Parameters:
Name
Description
account

Account id, name or object.

setDate(date:

string

|

Date

):

Transaction

Sets the date of the Transaction.

Returns This Transaction, for chainning

setDebitAccount(account:

Account

|

bkper.Account

):

Transaction

Sets the debit/destination Account of the Transaction. Same as to().

Returns This Transaction, for chainning.

Parameters:
Name
Description
account

Account id, name or object.

setDescription(description:

string

):

Transaction

Sets the description of the Transaction.

Returns This Transaction, for chainning.

setProperties(properties: any):

Transaction

Sets the custom properties of the Transaction

Returns This Transaction, for chainning.

Parameters:
Name
Description
properties

Object with key/value pair properties

setProperty(key:

string

, value:

string

):

Transaction

Sets a custom property in the Transaction.

Returns This Transaction, for chainning.

Parameters:
Name
Description
key

The property key

value

The property value

setUrls(urls:

string

[]):

Transaction

Sets the Transaction urls. Url starts with https://

Returns This Transaction, for chainning.

Parameters:
Name
Description
urls

The urls array.

to(account:

Account

|

bkper.Account

):

Transaction

Sets the debit/destination Account of the Transaction. Same as setDebitAccount().

Returns This Transaction, for chainning.

Parameters:
Name
Description
account

Account id, name or object.

uncheck():

Promise

Perform uncheck transaction.

update():

Promise

Upddate transaction, applying pending changes.

TransactionIterator

An iterator that allows scripts to iterate over a potentially large collection of transactions.

Example:

var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");

var transactionIterator = book.getTransactions("account:CreditCard after:28/01/2013 before:29/01/2013");

while (transactionIterator.hasNext()) {
 var transaction = transactions.next();
 Logger.log(transaction.getDescription());
}

getAccount():

Promise

Returns The account, when filtering by a single account.

getBook():

Book

Gets the Book that originate the iterator

getContinuationToken():

string

Gets a token that can be used to resume this iteration at a later time.

This method is useful if processing an iterator in one execution would exceed the maximum execution time.

Continuation tokens are generally valid short period of time.

hasNext():

Promise

Determines whether calling next() will return a transaction.

next():

Promise

Gets the next transaction in the collection of transactions.

setContinuationToken(continuationToken:

string

):

Promise

Sets a continuation token from previous paused iteration

User

This class defines a User.

getConnection(id:

string

):

Promise

Gets a Connection of the User.

Returns The retrieved Connection object

Parameters:
Name
Description
id

The Connection’s id

getConnections():

Promise

Gets the Connections of the User.

Returns The retrieved Connection objects

getFullName():

string

Gets the full name of the User.

Returns The User’s full name

getId():

string

Gets the id of the User.

Returns The User’s id

getName():

string

Gets the name of the User.

Returns The User’s name

Config

This class defines the Bkper API Config.

AccountType Enum

Enum that represents account types.

Name
Description
ASSET

Asset account type

INCOMING

Incoming account type

LIABILITY

Liability account type

OUTGOING

Outgoing account type

DecimalSeparator Enum

Decimal separator of numbers on book

Name
Description
COMMA

,

DOT

.

Month Enum

Enum that represents a Month.

Name
Description
APRIL

AUGUST

DECEMBER

FEBRUARY

JANUARY

JULY

JUNE

MARCH

MAY

NOVEMBER

OCTOBER

SEPTEMBER

Period Enum

Enum that represents a period slice.

Name
Description
MONTH

Monthly period

QUARTER

Quarterly period

YEAR

Yearly period

Periodicity Enum

The Periodicity of the query. It may depend on the level of granularity you write the range params.

Name
Description
DAILY

Example: after:25/01/1983, before:04/03/2013, after:$d-30, before:$d, after:$d-15/$m

MONTHLY

Example: after:jan/2013, before:mar/2013, after:$m-1, before:$m

YEARLY

Example: on:2013, after:2013, $y

Permission Enum

Enum representing permissions of user in the Book

Learn more at share article.

Name
Description
EDITOR

Manage accounts, transactions, book configuration and sharing

NONE

No permission

OWNER

Manage everything, including book visibility and deletion. Only one owner per book.

POSTER

View transactions, accounts, record and delete drafts

RECORDER

Record and delete drafts only. Useful to collect data only

VIEWER

View transactions, accounts and balances.