/** * A tenant's configured account at an email provider: provider slug, endpoint coordinates, and the NAME of the secret holding its credentials (never the credential itself) * @generated by @constructive-io/graphql-codegen * DO NOT EDIT - changes will be overwritten */ import { useQuery } from '@tanstack/react-query'; import type { UseQueryOptions, UseQueryResult, QueryClient } from '@tanstack/react-query'; import { getClient } from '../client'; import { buildListSelectionArgs } from '../selection'; import type { ListSelectionConfig } from '../selection'; import { platformEmailProviderAccountKeys } from '../query-keys'; import type { PlatformEmailProviderAccountSelect, PlatformEmailProviderAccountWithRelations, PlatformEmailProviderAccountFilter, PlatformEmailProviderAccountOrderBy, } from '../../orm/input-types'; import type { FindManyArgs, InferSelectResult, ConnectionResult, HookStrictSelect, } from '../../orm/select-types'; export type { PlatformEmailProviderAccountSelect, PlatformEmailProviderAccountWithRelations, PlatformEmailProviderAccountFilter, PlatformEmailProviderAccountOrderBy, } from '../../orm/input-types'; /** Query key factory - re-exported from query-keys.ts */ export const platformEmailProviderAccountsQueryKey = platformEmailProviderAccountKeys.list; /** * A tenant's configured account at an email provider: provider slug, endpoint coordinates, and the NAME of the secret holding its credentials (never the credential itself) * * @example * ```tsx * const { data, isLoading } = usePlatformEmailProviderAccountsQuery({ * selection: { * fields: { id: true, name: true }, * where: { name: { equalTo: "example" } }, * orderBy: ['CREATED_AT_DESC'], * first: 10, * }, * }); * ``` */ export function usePlatformEmailProviderAccountsQuery< S extends PlatformEmailProviderAccountSelect, TData = { platformEmailProviderAccounts: ConnectionResult< InferSelectResult >; }, >( params: { selection: { fields: S; } & Omit< ListSelectionConfig< S, PlatformEmailProviderAccountFilter, PlatformEmailProviderAccountOrderBy >, 'fields' > & HookStrictSelect, PlatformEmailProviderAccountSelect>; } & Omit< UseQueryOptions< { platformEmailProviderAccounts: ConnectionResult< InferSelectResult >; }, Error, TData >, 'queryKey' | 'queryFn' > ): UseQueryResult; export function usePlatformEmailProviderAccountsQuery( params: { selection: ListSelectionConfig< PlatformEmailProviderAccountSelect, PlatformEmailProviderAccountFilter, PlatformEmailProviderAccountOrderBy >; } & Omit, 'queryKey' | 'queryFn'> ) { const args = buildListSelectionArgs< PlatformEmailProviderAccountSelect, PlatformEmailProviderAccountFilter, PlatformEmailProviderAccountOrderBy >(params.selection); const { selection: _selection, ...queryOptions } = params ?? {}; void _selection; return useQuery({ queryKey: platformEmailProviderAccountKeys.list(args), queryFn: () => getClient().platformEmailProviderAccount.findMany(args).unwrap(), ...queryOptions, }); } /** * A tenant's configured account at an email provider: provider slug, endpoint coordinates, and the NAME of the secret holding its credentials (never the credential itself) * * @example * ```ts * const data = await fetchPlatformEmailProviderAccountsQuery({ * selection: { * fields: { id: true }, * first: 10, * }, * }); * ``` */ export async function fetchPlatformEmailProviderAccountsQuery< S extends PlatformEmailProviderAccountSelect, >(params: { selection: { fields: S; } & Omit< ListSelectionConfig, 'fields' > & HookStrictSelect, PlatformEmailProviderAccountSelect>; }): Promise<{ platformEmailProviderAccounts: ConnectionResult< InferSelectResult >; }>; export async function fetchPlatformEmailProviderAccountsQuery(params: { selection: ListSelectionConfig< PlatformEmailProviderAccountSelect, PlatformEmailProviderAccountFilter, PlatformEmailProviderAccountOrderBy >; }) { const args = buildListSelectionArgs< PlatformEmailProviderAccountSelect, PlatformEmailProviderAccountFilter, PlatformEmailProviderAccountOrderBy >(params.selection); return getClient().platformEmailProviderAccount.findMany(args).unwrap(); } /** * A tenant's configured account at an email provider: provider slug, endpoint coordinates, and the NAME of the secret holding its credentials (never the credential itself) * * @example * ```ts * await prefetchPlatformEmailProviderAccountsQuery(queryClient, { selection: { fields: { id: true }, first: 10 } }); * ``` */ export async function prefetchPlatformEmailProviderAccountsQuery< S extends PlatformEmailProviderAccountSelect, >( queryClient: QueryClient, params: { selection: { fields: S; } & Omit< ListSelectionConfig< S, PlatformEmailProviderAccountFilter, PlatformEmailProviderAccountOrderBy >, 'fields' > & HookStrictSelect, PlatformEmailProviderAccountSelect>; } ): Promise; export async function prefetchPlatformEmailProviderAccountsQuery( queryClient: QueryClient, params: { selection: ListSelectionConfig< PlatformEmailProviderAccountSelect, PlatformEmailProviderAccountFilter, PlatformEmailProviderAccountOrderBy >; } ): Promise { const args = buildListSelectionArgs< PlatformEmailProviderAccountSelect, PlatformEmailProviderAccountFilter, PlatformEmailProviderAccountOrderBy >(params.selection); await queryClient.prefetchQuery({ queryKey: platformEmailProviderAccountKeys.list(args), queryFn: () => getClient().platformEmailProviderAccount.findMany(args).unwrap(), }); }