2024-10-05 07:54:09 +02:00
|
|
|
import type { SzPlatformClient } from '../classes.platformclient.js';
|
|
|
|
|
import * as plugins from '../plugins.js';
|
|
|
|
|
|
|
|
|
|
export class SzPushNotificationConnector {
|
|
|
|
|
public platformClientRef: SzPlatformClient;
|
|
|
|
|
|
|
|
|
|
constructor(platformClientRefArg: SzPlatformClient) {
|
|
|
|
|
this.platformClientRef = platformClientRefArg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async sendPushNotification(
|
2026-04-28 11:30:20 +00:00
|
|
|
optionsArg: plugins.servezoneInterfaces.platform.pushnotification.IReq_SendPushNotification['request']
|
2024-10-05 07:54:09 +02:00
|
|
|
) {
|
|
|
|
|
if (this.platformClientRef.debugMode) {
|
|
|
|
|
console.log('sendPushNotification', optionsArg);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.platformClientRef.debugMode) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const typedRequest =
|
2026-04-28 11:30:20 +00:00
|
|
|
this.platformClientRef.typedsocket.createTypedRequest<plugins.servezoneInterfaces.platform.pushnotification.IReq_SendPushNotification>(
|
2024-10-05 07:54:09 +02:00
|
|
|
'sendPushNotification'
|
|
|
|
|
);
|
|
|
|
|
const response = await typedRequest.fire(optionsArg);
|
|
|
|
|
|
|
|
|
|
if (process.env.SERVEZONE_PLATFORMCLIENT_DEBUG) {
|
|
|
|
|
console.log('sendPushNotification response', response);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return response.status;
|
|
|
|
|
}
|
2026-04-28 11:30:20 +00:00
|
|
|
}
|