UNPKG

pubnub

Version:

Publish & Subscribe Real-time Messaging with PubNub

1,369 lines (1,367 loc) 278 kB
import { Readable } from 'stream'; import { Buffer } from 'buffer'; import { ProxyAgentOptions } from 'proxy-agent'; /** * PubNub client for Node.js platform. */ declare class PubNub extends PubNubCore< string | ArrayBuffer | Buffer | Readable, PubNub.PubNubFileParameters, PubNub.PubNubFile > { /** * Data encryption / decryption module constructor. */ static CryptoModule: typeof PubNub.CryptoModuleType; /** * PubNub File constructor. */ File: PubNub.PubNubFileConstructor<PubNub.PubNubFile, PubNub.PubNubFileParameters>; /** * Create and configure PubNub client core. * * @param configuration - User-provided PubNub client configuration. * * @returns Configured and ready to use PubNub client. */ constructor(configuration: PubNub.PubNubConfiguration); /** * Update request proxy configuration. * * @param configuration - Updated request proxy configuration. * * @throws An error if {@link PubNub} client already configured to use `keepAlive`. * `keepAlive` and `proxy` can't be used simultaneously. */ setProxy(configuration?: ProxyAgentOptions): void; } /** * Platform-agnostic PubNub client core. */ declare class PubNubCore< CryptographyTypes, FileConstructorParameters, PlatformFile extends Partial<PubNub.PubNubFileInterface> = Record<string, unknown>, > implements PubNub.EventEmitCapable { /** * Type of REST API endpoint which reported status. */ static OPERATIONS: typeof PubNub.RequestOperation; /** * API call status category. */ static CATEGORIES: typeof PubNub.StatusCategory; /** * Enum with API endpoint groups which can be used with retry policy to set up exclusions (which shouldn't be * retried). */ static Endpoint: typeof PubNub.Endpoint; /** * Exponential retry policy constructor. */ static ExponentialRetryPolicy: typeof PubNub.RetryPolicy.ExponentialRetryPolicy; /** * Linear retry policy constructor. */ static LinearRetryPolicy: typeof PubNub.RetryPolicy.LinearRetryPolicy; /** * Disabled / inactive retry policy. * * **Note:** By default `ExponentialRetryPolicy` is set for subscribe requests and this one can be used to disable * retry policy for all requests (setting `undefined` for retry configuration will set default policy). */ static NoneRetryPolicy: typeof PubNub.RetryPolicy.None; /** * Available minimum log levels. */ static LogLevel: typeof PubNub.LoggerLogLevel; /** * Construct notification payload which will trigger push notification. * * @param title - Title which will be shown on notification. * @param body - Payload which will be sent as part of notification. * * @returns Pre-formatted message payload which will trigger push notification. */ static notificationPayload(title: string, body: string): PubNub.NotificationsPayload; /** * Generate unique identifier. * * @returns Unique identifier. */ static generateUUID(): any; /** * PubNub client configuration. * * @returns Currently user PubNub client configuration. */ get configuration(): PubNub.ClientConfiguration; /** * Current PubNub client configuration. * * @returns Currently user PubNub client configuration. * * @deprecated Use {@link configuration} getter instead. */ get _config(): PubNub.ClientConfiguration; /** * REST API endpoint access authorization key. * * It is required to have `authorization key` with required permissions to access REST API * endpoints when `PAM` enabled for user key set. */ get authKey(): string | undefined; /** * REST API endpoint access authorization key. * * It is required to have `authorization key` with required permissions to access REST API * endpoints when `PAM` enabled for user key set. */ getAuthKey(): string | undefined; /** * Change REST API endpoint access authorization key. * * @param authKey - New authorization key which should be used with new requests. */ setAuthKey(authKey: string): void; /** * Get a PubNub client user identifier. * * @returns Current PubNub client user identifier. */ get userId(): string; /** * Change the current PubNub client user identifier. * * **Important:** Change won't affect ongoing REST API calls. * **Warning:** Because ongoing REST API calls won't be canceled there could happen unexpected events like implicit * `join` event for the previous `userId` after a long-poll subscribe request will receive a response. To avoid this * it is advised to unsubscribe from all/disconnect before changing `userId`. * * @param value - New PubNub client user identifier. * * @throws Error empty user identifier has been provided. */ set userId(value: string); /** * Get a PubNub client user identifier. * * @returns Current PubNub client user identifier. */ getUserId(): string; /** * Change the current PubNub client user identifier. * * **Important:** Change won't affect ongoing REST API calls. * * @param value - New PubNub client user identifier. * * @throws Error empty user identifier has been provided. */ setUserId(value: string): void; /** * Real-time updates filtering expression. * * @returns Filtering expression. */ get filterExpression(): string | undefined; /** * Real-time updates filtering expression. * * @returns Filtering expression. */ getFilterExpression(): string | undefined; /** * Update real-time updates filtering expression. * * @param expression - New expression which should be used or `undefined` to disable filtering. */ set filterExpression(expression: string | null | undefined); /** * Update real-time updates filtering expression. * * @param expression - New expression which should be used or `undefined` to disable filtering. */ setFilterExpression(expression: string | null): void; /** * Dta encryption / decryption key. * * @returns Currently used key for data encryption / decryption. */ get cipherKey(): string | undefined; /** * Change data encryption / decryption key. * * @param key - New key which should be used for data encryption / decryption. */ set cipherKey(key: string | undefined); /** * Change data encryption / decryption key. * * @param key - New key which should be used for data encryption / decryption. */ setCipherKey(key: string): void; /** * Change a heartbeat requests interval. * * @param interval - New presence request heartbeat intervals. */ set heartbeatInterval(interval: number); /** * Change a heartbeat requests interval. * * @param interval - New presence request heartbeat intervals. */ setHeartbeatInterval(interval: number): void; /** * Get registered loggers' manager. * * @returns Registered loggers' manager. */ get logger(): PubNub.LoggerManager; /** * Get PubNub SDK version. * * @returns Current SDK version. */ getVersion(): string; /** * Add framework's prefix. * * @param name - Name of the framework which would want to add own data into `pnsdk` suffix. * @param suffix - Suffix with information about a framework. */ _addPnsdkSuffix(name: string, suffix: string | number): void; /** * Get a PubNub client user identifier. * * @returns Current PubNub client user identifier. * * @deprecated Use the {@link getUserId} or {@link userId} getter instead. */ getUUID(): string; /** * Change the current PubNub client user identifier. * * **Important:** Change won't affect ongoing REST API calls. * * @param value - New PubNub client user identifier. * * @throws Error empty user identifier has been provided. * * @deprecated Use the {@link PubNubCore#setUserId setUserId} or {@link PubNubCore#userId userId} setter instead. */ setUUID(value: string): void; /** * Custom data encryption method. * * @deprecated Instead use {@link cryptoModule} for data encryption. */ get customEncrypt(): ((data: string) => string) | undefined; /** * Custom data decryption method. * * @deprecated Instead use {@link cryptoModule} for data decryption. */ get customDecrypt(): ((data: string) => string) | undefined; /** * Create a `Channel` entity. * * Entity can be used for the interaction with the following API: * - `subscribe` * * @param name - Unique channel name. * @returns `Channel` entity. */ channel(name: string): PubNub.Channel; /** * Create a `ChannelGroup` entity. * * Entity can be used for the interaction with the following API: * - `subscribe` * * @param name - Unique channel group name. * @returns `ChannelGroup` entity. */ channelGroup(name: string): PubNub.ChannelGroup; /** * Create a `ChannelMetadata` entity. * * Entity can be used for the interaction with the following API: * - `subscribe` * * @param id - Unique channel metadata object identifier. * @returns `ChannelMetadata` entity. */ channelMetadata(id: string): PubNub.ChannelMetadata; /** * Create a `UserMetadata` entity. * * Entity can be used for the interaction with the following API: * - `subscribe` * * @param id - Unique user metadata object identifier. * @returns `UserMetadata` entity. */ userMetadata(id: string): PubNub.UserMetadata; /** * Create subscriptions set object. * * @param parameters - Subscriptions set configuration parameters. */ subscriptionSet(parameters: { channels?: string[]; channelGroups?: string[]; subscriptionOptions?: PubNub.SubscriptionOptions; }): PubNub.SubscriptionSet; /** * Unsubscribe from all channels and groups. * * @param [isOffline] - Whether `offline` presence should be notified or not. */ destroy(isOffline?: boolean): void; /** * Unsubscribe from all channels and groups. * * @deprecated Use {@link destroy} method instead. */ stop(): void; /** * Publish data to a specific channel. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. */ publish( parameters: PubNub.Publish.PublishParameters, callback: PubNub.ResultCallback<PubNub.Publish.PublishResponse>, ): void; /** * Publish data to a specific channel. * * @param parameters - Request configuration parameters. * * @returns Asynchronous publish data response. */ publish(parameters: PubNub.Publish.PublishParameters): Promise<PubNub.Publish.PublishResponse>; /** * Signal data to a specific channel. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. */ signal( parameters: PubNub.Signal.SignalParameters, callback: PubNub.ResultCallback<PubNub.Signal.SignalResponse>, ): void; /** * Signal data to a specific channel. * * @param parameters - Request configuration parameters. * * @returns Asynchronous signal data response. */ signal(parameters: PubNub.Signal.SignalParameters): Promise<PubNub.Signal.SignalResponse>; /** * `Fire` a data to a specific channel. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. * * @deprecated Use {@link publish} method instead. */ fire( parameters: PubNub.Publish.PublishParameters, callback: PubNub.ResultCallback<PubNub.Publish.PublishResponse>, ): void; /** * `Fire` a data to a specific channel. * * @param parameters - Request configuration parameters. * * @returns Asynchronous signal data response. * * @deprecated Use {@link publish} method instead. */ fire(parameters: PubNub.Publish.PublishParameters): Promise<PubNub.Publish.PublishResponse>; /** * Get list of channels on which PubNub client currently subscribed. * * @returns List of active channels. */ getSubscribedChannels(): string[]; /** * Get list of channel groups on which PubNub client currently subscribed. * * @returns List of active channel groups. */ getSubscribedChannelGroups(): string[]; /** * Subscribe to specified channels and groups real-time events. * * @param parameters - Request configuration parameters. */ subscribe(parameters: PubNub.Subscription.SubscribeParameters): void; /** * Unsubscribe from specified channels and groups real-time events. * * @param parameters - Request configuration parameters. */ unsubscribe(parameters: PubNub.Presence.PresenceLeaveParameters): void; /** * Unsubscribe from all channels and groups. */ unsubscribeAll(): void; /** * Temporarily disconnect from the real-time events stream. * * **Note:** `isOffline` is set to `true` only when a client experiences network issues. * * @param [isOffline] - Whether `offline` presence should be notified or not. */ disconnect(isOffline?: boolean): void; /** * Restore connection to the real-time events stream. * * @param parameters - Reconnection catch-up configuration. **Note:** available only with the enabled event engine. */ reconnect(parameters?: { timetoken?: string; region?: number }): void; /** * Get reactions to a specific message. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. */ getMessageActions( parameters: PubNub.MessageAction.GetMessageActionsParameters, callback: PubNub.ResultCallback<PubNub.MessageAction.GetMessageActionsResponse>, ): void; /** * Get reactions to a specific message. * * @param parameters - Request configuration parameters. * * @returns Asynchronous get reactions response. */ getMessageActions( parameters: PubNub.MessageAction.GetMessageActionsParameters, ): Promise<PubNub.MessageAction.GetMessageActionsResponse>; /** * Add a reaction to a specific message. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. */ addMessageAction( parameters: PubNub.MessageAction.AddMessageActionParameters, callback: PubNub.ResultCallback<PubNub.MessageAction.AddMessageActionResponse>, ): void; /** * Add a reaction to a specific message. * * @param parameters - Request configuration parameters. * * @returns Asynchronous add a reaction response. */ addMessageAction( parameters: PubNub.MessageAction.AddMessageActionParameters, ): Promise<PubNub.MessageAction.AddMessageActionResponse>; /** * Remove a reaction from a specific message. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. */ removeMessageAction( parameters: PubNub.MessageAction.RemoveMessageActionParameters, callback: PubNub.ResultCallback<PubNub.MessageAction.RemoveMessageActionResponse>, ): void; /** * Remove a reaction from a specific message. * * @param parameters - Request configuration parameters. * * @returns Asynchronous remove a reaction response. */ removeMessageAction( parameters: PubNub.MessageAction.RemoveMessageActionParameters, ): Promise<PubNub.MessageAction.RemoveMessageActionResponse>; /** * Fetch messages history for channels. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. */ fetchMessages( parameters: PubNub.History.FetchMessagesParameters, callback: PubNub.ResultCallback<PubNub.History.FetchMessagesResponse>, ): void; /** * Fetch messages history for channels. * * @param parameters - Request configuration parameters. * * @returns Asynchronous fetch messages response. */ fetchMessages(parameters: PubNub.History.FetchMessagesParameters): Promise<PubNub.History.FetchMessagesResponse>; /** * Delete messages from the channel history. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. * */ deleteMessages( parameters: PubNub.History.DeleteMessagesParameters, callback: PubNub.ResultCallback<PubNub.History.DeleteMessagesResponse>, ): void; /** * Delete messages from the channel history. * * @param parameters - Request configuration parameters. * * @returns Asynchronous delete messages response. * */ deleteMessages(parameters: PubNub.History.DeleteMessagesParameters): Promise<PubNub.History.DeleteMessagesResponse>; /** * Count messages from the channels' history. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. */ messageCounts( parameters: PubNub.History.MessageCountParameters, callback: PubNub.ResultCallback<PubNub.History.MessageCountResponse>, ): void; /** * Count messages from the channels' history. * * @param parameters - Request configuration parameters. * * @returns Asynchronous count messages response. */ messageCounts(parameters: PubNub.History.MessageCountParameters): Promise<PubNub.History.MessageCountResponse>; /** * Fetch single channel history. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. * * @deprecated */ history( parameters: PubNub.History.GetHistoryParameters, callback: PubNub.ResultCallback<PubNub.History.GetHistoryResponse>, ): void; /** * Fetch single channel history. * * @param parameters - Request configuration parameters. * * @returns Asynchronous fetch channel history response. * * @deprecated */ history(parameters: PubNub.History.GetHistoryParameters): Promise<PubNub.History.GetHistoryResponse>; /** * Get channel's presence information. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. */ hereNow( parameters: PubNub.Presence.HereNowParameters, callback: PubNub.ResultCallback<PubNub.Presence.HereNowResponse>, ): void; /** * Get channel presence information. * * @param parameters - Request configuration parameters. * * @returns Asynchronous get channel's presence response. */ hereNow(parameters: PubNub.Presence.HereNowParameters): Promise<PubNub.Presence.HereNowResponse>; /** * Get user's presence information. * * Get list of channels to which `uuid` currently subscribed. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. */ whereNow( parameters: PubNub.Presence.WhereNowParameters, callback: PubNub.ResultCallback<PubNub.Presence.WhereNowResponse>, ): void; /** * Get user's presence information. * * Get list of channels to which `uuid` currently subscribed. * * @param parameters - Request configuration parameters. * * @returns Asynchronous get user's presence response. */ whereNow(parameters: PubNub.Presence.WhereNowParameters): Promise<PubNub.Presence.WhereNowResponse>; /** * Get associated user's data for channels and groups. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. */ getState( parameters: PubNub.Presence.GetPresenceStateParameters, callback: PubNub.ResultCallback<PubNub.Presence.GetPresenceStateResponse>, ): void; /** * Get associated user's data for channels and groups. * * @param parameters - Request configuration parameters. * * @returns Asynchronous get associated user's data response. */ getState(parameters: PubNub.Presence.GetPresenceStateParameters): Promise<PubNub.Presence.GetPresenceStateResponse>; /** * Set associated user's data for channels and groups. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. */ setState( parameters: PubNub.Presence.SetPresenceStateParameters | PubNub.Presence.SetPresenceStateWithHeartbeatParameters, callback: PubNub.ResultCallback< PubNub.Presence.SetPresenceStateResponse | PubNub.Presence.PresenceHeartbeatResponse >, ): void; /** * Set associated user's data for channels and groups. * * @param parameters - Request configuration parameters. * * @returns Asynchronous set associated user's data response. */ setState( parameters: PubNub.Presence.SetPresenceStateParameters | PubNub.Presence.SetPresenceStateWithHeartbeatParameters, ): Promise<PubNub.Presence.SetPresenceStateResponse | PubNub.Presence.PresenceHeartbeatResponse>; /** * Manual presence management. * * @param parameters - Desired presence state for a provided list of channels and groups. */ presence(parameters: { connected: boolean; channels?: string[]; channelGroups?: string[] }): void; /** * Grant token permission. * * Generate access token with requested permissions. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. */ grantToken( parameters: PubNub.PAM.GrantTokenParameters, callback: PubNub.ResultCallback<PubNub.PAM.GrantTokenResponse>, ): void; /** * Grant token permission. * * Generate an access token with requested permissions. * * @param parameters - Request configuration parameters. * * @returns Asynchronous grant token response. */ grantToken(parameters: PubNub.PAM.GrantTokenParameters): Promise<PubNub.PAM.GrantTokenResponse>; /** * Revoke token permission. * * @param token - Access token for which permissions should be revoked. * @param callback - Request completion handler callback. */ revokeToken( token: PubNub.PAM.RevokeParameters, callback: PubNub.ResultCallback<PubNub.PAM.RevokeTokenResponse>, ): void; /** * Revoke token permission. * * @param token - Access token for which permissions should be revoked. * * @returns Asynchronous revoke token response. */ revokeToken(token: PubNub.PAM.RevokeParameters): Promise<PubNub.PAM.RevokeTokenResponse>; /** * Get a current access token. * * @returns Previously configured access token using {@link setToken} method. */ get token(): string | undefined; /** * Get a current access token. * * @returns Previously configured access token using {@link setToken} method. */ getToken(): string | undefined; /** * Set current access token. * * @param token - New access token which should be used with next REST API endpoint calls. */ set token(token: string | undefined); /** * Set current access token. * * @param token - New access token which should be used with next REST API endpoint calls. */ setToken(token: string | undefined): void; /** * Parse access token. * * Parse token to see what permissions token owner has. * * @param token - Token which should be parsed. * * @returns Token's permissions information for the resources. */ parseToken(token: string): PubNub.PAM.Token | undefined; /** * Grant auth key(s) permission. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. * * @deprecated Use {@link grantToken} and {@link setToken} methods instead. */ grant(parameters: PubNub.PAM.GrantParameters, callback: PubNub.ResultCallback<PubNub.PAM.PermissionsResponse>): void; /** * Grant auth key(s) permission. * * @param parameters - Request configuration parameters. * * @returns Asynchronous grant auth key(s) permissions response. * * @deprecated Use {@link grantToken} and {@link setToken} methods instead. */ grant(parameters: PubNub.PAM.GrantParameters): Promise<PubNub.PAM.PermissionsResponse>; /** * Audit auth key(s) permission. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. * * @deprecated */ audit(parameters: PubNub.PAM.AuditParameters, callback: PubNub.ResultCallback<PubNub.PAM.PermissionsResponse>): void; /** * Audit auth key(s) permission. * * @param parameters - Request configuration parameters. * * @returns Asynchronous audit auth key(s) permissions response. * * @deprecated */ audit(parameters: PubNub.PAM.AuditParameters): Promise<PubNub.PAM.PermissionsResponse>; /** * PubNub App Context API group. */ get objects(): PubNub.PubNubObjects; /** * Fetch a paginated list of User objects. * * @param callback - Request completion handler callback. * * @deprecated Use {@link PubNubCore#objects.getAllUUIDMetadata getAllUUIDMetadata} method instead. */ fetchUsers<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( callback: PubNub.ResultCallback<PubNub.AppContext.GetAllUUIDMetadataResponse<Custom>>, ): void; /** * Fetch a paginated list of User objects. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. * * @deprecated Use {@link PubNubCore#objects.getAllUUIDMetadata getAllUUIDMetadata} method instead. */ fetchUsers<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( parameters: PubNub.AppContext.GetAllMetadataParameters<PubNub.AppContext.UUIDMetadataObject<Custom>>, callback: PubNub.ResultCallback<PubNub.AppContext.GetAllUUIDMetadataResponse<Custom>>, ): void; /** * Fetch a paginated list of User objects. * * @param [parameters] - Request configuration parameters. * * @returns Asynchronous get all User objects response. * * @deprecated Use {@link PubNubCore#objects.getAllUUIDMetadata getAllUUIDMetadata} method instead. */ fetchUsers<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( parameters?: PubNub.AppContext.GetAllMetadataParameters<PubNub.AppContext.UUIDMetadataObject<Custom>>, ): Promise<PubNub.AppContext.GetAllUUIDMetadataResponse<Custom>>; /** * Fetch User object for a currently configured PubNub client `uuid`. * * @param callback - Request completion handler callback. * * @deprecated Use {@link PubNubCore#objects.getUUIDMetadata getUUIDMetadata} method instead. */ fetchUser<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( callback: PubNub.ResultCallback<PubNub.AppContext.GetUUIDMetadataResponse<Custom>>, ): void; /** * Fetch User object for a currently configured PubNub client `uuid`. * * @param parameters - Request configuration parameters. Will fetch a User object for a currently * configured PubNub client `uuid` if not set. * @param callback - Request completion handler callback. * * @deprecated Use {@link PubNubCore#objects.getUUIDMetadata|getUUIDMetadata} method instead. */ fetchUser<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( parameters: PubNub.AppContext.GetUUIDMetadataParameters, callback: PubNub.ResultCallback<PubNub.AppContext.GetUUIDMetadataResponse<Custom>>, ): void; /** * Fetch User object for a currently configured PubNub client `uuid`. * * @param [parameters] - Request configuration parameters. Will fetch a User object for a currently * configured PubNub client `uuid` if not set. * * @returns Asynchronous get User object response. * * @deprecated Use {@link PubNubCore#objects.getUUIDMetadata getUUIDMetadata} method instead. */ fetchUser<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( parameters?: PubNub.AppContext.GetUUIDMetadataParameters, ): Promise<PubNub.AppContext.GetUUIDMetadataResponse<Custom>>; /** * Create a User object. * * @param parameters - Request configuration parameters. Will create a User object for a currently * configured PubNub client `uuid` if not set. * @param callback - Request completion handler callback. * * @deprecated Use {@link PubNubCore#objects.setUUIDMetadata setUUIDMetadata} method instead. */ createUser<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( parameters: PubNub.AppContext.SetUUIDMetadataParameters<Custom>, callback: PubNub.ResultCallback<PubNub.AppContext.SetUUIDMetadataResponse<Custom>>, ): void; /** * Create a User object. * * @param parameters - Request configuration parameters. Will create User object for a currently * configured PubNub client `uuid` if not set. * * @returns Asynchronous create User object response. * * @deprecated Use {@link PubNubCore#objects.setUUIDMetadata setUUIDMetadata} method instead. */ createUser<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( parameters: PubNub.AppContext.SetUUIDMetadataParameters<Custom>, ): Promise<PubNub.AppContext.SetUUIDMetadataResponse<Custom>>; /** * Update a User object. * * @param parameters - Request configuration parameters. Will update User object for currently * configured PubNub client `uuid` if not set. * @param callback - Request completion handler callback. * * @deprecated Use {@link PubNubCore#objects.setUUIDMetadata setUUIDMetadata} method instead. */ updateUser<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( parameters: PubNub.AppContext.SetUUIDMetadataParameters<Custom>, callback: PubNub.ResultCallback<PubNub.AppContext.SetUUIDMetadataResponse<Custom>>, ): void; /** * Update a User object. * * @param parameters - Request configuration parameters. Will update a User object for a currently * configured PubNub client `uuid` if not set. * * @returns Asynchronous update User object response. * * @deprecated Use {@link PubNubCore#objects.setUUIDMetadata setUUIDMetadata} method instead. */ updateUser<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( parameters: PubNub.AppContext.SetUUIDMetadataParameters<Custom>, ): Promise<PubNub.AppContext.SetUUIDMetadataResponse<Custom>>; /** * Remove a specific User object. * * @param callback - Request completion handler callback. Will remove a User object for a currently * configured PubNub client `uuid` if not set. * * @deprecated Use {@link PubNubCore#objects.removeUUIDMetadata removeUUIDMetadata} method instead. */ removeUser(callback: PubNub.ResultCallback<PubNub.AppContext.RemoveUUIDMetadataResponse>): void; /** * Remove a specific User object. * * @param parameters - Request configuration parameters. Will remove a User object for a currently * configured PubNub client `uuid` if not set. * @param callback - Request completion handler callback. * * @deprecated Use {@link PubNubCore#objects.removeUUIDMetadata removeUUIDMetadata} method instead. */ removeUser( parameters: PubNub.AppContext.RemoveUUIDMetadataParameters, callback: PubNub.ResultCallback<PubNub.AppContext.RemoveUUIDMetadataResponse>, ): void; /** * Remove a specific User object. * * @param [parameters] - Request configuration parameters. Will remove a User object for a currently * configured PubNub client `uuid` if not set. * * @returns Asynchronous User object remove response. * * @deprecated Use {@link PubNubCore#objects.removeUUIDMetadata removeUUIDMetadata} method instead. */ removeUser( parameters?: PubNub.AppContext.RemoveUUIDMetadataParameters, ): Promise<PubNub.AppContext.RemoveUUIDMetadataResponse>; /** * Fetch a paginated list of Space objects. * * @param callback - Request completion handler callback. * * @deprecated Use {@link PubNubCore#objects.getAllChannelMetadata getAllChannelMetadata} method instead. */ fetchSpaces<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( callback: PubNub.ResultCallback<PubNub.AppContext.GetAllChannelMetadataResponse<Custom>>, ): void; /** * Fetch a paginated list of Space objects. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. * * @deprecated Use {@link PubNubCore#objects.getAllChannelMetadata getAllChannelMetadata} method instead. */ fetchSpaces<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( parameters: PubNub.AppContext.GetAllMetadataParameters<PubNub.AppContext.ChannelMetadataObject<Custom>>, callback: PubNub.ResultCallback<PubNub.AppContext.GetAllChannelMetadataResponse<Custom>>, ): void; /** * Fetch a paginated list of Space objects. * * @param [parameters] - Request configuration parameters. * * @returns Asynchronous get all Space objects responses. * * @deprecated Use {@link PubNubCore#objects.getAllChannelMetadata getAllChannelMetadata} method instead. */ fetchSpaces<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( parameters?: PubNub.AppContext.GetAllMetadataParameters<PubNub.AppContext.ChannelMetadataObject<Custom>>, ): Promise<PubNub.AppContext.GetAllChannelMetadataResponse<Custom>>; /** * Fetch a specific Space object. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. * * @deprecated Use {@link PubNubCore#objects.getChannelMetadata getChannelMetadata} method instead. */ fetchSpace<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( parameters: PubNub.AppContext.GetChannelMetadataParameters, callback: PubNub.ResultCallback<PubNub.AppContext.GetChannelMetadataResponse<Custom>>, ): void; /** * Fetch a specific Space object. * * @param parameters - Request configuration parameters. * * @returns Asynchronous get Channel metadata response. * * @deprecated Use {@link PubNubCore#objects.getChannelMetadata getChannelMetadata} method instead. */ fetchSpace<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( parameters: PubNub.AppContext.GetChannelMetadataParameters, ): Promise<PubNub.AppContext.GetChannelMetadataResponse<Custom>>; /** * Create a specific Space object. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. * * @deprecated Use {@link PubNubCore#objects.setChannelMetadata setChannelMetadata} method instead. */ createSpace<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( parameters: PubNub.AppContext.SetChannelMetadataParameters<Custom>, callback: PubNub.ResultCallback<PubNub.AppContext.SetChannelMetadataResponse<Custom>>, ): void; /** * Create specific Space object. * * @param parameters - Request configuration parameters. * * @returns Asynchronous create Space object response. * * @deprecated Use {@link PubNubCore#objects.setChannelMetadata setChannelMetadata} method instead. */ createSpace<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( parameters: PubNub.AppContext.SetChannelMetadataParameters<Custom>, ): Promise<PubNub.AppContext.SetChannelMetadataResponse<Custom>>; /** * Update specific Space object. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. * * @deprecated Use {@link PubNubCore#objects.setChannelMetadata setChannelMetadata} method instead. */ updateSpace<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( parameters: PubNub.AppContext.SetChannelMetadataParameters<Custom>, callback: PubNub.ResultCallback<PubNub.AppContext.SetChannelMetadataResponse<Custom>>, ): void; /** * Update specific Space object. * * @param parameters - Request configuration parameters. * * @returns Asynchronous update Space object response. * * @deprecated Use {@link PubNubCore#objects.setChannelMetadata setChannelMetadata} method instead. */ updateSpace<Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData>( parameters: PubNub.AppContext.SetChannelMetadataParameters<Custom>, ): Promise<PubNub.AppContext.SetChannelMetadataResponse<Custom>>; /** * Remove a Space object. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. * * @deprecated Use {@link PubNubCore#objects.removeChannelMetadata removeChannelMetadata} method instead. */ removeSpace( parameters: PubNub.AppContext.RemoveChannelMetadataParameters, callback: PubNub.ResultCallback<PubNub.AppContext.RemoveChannelMetadataResponse>, ): void; /** * Remove a specific Space object. * * @param parameters - Request configuration parameters. * * @returns Asynchronous Space object remove response. * * @deprecated Use {@link PubNubCore#objects.removeChannelMetadata removeChannelMetadata} method instead. */ removeSpace( parameters: PubNub.AppContext.RemoveChannelMetadataParameters, ): Promise<PubNub.AppContext.RemoveChannelMetadataResponse>; /** * Fetch a paginated list of specific Space members or specific User memberships. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. * * @deprecated Use {@link PubNubCore#objects.getChannelMembers getChannelMembers} or * {@link PubNubCore#objects.getMemberships getMemberships} methods instead. */ fetchMemberships< RelationCustom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData, MetadataCustom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData, >( parameters: PubNub.AppContext.GetMembershipsParameters | PubNub.AppContext.GetMembersParameters, callback: PubNub.ResultCallback< | PubNub.AppContext.SpaceMembershipsResponse<RelationCustom, MetadataCustom> | PubNub.AppContext.UserMembersResponse<RelationCustom, MetadataCustom> >, ): void; /** * Fetch paginated list of specific Space members or specific User memberships. * * @param parameters - Request configuration parameters. * * @returns Asynchronous get specific Space members or specific User memberships response. * * @deprecated Use {@link PubNubCore#objects.getChannelMembers getChannelMembers} or * {@link PubNubCore#objects.getMemberships getMemberships} methods instead. */ fetchMemberships< RelationCustom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData, MetadataCustom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData, >( parameters: PubNub.AppContext.GetMembershipsParameters | PubNub.AppContext.GetMembersParameters, ): Promise< | PubNub.AppContext.SpaceMembershipsResponse<RelationCustom, MetadataCustom> | PubNub.AppContext.UserMembersResponse<RelationCustom, MetadataCustom> >; /** * Add members to specific Space or memberships specific User. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. * * @deprecated Use {@link PubNubCore#objects.setChannelMembers setChannelMembers} or * {@link PubNubCore#objects.setMemberships setMemberships} methods instead. */ addMemberships< Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData, MetadataCustom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData, >( parameters: | PubNub.AppContext.SetMembershipsParameters<Custom> | PubNub.AppContext.SetChannelMembersParameters<Custom>, callback: PubNub.ResultCallback< | PubNub.AppContext.SetMembershipsResponse<Custom, MetadataCustom> | PubNub.AppContext.SetMembersResponse<Custom, MetadataCustom> >, ): void; /** * Add members to specific Space or memberships specific User. * * @param parameters - Request configuration parameters. * * @returns Asynchronous add members to specific Space or memberships specific User response. * * @deprecated Use {@link PubNubCore#objects.setChannelMembers setChannelMembers} or * {@link PubNubCore#objects.setMemberships setMemberships} methods instead. */ addMemberships< Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData, MetadataCustom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData, >( parameters: | PubNub.AppContext.SetMembershipsParameters<Custom> | PubNub.AppContext.SetChannelMembersParameters<Custom>, ): Promise< | PubNub.AppContext.SetMembershipsResponse<Custom, MetadataCustom> | PubNub.AppContext.SetMembersResponse<Custom, MetadataCustom> >; /** * Update specific Space members or User memberships. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. * * @deprecated Use {@link PubNubCore#objects.setChannelMembers setChannelMembers} or * {@link PubNubCore#objects.setMemberships setMemberships} methods instead. */ updateMemberships< Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData, MetadataCustom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData, >( parameters: | PubNub.AppContext.SetMembershipsParameters<Custom> | PubNub.AppContext.SetChannelMembersParameters<Custom>, callback: PubNub.ResultCallback< | PubNub.AppContext.SetMembershipsResponse<Custom, MetadataCustom> | PubNub.AppContext.SetMembersResponse<Custom, MetadataCustom> >, ): void; /** * Update specific Space members or User memberships. * * @param parameters - Request configuration parameters. * * @returns Asynchronous update Space members or User memberships response. * * @deprecated Use {@link PubNubCore#objects.setChannelMembers setChannelMembers} or * {@link PubNubCore#objects.setMemberships setMemberships} methods instead. */ updateMemberships< Custom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData, MetadataCustom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData, >( parameters: | PubNub.AppContext.SetMembershipsParameters<Custom> | PubNub.AppContext.SetChannelMembersParameters<Custom>, ): Promise< | PubNub.AppContext.SetMembershipsResponse<Custom, MetadataCustom> | PubNub.AppContext.SetMembersResponse<Custom, MetadataCustom> >; /** * Remove User membership. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. * * @deprecated Use {@link PubNubCore#objects.removeMemberships removeMemberships} or * {@link PubNubCore#objects.removeChannelMembers removeChannelMembers} methods instead from `objects` API group. */ removeMemberships< RelationCustom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData, MetadataCustom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData, >( parameters: PubNub.AppContext.RemoveMembersParameters | PubNub.AppContext.RemoveMembershipsParameters, callback: PubNub.ResultCallback< | PubNub.AppContext.RemoveMembersResponse<RelationCustom, MetadataCustom> | PubNub.AppContext.RemoveMembershipsResponse<RelationCustom, MetadataCustom> >, ): void; /** * Remove User membership. * * @param parameters - Request configuration parameters. * * @returns Asynchronous memberships modification response. * * @deprecated Use {@link PubNubCore#objects.removeMemberships removeMemberships} or * {@link PubNubCore#objects.removeChannelMembers removeChannelMembers} methods instead from `objects` API group. */ removeMemberships< RelationCustom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData, MetadataCustom extends PubNub.AppContext.CustomData = PubNub.AppContext.CustomData, >( parameters: PubNub.AppContext.RemoveMembersParameters | PubNub.AppContext.RemoveMembershipsParameters, ): Promise<PubNub.AppContext.RemoveMembersResponse<RelationCustom, MetadataCustom>>; /** * PubNub Channel Groups API group. */ get channelGroups(): PubNub.PubNubChannelGroups; /** * PubNub Push Notifications API group. */ get push(): PubNub.PubNubPushNotifications; /** * Share file to a specific channel. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. */ sendFile( parameters: PubNub.FileSharing.SendFileParameters<FileConstructorParameters>, callback: PubNub.ResultCallback<PubNub.FileSharing.SendFileResponse>, ): void; /** * Share file to a specific channel. * * @param parameters - Request configuration parameters. * * @returns Asynchronous file sharing response. */ sendFile( parameters: PubNub.FileSharing.SendFileParameters<FileConstructorParameters>, ): Promise<PubNub.FileSharing.SendFileResponse>; /** * Publish file message to a specific channel. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. */ publishFile( parameters: PubNub.FileSharing.PublishFileMessageParameters, callback: PubNub.ResultCallback<PubNub.FileSharing.PublishFileMessageResponse>, ): void; /** * Publish file message to a specific channel. * * @param parameters - Request configuration parameters. * * @returns Asynchronous publish file message response. */ publishFile( parameters: PubNub.FileSharing.PublishFileMessageParameters, ): Promise<PubNub.FileSharing.PublishFileMessageResponse>; /** * Retrieve list of shared files in specific channel. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. */ listFiles( parameters: PubNub.FileSharing.ListFilesParameters, callback: PubNub.ResultCallback<PubNub.FileSharing.ListFilesResponse>, ): void; /** * Retrieve list of shared files in specific channel. * * @param parameters - Request configuration parameters. * * @returns Asynchronous shared files list response. */ listFiles(parameters: PubNub.FileSharing.ListFilesParameters): Promise<PubNub.FileSharing.ListFilesResponse>; /** * Get file download Url. * * @param parameters - Request configuration parameters. * * @returns File download Url. */ getFileUrl(parameters: PubNub.FileSharing.FileUrlParameters): PubNub.FileSharing.FileUrlResponse; /** * Download a shared file from a specific channel. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. */ downloadFile( parameters: PubNub.FileSharing.DownloadFileParameters, callback: PubNub.ResultCallback<PlatformFile>, ): void; /** * Download a shared file from a specific channel. * * @param parameters - Request configuration parameters. * * @returns Asynchronous download shared file response. */ downloadFile(parameters: PubNub.FileSharing.DownloadFileParameters): Promise<PlatformFile>; /** * Delete a shared file from a specific channel. * * @param parameters - Request configuration parameters. * @param callback - Request completion handler callback. */ deleteFile( parameters: PubNub.FileSharing.DeleteFileParameters, callback: PubNub.ResultCallback<PubNub.FileSharing.DeleteFileResponse>, ): void; /** * Delete a shared file from a specific channel. * * @param parameters - Request configuration parameters. * * @returns Asynchronous delete shared file response. */ deleteFile(parameters: PubNub.FileSharing.DeleteFileParameters): Promise<PubNub.FileSharing.DeleteFileResponse>; /** Get current high-precision timetoken. * * @param callback - Request completion handler callback. */ time(callback: PubNub.ResultCallback<PubNub.Time.TimeResponse>): void; /** * Get current high-precision timetoken. * * @returns Asynchronous get current timetoken response. */ time(): Promise<PubNub.Time.TimeResponse>; /** * Set a connection status change event handler. * * @param listener - Listener function, which will be called each time when the connection status changes. */ set onStatus(listener: ((status: PubNub.Status | PubNub.StatusEvent) => void) | undefined); /** * Set a new message handler. * * @param listener - Listener function, which will be called each time when a new message * is received from the real-time network. */ set onMessage(listener: ((event: PubNub.Subscription.Message) => void) | undefined); /** * Set a new presence events handler. * * @param listener - Listener function, which will be called each time when a new * presence event is received from the real-time network. */ set onPresence(listener: ((event: PubNub.Subscription.Presence) => void) | undefined); /** * Set a new signal handler. * * @param listener - Listener function, which will be called each time when a new signal * is received from the real-time network. */ set onSignal(listener: ((event: PubNub.Subscription.Signal) => void) | undefined); /** * Set a new app context event handler. * * @param listener - Listener function, which will be called each time when a new * app context event is