matrix-react-sdk
Version:
SDK for matrix.org using React
69 lines (68 loc) • 3.33 kB
TypeScript
import { MatrixClient } from "matrix-js-sdk/src/matrix";
import { MSC3575Filter, MSC3575List, SlidingSync } from "matrix-js-sdk/src/sliding-sync";
export type PartialSlidingSyncRequest = {
filters?: MSC3575Filter;
sort?: string[];
ranges?: [startIndex: number, endIndex: number][];
};
/**
* This class manages the entirety of sliding sync at a high UI/UX level. It controls the placement
* of placeholders in lists, controls updating sliding window ranges, and controls which events
* are pulled down when. The intention behind this manager is be the single place to look for sliding
* sync options and code.
*/
export declare class SlidingSyncManager {
static readonly ListSpaces = "space_list";
static readonly ListSearch = "search_list";
private static readonly internalInstance;
slidingSync?: SlidingSync;
private client?;
private configureDefer;
static get instance(): SlidingSyncManager;
configure(client: MatrixClient, proxyUrl: string): SlidingSync;
/**
* Ensure that this list is registered.
* @param listKey The list key to register
* @param updateArgs The fields to update on the list.
* @returns The complete list request params
*/
ensureListRegistered(listKey: string, updateArgs: PartialSlidingSyncRequest): Promise<MSC3575List>;
setRoomVisible(roomId: string, visible: boolean): Promise<string>;
/**
* Retrieve all rooms on the user's account. Used for pre-populating the local search cache.
* Retrieval is gradual over time.
* @param batchSize The number of rooms to return in each request.
* @param gapBetweenRequestsMs The number of milliseconds to wait between requests.
*/
startSpidering(batchSize: number, gapBetweenRequestsMs: number): Promise<void>;
/**
* Set up the Sliding Sync instance; configures the end point and starts spidering.
* The sliding sync endpoint is derived the following way:
* 1. The user-defined sliding sync proxy URL (legacy, for backwards compatibility)
* 2. The client `well-known` sliding sync proxy URL [declared at the unstable prefix](https://github.com/matrix-org/matrix-spec-proposals/blob/kegan/sync-v3/proposals/3575-sync.md#unstable-prefix)
* 3. The homeserver base url (for native server support)
* @param client The MatrixClient to use
* @returns A working Sliding Sync or undefined
*/
setup(client: MatrixClient): Promise<SlidingSync | undefined>;
/**
* Get the sliding sync proxy URL from the client well known
* @param client The MatrixClient to use
* @return The proxy url
*/
getProxyFromWellKnown(client: MatrixClient): Promise<string | undefined>;
/**
* Check if the server "natively" supports sliding sync (with an unstable endpoint).
* @param client The MatrixClient to use
* @return Whether the "native" (unstable) endpoint is supported
*/
nativeSlidingSyncSupport(client: MatrixClient): Promise<boolean>;
/**
* Check whether our homeserver has sliding sync support, that the endpoint is up, and
* is a sliding sync endpoint.
*
* Sets static member `SlidingSyncController.serverSupportsSlidingSync`
* @param client The MatrixClient to use
*/
checkSupport(client: MatrixClient): Promise<void>;
}