From 2699d29d7bb0f11e9031283ebb7a3164401c3462 Mon Sep 17 00:00:00 2001 From: Kat Huang Date: Sun, 29 Sep 2024 22:53:24 -0600 Subject: [PATCH] Create get shots by ids operation --- src/index.tsx | 185 +++++++++++++++++++++++++++++++++++++++ src/operations/shots.gql | 50 +++++++++++ 2 files changed, 235 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index 6ffa9f8..212297e 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2380,6 +2380,62 @@ export type GetShotsWithMetadataQuery = { }; }; +export type GetShotsByIdsQueryVariables = Exact<{ + ids: Array | Scalars["Int"]["input"]; + includeCreatedAt?: Scalars["Boolean"]["input"]; + includeUpdatedAt?: Scalars["Boolean"]["input"]; + includeCueObjectFeatures?: Scalars["Boolean"]["input"]; + includePocketingIntentionFeatures?: Scalars["Boolean"]["input"]; + includeCueObjectDistance?: Scalars["Boolean"]["input"]; + includeCueObjectAngle?: Scalars["Boolean"]["input"]; + includeCueBallSpeed?: Scalars["Boolean"]["input"]; + includeSpinType?: Scalars["Boolean"]["input"]; + includeShotDirection?: Scalars["Boolean"]["input"]; + includeTargetPocketDistance?: Scalars["Boolean"]["input"]; + includeMake?: Scalars["Boolean"]["input"]; + includeIntendedPocketType?: Scalars["Boolean"]["input"]; +}>; + +export type GetShotsByIdsQuery = { + __typename?: "Query"; + getShotsByIds: 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"; + 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"; + targetPocketDistance?: number | null; + make?: boolean | null; + intendedPocketType?: PocketEnum | null; + } | null; + }>; +}; + export type GetProfileImageUploadLinkMutationVariables = Exact<{ fileExt?: InputMaybe; }>; @@ -3695,6 +3751,135 @@ export type GetShotsWithMetadataQueryResult = Apollo.QueryResult< GetShotsWithMetadataQuery, GetShotsWithMetadataQueryVariables >; +export const GetShotsByIdsDocument = gql` + query GetShotsByIds( + $ids: [Int!]! + $includeCreatedAt: Boolean! = false + $includeUpdatedAt: Boolean! = false + $includeCueObjectFeatures: Boolean! = false + $includePocketingIntentionFeatures: Boolean! = false + $includeCueObjectDistance: Boolean! = false + $includeCueObjectAngle: Boolean! = false + $includeCueBallSpeed: Boolean! = false + $includeSpinType: Boolean! = false + $includeShotDirection: Boolean! = false + $includeTargetPocketDistance: Boolean! = false + $includeMake: Boolean! = false + $includeIntendedPocketType: Boolean! = false + ) { + getShotsByIds(ids: $ids) { + id + videoId + startFrame + endFrame + user { + id + } + falsePositiveScore + video { + stream { + resolution { + width + height + } + } + } + createdAt @include(if: $includeCreatedAt) + updatedAt @include(if: $includeUpdatedAt) + cueObjectFeatures @include(if: $includeCueObjectFeatures) { + cueObjectDistance @include(if: $includeCueObjectDistance) + cueObjectAngle @include(if: $includeCueObjectAngle) + cueBallSpeed @include(if: $includeCueBallSpeed) + shotDirection @include(if: $includeShotDirection) + spinType @include(if: $includeSpinType) + } + pocketingIntentionFeatures + @include(if: $includePocketingIntentionFeatures) { + targetPocketDistance @include(if: $includeTargetPocketDistance) + make @include(if: $includeMake) + intendedPocketType @include(if: $includeIntendedPocketType) + } + } + } +`; + +/** + * __useGetShotsByIdsQuery__ + * + * To run a query within a React component, call `useGetShotsByIdsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetShotsByIdsQuery` 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 } = useGetShotsByIdsQuery({ + * variables: { + * ids: // value for 'ids' + * includeCreatedAt: // value for 'includeCreatedAt' + * includeUpdatedAt: // value for 'includeUpdatedAt' + * includeCueObjectFeatures: // value for 'includeCueObjectFeatures' + * includePocketingIntentionFeatures: // value for 'includePocketingIntentionFeatures' + * includeCueObjectDistance: // value for 'includeCueObjectDistance' + * includeCueObjectAngle: // value for 'includeCueObjectAngle' + * includeCueBallSpeed: // value for 'includeCueBallSpeed' + * includeSpinType: // value for 'includeSpinType' + * includeShotDirection: // value for 'includeShotDirection' + * includeTargetPocketDistance: // value for 'includeTargetPocketDistance' + * includeMake: // value for 'includeMake' + * includeIntendedPocketType: // value for 'includeIntendedPocketType' + * }, + * }); + */ +export function useGetShotsByIdsQuery( + baseOptions: Apollo.QueryHookOptions< + GetShotsByIdsQuery, + GetShotsByIdsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + GetShotsByIdsDocument, + options, + ); +} +export function useGetShotsByIdsLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + GetShotsByIdsQuery, + GetShotsByIdsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + GetShotsByIdsDocument, + options, + ); +} +export function useGetShotsByIdsSuspenseQuery( + baseOptions?: Apollo.SuspenseQueryHookOptions< + GetShotsByIdsQuery, + GetShotsByIdsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery< + GetShotsByIdsQuery, + GetShotsByIdsQueryVariables + >(GetShotsByIdsDocument, options); +} +export type GetShotsByIdsQueryHookResult = ReturnType< + typeof useGetShotsByIdsQuery +>; +export type GetShotsByIdsLazyQueryHookResult = ReturnType< + typeof useGetShotsByIdsLazyQuery +>; +export type GetShotsByIdsSuspenseQueryHookResult = ReturnType< + typeof useGetShotsByIdsSuspenseQuery +>; +export type GetShotsByIdsQueryResult = Apollo.QueryResult< + GetShotsByIdsQuery, + GetShotsByIdsQueryVariables +>; export const GetProfileImageUploadLinkDocument = gql` mutation getProfileImageUploadLink($fileExt: String = ".png") { getProfileImageUploadLink(fileExt: $fileExt) { diff --git a/src/operations/shots.gql b/src/operations/shots.gql index 6bc7d28..50b6773 100644 --- a/src/operations/shots.gql +++ b/src/operations/shots.gql @@ -139,3 +139,53 @@ query GetShotsWithMetadata( } } } + +query GetShotsByIds( + $ids: [Int!]! + $includeCreatedAt: Boolean! = false + $includeUpdatedAt: Boolean! = false + $includeCueObjectFeatures: Boolean! = false + $includePocketingIntentionFeatures: Boolean! = false + $includeCueObjectDistance: Boolean! = false + $includeCueObjectAngle: Boolean! = false + $includeCueBallSpeed: Boolean! = false + $includeSpinType: Boolean! = false + $includeShotDirection: Boolean! = false + $includeTargetPocketDistance: Boolean! = false + $includeMake: Boolean! = false + $includeIntendedPocketType: Boolean! = false +) { + getShotsByIds(ids: $ids) { + id + videoId + startFrame + endFrame + user { + id + } + falsePositiveScore + video { + stream { + resolution { + width + height + } + } + } + createdAt @include(if: $includeCreatedAt) + updatedAt @include(if: $includeUpdatedAt) + cueObjectFeatures @include(if: $includeCueObjectFeatures) { + cueObjectDistance @include(if: $includeCueObjectDistance) + cueObjectAngle @include(if: $includeCueObjectAngle) + cueBallSpeed @include(if: $includeCueBallSpeed) + shotDirection @include(if: $includeShotDirection) + spinType @include(if: $includeSpinType) + } + pocketingIntentionFeatures + @include(if: $includePocketingIntentionFeatures) { + targetPocketDistance @include(if: $includeTargetPocketDistance) + make @include(if: $includeMake) + intendedPocketType @include(if: $includeIntendedPocketType) + } + } +} -- 2.46.1