From c18628a4ca3dfd9ecd99d5f9ad1afa624091c2b1 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Thu, 1 Aug 2024 19:49:57 -0600 Subject: [PATCH] Add pagination to getShots --- src/index.tsx | 12 ++++++++++++ src/schema.gql | 35 +++++++++++++++++++++++++---------- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 2ca2c25..c3660af 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -102,6 +102,10 @@ export type CreateUploadStreamReturn = { videoId: Scalars["Int"]["output"]; }; +export type CreatedAfter = + | { createdAt: Scalars["DateTime"]["input"]; videoId?: never } + | { createdAt?: never; videoId: Scalars["Int"]["input"] }; + export type CueObjectFeaturesGql = { __typename?: "CueObjectFeaturesGQL"; cueBallSpeed?: Maybe; @@ -1029,6 +1033,11 @@ export type FilterInput = videoId: Array; }; +export type GetShotsPagination = { + createdAfter: CreatedAfter; + startFrameAfter: Scalars["Int"]["input"]; +}; + export type GetUploadLinkReturn = { __typename?: "GetUploadLinkReturn"; headers: Array>; @@ -1201,6 +1210,8 @@ export type QueryGetPlayTimeArgs = { export type QueryGetShotsArgs = { filterInput: FilterInput; + limit?: Scalars["Int"]["input"]; + shotsPagination?: InputMaybe; }; export type QueryGetUserArgs = { @@ -1284,6 +1295,7 @@ export type ShotGql = { startFrame: Scalars["Int"]["output"]; updatedAt?: Maybe; user?: Maybe; + video?: Maybe; videoId: Scalars["Int"]["output"]; }; diff --git a/src/schema.gql b/src/schema.gql index 1368953..3186807 100644 --- a/src/schema.gql +++ b/src/schema.gql @@ -8,7 +8,11 @@ type Query { videoId: ID! intervalDuration: Int! = 300 ): [MakePercentageIntervalGQL!]! - getShots(filterInput: FilterInput!): [ShotGQL!]! + getShots( + filterInput: FilterInput! + shotsPagination: GetShotsPagination = null + limit: Int! = 10 + ): [ShotGQL!]! getShotAnnotationTypes: [ShotAnnotationTypeGQL!]! getUser(userId: Int!): UserGQL getLoggedInUser: UserGQL @@ -168,6 +172,7 @@ type ShotGQL { user: UserGQL annotations: [ShotAnnotationGQL!]! falsePositiveScore: Float + video: VideoGQL } """ @@ -229,15 +234,6 @@ type ShotAnnotationTypeGQL { name: String! } -type UserPlayTimeGQL { - totalSeconds: Float! -} - -type VideoHistoryGQL { - videos: [VideoGQL!]! - pageInfo: PageInfoGQL! -} - type VideoGQL { id: Int! owner: UserGQL @@ -364,6 +360,25 @@ type VideoProcessingErrorGQL { endSegmentIndex: Int } +input GetShotsPagination { + createdAfter: CreatedAfter! + startFrameAfter: Int! +} + +input CreatedAfter @oneOf { + videoId: Int + createdAt: DateTime +} + +type UserPlayTimeGQL { + totalSeconds: Float! +} + +type VideoHistoryGQL { + videos: [VideoGQL!]! + pageInfo: PageInfoGQL! +} + type PageInfoGQL { hasNextPage: Boolean! endCursor: String