import { IMatrixProfile, MatrixClient, MatrixError } from "matrix-js-sdk/src/matrix";
type StoreProfileValue = IMatrixProfile | undefined | null;
interface GetOptions {
    /** Whether calling the function shouuld raise an Error. */
    shouldThrow: boolean;
}
/**
 * This store provides cached access to user profiles.
 * Listens for membership events and invalidates the cache for a profile on update with different profile values.
 */
export declare class UserProfilesStore {
    private client;
    private profiles;
    private profileLookupErrors;
    private knownProfiles;
    constructor(client: MatrixClient);
    /**
     * Synchronously get a profile from the store cache.
     *
     * @param userId - User Id of the profile to fetch
     * @returns The profile, if cached by the store.
     *          Null if the profile does not exist.
     *          Undefined if the profile is not cached by the store.
     *          In this case a profile can be fetched from the API via {@link fetchProfile}.
     */
    getProfile(userId: string): StoreProfileValue;
    /**
     * Async shortcut function that returns the profile from cache or
     * or fetches it on cache miss.
     *
     * @param userId - User Id of the profile to get or fetch
     * @returns The profile, if cached by the store or fetched from the API.
     *          Null if the profile does not exist or an error occurred during fetch.
     */
    getOrFetchProfile(userId: string, options?: GetOptions): Promise<IMatrixProfile | null>;
    /**
     * Get a profile lookup error.
     *
     * @param userId - User Id for which to get the lookup error
     * @returns The lookup error or undefined if there was no error or the profile was not fetched.
     */
    getProfileLookupError(userId: string): MatrixError | undefined;
    /**
     * Synchronously get a profile from known users from the store cache.
     * Known user means that at least one shared room with the user exists.
     *
     * @param userId - User Id of the profile to fetch
     * @returns The profile, if cached by the store.
     *          Null if the profile does not exist.
     *          Undefined if the profile is not cached by the store.
     *          In this case a profile can be fetched from the API via {@link fetchOnlyKnownProfile}.
     */
    getOnlyKnownProfile(userId: string): StoreProfileValue;
    /**
     * Asynchronousely fetches a profile from the API.
     * Stores the result in the cache, so that next time {@link getProfile} returns this value.
     *
     * @param userId - User Id for which the profile should be fetched for
     * @returns The profile, if found.
     *          Null if the profile does not exist or there was an error fetching it.
     */
    fetchProfile(userId: string, options?: GetOptions): Promise<IMatrixProfile | null>;
    /**
     * Asynchronousely fetches a profile from a known user from the API.
     * Known user means that at least one shared room with the user exists.
     * Stores the result in the cache, so that next time {@link getOnlyKnownProfile} returns this value.
     *
     * @param userId - User Id for which the profile should be fetched for
     * @returns The profile, if found.
     *          Undefined if the user is unknown.
     *          Null if the profile does not exist or there was an error fetching it.
     */
    fetchOnlyKnownProfile(userId: string): Promise<StoreProfileValue>;
    flush(): void;
    /**
     * Looks up a user profile via API.
     *
     * @param userId - User Id for which the profile should be fetched for
     * @returns The profile information or null on errors
     */
    private fetchProfileFromApi;
    /**
     * Whether at least one shared room with the userId exists.
     *
     * @param userId
     * @returns true: at least one room shared with user identified by its Id, else false.
     */
    private isUserIdKnown;
    /**
     * Simple cache invalidation if a room membership event is received and
     * at least one profile value differs from the cached one.
     */
    private onRoomMembershipEvent;
}
export {};
