30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
|
import type { SzPlatformClient } from '../classes.platformclient.js';
|
||
|
import * as plugins from '../plugins.js';
|
||
|
|
||
|
export class SzSmsConnector {
|
||
|
public platformClientRef: SzPlatformClient;
|
||
|
|
||
|
constructor(platformClientRefArg: SzPlatformClient) {
|
||
|
this.platformClientRef = platformClientRefArg;
|
||
|
}
|
||
|
|
||
|
public async sendSms(messageArg: plugins.servezoneInterfaces.platformservice.sms.IRequest_SendSms['request']) {
|
||
|
const typedrequest = this.platformClientRef.typedsocket.createTypedRequest<plugins.servezoneInterfaces.platformservice.sms.IRequest_SendSms>(
|
||
|
'sendSms'
|
||
|
);
|
||
|
const response = await typedrequest.fire(messageArg);
|
||
|
return response.status;
|
||
|
}
|
||
|
|
||
|
public async sendSmsVerifcation(
|
||
|
recipientArg: plugins.servezoneInterfaces.platformservice.sms.IRequest_SendVerificationCode['request']
|
||
|
) {
|
||
|
const typedrequest =
|
||
|
this.platformClientRef.typedsocket.createTypedRequest<plugins.servezoneInterfaces.platformservice.sms.IRequest_SendVerificationCode>(
|
||
|
'sendVerificationCode'
|
||
|
);
|
||
|
const response = await typedrequest.fire(recipientArg);
|
||
|
return response.verificationCode;
|
||
|
}
|
||
|
}
|