///
import { DateTime } from 'luxon';
import { Api, ApiResponseType } from 'rest-api-handler';
import * as SCOPES from './api-scopes';
import * as ERROR_CODES from './error-codes';
import { TransactionOrientation } from './transaction-orientations';
import { TransactionCategory } from './transaction-categories';
interface Token {
access_token: string;
token_type: string;
refresh_token: string;
expires_in: number;
scope: string;
}
interface Transaction {
id: number;
amount: number;
discount: number;
category: TransactionCategory;
transactionDate: DateTime;
customMessage: string | undefined;
orientation: TransactionOrientation;
loanId: number;
loanName: string;
nickName: string;
}
interface TransactionsResponse {
transactions: Transaction[];
paging: {
page: number;
total: number;
};
}
export default class ZonkyApi extends Api> {
protected refreshToken?: string;
protected accessToken?: string;
protected tokenExpire?: DateTime;
static SCOPES: typeof SCOPES;
static ERROR_CODES: typeof ERROR_CODES;
constructor();
getAccessToken(): string | undefined;
setAccessToken(token?: string): this;
setRefreshToken(token: string): this;
getRefreshToken(): string | undefined;
setTokenExpire(expire: DateTime): this;
getTokenExpire(): DateTime | undefined;
login(username: string, password: string, scope?: SCOPES.ApiScope[]): Promise;
getTransactions(from?: DateTime, page?: number, size?: number): Promise;
download(endpoint: string, smsCode?: string): Promise;
downloadTransactions(smsCode?: string): Promise;
downloadInvestments(): Promise;
processTransactions(processor: (workout: Transaction) => Promise, from?: DateTime, size?: number, page?: number): Promise;
}
export {};