UNPKG

@towns-protocol/sdk

Version:

For more details, visit the following resources:

51 lines 2.78 kB
import { DmChannelSettingValue, GdmChannelSettingValue, GetSettingsResponse, SpaceChannelSettingValue, WebPushSubscriptionObject, PlainMessage } from '@towns-protocol/proto'; import { DescMessage, MessageShape } from '@bufbuild/protobuf'; import { Observable } from './observable/observable'; import { SignerContext } from './signerContext'; import { RpcOptions } from './rpcCommon'; export interface INotificationStore { getItem<Desc extends DescMessage>(schema: Desc, key: string): MessageShape<Desc> | undefined; setItem<Desc extends DescMessage>(schema: Desc, key: string, value: MessageShape<Desc>): void; } export interface NotificationSettingsModel { fetchedAtMs: number | undefined; settings: GetSettingsResponse | undefined; error: Error | undefined; } export declare class NotificationsClient { private readonly signerContext; private readonly url; private readonly store; private readonly opts; data: Observable<NotificationSettingsModel>; private _client?; private startResponseKey; private finishResponseKey; private settingsKey; private getClientPromise; private getSettingsPromise; constructor(signerContext: SignerContext, url: string, store?: INotificationStore, opts?: RpcOptions | undefined); get userId(): string; private getLocalStartResponse; private setLocalStartResponse; private getLocalFinishResponse; private setLocalFinishResponse; private getLocalSettings; private setLocalSettings; private updateLocalSettings; private getClient; private _getClient; private withClient; getSettings(): Promise<GetSettingsResponse | undefined>; private _getSettings; subscribeWebPush(subscription: PlainMessage<WebPushSubscriptionObject>): Promise<import("@bufbuild/protobuf").Message<"river.SubscribeWebPushResponse"> | undefined>; unsubscribeWebPush(subscription: PlainMessage<WebPushSubscriptionObject>): Promise<import("@bufbuild/protobuf").Message<"river.UnsubscribeWebPushResponse"> | undefined>; setDmGlobalSetting(value: DmChannelSettingValue): Promise<void | undefined>; setGdmGlobalSetting(value: GdmChannelSettingValue): Promise<void | undefined>; setDmChannelSetting(channelId: string, value: DmChannelSettingValue): Promise<void | undefined>; setGdmChannelSetting(channelId: string, value: GdmChannelSettingValue): Promise<void | undefined>; setSpaceSetting(spaceId: string, value: SpaceChannelSettingValue): Promise<void | undefined>; setChannelSetting(channelId: string, value: SpaceChannelSettingValue): Promise<void | undefined>; } export declare function getMutedChannelIds(settings?: PlainMessage<GetSettingsResponse>): Set<string> | undefined; //# sourceMappingURL=notificationsClient.d.ts.map