ClassSDK v0.3.0

PushDevices

Server-side management of browser push devices registered through `@usepapier/browser`. Requires a secret API key; never call it from a browser.

import { PushDevices } from '@usepapier/client/base';

Declaration #

devices.tsTypeScript
export class PushDevices {
    constructor(context: PapierApiContext);
    issueUserToken(options: {
        userId: string;
        ttlSeconds?: number;
    }): Promise<{ token: string; expiresInSeconds: number; }>;
    list(options?: {
        userId?: string;
        limit?: number;
    }): Promise<PushDevice[]>;
    remove(id: string): Promise<void>;
}

Source: packages/client/src/delivery/devices.ts:17

Members 4

constructor(context: PapierApiContext);

Parameters

context
PapierApiContext

packages/client/src/delivery/devices.ts:18

Mints a short-lived token for one signed-in user. Hand it to that user's browser and pass it to `push.subscribe({ userToken })`; only then is the device tied to `userId`.

issueUserToken(options: {
    userId: string;
    ttlSeconds?: number;
}): Promise<{ token: string; expiresInSeconds: number; }>;

Parameters

options
{ userId: string; ttlSeconds?: number }

packages/client/src/delivery/devices.ts:28

list(options?: {
    userId?: string;
    limit?: number;
}): Promise<PushDevice[]>;

Parameters

optionsOptional
{ userId?: string; limit?: number }

packages/client/src/delivery/devices.ts:41

remove(id: string): Promise<void>;

Parameters

id
string

packages/client/src/delivery/devices.ts:54

Generated from TypeScript source.b1e9ee529902