Merge pull request 'Added get shots with metadadata operation' (#51) from add-get-shots-with-metadata-query into master

Reviewed-on: #51
Reviewed-by: Ivan Malison <ivanmalison@gmail.com>
This commit is contained in:
Ivan Malison 2024-09-05 23:18:37 -06:00
commit 2bdfcb994e
2 changed files with 261 additions and 0 deletions

View File

@ -1890,6 +1890,68 @@ export type GetShotAnnotationTypesQuery = {
}>; }>;
}; };
export type GetShotsWithMetadataQueryVariables = Exact<{
filterInput: FilterInput;
shotsPagination?: InputMaybe<GetShotsPagination>;
limit?: InputMaybe<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 GetShotsWithMetadataQuery = {
__typename?: "Query";
getShotsWithMetadata: {
__typename?: "GetShotsResult";
count?: number | null;
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";
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<{ export type GetProfileImageUploadLinkMutationVariables = Exact<{
fileExt?: InputMaybe<Scalars["String"]["input"]>; fileExt?: InputMaybe<Scalars["String"]["input"]>;
}>; }>;
@ -3056,6 +3118,146 @@ export type GetShotAnnotationTypesQueryResult = Apollo.QueryResult<
GetShotAnnotationTypesQuery, GetShotAnnotationTypesQuery,
GetShotAnnotationTypesQueryVariables GetShotAnnotationTypesQueryVariables
>; >;
export const GetShotsWithMetadataDocument = gql`
query GetShotsWithMetadata(
$filterInput: FilterInput!
$shotsPagination: GetShotsPagination
$limit: 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
) {
getShotsWithMetadata(
filterInput: $filterInput
shotsPagination: $shotsPagination
limit: $limit
) {
count
shots {
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)
}
}
}
}
`;
/**
* __useGetShotsWithMetadataQuery__
*
* To run a query within a React component, call `useGetShotsWithMetadataQuery` and pass it any options that fit your needs.
* When your component renders, `useGetShotsWithMetadataQuery` 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 } = useGetShotsWithMetadataQuery({
* variables: {
* filterInput: // value for 'filterInput'
* shotsPagination: // value for 'shotsPagination'
* limit: // value for 'limit'
* 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 useGetShotsWithMetadataQuery(
baseOptions: Apollo.QueryHookOptions<
GetShotsWithMetadataQuery,
GetShotsWithMetadataQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useQuery<
GetShotsWithMetadataQuery,
GetShotsWithMetadataQueryVariables
>(GetShotsWithMetadataDocument, options);
}
export function useGetShotsWithMetadataLazyQuery(
baseOptions?: Apollo.LazyQueryHookOptions<
GetShotsWithMetadataQuery,
GetShotsWithMetadataQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<
GetShotsWithMetadataQuery,
GetShotsWithMetadataQueryVariables
>(GetShotsWithMetadataDocument, options);
}
export function useGetShotsWithMetadataSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<
GetShotsWithMetadataQuery,
GetShotsWithMetadataQueryVariables
>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<
GetShotsWithMetadataQuery,
GetShotsWithMetadataQueryVariables
>(GetShotsWithMetadataDocument, options);
}
export type GetShotsWithMetadataQueryHookResult = ReturnType<
typeof useGetShotsWithMetadataQuery
>;
export type GetShotsWithMetadataLazyQueryHookResult = ReturnType<
typeof useGetShotsWithMetadataLazyQuery
>;
export type GetShotsWithMetadataSuspenseQueryHookResult = ReturnType<
typeof useGetShotsWithMetadataSuspenseQuery
>;
export type GetShotsWithMetadataQueryResult = Apollo.QueryResult<
GetShotsWithMetadataQuery,
GetShotsWithMetadataQueryVariables
>;
export const GetProfileImageUploadLinkDocument = gql` export const GetProfileImageUploadLinkDocument = gql`
mutation getProfileImageUploadLink($fileExt: String = ".png") { mutation getProfileImageUploadLink($fileExt: String = ".png") {
getProfileImageUploadLink(fileExt: $fileExt) { getProfileImageUploadLink(fileExt: $fileExt) {

View File

@ -72,3 +72,62 @@ query GetShotAnnotationTypes {
name name
} }
} }
query GetShotsWithMetadata(
$filterInput: FilterInput!
$shotsPagination: GetShotsPagination
$limit: 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
) {
getShotsWithMetadata(
filterInput: $filterInput
shotsPagination: $shotsPagination
limit: $limit
) {
count
shots {
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)
}
}
}
}