Skip to main content

Notification API Introduction

Notification Type

Represents a type of notification.

type NotificationType {
type: String,
index: Int
}

Fields

  • type (String): The name of the notification type.
  • index (Int): The index of the notification type.

Notification

Represents a notification sent to a user.

type Notification {
id: Int,
userId: Int,
timeStamp: Float,
nType: Int,
read: Boolean,
title: String,
msg: String
}

Fields

  • id (Int): The ID of the notification.
  • userId (Int): The ID of the user receiving the notification.
  • timeStamp (Float): The timestamp of when the notification was sent.
  • nType (Int): The type of notification (as an integer value).
  • read (Boolean): Whether the notification has been read.
  • title (String): The title of the notification.
  • msg (String): The message content of the notification.

Notification Settings

To speed up sending notifications, there is an integer value for notification settings in the user table. All notification settings are stored as bits of a binary value.

Binary Value Mapping

Binary ValueNotification Type NameNotification Type Value
0000,0000,0000,0001bNEW ROUND STARTED0
0000,0000,0000,0010bBID RANKING UPDATED1
0000,0000,0000,0100bROUND FINISHED2
0000,0000,0000,1000bPAYMENT RESULT3
0000,0000,0001,0000bVERIFICATION RESULT4
.........

If a user has enabled BID RANKING UPDATED, PAYMENT RESULT, and VERIFICATION RESULT, their setting value will be 0001,1010b.

Example Usage

If you want to check a user's notification settings, you can decode the integer value stored in their profile to determine which notifications are enabled. For instance:

  • Binary value 0001,1010b corresponds to decimal 26.
  • This means the user has enabled notifications for:
    • BID RANKING UPDATED (bit 1)
    • PAYMENT RESULT (bit 3)
    • VERIFICATION RESULT (bit 4)

These bits are set to 1 in the user's notification settings integer value.