Create gql feed #4

Merged
colonelpanic merged 2 commits from kat/update-video-gql into master 2024-02-21 19:18:21 -07:00
2 changed files with 144 additions and 0 deletions
Showing only changes of commit 60af058ba4 - Show all commits

View File

@ -369,6 +369,21 @@ export type GetAggregateShotsQueryVariables = Exact<{
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 GetFeedQueryVariables = Exact<{
first?: Scalars['Int']['input'];
after?: InputMaybe<Scalars['String']['input']>;
includeTotalShotsMade?: Scalars['Boolean']['input'];
includeMakePercentage?: Scalars['Boolean']['input'];
includeMedianRun?: Scalars['Boolean']['input'];
includeAverageTimeBetweenShots?: Scalars['Boolean']['input'];
includeElapsedTime?: Scalars['Boolean']['input'];
includeFramesPerSecond?: Scalars['Boolean']['input'];
includeStream?: Scalars['Boolean']['input'];
}>;
export type GetFeedQuery = { __typename?: 'Query', getVideoFeedForUser: { __typename?: 'VideoFeedGQL', videos: Array<{ __typename?: 'VideoGQL', id: number, name: string, totalShotsMade?: number, totalShots: number, makePercentage?: number, medianRun?: number | null, averageTimeBetweenShots?: number | null, createdAt: any, updatedAt: any, startTime: any, endTime: any, elapsedTime?: number | null, shots: Array<{ __typename?: 'ShotGQL', id?: number | null, videoId?: number | null, startFrame?: number | null, endFrame?: number | null, createdAt?: any | null, updatedAt?: any | null }>, stream?: { __typename?: 'UploadStreamGQL', id: string, linksRequested: number, uploadsCompleted: number, isCompleted: boolean, createdAt: any, updatedAt: any } | null }>, pageInfo: { __typename?: 'PageInfoGQL', hasNextPage: boolean, endCursor?: string | null } } };
export type GetShotsQueryVariables = Exact<{
filterInput?: InputMaybe<FilterInput>;
includeCueObjectDistance?: Scalars['Boolean']['input'];
@ -470,6 +485,87 @@ export type GetAggregateShotsQueryHookResult = ReturnType<typeof useGetAggregate
export type GetAggregateShotsLazyQueryHookResult = ReturnType<typeof useGetAggregateShotsLazyQuery>;
export type GetAggregateShotsSuspenseQueryHookResult = ReturnType<typeof useGetAggregateShotsSuspenseQuery>;
export type GetAggregateShotsQueryResult = Apollo.QueryResult<GetAggregateShotsQuery, GetAggregateShotsQueryVariables>;
export const GetFeedDocument = gql`
query GetFeed($first: Int! = 5, $after: String = null, $includeTotalShotsMade: Boolean! = false, $includeMakePercentage: Boolean! = false, $includeMedianRun: Boolean! = false, $includeAverageTimeBetweenShots: Boolean! = false, $includeElapsedTime: Boolean! = false, $includeFramesPerSecond: Boolean! = false, $includeStream: Boolean! = false) {
getVideoFeedForUser(first: $first, after: $after) {
videos {
id
name
totalShotsMade @include(if: $includeTotalShotsMade)
totalShots
makePercentage @include(if: $includeMakePercentage)
medianRun @include(if: $includeMedianRun)
averageTimeBetweenShots @include(if: $includeAverageTimeBetweenShots)
createdAt
updatedAt
shots {
id
videoId
startFrame
endFrame
createdAt
updatedAt
}
startTime
endTime
elapsedTime @include(if: $includeElapsedTime)
stream @include(if: $includeStream) {
id
linksRequested
uploadsCompleted
isCompleted
createdAt
updatedAt
}
}
pageInfo {
hasNextPage
endCursor
}
}
}
`;
/**
* __useGetFeedQuery__
*
* To run a query within a React component, call `useGetFeedQuery` and pass it any options that fit your needs.
* When your component renders, `useGetFeedQuery` 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 } = useGetFeedQuery({
* variables: {
* first: // value for 'first'
* after: // value for 'after'
* includeTotalShotsMade: // value for 'includeTotalShotsMade'
* includeMakePercentage: // value for 'includeMakePercentage'
* includeMedianRun: // value for 'includeMedianRun'
* includeAverageTimeBetweenShots: // value for 'includeAverageTimeBetweenShots'
* includeElapsedTime: // value for 'includeElapsedTime'
* includeFramesPerSecond: // value for 'includeFramesPerSecond'
* includeStream: // value for 'includeStream'
* },
* });
*/
export function useGetFeedQuery(baseOptions?: Apollo.QueryHookOptions<GetFeedQuery, GetFeedQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useQuery<GetFeedQuery, GetFeedQueryVariables>(GetFeedDocument, options);
}
export function useGetFeedLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<GetFeedQuery, GetFeedQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useLazyQuery<GetFeedQuery, GetFeedQueryVariables>(GetFeedDocument, options);
}
export function useGetFeedSuspenseQuery(baseOptions?: Apollo.SuspenseQueryHookOptions<GetFeedQuery, GetFeedQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useSuspenseQuery<GetFeedQuery, GetFeedQueryVariables>(GetFeedDocument, options);
}
export type GetFeedQueryHookResult = ReturnType<typeof useGetFeedQuery>;
export type GetFeedLazyQueryHookResult = ReturnType<typeof useGetFeedLazyQuery>;
export type GetFeedSuspenseQueryHookResult = ReturnType<typeof useGetFeedSuspenseQuery>;
export type GetFeedQueryResult = Apollo.QueryResult<GetFeedQuery, GetFeedQueryVariables>;
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) {

48
src/operations/feed.gql Normal file
View File

@ -0,0 +1,48 @@
query GetFeed(
$first: Int! = 5,
$after: String = null,
$includeTotalShotsMade: Boolean! = false,
$includeMakePercentage: Boolean! = false,
$includeMedianRun: Boolean! = false,
$includeAverageTimeBetweenShots: Boolean! = false,
$includeElapsedTime: Boolean! = false,
$includeFramesPerSecond: Boolean! = false,
$includeStream: Boolean! = false
) {
getVideoFeedForUser(first: $first, after: $after) {
videos {
id
name
totalShotsMade @include(if: $includeTotalShotsMade)
totalShots
makePercentage @include(if: $includeMakePercentage)
medianRun @include(if: $includeMedianRun)
averageTimeBetweenShots @include(if: $includeAverageTimeBetweenShots)
createdAt
updatedAt
shots {
id
videoId
startFrame
endFrame
createdAt
updatedAt
}
startTime
endTime
elapsedTime @include(if: $includeElapsedTime)
stream @include(if: $includeStream) {
id
linksRequested
uploadsCompleted
isCompleted
createdAt
updatedAt
}
}
pageInfo {
hasNextPage
endCursor
}
}
}