AccountPush
AccountPush: the browsers that show the signed-in person NoClick's notifications (Web Push).
class AccountPushThe browsers that show the signed-in person NoClick's notifications: a DM or
| configured | boolean | Whether this NoClick sends notifications to browsers. |
| publicKey | string | null | The key a browser subscribes with ( |
| devices | readonly PushDevice[] | |
| raw | JsonObject | The response JSON exactly as the API sent it. |
type JsonObject = { [key: string]: unknown };getstatic
static get(options?: { client?: NoClick }): Promise<AccountPush>Read the browsers that show the person's notifications, and the key a new one subscribes with.
const { publicKey, devices } = await AccountPush.get();The client to send with; defaults to the module client built from NOCLICK_API_KEY.
The browsers (devices), whether this NoClick sends notifications to browsers (configured) and the
key a new one subscribes with (public_key).
addstatic
static add(
subscription: PushSubscriptionJson,
options?: { device?: string; client?: NoClick },
): Promise<PushDevice>Turn notifications on in this browser, with its push subscription: the same browser again (or one signed in to
another account before) is updated, never added twice. device names it for the person, like iPhone.
const subscription = await registration.pushManager.subscribe({ userVisibleOnly: true, applicationServerKey: publicKey });
const { id } = await AccountPush.add(subscription.toJSON(), { device: "iPhone" });The client to send with; defaults to the module client built from NOCLICK_API_KEY.
The browser, as it's kept.
/** A browser's push subscription, as `PushSubscription.toJSON()` gives it. */
interface PushSubscriptionJson {
endpoint?: string;
keys?: Record<string, string>;
}removestatic
static remove(deviceId: string, options?: { client?: NoClick }): Promise<void>Turn notifications off in one browser.
await AccountPush.remove(id);The client to send with; defaults to the module client built from NOCLICK_API_KEY.
Nothing.
PushDevice
interface PushDeviceOne browser that shows the person's notifications, as its push service names it (endpoint).
| id | string | |
| device | string | null | |
| endpoint | string | |
| createdAt | Date | null | |
| lastSentAt | Date | null |