monzolib
Version:
Fully Featured JS/Node Monzo Library
104 lines (103 loc) • 3.28 kB
TypeScript
import { Amount } from './Amount';
import { Attachment, MonzoAttachmentResponse } from './Attachment';
import { Merchant, MonzoMerchantResponse } from './Merchant';
import { MonzoRequest } from './api';
import { Json } from './helpers';
export declare class Transaction {
private readonly tx;
constructor(tx: MonzoTransactionResponse);
get amount(): Amount;
get attachments(): Attachment[];
get balance(): Amount;
get category(): {
raw: string;
formatted: string;
toString: () => string;
};
get counterparty(): MonzoCounterpartyResponse;
get created(): Date;
get declined(): boolean;
get declineReason(): string | undefined;
get description(): string;
get displayName(): string;
get displaySub(): string;
get hidden(): boolean;
get icon(): string;
get iconFallback(): string;
get id(): string;
get is(): {
[feature: string]: boolean;
};
get inSpending(): boolean;
get location(): string;
get merchant(): Merchant | string | undefined;
get metadata(): Record<string, Json>;
get notes(): {
short: string;
full: string;
toString: () => string;
};
get online(): boolean;
get pending(): boolean;
get settled(): string;
selfRequest(): MonzoRequest;
changeCategoryRequest(category: string): MonzoRequest;
annotateRequest(key: string, val: string | number | boolean): MonzoRequest;
setNotesRequest(val: string): MonzoRequest;
hideRequest(): MonzoRequest;
unhideRequest(): MonzoRequest;
attachmentUploadRequest(contentType?: string): MonzoRequest;
attachmentRegisterRequest(fileUrl: string, contentType?: string): MonzoRequest;
get json(): MonzoTransactionResponse;
get stringify(): string;
}
export declare function transactionRequest(id: string): MonzoRequest;
export interface MonzoTransactionResponse extends Record<string, Json> {
account_balance: number;
account_id: string;
amount: number;
attachments: MonzoAttachmentResponse[];
can_be_excluded_from_breakdown: boolean;
can_be_made_subscription: boolean;
can_split_the_bill: boolean;
category: string;
counterparty: MonzoCounterpartyResponse;
created: string;
currency: string;
decline_reason: string;
dedupe_id: string;
description: string;
fees: {};
id: string;
include_in_spending: boolean;
international: null;
is_load: boolean;
labels: {};
local_amount: number;
local_currency: string;
merchant: MonzoMerchantResponse | string | null;
metadata: Record<string, Json>;
notes: string;
originator: boolean;
scheme: string;
settled: string;
updated: string;
user_id: string;
}
export interface MonzoTransactionOuterResponse extends Record<string, Json> {
transaction: MonzoTransactionResponse;
}
export interface MonzoTransactionsResponse extends Record<string, Json> {
transactions: MonzoTransactionResponse[];
}
export interface MonzoCounterpartyResponse extends Record<string, Json> {
name: string;
number: string;
preferred_name: string;
user_id: string;
}
export interface TransactionRequestOpts {
since?: Date | string;
before?: Date;
limit?: number;
}