From e23546de8840f990d45893d9eacde5b7df930155 Mon Sep 17 00:00:00 2001 From: Kat Huang Date: Sat, 3 Feb 2024 13:30:52 -0700 Subject: [PATCH] Create gql query for shot data --- src/generated/graphql.tsx | 77 ++++++++++++++++++++++++++++++++++++ src/operations/shot_data.gql | 30 ++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 src/operations/shot_data.gql diff --git a/src/generated/graphql.tsx b/src/generated/graphql.tsx index a09aedd..1af2d14 100644 --- a/src/generated/graphql.tsx +++ b/src/generated/graphql.tsx @@ -355,6 +355,20 @@ export enum WallTypeEnum { Short = 'SHORT' } +export type GetShotsQueryVariables = Exact<{ + filterInput?: InputMaybe; + includeCueObjectDistance?: Scalars['Boolean']['input']; + includeCueObjectAngle?: Scalars['Boolean']['input']; + includeCueBallSpeed?: Scalars['Boolean']['input']; + includeShotDirection?: Scalars['Boolean']['input']; + includeTargetPocketDistance?: Scalars['Boolean']['input']; + includeMake?: Scalars['Boolean']['input']; + includeIntendedPocketType?: Scalars['Boolean']['input']; +}>; + + +export type GetShotsQuery = { __typename?: 'Query', getShots: Array<{ __typename?: 'ShotGQL', id?: number | null, videoId?: number | null, startFrame?: number | null, endFrame?: number | null, createdAt?: any | null, updatedAt?: any | null, cueObjectFeatures?: { __typename?: 'CueObjectFeaturesGQL', cueObjectDistance?: number | null, cueObjectAngle?: number | null, cueBallSpeed?: number | null, shotDirection?: ShotDirectionEnum | null } | null, pocketingIntentionFeatures?: { __typename?: 'PocketingIntentionFeaturesGQL', targetPocketDistance?: number | null, make?: boolean | null, intendedPocketType?: PocketEnum | null } | null }> }; + export type CreateUploadStreamMutationVariables = Exact<{ videoName: Scalars['String']['input']; deviceType?: InputMaybe; @@ -387,6 +401,69 @@ export type TerminateUploadStreamMutationVariables = Exact<{ export type TerminateUploadStreamMutation = { __typename?: 'Mutation', terminateUploadStream: boolean }; +export const GetShotsDocument = gql` + query GetShots($filterInput: FilterInput, $includeCueObjectDistance: Boolean! = false, $includeCueObjectAngle: Boolean! = false, $includeCueBallSpeed: Boolean! = false, $includeShotDirection: Boolean! = false, $includeTargetPocketDistance: Boolean! = false, $includeMake: Boolean! = false, $includeIntendedPocketType: Boolean! = false) { + getShots(filterInput: $filterInput) { + id + videoId + startFrame + endFrame + createdAt + updatedAt + cueObjectFeatures { + cueObjectDistance @include(if: $includeCueObjectDistance) + cueObjectAngle @include(if: $includeCueObjectAngle) + cueBallSpeed @include(if: $includeCueBallSpeed) + shotDirection @include(if: $includeShotDirection) + } + pocketingIntentionFeatures { + targetPocketDistance @include(if: $includeTargetPocketDistance) + make @include(if: $includeMake) + intendedPocketType @include(if: $includeIntendedPocketType) + } + } +} + `; + +/** + * __useGetShotsQuery__ + * + * To run a query within a React component, call `useGetShotsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetShotsQuery` 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 } = useGetShotsQuery({ + * variables: { + * filterInput: // value for 'filterInput' + * includeCueObjectDistance: // value for 'includeCueObjectDistance' + * includeCueObjectAngle: // value for 'includeCueObjectAngle' + * includeCueBallSpeed: // value for 'includeCueBallSpeed' + * includeShotDirection: // value for 'includeShotDirection' + * includeTargetPocketDistance: // value for 'includeTargetPocketDistance' + * includeMake: // value for 'includeMake' + * includeIntendedPocketType: // value for 'includeIntendedPocketType' + * }, + * }); + */ +export function useGetShotsQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(GetShotsDocument, options); + } +export function useGetShotsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(GetShotsDocument, options); + } +export function useGetShotsSuspenseQuery(baseOptions?: Apollo.SuspenseQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSuspenseQuery(GetShotsDocument, options); + } +export type GetShotsQueryHookResult = ReturnType; +export type GetShotsLazyQueryHookResult = ReturnType; +export type GetShotsSuspenseQueryHookResult = ReturnType; +export type GetShotsQueryResult = Apollo.QueryResult; export const CreateUploadStreamDocument = gql` mutation CreateUploadStream($videoName: String!, $deviceType: DeviceTypeEnum, $osVersion: String, $appVersion: String, $browserName: String, $browserVersion: String, $locale: String, $timezone: String, $networkType: String, $ipAddress: String) { createUploadStream( diff --git a/src/operations/shot_data.gql b/src/operations/shot_data.gql new file mode 100644 index 0000000..c41fc5c --- /dev/null +++ b/src/operations/shot_data.gql @@ -0,0 +1,30 @@ +query GetShots( + $filterInput: FilterInput + $includeCueObjectDistance: Boolean! = false + $includeCueObjectAngle: Boolean! = false + $includeCueBallSpeed: Boolean! = false + $includeShotDirection: Boolean! = false + $includeTargetPocketDistance: Boolean! = false + $includeMake: Boolean! = false + $includeIntendedPocketType: Boolean! = false +) { + getShots(filterInput: $filterInput) { + id + videoId + startFrame + endFrame + createdAt + updatedAt + cueObjectFeatures { + cueObjectDistance @include(if: $includeCueObjectDistance) + cueObjectAngle @include(if: $includeCueObjectAngle) + cueBallSpeed @include(if: $includeCueBallSpeed) + shotDirection @include(if: $includeShotDirection) + } + pocketingIntentionFeatures { + targetPocketDistance @include(if: $includeTargetPocketDistance) + make @include(if: $includeMake) + intendedPocketType @include(if: $includeIntendedPocketType) + } + } +} -- 2.45.2