ofx4js
Version:
A javascript OFX library, ported from OFX4J
100 lines (99 loc) • 2.96 kB
TypeScript
import { OFXConnection } from "./OFXConnection";
import { AggregateMarshaller } from "../../io/AggregateMarshaller";
import { AggregateUnmarshaller } from "../../io/AggregateUnmarshaller";
import { ResponseEnvelope } from "../../domain/data/ResponseEnvelope";
import { RequestEnvelope } from "../../domain/data/RequestEnvelope";
import { OutputBuffer } from "../../io/StreamWriter";
import { OFXWriter } from "../../io/OFXWriter";
export declare type HeadersObject = {
[header: string]: string;
};
export declare type AjaxHandler = (url: string, verb: string, headers: HeadersObject, data: string, async: boolean) => Promise<string>;
/**
* Base implementation for an OFX connection.
*/
export declare class OFXV1Connection implements OFXConnection {
private async;
private marshaller;
private unmarshaller;
private ajax;
constructor();
sendRequest(request: RequestEnvelope, url: string): Promise<ResponseEnvelope>;
/**
* Log a request buffer.
*
* @param outBuffer The buffer to log.
*/
protected logRequest(outBuffer: OutputBuffer): void;
protected logResponse(inBuffer: string): void;
/**
* Send the specified buffer to the specified URL.
*
* @param url The URL.
* @param outBuffer The buffer.
* @return a promise that resolves with the response.
*/
protected sendBuffer(url: string, outBuffer: OutputBuffer): Promise<string>;
/**
* Unmarshal the input stream.
*
* @param in The input stream.
* @return The response envelope.
*/
protected unmarshal(in_: string): ResponseEnvelope;
/**
* Create a new OFX writer.
*
* @param out The output stream for the writer.
* @return The OFX writer.
*/
protected newOFXWriter(out: OutputBuffer): OFXWriter;
/**
* The marshaller.
*
* @return The marshaller.
*/
getMarshaller(): AggregateMarshaller;
/**
* The marshaller.
*
* @param marshaller The marshaller.
*/
setMarshaller(marshaller: AggregateMarshaller): void;
/**
* The unmarshaller.
*
* @return The unmarshaller.
*/
getUnmarshaller(): AggregateUnmarshaller<ResponseEnvelope>;
/**
* The unmarshaller.
*
* @param unmarshaller The unmarshaller.
*/
setUnmarshaller(unmarshaller: AggregateUnmarshaller<ResponseEnvelope>): void;
/**
* Async mode
*
* @return {bool} Whether in async mode.
*/
getAsync(): boolean;
/**
* Async mode
*
* @param {bool} async async mode.
*/
setAsync(async: boolean): void;
/**
* Async mode
*
* @return {bool} Whether in async mode.
*/
getAjax(): AjaxHandler;
/**
* Async mode
*
* @param {bool} async async mode.
*/
setAjax(ajax: AjaxHandler): void;
}