import { ClientConfig } from '../config/ClientConfig'; import { HttpMessage } from '../node/sendHttpRequest'; export abstract class Base { abstract send(): Promise; protected abstract getDefaultRequest(): Promise; public certPem: string | null = null; protected privateKeyPem: string | null = null; protected publicKeyPem: string | null = null; protected autoCreteKeyPair: boolean = true; private _userConfig: typeof ClientConfig & Record = {...ClientConfig}; public get userConfig() { return this._userConfig; } public setKeyPair(privateKeyPem: string, publicKeyPem: string) { this.privateKeyPem = privateKeyPem; this.publicKeyPem = publicKeyPem; this.autoCreteKeyPair = false; } private request: any; async setRequest(result?: any) { this.request = result; } async getRequest() { if (!this.request) { this.request = await this.getDefaultRequest(); } return this.request; } }