import { useQuery, UseQueryOptions } from 'react-query'; import { fetcher } from './fetcher'; export type Maybe = T | null; export type InputMaybe = Maybe; export type Exact = { [K in keyof T]: T[K] }; export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: string; String: string; Boolean: boolean; Int: number; Float: number; /** The 'Long' scalar type represents non-fractional signed whole numeric values. Long can represent values between -(2^64) and 2^64 - 1. */ Long: any; }; /** Authentication requires either a valid mail+password combination or a jwt obtained by an earlier login. */ export type Auth = { /** Self descriptive. */ jwt: Scalars['String']; /** Self descriptive. */ mail: Scalars['String']; /** Self descriptive. */ password: Scalars['String']; }; /** The type that query operations will be rooted at. */ export type QueryType = { __typename?: 'QueryType'; /** Export an encrypted database dump */ export?: Maybe; /** The offers that are visible for the ngo, belonging to the login */ get_offers?: Maybe>; /** For a username+password get a jwt containing the login:id */ login: Login; }; /** The type that query operations will be rooted at. */ export type QueryTypeExportArgs = { password: Scalars['String']; }; /** The type that query operations will be rooted at. */ export type QueryTypeGet_OffersArgs = { auth: Auth; }; /** The type that query operations will be rooted at. */ export type QueryTypeLoginArgs = { auth: Auth; }; /** Export an encrypted database dump */ export type Export = { __typename?: 'export'; err?: Maybe; /** Self descriptive. */ exit: Scalars['Int']; out?: Maybe; }; /** The offers that are visible for the ngo, belonging to the login */ export type Get_Offers = { __typename?: 'get_offers'; accessible?: Maybe; animals_allowed?: Maybe; animals_present?: Maybe; beds?: Maybe; contact_email?: Maybe; contact_name_full?: Maybe; contact_phone?: Maybe; id?: Maybe; languages?: Maybe>; note?: Maybe; place_city?: Maybe; place_country?: Maybe; place_street?: Maybe; place_street_number?: Maybe; place_zip?: Maybe; time_duration_str?: Maybe; time_from_str?: Maybe; }; /** For a username+password get a jwt containing the login:id */ export type Login = { __typename?: 'login'; jwt?: Maybe; }; export type LoginQueryVariables = Exact<{ auth: Auth; }>; export type LoginQuery = { __typename?: 'QueryType', login: { __typename?: 'login', jwt?: string | null } }; export type GetOffersQueryVariables = Exact<{ auth: Auth; }>; export type GetOffersQuery = { __typename?: 'QueryType', get_offers?: Array<{ __typename?: 'get_offers', id?: string | null, time_from_str?: string | null, time_duration_str?: string | null, beds?: number | null, languages?: Array | null, place_country?: string | null, place_city?: string | null, place_zip?: string | null, place_street?: string | null, place_street_number?: string | null, accessible?: boolean | null, animals_allowed?: boolean | null, animals_present?: boolean | null, contact_name_full?: string | null, contact_phone?: string | null, contact_email?: string | null, note?: string | null }> | null }; export const LoginDocument = ` query Login($auth: Auth!) { login(auth: $auth) { jwt } } `; export const useLoginQuery = < TData = LoginQuery, TError = unknown >( variables: LoginQueryVariables, options?: UseQueryOptions ) => useQuery( ['Login', variables], fetcher(LoginDocument, variables), options ); export const GetOffersDocument = ` query GetOffers($auth: Auth!) { get_offers(auth: $auth) { id time_from_str time_duration_str beds languages place_country place_city place_zip place_street place_street_number accessible animals_allowed animals_present contact_name_full contact_phone contact_email note } } `; export const useGetOffersQuery = < TData = GetOffersQuery, TError = unknown >( variables: GetOffersQueryVariables, options?: UseQueryOptions ) => useQuery( ['GetOffers', variables], fetcher(GetOffersDocument, variables), options );