Web SDK
  • Home
  • Overview
  • Getting started
  • References
    • Authentication
    • Account
      • Users
    • Notifications
    • Bookmark
    • 2FA
    • Collection
    • Connection filters
    • Feed
    • File Upload
    • Invite
    • Messaging
    • Payment
    • Reviews
    • Search
    • Verification
      • Supported document type
      • List of expected ISO countries
    • Wallet
      • Withdrawal
  • Tutorial
  • Web API
Powered by GitBook
On this page
  • Notification Model
  • Mark all Notifications as read
  • Mark a Notification as read
  • Get all Notifications
  • INotificationDto
  • filterNotificationDto
  1. References

Notifications

With the PAKT SDK, users can set notifications to draw user attention to desired Chainsite actions, relationships, and behaviors.

Notifications are advisory messages generated to provide information relating to activities that occur in the system.

The following are the list of features for notifications.

  1. Mark all their notifications as read

  2. Mark a notification as read

  3. Get all notifications

Notification Model

// Notification Model
interface NotificationModel {
  owner: NotificationUser;
  title: string;
  description: string;
  read: boolean;
  notifyUser: NotificationUser;
  data: string;
  isAdmin: boolean;
  type: INotificationType;
}

Mark all Notifications as read

Users can indicate all notifications as read. This feature requires the authenticated user jwt token.

export const markAll = async (authToken: string) => {
  //it returns a void
  const resp: ResponseDto<void> = await sdkInit.notifications.markAll(authToken);
};

Mark a Notification as read

Users can also mark a single notification as read, requiring the notification identifier, as well as the authorization token of the user who is owns the notification.

export const markSingleAsRead = (authToken: string, notificationId: string, filter?: NotificationModel) => {
  //it returns a void
  const resp: ResponseDto<void> = await sdkInit.notifications.markOneAsRead(authToken, notificationId);
};

Get all Notifications

Fetch all Notifications using the filterNotificationDto, which is an extension of INotificationDto

INotificationDto

Field
Description
Type

_id

The identification for the notification

string

owner

The user for which this notification was created

string | NotificationUser

title

The appellation of the notification

string

description

Detailed explanation of what the advisory is

string

read

Identifier to indicate if the notification is acknowledged

boolean

data

Meta data for the notification

string

isAdmin

Identifier to determine if the advisory for the Chainsite administration

boolean

type

The classification of the notification

INotificationType

filterNotificationDto

Field
Description
Type

page

limit

type FilterDto = {
  page?: string;
  limit?: string;
} & INotificationDto;

type FindNotificationDto = {
  page: number;
  pages: number;
  total: number;
  limit: number;
  notification: INotificationDto[];
};

export const getAll = async (filter?: FilterDto) => {
  const notifications: FindNotificationDto = await sdkInit.notifications.getAll(filter);
};
PreviousUsersNextBookmark

Last updated 11 months ago