synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
41 lines • 2.23 kB
TypeScript
import { Realm, SynapseClientError } from '@sage-bionetworks/synapse-client';
import { RealmPrincipal } from '@sage-bionetworks/synapse-client/generated/models/RealmPrincipal';
import { UseQueryOptions } from '@tanstack/react-query';
import { KeyFactory } from '../KeyFactory';
import { SynapseClient } from '@sage-bionetworks/synapse-client/SynapseClient';
/**
* Get query options for fetching a realm by ID.
* This can be used with useQuery, useQueries, or useSuspenseQuery.
*
* @param realmId - The realm ID to fetch
* @param keyFactory - The key factory instance
* @param synapseClient - The Synapse client instance
* @returns Query options for fetching the realm
*/
export declare const getRealmByIdQueryOptions: (realmId: string, keyFactory: KeyFactory, synapseClient: InstanceType<typeof SynapseClient>) => {
queryKey: readonly unknown[];
queryFn: () => Promise<Realm>;
};
/**
* Get the current realm for the logged in user.
*
* @param options - Query options
* @returns The realm ID for the current user
*/
export declare function useGetCurrentRealm<TData = Realm>(options?: Partial<UseQueryOptions<Realm, SynapseClientError, TData>>): import("@tanstack/react-query").UseQueryResult<import("@tanstack/query-core").NoInfer<TData>, SynapseClientError>;
/**
* Get a realm by its ID.
*
* @param realmId - The realm ID to fetch
* @param options - Query options
* @returns The realm object
*/
export declare function useGetRealm<TData = Realm>(realmId: string, options?: Partial<UseQueryOptions<Realm, SynapseClientError, TData>>): import("@tanstack/react-query").UseQueryResult<import("@tanstack/query-core").NoInfer<TData>, SynapseClientError>;
/**
* Get the realm principals for the current user's realm.
*
* @param options - Query options
* @returns The realm principal IDs as strings (authenticatedUsersId, publicGroupId, anonymousUserId), along with loading and error states
*/
export declare function useGetRealmPrincipals<TData = RealmPrincipal>(options?: Partial<UseQueryOptions<RealmPrincipal, SynapseClientError, TData>>): import("@tanstack/react-query").UseQueryResult<import("@tanstack/query-core").NoInfer<TData>, SynapseClientError>;
//# sourceMappingURL=useRealmPrincipals.d.ts.map