151 lines
5.3 KiB
TypeScript
151 lines
5.3 KiB
TypeScript
import { gql } from '@apollo/client';
|
|
import * as Apollo from '@apollo/client';
|
|
export type Maybe<T> = T | null;
|
|
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
|
|
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
|
|
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
|
|
const defaultOptions = {}
|
|
/** All built-in and custom scalars, mapped to their actual values */
|
|
export type Scalars = {
|
|
ID: string;
|
|
String: string;
|
|
Boolean: boolean;
|
|
Int: number;
|
|
Float: number;
|
|
/** Date with time (isoformat) */
|
|
DateTime: any;
|
|
};
|
|
|
|
export type Product = {
|
|
__typename?: 'Product';
|
|
id: Scalars['ID'];
|
|
name: Scalars['String'];
|
|
salePriceExt: Scalars['Float'];
|
|
salePriceInt: Scalars['Float'];
|
|
};
|
|
|
|
export type ProductFilter = {
|
|
active?: Maybe<Scalars['Boolean']>;
|
|
id?: Maybe<Scalars['ID']>;
|
|
};
|
|
|
|
export type Query = {
|
|
__typename?: 'Query';
|
|
allProducts: Array<Product>;
|
|
allUsers: Array<User>;
|
|
};
|
|
|
|
|
|
export type QueryAllProductsArgs = {
|
|
filters?: Maybe<ProductFilter>;
|
|
};
|
|
|
|
export type User = {
|
|
__typename?: 'User';
|
|
firstName: Scalars['String'];
|
|
id: Scalars['ID'];
|
|
lastName: Scalars['String'];
|
|
profile?: Maybe<UserProfile>;
|
|
};
|
|
|
|
export type UserProfile = {
|
|
__typename?: 'UserProfile';
|
|
balance: Scalars['Float'];
|
|
id: Scalars['ID'];
|
|
image: Scalars['String'];
|
|
lastPurchaseDate: Scalars['DateTime'];
|
|
};
|
|
|
|
export type AllProductsQueryVariables = Exact<{
|
|
active: Scalars['Boolean'];
|
|
}>;
|
|
|
|
|
|
export type AllProductsQuery = { __typename?: 'Query', allProducts: Array<{ __typename?: 'Product', id: string, name: string, salePriceExt: number, salePriceInt: number }> };
|
|
|
|
export type AllUsersQueryVariables = Exact<{ [key: string]: never; }>;
|
|
|
|
|
|
export type AllUsersQuery = { __typename?: 'Query', allUsers: Array<{ __typename?: 'User', id: string, firstName: string, lastName: string, profile?: { __typename?: 'UserProfile', id: string, balance: number, image: string, lastPurchaseDate: any } | null | undefined }> };
|
|
|
|
|
|
export const AllProductsDocument = gql`
|
|
query allProducts($active: Boolean!) {
|
|
allProducts(filters: {active: $active}) {
|
|
id
|
|
name
|
|
salePriceExt
|
|
salePriceInt
|
|
}
|
|
}
|
|
`;
|
|
|
|
/**
|
|
* __useAllProductsQuery__
|
|
*
|
|
* To run a query within a React component, call `useAllProductsQuery` and pass it any options that fit your needs.
|
|
* When your component renders, `useAllProductsQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
|
* you can use to render your UI.
|
|
*
|
|
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
|
*
|
|
* @example
|
|
* const { data, loading, error } = useAllProductsQuery({
|
|
* variables: {
|
|
* active: // value for 'active'
|
|
* },
|
|
* });
|
|
*/
|
|
export function useAllProductsQuery(baseOptions: Apollo.QueryHookOptions<AllProductsQuery, AllProductsQueryVariables>) {
|
|
const options = {...defaultOptions, ...baseOptions}
|
|
return Apollo.useQuery<AllProductsQuery, AllProductsQueryVariables>(AllProductsDocument, options);
|
|
}
|
|
export function useAllProductsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<AllProductsQuery, AllProductsQueryVariables>) {
|
|
const options = {...defaultOptions, ...baseOptions}
|
|
return Apollo.useLazyQuery<AllProductsQuery, AllProductsQueryVariables>(AllProductsDocument, options);
|
|
}
|
|
export type AllProductsQueryHookResult = ReturnType<typeof useAllProductsQuery>;
|
|
export type AllProductsLazyQueryHookResult = ReturnType<typeof useAllProductsLazyQuery>;
|
|
export type AllProductsQueryResult = Apollo.QueryResult<AllProductsQuery, AllProductsQueryVariables>;
|
|
export const AllUsersDocument = gql`
|
|
query allUsers {
|
|
allUsers {
|
|
id
|
|
firstName
|
|
lastName
|
|
profile {
|
|
id
|
|
balance
|
|
image
|
|
lastPurchaseDate
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
/**
|
|
* __useAllUsersQuery__
|
|
*
|
|
* To run a query within a React component, call `useAllUsersQuery` and pass it any options that fit your needs.
|
|
* When your component renders, `useAllUsersQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
|
* you can use to render your UI.
|
|
*
|
|
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
|
*
|
|
* @example
|
|
* const { data, loading, error } = useAllUsersQuery({
|
|
* variables: {
|
|
* },
|
|
* });
|
|
*/
|
|
export function useAllUsersQuery(baseOptions?: Apollo.QueryHookOptions<AllUsersQuery, AllUsersQueryVariables>) {
|
|
const options = {...defaultOptions, ...baseOptions}
|
|
return Apollo.useQuery<AllUsersQuery, AllUsersQueryVariables>(AllUsersDocument, options);
|
|
}
|
|
export function useAllUsersLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<AllUsersQuery, AllUsersQueryVariables>) {
|
|
const options = {...defaultOptions, ...baseOptions}
|
|
return Apollo.useLazyQuery<AllUsersQuery, AllUsersQueryVariables>(AllUsersDocument, options);
|
|
}
|
|
export type AllUsersQueryHookResult = ReturnType<typeof useAllUsersQuery>;
|
|
export type AllUsersLazyQueryHookResult = ReturnType<typeof useAllUsersLazyQuery>;
|
|
export type AllUsersQueryResult = Apollo.QueryResult<AllUsersQuery, AllUsersQueryVariables>; |