feat: 支持 push
This commit is contained in:
25
src/push-notifications/interfaces/apns-config.interface.ts
Normal file
25
src/push-notifications/interfaces/apns-config.interface.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
export interface ApnsConfig {
|
||||
token: {
|
||||
key: string | Buffer;
|
||||
keyId: string;
|
||||
teamId: string;
|
||||
};
|
||||
production: boolean;
|
||||
clientCount?: number;
|
||||
proxy?: {
|
||||
host: string;
|
||||
port: number;
|
||||
};
|
||||
connectionRetryLimit?: number;
|
||||
heartBeat?: number;
|
||||
requestTimeout?: number;
|
||||
}
|
||||
|
||||
export interface ApnsNotificationOptions {
|
||||
topic: string;
|
||||
id?: string;
|
||||
collapseId?: string;
|
||||
priority?: number;
|
||||
pushType?: string;
|
||||
expiry?: number;
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import { PushType } from '../enums/push-type.enum';
|
||||
|
||||
export interface PushNotificationRequest {
|
||||
userIds: string[];
|
||||
title: string;
|
||||
body: string;
|
||||
payload?: any;
|
||||
pushType?: PushType;
|
||||
priority?: number;
|
||||
expiry?: number;
|
||||
collapseId?: string;
|
||||
}
|
||||
|
||||
export interface PushNotificationByTemplateRequest {
|
||||
userIds: string[];
|
||||
templateKey: string;
|
||||
data: any;
|
||||
payload?: any;
|
||||
}
|
||||
|
||||
export interface PushResult {
|
||||
userId: string;
|
||||
deviceToken: string;
|
||||
success: boolean;
|
||||
error?: string;
|
||||
apnsResponse?: any;
|
||||
}
|
||||
|
||||
export interface BatchPushResult {
|
||||
totalUsers: number;
|
||||
totalTokens: number;
|
||||
successCount: number;
|
||||
failedCount: number;
|
||||
results: PushResult[];
|
||||
}
|
||||
|
||||
export interface RenderedTemplate {
|
||||
title: string;
|
||||
body: string;
|
||||
payload?: any;
|
||||
pushType: PushType;
|
||||
priority: number;
|
||||
}
|
||||
|
||||
export interface PushStats {
|
||||
totalSent: number;
|
||||
totalFailed: number;
|
||||
successRate: number;
|
||||
averageDeliveryTime: number;
|
||||
errorBreakdown: Record<string, number>;
|
||||
}
|
||||
|
||||
export interface QueryOptions {
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
startDate?: Date;
|
||||
endDate?: Date;
|
||||
status?: string;
|
||||
messageType?: string;
|
||||
}
|
||||
|
||||
export interface TimeRange {
|
||||
startDate: Date;
|
||||
endDate: Date;
|
||||
}
|
||||
Reference in New Issue
Block a user