web-push-notifications
Version:
Pushwoosh web push notifications
84 lines (83 loc) • 2.88 kB
TypeScript
export type TInboxActionLink = 1;
export type TInboxActionRichMedia = 2;
export type TInboxActionType = TInboxActionLink | TInboxActionRichMedia;
export type TInboxMessageStatusDelivered = 1;
export type TInboxMessageStatusRead = 2;
export type TInboxMessageStatusOpen = 3;
export type TInboxMessageStatusDeleted = 4;
export type TInboxMessageStatus = TInboxMessageStatusDelivered | TInboxMessageStatusRead | TInboxMessageStatusOpen | TInboxMessageStatusDeleted;
export type TReadInboxMessagesStatusRange = [TInboxMessageStatusRead, TInboxMessageStatusOpen];
export interface IInboxMessageActionParams {
l?: string | null;
rm?: string;
h?: string;
r?: string;
}
export interface IInboxMessage {
inbox_id: string;
order: string;
rt: string;
send_date: string;
title: string;
image: string;
text: string;
action_type: TInboxActionType;
action_params: string;
status: TInboxMessageStatus;
}
export interface IGetInboxMessagesRequest {
application: string;
userId: string;
hwid: string;
last_code: string;
count?: number;
last_request_time: number;
}
export interface IGetInboxMessagesResponse {
messages: Array<IInboxMessage>;
next: string;
deleted: Array<string>;
new_inbox: number;
}
export interface IInboxStatusRequest {
userId: string;
hwid: string;
application: string;
inbox_code: string;
time: number;
status: TInboxMessageStatus;
hash?: string;
device_type: number;
}
export type TGetInboxMessagesMethod = 'getInboxMessages';
export type TInboxStatusMethod = 'inboxStatus';
export type TInboxMessagesIDBKeyPath = 'inbox_id';
export type TInboxMessagesIDBStatusIndex = 'status';
export type TInboxMessagesIDBRemovalTimeIndex = 'rt';
export type TInboxMessageTypePlain = 0;
export type TInboxMessageTypeRichmedia = 1;
export type TInboxMessageTypeURL = 2;
export type TInboxMessageTypeDeeplink = 3;
export type TInboxMessageType = TInboxMessageTypePlain | TInboxMessageTypeRichmedia | TInboxMessageTypeURL | TInboxMessageTypeDeeplink;
export type TInboxDefaultLink = '/';
export interface IInboxMessagePublic {
code: string;
title: string;
message: string;
imageUrl: string;
sendDate: string;
type: TInboxMessageType;
link: string | TInboxDefaultLink;
isRead: boolean;
isActionPerformed: boolean;
}
export interface IInboxMessages {
messagesWithNoActionPerformedCount(): Promise<number>;
unreadMessagesCount(): Promise<number>;
messagesCount(): Promise<number>;
loadMessages(): Promise<Array<IInboxMessagePublic>>;
readMessagesWithCodes(codes: Array<string>): Promise<void>;
performActionForMessageWithCode(code: string): Promise<void>;
deleteMessagesWithCodes(codes: Array<string>): Promise<void>;
publicMessageBuilder(message: IInboxMessage): Promise<IInboxMessagePublic>;
}