UNPKG

3.32 kBTypeScriptView Raw
1import { AxiosInstance } from "axios";
2import BunqJSClient from "./BunqJSClient";
3import Session from "./Session";
4import LoggerInterface from "./Interfaces/LoggerInterface";
5import ApiAdapterOptions from "./Types/ApiAdapterOptions";
6import { Method } from "./Types/Method";
7import Headers from "./Types/Headers";
8import RequestLimitFactory from "./RequestLimitFactory";
9import SignRequestHandler from "./HTTP/SignRequestHandler";
10import EncryptRequestHandler from "./HTTP/EncryptRequestHandler";
11import VerifyResponseHandler from "./HTTP/VerifyResponseHandler";
12export declare const BUNQ_SERVER_SIGNATURE_HEADER_KEY = "X-Bunq-Server-Signature";
13export declare const BUNQ_REQUEST_SIGNATURE_HEADER_KEY = "X-Bunq-Client-Signature";
14export declare const BUNQ_REQUEST_AUTHENTICATION_HEADER_KEY = "X-Bunq-Client-Authentication";
15export default class ApiAdapter {
16 Session: Session;
17 logger: LoggerInterface;
18 BunqJSClient: BunqJSClient;
19 RequestLimitFactory: RequestLimitFactory;
20 SignRequestHandler: SignRequestHandler;
21 EncryptRequestHandler: EncryptRequestHandler;
22 VerifyResponseHandler: VerifyResponseHandler;
23 language: string;
24 region: string;
25 geoLocation: string;
26 constructor(Session: Session, loggerInterface: LoggerInterface, BunqJSClient: BunqJSClient);
27 setup(): Promise<void>;
28 /**
29 * @param {string} url
30 * @param headers
31 * @param {ApiAdapterOptions} options
32 * @param {AxiosInstance | false} axiosInstance
33 * @returns {Promise<void>}
34 */
35 get(url: string, headers?: any, options?: ApiAdapterOptions, axiosInstance?: AxiosInstance | false): Promise<any>;
36 /**
37 * @param {string} url
38 * @param headers
39 * @param {ApiAdapterOptions} options
40 * @param {AxiosInstance | false} axiosInstance
41 * @returns {Promise<void>}
42 */
43 delete(url: string, headers?: any, options?: ApiAdapterOptions, axiosInstance?: AxiosInstance | false): Promise<any>;
44 /**
45 * @param {string} url
46 * @param data
47 * @param headers
48 * @param {ApiAdapterOptions} options
49 * @param {AxiosInstance | false} axiosInstance
50 * @returns {Promise<void>}
51 */
52 post(url: string, data?: any, headers?: any, options?: ApiAdapterOptions, axiosInstance?: AxiosInstance | false): Promise<any>;
53 /**
54 * @param {string} url
55 * @param data
56 * @param headers
57 * @param {ApiAdapterOptions} options
58 * @param {AxiosInstance | false} axiosInstance
59 * @returns {Promise<void>}
60 */
61 put(url: string, data?: any, headers?: any, options?: ApiAdapterOptions, axiosInstance?: AxiosInstance | false): Promise<any>;
62 /**
63 * @param {string} url
64 * @param {string} method
65 * @param data
66 * @param headers
67 * @param {ApiAdapterOptions} options
68 * @param {AxiosInstance | false} axiosInstance
69 * @returns {Promise<any>}
70 */
71 request(url: string, method?: Method, data?: any, headers?: Headers, options?: ApiAdapterOptions, axiosInstance?: AxiosInstance | false): Promise<any>;
72 /**
73 * Checks if the session is valid and waits for it to be refreshed
74 * @returns {Promise<void>}
75 */
76 private sessionValidationCheck;
77 /**
78 * Attempts to improve the error data and defaults to rethrowing it
79 * @param error
80 */
81 private requestErrorHandler;
82}