@allthings/sdk
Version:
Allthings Node/Javascript SDK
62 lines (61 loc) • 2.71 kB
TypeScript
import { EntityResultList, IAllthingsRestClient } from '../types';
export declare enum EnumNotificationCategory {
events = "events",
hintsAndTips = "hints-and-tips",
lostAndFound = "lost-and-found",
localDeals = "local-deals",
localEvents = "local-events",
miscellaneous = "miscellaneous",
deals = "deals",
messages = "messages",
adminMessages = "admin-messages",
newThingsToGive = "new-things-to-give",
newThingsForSale = "new-things-for-sale",
surveys = "surveys",
supportOffer = "support-offer",
supportRequest = "support-request",
sustainability = "sustainability",
localServices = "local-services",
services = "services",
ticketDigestEmail = "ticket-digest-email",
appDigestEmail = "app-digest-email",
newFile = "new-file"
}
export declare enum EnumNotificationType {
clipboardThing = "clipboard-thing",
comment = "comment",
communityArticle = "community-article",
newFile = "new-file",
ticketComment = "ticket-comment",
welcomeNotification = "welcome-notification"
}
export interface IBasicNotification {
readonly category: EnumNotificationCategory;
readonly id: string;
readonly read: boolean;
readonly title: string;
readonly type: EnumNotificationType;
}
export interface IPreprocessedNotification extends IBasicNotification {
readonly createdAt: string;
readonly objectID: string;
readonly referencedObjectID: string | null;
}
export interface INotification extends IBasicNotification {
readonly createdAt: Date;
readonly objectId: string;
readonly referencedObjectId: string | null;
}
export type NotificationResultList = EntityResultList<INotification, {
readonly metaData: {
readonly unreadNotifications: number;
};
}>;
export type MethodNotificationsGetByUser = (userId: string, page?: number, limit?: number) => NotificationResultList;
export declare function notificationsGetByUser(client: IAllthingsRestClient, userId: string, page?: number, limit?: number): NotificationResultList;
export type NotificationsUpdateReadByUserResult = Promise<null>;
export type MethodNotificationsUpdateReadByUser = (userId: string, lastReadAt?: Date) => NotificationsUpdateReadByUserResult;
export declare function notificationsUpdateReadByUser(client: IAllthingsRestClient, userId: string, lastReadAt?: Date): NotificationsUpdateReadByUserResult;
export type NotificationUpdateReadResult = Promise<INotification>;
export type MethodNotificationUpdateRead = (notificationId: string) => NotificationUpdateReadResult;
export declare function notificationUpdateRead(client: IAllthingsRestClient, notificationId: string): NotificationUpdateReadResult;