From b2a09c1b8c1792b42084dfb46bd3f907592a21d4 Mon Sep 17 00:00:00 2001 From: Kat Huang Date: Fri, 11 Oct 2024 18:46:46 -0600 Subject: [PATCH] Create reserved query for get shots with metadata (#74) Reviewed-on: https://dev.railbird.ai/railbird/railbird-gql/pulls/74 Reviewed-by: Ivan Malison --- src/index.tsx | 156 +++++++++++++++++++++++++++++++++++++++ src/operations/shots.gql | 22 ++++++ 2 files changed, 178 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index edacc9d..d921097 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2424,6 +2424,72 @@ export type GetShotsWithVideoGqlQuery = { }; }; +export type GetShotsWithMetadataFilterResultQueryVariables = Exact<{ + filterInput: FilterInput; + shotsPagination?: InputMaybe; + limit?: InputMaybe; + ids?: InputMaybe | Scalars["Int"]["input"]>; +}>; + +export type GetShotsWithMetadataFilterResultQuery = { + __typename?: "Query"; + getShotsWithMetadata: { + __typename?: "GetShotsResult"; + count?: number | null; + ids: Array; + shots: Array<{ + __typename?: "ShotGQL"; + id: number; + videoId: number; + startFrame: number; + endFrame: number; + falsePositiveScore?: number | null; + createdAt?: any | null; + updatedAt?: any | null; + user?: { __typename?: "UserGQL"; id: number } | null; + video?: { + __typename?: "VideoGQL"; + id: number; + stream?: { + __typename?: "UploadStreamGQL"; + resolution: { + __typename?: "VideoResolutionGQL"; + width?: number | null; + height?: number | null; + }; + } | null; + } | null; + cueObjectFeatures?: { + __typename?: "CueObjectFeaturesGQL"; + cueObjectDistance?: number | null; + cueObjectAngle?: number | null; + cueBallSpeed?: number | null; + shotDirection?: ShotDirectionEnum | null; + spinType?: SpinTypeEnum | null; + } | null; + pocketingIntentionFeatures?: { + __typename?: "PocketingIntentionFeaturesGQL"; + make?: boolean | null; + targetPocketDistance?: number | null; + targetPocketAngle?: number | null; + targetPocketAngleDirection?: ShotDirectionEnum | null; + marginOfErrorInDegrees?: number | null; + intendedPocketType?: PocketEnum | null; + } | null; + pocketingIntentionInfo?: { + __typename?: "PocketingIntentionInfoGQL"; + ballId: number; + pocketId: PocketIdentifier; + pathMetadataIndex: number; + } | null; + serializedShotPaths?: { + __typename?: "SerializedShotPathsGQL"; + b64EncodedBuffer?: string | null; + } | null; + }>; + }; +}; + export type GetShotsWithMetadataQueryVariables = Exact<{ filterInput: FilterInput; shotsPagination?: InputMaybe; @@ -3775,6 +3841,96 @@ export type GetShotsWithVideoGqlQueryResult = Apollo.QueryResult< GetShotsWithVideoGqlQuery, GetShotsWithVideoGqlQueryVariables >; +export const GetShotsWithMetadataFilterResultDocument = gql` + query GetShotsWithMetadataFilterResult( + $filterInput: FilterInput! + $shotsPagination: GetShotsPagination + $limit: Int + $ids: [Int!] + ) { + getShotsWithMetadata( + filterInput: $filterInput + shotsPagination: $shotsPagination + limit: $limit + ids: $ids + ) { + count + shots { + ...ShotWithAllFeatures + } + ids + } + } + ${ShotWithAllFeaturesFragmentDoc} +`; + +/** + * __useGetShotsWithMetadataFilterResultQuery__ + * + * To run a query within a React component, call `useGetShotsWithMetadataFilterResultQuery` and pass it any options that fit your needs. + * When your component renders, `useGetShotsWithMetadataFilterResultQuery` 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 } = useGetShotsWithMetadataFilterResultQuery({ + * variables: { + * filterInput: // value for 'filterInput' + * shotsPagination: // value for 'shotsPagination' + * limit: // value for 'limit' + * ids: // value for 'ids' + * }, + * }); + */ +export function useGetShotsWithMetadataFilterResultQuery( + baseOptions: Apollo.QueryHookOptions< + GetShotsWithMetadataFilterResultQuery, + GetShotsWithMetadataFilterResultQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery< + GetShotsWithMetadataFilterResultQuery, + GetShotsWithMetadataFilterResultQueryVariables + >(GetShotsWithMetadataFilterResultDocument, options); +} +export function useGetShotsWithMetadataFilterResultLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + GetShotsWithMetadataFilterResultQuery, + GetShotsWithMetadataFilterResultQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + GetShotsWithMetadataFilterResultQuery, + GetShotsWithMetadataFilterResultQueryVariables + >(GetShotsWithMetadataFilterResultDocument, options); +} +export function useGetShotsWithMetadataFilterResultSuspenseQuery( + baseOptions?: Apollo.SuspenseQueryHookOptions< + GetShotsWithMetadataFilterResultQuery, + GetShotsWithMetadataFilterResultQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery< + GetShotsWithMetadataFilterResultQuery, + GetShotsWithMetadataFilterResultQueryVariables + >(GetShotsWithMetadataFilterResultDocument, options); +} +export type GetShotsWithMetadataFilterResultQueryHookResult = ReturnType< + typeof useGetShotsWithMetadataFilterResultQuery +>; +export type GetShotsWithMetadataFilterResultLazyQueryHookResult = ReturnType< + typeof useGetShotsWithMetadataFilterResultLazyQuery +>; +export type GetShotsWithMetadataFilterResultSuspenseQueryHookResult = + ReturnType; +export type GetShotsWithMetadataFilterResultQueryResult = Apollo.QueryResult< + GetShotsWithMetadataFilterResultQuery, + GetShotsWithMetadataFilterResultQueryVariables +>; export const GetShotsWithMetadataDocument = gql` query GetShotsWithMetadata( $filterInput: FilterInput! diff --git a/src/operations/shots.gql b/src/operations/shots.gql index 3d31693..9a90273 100644 --- a/src/operations/shots.gql +++ b/src/operations/shots.gql @@ -31,6 +31,28 @@ query GetShotsWithVideoGql($filterInput: FilterInput!, $limit: Int) { } } +## Reserved for playlists (which are created from a filter) +query GetShotsWithMetadataFilterResult( + $filterInput: FilterInput! + $shotsPagination: GetShotsPagination + $limit: Int + $ids: [Int!] +) { + getShotsWithMetadata( + filterInput: $filterInput + shotsPagination: $shotsPagination + limit: $limit + ids: $ids + ) { + count + shots { + ...ShotWithAllFeatures + } + ids + } +} + +# TODO: Delete query GetShotsWithMetadata( $filterInput: FilterInput! $shotsPagination: GetShotsPagination