bkper-js 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts ADDED
@@ -0,0 +1,1804 @@
1
+ /**
2
+ * Bkper REST API Node client.
3
+ *
4
+ * Learn more at https://bkper.com/docs
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+
9
+ /**
10
+ *
11
+ * This class defines an [Account](https://en.wikipedia.org/wiki/Account_(bookkeeping)) of a [[Book]].
12
+ *
13
+ * It mantains a balance of all amount [credited and debited](http://en.wikipedia.org/wiki/Debits_and_credits) in it by [[Transactions]].
14
+ *
15
+ * An Account can be grouped by [[Groups]].
16
+ *
17
+ * @public
18
+ */
19
+ export declare class Account {
20
+
21
+
22
+ /**
23
+ *
24
+ * @returns The wrapped plain json object
25
+ */
26
+ json(): bkper.Account;
27
+ /**
28
+ * Gets the account internal id.
29
+ */
30
+ getId(): string;
31
+ /**
32
+ * Gets the account name.
33
+ */
34
+ getName(): string;
35
+ /**
36
+ *
37
+ * Sets the name of the Account.
38
+ *
39
+ * @returns This Account, for chainning.
40
+ */
41
+ setName(name: string): Account;
42
+ /**
43
+ * @returns The name of this account without spaces or special characters.
44
+ */
45
+ getNormalizedName(): string;
46
+ /**
47
+ * @returns The type for of this account.
48
+ */
49
+ getType(): AccountType;
50
+ /**
51
+ *
52
+ * Sets the type of the Account.
53
+ *
54
+ * @returns This Account, for chainning
55
+ */
56
+ setType(type: AccountType): Account;
57
+ /**
58
+ * Gets the custom properties stored in this Account.
59
+ */
60
+ getProperties(): {
61
+ [key: string]: string;
62
+ };
63
+ /**
64
+ * Sets the custom properties of the Account
65
+ *
66
+ * @param properties - Object with key/value pair properties
67
+ *
68
+ * @returns This Account, for chainning.
69
+ */
70
+ setProperties(properties: {
71
+ [key: string]: string;
72
+ }): Account;
73
+ /**
74
+ * Gets the property value for given keys. First property found will be retrieved
75
+ *
76
+ * @param keys - The property key
77
+ */
78
+ getProperty(...keys: string[]): string;
79
+ /**
80
+ * Sets a custom property in the Account.
81
+ *
82
+ * @param key - The property key
83
+ * @param value - The property value
84
+ *
85
+ * @returns This Account, for chainning.
86
+ */
87
+ setProperty(key: string, value: string): Account;
88
+ /**
89
+ * Delete a custom property
90
+ *
91
+ * @param key - The property key
92
+ *
93
+ * @returns This Account, for chainning.
94
+ */
95
+ deleteProperty(key: string): Account;
96
+ /**
97
+ * Gets the balance based on credit nature of this Account.
98
+ * @deprecated Use `Book.getBalancesReport` instead.
99
+ * @returns The balance of this account.
100
+ */
101
+ getBalance(): Amount;
102
+ /**
103
+ * Gets the raw balance, no matter credit nature of this Account.
104
+ * @deprecated Use `Book.getBalancesReport` instead.
105
+ * @returns The balance of this account.
106
+ */
107
+ getBalanceRaw(): Amount;
108
+ /**
109
+ * Tell if this account is archived.
110
+ */
111
+ isArchived(): boolean;
112
+ /**
113
+ * Set account archived/unarchived.
114
+ *
115
+ * @returns This Account, for chainning.
116
+ */
117
+ setArchived(archived: boolean): Account;
118
+ /**
119
+ * Tell if the Account has any transaction already posted.
120
+ *
121
+ * Accounts with transaction posted, even with zero balance, can only be archived.
122
+ */
123
+ hasTransactionPosted(): boolean;
124
+ /**
125
+ *
126
+ * Tell if the account is permanent.
127
+ *
128
+ * Permanent Accounts are the ones which final balance is relevant and keep its balances over time.
129
+ *
130
+ * They are also called [Real Accounts](http://en.wikipedia.org/wiki/Account_(accountancy)#Based_on_periodicity_of_flow)
131
+ *
132
+ * Usually represents assets or tangibles, capable of being perceived by the senses or the mind, like bank accounts, money, debts and so on.
133
+ *
134
+ * @returns True if its a permanent Account
135
+ */
136
+ isPermanent(): boolean;
137
+ /**
138
+ * Tell if the account has a Credit nature or Debit otherwise
139
+ *
140
+ * 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.
141
+ *
142
+ * 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.
143
+ *
144
+ * ```
145
+ * Crediting a credit
146
+ * Thus ---------------------> account increases its absolute balance
147
+ * Debiting a debit
148
+ *
149
+ *
150
+ * Debiting a credit
151
+ * Thus ---------------------> account decreases its absolute balance
152
+ * Crediting a debit
153
+ * ```
154
+ *
155
+ * 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.
156
+ */
157
+ isCredit(): boolean;
158
+ /**
159
+ * Get the [[Groups]] of this account.
160
+ */
161
+ getGroups(): Promise<Group[]>;
162
+ /**
163
+ * Sets the groups of the Account.
164
+ *
165
+ * @returns This Account, for chainning.
166
+ */
167
+ setGroups(groups: Group[] | bkper.Group[]): Account;
168
+ /**
169
+ * Add a group to the Account.
170
+ *
171
+ * @returns This Account, for chainning.
172
+ */
173
+ addGroup(group: Group | bkper.Group): Account;
174
+ /**
175
+ * Remove a group from the Account.
176
+ */
177
+ removeGroup(group: string | Group): Promise<Account>;
178
+ /**
179
+ * Tell if this account is in the [[Group]]
180
+ *
181
+ * @param group - The Group name, id or object
182
+ */
183
+ isInGroup(group: string | Group): Promise<boolean>;
184
+
185
+ /**
186
+ * Perform create new account.
187
+ */
188
+ create(): Promise<Account>;
189
+ /**
190
+ * Perform update account, applying pending changes.
191
+ */
192
+ update(): Promise<Account>;
193
+ /**
194
+ * Perform delete account.
195
+ */
196
+ remove(): Promise<Account>;
197
+ }
198
+
199
+ /**
200
+ * Enum that represents account types.
201
+ *
202
+ * @public
203
+ */
204
+ export declare enum AccountType {
205
+ /**
206
+ * Asset account type
207
+ */
208
+ ASSET = "ASSET",
209
+ /**
210
+ * Liability account type
211
+ */
212
+ LIABILITY = "LIABILITY",
213
+ /**
214
+ * Incoming account type
215
+ */
216
+ INCOMING = "INCOMING",
217
+ /**
218
+ * Outgoing account type
219
+ */
220
+ OUTGOING = "OUTGOING"
221
+ }
222
+
223
+ /**
224
+ * This class defines an Amount for arbitrary-precision decimal arithmetic.
225
+ *
226
+ * It inherits methods from [big.js](http://mikemcl.github.io/big.js/) library
227
+ *
228
+ * @public
229
+ */
230
+ export declare class Amount {
231
+
232
+ /**
233
+ * The Amount constructor.
234
+ */
235
+ constructor(n: number | string | Amount);
236
+ /**
237
+ * Returns an absolute Amount.
238
+ */
239
+ abs(): Amount;
240
+ /**
241
+ * Compare
242
+ */
243
+ cmp(n: number | string | Amount): -1 | 0 | 1;
244
+ /**
245
+ * Divide by
246
+ */
247
+ div(n: number | string | Amount): Amount;
248
+ /**
249
+ * Equals to
250
+ */
251
+ eq(n: number | string | Amount): boolean;
252
+ /**
253
+ * Greater than
254
+ */
255
+ gt(n: number | string | Amount): boolean;
256
+ /**
257
+ * Greater than or equal
258
+ */
259
+ gte(n: number | string | Amount): boolean;
260
+ /**
261
+ * Less than
262
+ */
263
+ lt(n: number | string | Amount): boolean;
264
+ /**
265
+ * Less than or equal to
266
+ */
267
+ lte(n: number | string | Amount): boolean;
268
+ /**
269
+ * Sum
270
+ */
271
+ plus(n: number | string | Amount): Amount;
272
+ /**
273
+ * Minus
274
+ */
275
+ minus(n: number | string | Amount): Amount;
276
+ /**
277
+ * Modulo - the integer remainder of dividing this Amount by n.
278
+ *
279
+ * Similar to % operator
280
+ *
281
+ */
282
+ mod(n: number | string | Amount): Amount;
283
+ /**
284
+ * Round to a maximum of dp decimal places.
285
+ */
286
+ round(dp?: number): Amount;
287
+ /**
288
+ * Multiply
289
+ */
290
+ times(n: number | string | Amount): Amount;
291
+ /**
292
+ * Returns a string representing the value of this Amount in normal notation to a fixed number of decimal places dp.
293
+ */
294
+ toFixed(dp?: number): string;
295
+ /**
296
+ * Returns a string representing the value of this Amount.
297
+ */
298
+ toString(): string;
299
+ /**
300
+ * Returns a primitive number representing the value of this Amount.
301
+ */
302
+ toNumber(): number;
303
+
304
+
305
+
306
+ }
307
+
308
+ /**
309
+ * Defines an App on Bkper.
310
+ *
311
+ * Apps can be installed on Books by users.
312
+ *
313
+ * @public
314
+ */
315
+ export declare class App {
316
+
317
+ constructor(json: bkper.App);
318
+ /**
319
+ *
320
+ * Sets the webhook url for development.
321
+ *
322
+ * @returns This App, for chainning.
323
+ */
324
+ setWebhookUrlDev(webhookUrlDev: string): App;
325
+ /**
326
+ *
327
+ * @returns The App universal identifier
328
+ */
329
+ getId(): string;
330
+ /**
331
+ * Sets the whitelabeled user emails
332
+ *
333
+ * @returns This App for chaining
334
+ */
335
+ setUserEmails(emails: string): App;
336
+ /**
337
+ * Sets the developer email
338
+ *
339
+ * @returns This App for chaining
340
+ */
341
+ setDeveloperEmail(email: string): App;
342
+ /**
343
+ * Sets the client secret
344
+ *
345
+ * @returns This App for chaining
346
+ */
347
+ setClientSecret(clientSecret: string): App;
348
+ /**
349
+ * Sets the readme text
350
+ *
351
+ * @returns This App for chaining
352
+ */
353
+ setReadme(readme: string): App;
354
+ /**
355
+ * Performs the app creation, applying pending changes.
356
+ *
357
+ * The App id MUST be unique. If another app is already existing, an error will be thrown.
358
+ */
359
+ create(): Promise<App>;
360
+ /**
361
+ * Partially update an App, applying pending changes.
362
+ */
363
+ patch(): Promise<App>;
364
+ /**
365
+ * Perform update App, applying pending changes.
366
+ */
367
+ update(): Promise<App>;
368
+ }
369
+
370
+ /**
371
+ * This is the main Entry Point of the [bkper-node](https://www.npmjs.com/package/bkper) library.
372
+ *
373
+ * @public
374
+ */
375
+ export declare class Bkper {
376
+ /**
377
+ * Gets the [[Book]] with the specified bookId from url param.
378
+ *
379
+ * @param id - The universal book id - The same bookId param of URL you access at app.bkper.com
380
+ *
381
+ * @returns The retrieved Book, for chaining
382
+ */
383
+ static getBook(id: string): Promise<Book>;
384
+ /**
385
+ * Gets the current logged [[User]].
386
+ *
387
+ * @returns The retrieved User, for chaining
388
+ */
389
+ static getUser(): Promise<User>;
390
+ /**
391
+ * Sets the API [[Config]] object.
392
+ *
393
+ * @param config - The Config object
394
+ */
395
+ static setConfig(config: Config): void;
396
+ /**
397
+ * Sets the API key to identify the agent.
398
+ *
399
+ * @param key - The API key
400
+ *
401
+ * @returns The defined [[App]] object
402
+ *
403
+ * @deprecated Use `setConfig()` instead
404
+ */
405
+ static setApiKey(key: string): App;
406
+ /**
407
+ * Sets the provider of the valid OAuth2 access token
408
+ *
409
+ * @deprecated Use `setConfig()` instead
410
+ */
411
+ static setOAuthTokenProvider(oauthTokenProvider: () => Promise<string>): Promise<void>;
412
+ }
413
+
414
+ /**
415
+ *
416
+ * A Book represents [General Ledger](https://en.wikipedia.org/wiki/General_ledger) for a company or business, but can also represent a [Ledger](https://en.wikipedia.org/wiki/Ledger) for a project or department
417
+ *
418
+ * It contains all [[Accounts]] where [[Transactions]] are recorded/posted;
419
+ *
420
+ * @public
421
+ */
422
+ export declare class Book {
423
+
424
+
425
+
426
+
427
+ constructor(json: bkper.Book);
428
+ /**
429
+ * @returns The wrapped plain json object
430
+ */
431
+ json(): bkper.Book;
432
+ /**
433
+ * Same as bookId param
434
+ */
435
+ getId(): string;
436
+ /**
437
+ * @returns The name of this Book
438
+ */
439
+ getName(): string;
440
+ /**
441
+ *
442
+ * Sets the name of the Book.
443
+ *
444
+ * @returns This Book, for chainning.
445
+ */
446
+ setName(name: string): Book;
447
+ /**
448
+ * @returns The number of fraction digits supported by this Book. Same as getDecimalPlaces
449
+ */
450
+ getFractionDigits(): number;
451
+ /**
452
+ * @returns The number of decimal places supported by this Book. Same as getFractionDigits
453
+ */
454
+ getDecimalPlaces(): number;
455
+ /**
456
+ *
457
+ * Sets the number of fraction digits (decimal places) supported by this Book
458
+ *
459
+ * @returns This Book, for chainning.
460
+ */
461
+ setFractionDigits(fractionDigits: number): Book;
462
+ /**
463
+ * @returns The period slice for balances visualization
464
+ */
465
+ getPeriod(): Period;
466
+ /**
467
+ * Sets the period slice for balances visualization
468
+ *
469
+ * @returns This Book, for chainning.
470
+ */
471
+ setPeriod(period: Period): Book;
472
+ /**
473
+ * @returns The start month when YEAR period set
474
+ */
475
+ getPeriodStartMonth(): Month;
476
+ /**
477
+ * Sets the start month when YEAR period set
478
+ *
479
+ * @returns This Book, for chainning.
480
+ */
481
+ setPeriodStartMonth(month: Month): Book;
482
+ /**
483
+ * @returns The transactions pagination page size
484
+ */
485
+ getPageSize(): number;
486
+ /**
487
+ * Sets the transactions pagination page size
488
+ *
489
+ * @returns This Book, for chainning.
490
+ */
491
+ setPageSize(pageSize: number): Book;
492
+ /**
493
+ * @returns The name of the owner of the Book
494
+ */
495
+ getOwnerName(): string;
496
+ /**
497
+ * @returns The permission for the current user
498
+ */
499
+ getPermission(): Permission;
500
+ /**
501
+ * @returns The collection of this book
502
+ */
503
+ getCollection(): Collection;
504
+ /**
505
+ * @returns The date pattern of the Book. Current: dd/MM/yyyy | MM/dd/yyyy | yyyy/MM/dd
506
+ */
507
+ getDatePattern(): string;
508
+ /**
509
+ *
510
+ * Sets the date pattern of the Book. Current: dd/MM/yyyy | MM/dd/yyyy | yyyy/MM/dd
511
+ *
512
+ * @returns This Book, for chainning.
513
+ */
514
+ setDatePattern(datePattern: string): Book;
515
+ /**
516
+ * @returns The lock date of the Book in ISO format yyyy-MM-dd
517
+ */
518
+ getLockDate(): string;
519
+ /**
520
+ *
521
+ * Sets the lock date of the Book in ISO format yyyy-MM-dd.
522
+ *
523
+ * @returns This Book, for chainning.
524
+ */
525
+ setLockDate(lockDate: string): Book;
526
+ /**
527
+ * @returns The closing date of the Book in ISO format yyyy-MM-dd
528
+ */
529
+ getClosingDate(): string;
530
+ /**
531
+ *
532
+ * Sets the closing date of the Book in ISO format yyyy-MM-dd.
533
+ *
534
+ * @returns This Book, for chainning.
535
+ */
536
+ setClosingDate(closingDate: string): Book;
537
+ /**
538
+ * @returns The decimal separator of the Book
539
+ */
540
+ getDecimalSeparator(): DecimalSeparator;
541
+ /**
542
+ *
543
+ * Sets the decimal separator of the Book
544
+ *
545
+ * @returns This Book, for chainning.
546
+ */
547
+ setDecimalSeparator(decimalSeparator: DecimalSeparator): Book;
548
+ /**
549
+ * @returns The time zone of the Book
550
+ */
551
+ getTimeZone(): string;
552
+ /**
553
+ *
554
+ * Sets the time zone of the Book
555
+ *
556
+ * @returns This Book, for chainning.
557
+ */
558
+ setTimeZone(timeZone: string): Book;
559
+ /**
560
+ * @returns The time zone offset of the book, in minutes
561
+ */
562
+ getTimeZoneOffset(): number;
563
+ /**
564
+ * @returns The last update date of the book, in in milliseconds
565
+ */
566
+ getLastUpdateMs(): number;
567
+ /**
568
+ * Gets the custom properties stored in this Book
569
+ */
570
+ getProperties(): {
571
+ [key: string]: string;
572
+ };
573
+ /**
574
+ * Gets the property value for given keys. First property found will be retrieved
575
+ *
576
+ * @param keys - The property key
577
+ */
578
+ getProperty(...keys: string[]): string;
579
+ /**
580
+ * Sets the custom properties of the Book
581
+ *
582
+ * @param properties - Object with key/value pair properties
583
+ *
584
+ * @returns This Book, for chainning.
585
+ */
586
+ setProperties(properties: {
587
+ [key: string]: string;
588
+ }): Book;
589
+ /**
590
+ * Sets a custom property in the Book.
591
+ *
592
+ * @param key - The property key
593
+ * @param value - The property value
594
+ *
595
+ * @returns This Book, for chainning.
596
+ */
597
+ setProperty(key: string, value: string): Book;
598
+ /**
599
+ * Formats a date according to date pattern of the Book.
600
+ *
601
+ * @param date - The date to format as string.
602
+ * @param timeZone - The output timezone of the result. Default to script's timeZone
603
+ *
604
+ * @returns The date formated
605
+ */
606
+ formatDate(date: Date, timeZone?: string): string;
607
+ /**
608
+ * Parse a date string according to date pattern and timezone of the Book.
609
+ *
610
+ * Also parse ISO yyyy-mm-dd format.
611
+ */
612
+ parseDate(date: string): Date;
613
+ /**
614
+ * Formats a value according to [[DecimalSeparator]] and fraction digits of the Book.
615
+ *
616
+ * @param value - The value to be formatted.
617
+ *
618
+ * @returns The value formated
619
+ */
620
+ formatValue(value: Amount | number | null | undefined): string;
621
+ /**
622
+ * Parse a value string according to [[DecimalSeparator]] and fraction digits of the Book.
623
+ */
624
+ parseValue(value: string): Amount;
625
+ /**
626
+ * Rounds a value according to the number of fraction digits of the Book
627
+ *
628
+ * @param value - The value to be rounded
629
+ *
630
+ * @returns The value rounded
631
+ */
632
+ round(value: Amount | number): Amount;
633
+ /**
634
+ * Create [[Transactions]] on the Book, in batch.
635
+ */
636
+ batchCreateTransactions(transactions: Transaction[]): Promise<Transaction[]>;
637
+ /**
638
+ * Trash [[Transactions]] on the Book, in batch.
639
+ */
640
+ batchTrashTransactions(transactions: Transaction[]): Promise<void>;
641
+ /**
642
+ * Trigger [Balances Audit](https://help.bkper.com/en/articles/4412038-balances-audit) async process.
643
+ */
644
+ audit(): void;
645
+ /**
646
+ * Gets the existing [[Integrations]] in the Book.
647
+ *
648
+ * @returns The existing Integration objects
649
+ */
650
+ getIntegrations(): Promise<Integration[]>;
651
+ /**
652
+ * Creates a new [[Integration]] in the Book.
653
+ *
654
+ * @param integration - The Integration object or wrapped plain json
655
+ *
656
+ * @returns The created Integration object
657
+ */
658
+ createIntegration(integration: bkper.Integration | Integration): Promise<Integration>;
659
+ /**
660
+ * Updates an existing [[Integration]] in the Book.
661
+ *
662
+ * @param integration - The Integration wrapped plain json
663
+ *
664
+ * @returns The updated Integration object
665
+ */
666
+ updateIntegration(integration: bkper.Integration): Promise<Integration>;
667
+ /**
668
+ * Resumes a transaction iteration using a continuation token from a previous iterator.
669
+ *
670
+ * @param continuationToken - continuation token from a previous transaction iterator
671
+ *
672
+ * @returns a collection of transactions that remained in a previous iterator when the continuation token was generated
673
+ */
674
+ continueTransactionIterator(query: string, continuationToken: string): TransactionIterator;
675
+ configureTransactions_(transactions: Transaction[]): Transaction[];
676
+
677
+ /**
678
+ * Instantiate a new [[Transaction]]
679
+ *
680
+ * Example:
681
+ *
682
+ * ```js
683
+ * var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");
684
+ *
685
+ * book.newTransaction()
686
+ * .setDate('2013-01-25')
687
+ * .setDescription("Filling tank of my truck")
688
+ * .from('Credit Card')
689
+ * .to('Gas')
690
+ * .setAmount(126.50)
691
+ * .create();
692
+ *
693
+ * ```
694
+ *
695
+ */
696
+ newTransaction(): Transaction;
697
+ /**
698
+ * Instantiate a new [[Account]]
699
+ *
700
+ * Example:
701
+ * ```js
702
+ * var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");
703
+ *
704
+ * book.newAccount()
705
+ * .setName('Some New Account')
706
+ * .setType('INCOMING')
707
+ * .addGroup('Revenue').addGroup('Salary')
708
+ * .setProperties({prop_a: 'A', prop_b: 'B'})
709
+ * .create();
710
+ * ```
711
+ */
712
+ newAccount(): Account;
713
+ /**
714
+ * Instantiate a new [[Group]]
715
+ *
716
+ * Example:
717
+ * ```js
718
+ * var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");
719
+ *
720
+ * book.newGroup()
721
+ * .setName('Some New Group')
722
+ * .setProperty('key', 'value')
723
+ * .create();
724
+ * ```
725
+ */
726
+ newGroup(): Group;
727
+ /**
728
+ * Gets an [[Account]] object
729
+ *
730
+ * @param idOrName - The id or name of the Account
731
+ *
732
+ * @returns The matching Account object
733
+ */
734
+ getAccount(idOrName: string): Promise<Account>;
735
+
736
+ removeGroupCache(group: Group): void;
737
+ /**
738
+ * Gets a [[Group]] object
739
+ *
740
+ * @param idOrName - The id or name of the Group
741
+ *
742
+ * @returns The matching Group object
743
+ */
744
+ getGroup(idOrName: string): Promise<Group>;
745
+ /**
746
+ * Gets all [[Groups]] of this Book
747
+ */
748
+ getGroups(): Promise<Group[]>;
749
+ /**
750
+ * Get the [[Groups]] of a given account.
751
+ */
752
+ getGroupsByAccount(accountIdOrName: string): Promise<Group[]>;
753
+ /**
754
+ * Get Book transactions based on a query.
755
+ *
756
+ * See [Query Guide](https://help.bkper.com/en/articles/2569178-search-query-guide) to learn more
757
+ *
758
+ * @param query - The query string.
759
+ *
760
+ * @returns The Transactions result as an iterator.
761
+ *
762
+ * Example:
763
+ *
764
+ * ```js
765
+ * var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");
766
+ *
767
+ * var transactions = book.getTransactions("account:CreditCard after:28/01/2013 before:29/01/2013");
768
+ *
769
+ * while (transactions.hasNext()) {
770
+ * var transaction = transactions.next();
771
+ * Logger.log(transaction.getDescription());
772
+ * }
773
+ * ```
774
+ */
775
+ getTransactions(query?: string): TransactionIterator;
776
+ /**
777
+ * Retrieve a transaction by id
778
+ */
779
+ getTransaction(id: string): Promise<Transaction>;
780
+ /**
781
+ * Instantiate a new [[BkperFile]]
782
+ *
783
+ * Example:
784
+ * ```js
785
+ * var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");
786
+ *
787
+ * book.newFile()
788
+ * .setBlob(UrlFetchApp.fetch('https://bkper.com/images/index/integrations4.png').getBlob())
789
+ * .create();
790
+ * ```
791
+ */
792
+ newFile(): File;
793
+ /**
794
+ * Retrieve a file by id
795
+ */
796
+ getFile(id: string): Promise<File>;
797
+ /**
798
+ * Perform update Book, applying pending changes.
799
+ */
800
+ update(): Promise<Book>;
801
+ }
802
+
803
+ /**
804
+ * This class defines a Collection of [[Books]].
805
+ *
806
+ * @public
807
+ */
808
+ export declare class Collection {
809
+
810
+
811
+ /**
812
+ * @returns The id of this Collection
813
+ */
814
+ getId(): string;
815
+ /**
816
+ * @returns The name of this Collection
817
+ */
818
+ getName(): string;
819
+ /**
820
+ * @returns All Books of this collection.
821
+ */
822
+ getBooks(): Book[];
823
+ }
824
+
825
+ /**
826
+ * This class defines the [[Bkper]] API Config.
827
+ *
828
+ * @public
829
+ */
830
+ export declare interface Config {
831
+ /**
832
+ * The API key to identify the agent.
833
+ *
834
+ * API keys are intended for agent identification only, not for authentication. [Learn more](https://cloud.google.com/endpoints/docs/frameworks/java/when-why-api-key)
835
+ *
836
+ * See how to create your api key [here](https://cloud.google.com/docs/authentication/api-keys).
837
+ */
838
+ apiKeyProvider?: () => Promise<string>;
839
+ /**
840
+ * Issue a valid OAuth2 access token with **https://www.googleapis.com/auth/userinfo.email** scope authorized.
841
+ */
842
+ oauthTokenProvider?: () => Promise<string>;
843
+ /**
844
+ * Provides additional headers to append to the API request
845
+ */
846
+ requestHeadersProvider?: () => Promise<{
847
+ [key: string]: string;
848
+ }>;
849
+ /**
850
+ * Custom request error handler
851
+ */
852
+ requestErrorHandler?: (error: any) => any;
853
+ /**
854
+ * Sets the base api url. Default to https://app.bkper.com/_ah/api/bkper
855
+ */
856
+ apiBaseUrl?: string;
857
+ }
858
+
859
+ /**
860
+ * This class defines a Connection from an [[User]] to an external service.
861
+ *
862
+ * @public
863
+ */
864
+ export declare class Connection {
865
+
866
+ constructor(json?: bkper.Connection);
867
+ /**
868
+ * Gets the wrapped plain json object of the Connection.
869
+ *
870
+ * @returns The Connection wrapped plain json object
871
+ */
872
+ json(): bkper.Connection;
873
+ /**
874
+ * Gets the id of the Connection.
875
+ *
876
+ * @returns The Connection's id
877
+ */
878
+ getId(): string;
879
+ /**
880
+ * Gets the agentId of the Connection.
881
+ *
882
+ * @returns The Connection's agentId
883
+ */
884
+ getAgentId(): string;
885
+ /**
886
+ * Sets the Connection agentId.
887
+ *
888
+ * @param agentId - The Connection agentId
889
+ *
890
+ * @returns The Connection, for chainning
891
+ */
892
+ setAgentId(agentId: string): Connection;
893
+ /**
894
+ * Gets the name of the Connection.
895
+ *
896
+ * @returns The Connection name
897
+ */
898
+ getName(): string;
899
+ /**
900
+ * Gets the email of the owner of the Connection.
901
+ *
902
+ * @returns The Connection owner's email
903
+ */
904
+ getEmail(): string;
905
+ /**
906
+ * Sets the name of the Connection.
907
+ *
908
+ * @param name - The name of the Connection
909
+ *
910
+ * @returns The Connection, for chainning
911
+ */
912
+ setName(name: string): Connection;
913
+ /**
914
+ * Sets the universal unique identifier of the Connection.
915
+ *
916
+ * @param uuid - The universal unique identifier of the Connection
917
+ *
918
+ * @returns The Connection, for chainning
919
+ */
920
+ setUUID(uuid: string): Connection;
921
+ /**
922
+ * Gets the universal unique identifier of this Connection.
923
+ *
924
+ * @returns The Connection's universal unique identifier name
925
+ */
926
+ getUUID(): string;
927
+ /**
928
+ * Gets the type of the Connection.
929
+ *
930
+ * @returns The Connection type
931
+ */
932
+ getType(): "APP" | "BANK";
933
+ /**
934
+ * Sets the Connection type.
935
+ *
936
+ * @param type - The Connection type
937
+ *
938
+ * @returns The Connection, for chainning
939
+ */
940
+ setType(type: "APP" | "BANK"): Connection;
941
+ /**
942
+ * Gets the custom properties stored in the Connection
943
+ *
944
+ * @returns Object with key/value pair properties
945
+ */
946
+ getProperties(): {
947
+ [key: string]: string;
948
+ };
949
+ /**
950
+ * Sets the custom properties of the Connection.
951
+ *
952
+ * @param properties - Object with key/value pair properties
953
+ *
954
+ * @returns The Connection, for chainning
955
+ */
956
+ setProperties(properties: {
957
+ [key: string]: string;
958
+ }): Connection;
959
+ /**
960
+ * Gets the property value for given keys. First property found will be retrieved.
961
+ *
962
+ * @param keys - The property key
963
+ *
964
+ * @returns The retrieved property value
965
+ */
966
+ getProperty(...keys: string[]): string;
967
+ /**
968
+ * Sets a custom property in the Connection.
969
+ *
970
+ * @param key - The property key
971
+ * @param value - The property value
972
+ *
973
+ * @returns The Connection, for chaining
974
+ */
975
+ setProperty(key: string, value: string): Connection;
976
+ /**
977
+ * Deletes a custom property stored in the Connection.
978
+ *
979
+ * @param key - The property key
980
+ *
981
+ * @returns The Connection, for chainning
982
+ */
983
+ deleteProperty(key: string): Connection;
984
+ /**
985
+ * Cleans any token property stored in the Connection.
986
+ */
987
+ clearTokenProperties(): void;
988
+ /**
989
+ * Gets the custom properties keys stored in the Connection.
990
+ *
991
+ * @returns The retrieved property keys
992
+ */
993
+ getPropertyKeys(): string[];
994
+ /**
995
+ * Gets the existing [[Integrations]] on the Connection.
996
+ *
997
+ * @returns The existing Integration objects
998
+ */
999
+ getIntegrations(): Promise<Integration[]>;
1000
+ /**
1001
+ * Performs create new Connection.
1002
+ *
1003
+ * @returns The Connection, for chaining
1004
+ */
1005
+ create(): Promise<Connection>;
1006
+ }
1007
+
1008
+ /**
1009
+ * Decimal separator of numbers on book
1010
+ *
1011
+ * @public
1012
+ */
1013
+ export declare enum DecimalSeparator {
1014
+ /**
1015
+ * ,
1016
+ */
1017
+ COMMA = "COMMA",
1018
+ /**
1019
+ * .
1020
+ */
1021
+ DOT = "DOT"
1022
+ }
1023
+
1024
+ /**
1025
+ *
1026
+ * This class defines a File uploaded to a [[Book]].
1027
+ *
1028
+ * A File can be attached to a [[Transaction]] or used to import data.
1029
+ *
1030
+ * @public
1031
+ */
1032
+ export declare class File {
1033
+
1034
+
1035
+ /**
1036
+ * Gets the File id
1037
+ */
1038
+ getId(): string;
1039
+ /**
1040
+ * Gets the File name
1041
+ */
1042
+ getName(): string;
1043
+ /**
1044
+ *
1045
+ * Sets the name of the File.
1046
+ *
1047
+ * @returns This File, for chainning.
1048
+ */
1049
+ setName(name: string): File;
1050
+ /**
1051
+ * Gets the File content type
1052
+ */
1053
+ getContentType(): string;
1054
+ /**
1055
+ *
1056
+ * Sets the File content type.
1057
+ *
1058
+ * @returns This File, for chainning.
1059
+ */
1060
+ setContentType(contentType: string): File;
1061
+ /**
1062
+ * Gets the file content Base64 encoded
1063
+ */
1064
+ getContent(): Promise<string>;
1065
+ /**
1066
+ *
1067
+ * Sets the File content Base64 encoded.
1068
+ *
1069
+ * @returns This File, for chainning.
1070
+ */
1071
+ setContent(content: string): File;
1072
+ /**
1073
+ * Gets the file serving url for accessing via browser
1074
+ */
1075
+ getUrl(): string;
1076
+ /**
1077
+ * Gets the file size in bytes
1078
+ */
1079
+ getSize(): number;
1080
+ /**
1081
+ * Perform create new File.
1082
+ */
1083
+ create(): Promise<File>;
1084
+ }
1085
+
1086
+ /**
1087
+ * This class defines a Group of [[Accounts]].
1088
+ *
1089
+ * Accounts can be grouped by different meaning, like Expenses, Revenue, Assets, Liabilities and so on
1090
+ *
1091
+ * Its useful to keep organized and for high level analysis.
1092
+ *
1093
+ * @public
1094
+ */
1095
+ export declare class Group {
1096
+
1097
+ accounts: Set<Account>;
1098
+
1099
+ /**
1100
+ *
1101
+ * @returns The wrapped plain json object
1102
+ */
1103
+ json(): bkper.Group;
1104
+ /**
1105
+ * @returns The id of this Group
1106
+ */
1107
+ getId(): string;
1108
+ /**
1109
+ * @returns The parent Group
1110
+ */
1111
+ getParent(): Promise<Group>;
1112
+ /**
1113
+ * Sets the parent Group.
1114
+ *
1115
+ * @returns This Group, for chainning.
1116
+ */
1117
+ setParent(group: Group | null): Group;
1118
+ /**
1119
+ * @returns The name of this Group
1120
+ */
1121
+ getName(): string;
1122
+ /**
1123
+ * Sets the name of the Group.
1124
+ *
1125
+ * @returns This Group, for chainning.
1126
+ */
1127
+ setName(name: string): Group;
1128
+ /**
1129
+ * @returns The name of this group without spaces and special characters
1130
+ */
1131
+ getNormalizedName(): string;
1132
+ /**
1133
+ * @returns All Accounts of this group.
1134
+ */
1135
+ getAccounts(): Promise<Account[]>;
1136
+ /**
1137
+ * @returns True if this group has any account in it
1138
+ */
1139
+ hasAccounts(): boolean;
1140
+ /**
1141
+ * @returns The type for of the accounts of this group. Null if mixed
1142
+ */
1143
+ getType(): AccountType;
1144
+ /**
1145
+ * Gets the custom properties stored in this Group
1146
+ */
1147
+ getProperties(): {
1148
+ [key: string]: string;
1149
+ };
1150
+ /**
1151
+ * Sets the custom properties of the Group
1152
+ *
1153
+ * @param properties - Object with key/value pair properties
1154
+ *
1155
+ * @returns This Group, for chainning.
1156
+ */
1157
+ setProperties(properties: {
1158
+ [key: string]: string;
1159
+ }): Group;
1160
+ /**
1161
+ * Gets the property value for given keys. First property found will be retrieved
1162
+ *
1163
+ * @param keys - The property key
1164
+ */
1165
+ getProperty(...keys: string[]): string;
1166
+ /**
1167
+ * Sets a custom property in the Group.
1168
+ *
1169
+ * @param key - The property key
1170
+ * @param value - The property value
1171
+ */
1172
+ setProperty(key: string, value: string): Group;
1173
+ /**
1174
+ * Delete a custom property
1175
+ *
1176
+ * @param key - The property key
1177
+ *
1178
+ * @returns This Group, for chainning.
1179
+ */
1180
+ deleteProperty(key: string): Group;
1181
+ /**
1182
+ * Tell if the Group is hidden on main transactions menu
1183
+ */
1184
+ isHidden(): boolean;
1185
+ /**
1186
+ * Hide/Show group on main menu.
1187
+ */
1188
+ setHidden(hidden: boolean): Group;
1189
+ /**
1190
+ * Perform create new group.
1191
+ */
1192
+ create(): Promise<Group>;
1193
+ /**
1194
+ * Perform update group, applying pending changes.
1195
+ */
1196
+ update(): Promise<Group>;
1197
+ /**
1198
+ * Perform delete group.
1199
+ */
1200
+ remove(): Promise<Group>;
1201
+ }
1202
+
1203
+ /**
1204
+ * This class defines a Integration from an [[User]] to an external service.
1205
+ *
1206
+ * @public
1207
+ */
1208
+ export declare class Integration {
1209
+
1210
+ constructor(json: bkper.Integration);
1211
+ /**
1212
+ * Gets the wrapped plain json object of the Integration.
1213
+ *
1214
+ * @returns The Integration wrapped plain json object
1215
+ */
1216
+ json(): bkper.Integration;
1217
+ /**
1218
+ * Gets the [[Book]] id of the Integration.
1219
+ *
1220
+ * @returns The Integration's Book id
1221
+ */
1222
+ getBookId(): string;
1223
+ /**
1224
+ * Gets the id of the Integration.
1225
+ *
1226
+ * @returns This Integration's id
1227
+ */
1228
+ getId(): string;
1229
+ /**
1230
+ * Gets the name of the Integration.
1231
+ *
1232
+ * @returns The Integration's name
1233
+ */
1234
+ getName(): string;
1235
+ /**
1236
+ * Gets the custom properties stored in the Integration.
1237
+ *
1238
+ * @returns Object with key/value pair properties
1239
+ */
1240
+ getProperties(): {
1241
+ [key: string]: string;
1242
+ };
1243
+ /**
1244
+ * Sets the custom properties of the Integration.
1245
+ *
1246
+ * @param properties - Object with key/value pair properties
1247
+ *
1248
+ * @returns The Integration, for chainning
1249
+ */
1250
+ setProperties(properties: {
1251
+ [key: string]: string;
1252
+ }): Integration;
1253
+ /**
1254
+ * Gets the property value for given keys. First property found will be retrieved.
1255
+ *
1256
+ * @param keys - The property key
1257
+ *
1258
+ * @returns The retrieved property value
1259
+ */
1260
+ getProperty(...keys: string[]): string;
1261
+ /**
1262
+ * Sets a custom property in the Integration.
1263
+ *
1264
+ * @param key - The property key
1265
+ * @param value - The property value
1266
+ *
1267
+ * @returns The Integration, for chaining
1268
+ */
1269
+ setProperty(key: string, value: string): Integration;
1270
+ /**
1271
+ * Deletes a custom property stored in the Integration.
1272
+ *
1273
+ * @param key - The property key
1274
+ *
1275
+ * @returns The Integration, for chainning
1276
+ */
1277
+ deleteProperty(key: string): Integration;
1278
+ }
1279
+
1280
+ /**
1281
+ * Enum that represents a Month.
1282
+ *
1283
+ * @public
1284
+ */
1285
+ declare enum Month {
1286
+ JANUARY = "JANUARY",
1287
+ FEBRUARY = "FEBRUARY",
1288
+ MARCH = "MARCH",
1289
+ APRIL = "APRIL",
1290
+ MAY = "MAY",
1291
+ JUNE = "JUNE",
1292
+ JULY = "JULY",
1293
+ AUGUST = "AUGUST",
1294
+ SEPTEMBER = "SEPTEMBER",
1295
+ OCTOBER = "OCTOBER",
1296
+ NOVEMBER = "NOVEMBER",
1297
+ DECEMBER = "DECEMBER"
1298
+ }
1299
+
1300
+ /**
1301
+ * Enum that represents a period slice.
1302
+ *
1303
+ * @public
1304
+ */
1305
+ declare enum Period {
1306
+ /**
1307
+ * Monthly period
1308
+ */
1309
+ MONTH = "MONTH",
1310
+ /**
1311
+ * Quarterly period
1312
+ */
1313
+ QUARTER = "QUARTER",
1314
+ /**
1315
+ * Yearly period
1316
+ */
1317
+ YEAR = "YEAR"
1318
+ }
1319
+
1320
+ /**
1321
+ * The Periodicity of the query. It may depend on the level of granularity you write the range params.
1322
+ *
1323
+ * @public
1324
+ */
1325
+ export declare enum Periodicity {
1326
+ /**
1327
+ * Example: after:25/01/1983, before:04/03/2013, after:$d-30, before:$d, after:$d-15/$m
1328
+ */
1329
+ DAILY = "DAILY",
1330
+ /**
1331
+ * Example: after:jan/2013, before:mar/2013, after:$m-1, before:$m
1332
+ */
1333
+ MONTHLY = "MONTHLY",
1334
+ /**
1335
+ * Example: on:2013, after:2013, $y
1336
+ */
1337
+ YEARLY = "YEARLY"
1338
+ }
1339
+
1340
+ /**
1341
+ * Enum representing permissions of user in the Book
1342
+ *
1343
+ * Learn more at [share article](https://help.bkper.com/en/articles/2569153-share-your-book-with-your-peers).
1344
+ *
1345
+ * @public
1346
+ */
1347
+ export declare enum Permission {
1348
+ /**
1349
+ * No permission
1350
+ */
1351
+ NONE = "NONE",
1352
+ /**
1353
+ * View transactions, accounts and balances.
1354
+ */
1355
+ VIEWER = "VIEWER",
1356
+ /**
1357
+ * Record and delete drafts only. Useful to collect data only
1358
+ */
1359
+ RECORDER = "RECORDER",
1360
+ /**
1361
+ * View transactions, accounts, record and delete drafts
1362
+ */
1363
+ POSTER = "POSTER",
1364
+ /**
1365
+ * Manage accounts, transactions, book configuration and sharing
1366
+ */
1367
+ EDITOR = "EDITOR",
1368
+ /**
1369
+ * Manage everything, including book visibility and deletion. Only one owner per book.
1370
+ */
1371
+ OWNER = "OWNER"
1372
+ }
1373
+
1374
+ /**
1375
+ *
1376
+ * This class defines a Transaction between [credit and debit](http://en.wikipedia.org/wiki/Debits_and_credits) [[Accounts]].
1377
+ *
1378
+ * A Transaction is the main entity on the [Double Entry](http://en.wikipedia.org/wiki/Double-entry_bookkeeping_system) [Bookkeeping](http://en.wikipedia.org/wiki/Bookkeeping) system.
1379
+ *
1380
+ * @public
1381
+ */
1382
+ export declare class Transaction {
1383
+
1384
+
1385
+ /**
1386
+ *
1387
+ * @returns The wrapped plain json object
1388
+ */
1389
+ json(): bkper.Transaction;
1390
+ /**
1391
+ * @returns The id of the Transaction.
1392
+ */
1393
+ getId(): string;
1394
+ /**
1395
+ * @returns The id of the agent that created this transaction
1396
+ */
1397
+ getAgentId(): string;
1398
+ /**
1399
+ * Remote ids are used to avoid duplication.
1400
+ *
1401
+ * @returns The remote ids of the Transaction.
1402
+ */
1403
+ getRemoteIds(): string[];
1404
+ /**
1405
+ * Add a remote id to the Transaction.
1406
+ *
1407
+ * @param remoteId - The remote id to add.
1408
+ *
1409
+ * @returns This Transaction, for chainning.
1410
+ */
1411
+ addRemoteId(remoteId: string): Transaction;
1412
+ /**
1413
+ * @returns True if transaction was already posted to the accounts. False if is still a Draft.
1414
+ */
1415
+ isPosted(): boolean;
1416
+ /**
1417
+ * @returns True if transaction is checked.
1418
+ */
1419
+ isChecked(): boolean;
1420
+ /**
1421
+ * Set the check state of the Transaction.
1422
+ *
1423
+ * @param checked - The check state.
1424
+ *
1425
+ * @returns This Transaction, for chainning.
1426
+ */
1427
+ setChecked(checked: boolean): Transaction;
1428
+ /**
1429
+ * @returns True if transaction is in trash.
1430
+ */
1431
+ isTrashed(): boolean;
1432
+ /**
1433
+ * @returns All #hashtags used on the transaction.
1434
+ */
1435
+ getTags(): string[];
1436
+ /**
1437
+ * @returns All urls of the transaction.
1438
+ */
1439
+ getUrls(): string[];
1440
+ /**
1441
+ * Sets the Transaction urls. Url starts with https://
1442
+ *
1443
+ * @param urls - The urls array.
1444
+ *
1445
+ * @returns This Transaction, for chainning.
1446
+ */
1447
+ setUrls(urls: string[]): Transaction;
1448
+ /**
1449
+ * Add a url to the Transaction. Url starts with https://
1450
+ *
1451
+ * @param url - The url to add.
1452
+ *
1453
+ * @returns This Transaction, for chainning.
1454
+ */
1455
+ addUrl(url: string): Transaction;
1456
+ /**
1457
+ * @returns The files attached to the transaction.
1458
+ */
1459
+ getFiles(): File[];
1460
+ /**
1461
+ *
1462
+ * Adds a file attachment to the Transaction.
1463
+ *
1464
+ * Files not previously created in the Book will be automatically created.
1465
+ *
1466
+ * @param file - The file to add
1467
+ *
1468
+ * @returns This Transaction, for chainning.
1469
+ */
1470
+ addFile(file: File): Promise<Transaction>;
1471
+ /**
1472
+ * Check if the transaction has the specified tag.
1473
+ */
1474
+ hasTag(tag: string): boolean;
1475
+ /**
1476
+ * Gets the custom properties stored in this Transaction.
1477
+ */
1478
+ getProperties(): {
1479
+ [key: string]: string;
1480
+ };
1481
+ /**
1482
+ * Sets the custom properties of the Transaction
1483
+ *
1484
+ * @param properties - Object with key/value pair properties
1485
+ *
1486
+ * @returns This Transaction, for chainning.
1487
+ */
1488
+ setProperties(properties: {
1489
+ [key: string]: string;
1490
+ }): Transaction;
1491
+ /**
1492
+ * Gets the property value for given keys. First property found will be retrieved
1493
+ *
1494
+ * @param keys - The property key
1495
+ */
1496
+ getProperty(...keys: string[]): string;
1497
+ /**
1498
+ * Gets the custom properties keys stored in this Transaction.
1499
+ */
1500
+ getPropertyKeys(): string[];
1501
+ /**
1502
+ * Sets a custom property in the Transaction.
1503
+ *
1504
+ * @param key - The property key
1505
+ * @param value - The property value
1506
+ *
1507
+ * @returns This Transaction, for chainning.
1508
+ */
1509
+ setProperty(key: string, value: string): Transaction;
1510
+ /**
1511
+ * Delete a custom property
1512
+ *
1513
+ * @param key - The property key
1514
+ *
1515
+ * @returns This Transaction, for chainning.
1516
+ */
1517
+ deleteProperty(key: string): Transaction;
1518
+ /**
1519
+ * @returns The credit account. The same as origin account.
1520
+ */
1521
+ getCreditAccount(): Promise<Account>;
1522
+ /**
1523
+ * @returns The credit account name.
1524
+ */
1525
+ getCreditAccountName(): Promise<string>;
1526
+ /**
1527
+ *
1528
+ * Sets the credit/origin Account of the Transaction. Same as from().
1529
+ *
1530
+ * @param account - Account id, name or object.
1531
+ *
1532
+ * @returns This Transaction, for chainning.
1533
+ */
1534
+ setCreditAccount(account: Account | bkper.Account): Transaction;
1535
+ /**
1536
+ *
1537
+ * Sets the credit/origin Account of the Transaction. Same as setCreditAccount().
1538
+ *
1539
+ * @param account - Account id, name or object.
1540
+ *
1541
+ * @returns This Transaction, for chainning.
1542
+ */
1543
+ from(account: Account | bkper.Account): Transaction;
1544
+ /**
1545
+ * @returns The debit account. The same as destination account.
1546
+ *
1547
+ */
1548
+ getDebitAccount(): Promise<Account>;
1549
+ /**
1550
+ * @returns The debit account name.
1551
+ */
1552
+ getDebitAccountName(): Promise<string>;
1553
+ /**
1554
+ *
1555
+ * Sets the debit/destination Account of the Transaction. Same as to().
1556
+ *
1557
+ * @param account - Account id, name or object.
1558
+ *
1559
+ * @returns This Transaction, for chainning.
1560
+ */
1561
+ setDebitAccount(account: Account | bkper.Account): Transaction;
1562
+ /**
1563
+ *
1564
+ * Sets the debit/destination Account of the Transaction. Same as setDebitAccount().
1565
+ *
1566
+ * @param account - Account id, name or object.
1567
+ *
1568
+ * @returns This Transaction, for chainning.
1569
+ */
1570
+ to(account: Account | bkper.Account): Transaction;
1571
+ /**
1572
+ * @returns The amount of the transaction.
1573
+ */
1574
+ getAmount(): Amount;
1575
+ /**
1576
+ *
1577
+ * Sets the amount of the Transaction.
1578
+ *
1579
+ * @returns This Transaction, for chainning.
1580
+ */
1581
+ setAmount(amount: Amount | number | string): Transaction;
1582
+ /**
1583
+ * Get the absolute amount of this transaction if the given account is at the credit side, else null.
1584
+ *
1585
+ * @param account - The account object, id or name.
1586
+ */
1587
+ getCreditAmount(account: Account | string): Promise<Amount>;
1588
+ /**
1589
+ * Gets the absolute amount of this transaction if the given account is at the debit side, else null.
1590
+ *
1591
+ * @param account - The account object, id or name.
1592
+ */
1593
+ getDebitAmount(account: Account | string): Promise<Amount>;
1594
+ /**
1595
+ * Gets the [[Account]] at the other side of the transaction given the one in one side.
1596
+ *
1597
+ * @param account - The account object, id or name.
1598
+ */
1599
+ getOtherAccount(account: Account | string): Promise<Account>;
1600
+ /**
1601
+ *
1602
+ * The account name at the other side of the transaction given the one in one side.
1603
+ *
1604
+ * @param account - The account object, id or name.
1605
+ */
1606
+ getOtherAccountName(account: string | Account): Promise<string>;
1607
+ /**
1608
+ *
1609
+ * Tell if the given account is credit on the transaction
1610
+ *
1611
+ * @param account - The account object
1612
+ */
1613
+ isCredit(account: Account): Promise<boolean>;
1614
+ /**
1615
+ *
1616
+ * Tell if the given account is debit on the transaction
1617
+ *
1618
+ * @param account - The account object
1619
+ */
1620
+ isDebit(account: Account): Promise<boolean>;
1621
+
1622
+ /**
1623
+ * @returns The description of this transaction.
1624
+ */
1625
+ getDescription(): string;
1626
+ /**
1627
+ *
1628
+ * Sets the description of the Transaction.
1629
+ *
1630
+ * @returns This Transaction, for chainning.
1631
+ */
1632
+ setDescription(description: string): Transaction;
1633
+ /**
1634
+ * @returns The Transaction date, in ISO format yyyy-MM-dd.
1635
+ */
1636
+ getDate(): string;
1637
+ /**
1638
+ *
1639
+ * Sets the date of the Transaction.
1640
+ *
1641
+ * @returns This Transaction, for chainning
1642
+ */
1643
+ setDate(date: string | Date): Transaction;
1644
+ /**
1645
+ * @returns The Transaction Date object, on the time zone of the [[Book]].
1646
+ */
1647
+ getDateObject(): Date;
1648
+ /**
1649
+ * @returns The Transaction date number, in format YYYYMMDD.
1650
+ */
1651
+ getDateValue(): number;
1652
+ /**
1653
+ * @returns The Transaction date, formatted on the date pattern of the [[Book]].
1654
+ */
1655
+ getDateFormatted(): string;
1656
+ /**
1657
+ * @returns The date the transaction was created.
1658
+ */
1659
+ getCreatedAt(): Date;
1660
+ /**
1661
+ * @returns The date the transaction was created, formatted according to the date pattern of [[Book]].
1662
+ */
1663
+ getCreatedAtFormatted(): string;
1664
+
1665
+
1666
+ /**
1667
+ * Gets the balance that the [[Account]] has at that day, when listing transactions of that Account.
1668
+ *
1669
+ * Evolved balances is returned when searching for transactions of a permanent [[Account]].
1670
+ *
1671
+ * Only comes with the last posted transaction of the day.
1672
+ *
1673
+ * @param raw - True to get the raw balance, no matter the credit nature of the [[Account]].
1674
+ */
1675
+ getAccountBalance(raw?: boolean): Promise<Amount>;
1676
+ /**
1677
+ * Perform create new draft transaction.
1678
+ */
1679
+ create(): Promise<Transaction>;
1680
+ /**
1681
+ * Upddate transaction, applying pending changes.
1682
+ */
1683
+ update(): Promise<Transaction>;
1684
+ /**
1685
+ * Perform check transaction.
1686
+ */
1687
+ check(): Promise<Transaction>;
1688
+ /**
1689
+ * Perform uncheck transaction.
1690
+ */
1691
+ uncheck(): Promise<Transaction>;
1692
+ /**
1693
+ * Perform post transaction, changing credit and debit [[Account]] balances.
1694
+ */
1695
+ post(): Promise<Transaction>;
1696
+ /**
1697
+ * Remove the transaction, sending to trash.
1698
+ */
1699
+ remove(): Promise<Transaction>;
1700
+ /**
1701
+ * Restore the transaction from trash.
1702
+ */
1703
+ restore(): Promise<Transaction>;
1704
+ }
1705
+
1706
+ /**
1707
+ *
1708
+ * An iterator that allows scripts to iterate over a potentially large collection of transactions.
1709
+ *
1710
+ * Example:
1711
+ *
1712
+ * ```js
1713
+ * var book = BkperApp.getBook("agtzfmJrcGVyLWhyZHITCxIGTGVkZ2VyGICAgIDggqALDA");
1714
+ *
1715
+ * var transactionIterator = book.getTransactions("account:CreditCard after:28/01/2013 before:29/01/2013");
1716
+ *
1717
+ * while (transactionIterator.hasNext()) {
1718
+ * var transaction = transactions.next();
1719
+ * Logger.log(transaction.getDescription());
1720
+ * }
1721
+ * ```
1722
+ *
1723
+ * @public
1724
+ */
1725
+ export declare class TransactionIterator {
1726
+
1727
+
1728
+
1729
+
1730
+
1731
+
1732
+ /**
1733
+ * Gets the Book that originate the iterator
1734
+ */
1735
+ getBook(): Book;
1736
+ /**
1737
+ * Gets a token that can be used to resume this iteration at a later time.
1738
+ *
1739
+ * This method is useful if processing an iterator in one execution would exceed the maximum execution time.
1740
+ *
1741
+ * Continuation tokens are generally valid short period of time.
1742
+ */
1743
+ getContinuationToken(): string;
1744
+ /**
1745
+ * Sets a continuation token from previous paused iteration
1746
+ */
1747
+ setContinuationToken(continuationToken: string): Promise<void>;
1748
+ /**
1749
+ * Determines whether calling next() will return a transaction.
1750
+ */
1751
+ hasNext(): Promise<boolean>;
1752
+ /**
1753
+ * Gets the next transaction in the collection of transactions.
1754
+ */
1755
+ next(): Promise<Transaction>;
1756
+ /**
1757
+ * @returns The account, when filtering by a single account.
1758
+ */
1759
+ getAccount(): Promise<Account>;
1760
+ }
1761
+
1762
+ /**
1763
+ * This class defines a User.
1764
+ *
1765
+ * @public
1766
+ */
1767
+ export declare class User {
1768
+
1769
+ constructor(wrapped: bkper.User);
1770
+ /**
1771
+ * Gets the id of the User.
1772
+ *
1773
+ * @returns The User's id
1774
+ */
1775
+ getId(): string;
1776
+ /**
1777
+ * Gets the name of the User.
1778
+ *
1779
+ * @returns The User's name
1780
+ */
1781
+ getName(): string;
1782
+ /**
1783
+ * Gets the full name of the User.
1784
+ *
1785
+ * @returns The User's full name
1786
+ */
1787
+ getFullName(): string;
1788
+ /**
1789
+ * Gets the [[Connections]] of the User.
1790
+ *
1791
+ * @returns The retrieved Connection objects
1792
+ */
1793
+ getConnections(): Promise<Connection[]>;
1794
+ /**
1795
+ * Gets a [[Connection]] of the User.
1796
+ *
1797
+ * @param id - The Connection's id
1798
+ *
1799
+ * @returns The retrieved Connection object
1800
+ */
1801
+ getConnection(id: string): Promise<Connection>;
1802
+ }
1803
+
1804
+ export { }