31 lines
961 B
TypeScript
31 lines
961 B
TypeScript
import { PushChannel } from '../entities/device-token.entity';
|
|
|
|
export interface PushPayload {
|
|
token: string;
|
|
title: string;
|
|
body: string;
|
|
data?: Record<string, string>;
|
|
imageUrl?: string;
|
|
}
|
|
|
|
export interface PushResult {
|
|
success: boolean;
|
|
messageId?: string;
|
|
error?: string;
|
|
/** If true, the token is invalid and should be deactivated */
|
|
shouldDeactivateToken?: boolean;
|
|
}
|
|
|
|
export interface IPushChannelProvider {
|
|
readonly channel: PushChannel;
|
|
send(payload: PushPayload): Promise<PushResult>;
|
|
sendBatch(payloads: PushPayload[]): Promise<PushResult[]>;
|
|
}
|
|
|
|
export const FCM_PUSH_PROVIDER = Symbol('IFcmPushProvider');
|
|
export const APNS_PUSH_PROVIDER = Symbol('IApnsPushProvider');
|
|
export const HMS_PUSH_PROVIDER = Symbol('IHmsPushProvider');
|
|
export const XIAOMI_PUSH_PROVIDER = Symbol('IXiaomiPushProvider');
|
|
export const OPPO_PUSH_PROVIDER = Symbol('IOppoPushProvider');
|
|
export const VIVO_PUSH_PROVIDER = Symbol('IVivoPushProvider');
|