Notification

Address: [-------------]

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░█████╗░██╗░░░░░░█████╗░░██████╗██╗░░██╗░█████╗░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░██╔══██╗██║░░░░░██╔══██╗██╔════╝██║░██╔╝██╔══██╗░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░███████║██║░░░░░███████║╚█████╗░█████═╝░███████║░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░██╔══██║██║░░░░░██╔══██║░╚═══██╗██╔═██╗░██╔══██║░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░██║░░██║███████╗██║░░██║██████╔╝██║░╚██╗██║░░██║░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝╚═════╝░╚═╝░░╚═╝╚═╝░░╚═╝░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
░░░░ ░░░░░
░░░░ █▄░█ █▀█ ▀█▀ █ █▀▀ █ █▀▀ ▄▀█ ▀█▀ █ █▀█ █▄░█ █▀ ░░░░░   
░░░░ █░▀█ █▄█ ░█░ █ █▀░ █ █▄▄ █▀█ ░█░ █ █▄█ █░▀█ ▄█ ░░░░░   
░░░░ ░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

IDL

type VesselPushNotification =
record {
data: NotificationData;
message: text;
notification_for: text;
title: text;
};
type UserNotifications =
opt record {
UserNotification;
List;
};
type UserNotification =
record {
at: int;
data: NotificationData;
from: NotificationFrom;
message: text;
notification_for: text;
title: text;
};
type SocialPushNotification =
record {
data: NotificationData;
message: text;
notification_for: text;
title: text;
};
type ProtocolPushNotification =
record {
data: NotificationData;
message: text;
notification_for: text;
title: text;
};
type Notifications =
service {
deployToAlaska: () -> ();
getNotification: (principal) -> (opt UserNotifications) query;
getNotifications: (principal) -> (opt vec UserNotification) query;
pushNotificationByProtocol: (principal, ProtocolPushNotification) -> ();
pushNotificationBySocial: (principal, SocialPushNotification) -> ();
pushNotificationByVessel: (principal, VesselPushNotification) -> ();
readNotifications: () -> (opt UserNotifications);
whoami: () -> (principal);
};
type NotificationFrom =
variant {
Profile;
Protocol;
Vessel;
};
type NotificationData =
vec record {
text;
text;
};
type List =
opt record {
UserNotification;
List;
};
service : (text) -> Notifications

Getters

getNotifications

Returns all Notifications of a User
@returns ?[T.UserNotification]
@parameters (p: Principal)

getNotification

SAME AD ABOVE
@returns ?T.UserNotifications
@parameters (p: Principal)

readNotifications

Read & clear all Notifications of a User
@returns ?T.UserNotifications
@parameters ()

Setters

pushNotificationByProtocol

Push Notification for user by a Protocol
@returns ()
@parameters (p: Principal, notification_data: T.ProtocolPushNotification)

pushNotificationByVessel

Push Notification for user by a Vessel
@returns ()
@parameters (p: Principal, notification_data: T.VesselPushNotification)

pushNotificationBySocial

Push Notification for user by another Profile
@returns ()
@parameters (p: Principal, notification_data: T.SocialPushNotification)