import type { SzPlatformService } from '../classes.platformservice.js'; import * as plugins from '../plugins.js'; export interface ILetterConstructorOptions { letterxpressUser: string; letterxpressToken: string; } export class LetterService { public platformServiceRef: SzPlatformService; public options: ILetterConstructorOptions; public letterxpressAccount: plugins.letterxpress.LetterXpressAccount; public typedrouter = new plugins.typedrequest.TypedRouter(); constructor(platformServiceRefArg: SzPlatformService, optionsArg: ILetterConstructorOptions) { this.platformServiceRef = platformServiceRefArg; this.options = optionsArg; this.platformServiceRef.typedrouter.addTypedRouter(this.typedrouter); this.typedrouter.addTypedHandler< plugins.servezoneInterfaces.platformservice.letter.IRequest_SendLetter >(new plugins.typedrequest.TypedHandler('sendLetter', async dataArg => { if(dataArg.needsCover) { } return { processId: '', } })); } public async start() { this.letterxpressAccount = new plugins.letterxpress.LetterXpressAccount({ username: this.options.letterxpressUser, apiKey: this.options.letterxpressToken, }); await this.letterxpressAccount.start(); } public async stop() {} }