From 838304efdd49a093bd8f9cea6cd6ef9e306d888a Mon Sep 17 00:00:00 2001 From: Kat Huang Date: Mon, 5 Feb 2024 12:16:58 -0700 Subject: [PATCH] Add shots and bucketed shot gql --- src/index.tsx | 136 ++++++++++++++++++++++++++++ src/operations/bucketed_metrics.gql | 17 ++++ src/operations/shots.gql | 30 ++++++ 3 files changed, 183 insertions(+) create mode 100644 src/operations/bucketed_metrics.gql create mode 100644 src/operations/shots.gql diff --git a/src/index.tsx b/src/index.tsx index a09aedd..9adb914 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -355,6 +355,27 @@ export enum WallTypeEnum { Short = 'SHORT' } +export type GetAggregateShotsQueryVariables = Exact<{ + bucketSets: Array | BucketSetInputGql; +}>; + + +export type GetAggregateShotsQuery = { __typename?: 'Query', getAggregateShots: Array<{ __typename?: 'AggregateResultGQL', featureBuckets: Array<{ __typename?: 'BucketGQL', rangeKey: string, lowerBound: number }>, targetMetrics: Array<{ __typename?: 'TargetMetricGQL', count?: number | null, makePercentage?: number | null, floatFeature?: { __typename?: 'TargetFloatFeatureGQL', featureName: string, average?: number | null, median?: number | null } | null }> }> }; + +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 +408,121 @@ export type TerminateUploadStreamMutationVariables = Exact<{ export type TerminateUploadStreamMutation = { __typename?: 'Mutation', terminateUploadStream: boolean }; +export const GetAggregateShotsDocument = gql` + query GetAggregateShots($bucketSets: [BucketSetInputGQL!]!) { + getAggregateShots(bucketSets: $bucketSets) { + featureBuckets { + rangeKey + lowerBound + } + targetMetrics { + count + makePercentage + floatFeature { + featureName + average + median + } + } + } +} + `; + +/** + * __useGetAggregateShotsQuery__ + * + * To run a query within a React component, call `useGetAggregateShotsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetAggregateShotsQuery` 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 } = useGetAggregateShotsQuery({ + * variables: { + * bucketSets: // value for 'bucketSets' + * }, + * }); + */ +export function useGetAggregateShotsQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(GetAggregateShotsDocument, options); + } +export function useGetAggregateShotsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(GetAggregateShotsDocument, options); + } +export function useGetAggregateShotsSuspenseQuery(baseOptions?: Apollo.SuspenseQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSuspenseQuery(GetAggregateShotsDocument, options); + } +export type GetAggregateShotsQueryHookResult = ReturnType; +export type GetAggregateShotsLazyQueryHookResult = ReturnType; +export type GetAggregateShotsSuspenseQueryHookResult = ReturnType; +export type GetAggregateShotsQueryResult = Apollo.QueryResult; +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/bucketed_metrics.gql b/src/operations/bucketed_metrics.gql new file mode 100644 index 0000000..5d23209 --- /dev/null +++ b/src/operations/bucketed_metrics.gql @@ -0,0 +1,17 @@ +query GetAggregateShots($bucketSets: [BucketSetInputGQL!]!) { + getAggregateShots(bucketSets: $bucketSets) { + featureBuckets { + rangeKey + lowerBound + } + targetMetrics { + count + makePercentage + floatFeature { + featureName + average + median + } + } + } +} diff --git a/src/operations/shots.gql b/src/operations/shots.gql new file mode 100644 index 0000000..c41fc5c --- /dev/null +++ b/src/operations/shots.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) + } + } +}