-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
HeroDetails.tsx
40 lines (34 loc) · 1.83 KB
/
HeroDetails.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import * as Types from '../types.d';
import gql from 'graphql-tag';
import * as React from 'react';
import * as ApolloReactCommon from '@apollo/react-common';
import * as ApolloReactComponents from '@apollo/react-components';
import * as ApolloReactHoc from '@apollo/react-hoc';
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export type HeroDetailsQueryVariables = {
episode?: Types.Maybe<Types.Episode>;
};
export type HeroDetailsQuery = { __typename?: 'Query' } & { hero: Types.Maybe<({ __typename?: 'Human' } & Pick<Types.Human, 'height' | 'name'>) | ({ __typename?: 'Droid' } & Pick<Types.Droid, 'primaryFunction' | 'name'>)> };
export const HeroDetailsDocument = gql`
query HeroDetails($episode: Episode) {
hero(episode: $episode) {
name
... on Human {
height
}
... on Droid {
primaryFunction
}
}
}
`;
export type HeroDetailsComponentProps = Omit<ApolloReactComponents.QueryComponentOptions<HeroDetailsQuery, HeroDetailsQueryVariables>, 'query'>;
export const HeroDetailsComponent = (props: HeroDetailsComponentProps) => <ApolloReactComponents.Query<HeroDetailsQuery, HeroDetailsQueryVariables> query={HeroDetailsDocument} {...props} />;
export type HeroDetailsProps<TChildProps = {}> = ApolloReactHoc.DataProps<HeroDetailsQuery, HeroDetailsQueryVariables> | TChildProps;
export function withHeroDetails<TProps, TChildProps = {}>(operationOptions?: ApolloReactHoc.OperationOption<TProps, HeroDetailsQuery, HeroDetailsQueryVariables, HeroDetailsProps<TChildProps>>) {
return ApolloReactHoc.withQuery<TProps, HeroDetailsQuery, HeroDetailsQueryVariables, HeroDetailsProps<TChildProps>>(HeroDetailsDocument, {
alias: 'heroDetails',
...operationOptions,
});
}
export type HeroDetailsQueryResult = ApolloReactCommon.QueryResult<HeroDetailsQuery, HeroDetailsQueryVariables>;