From 8102a0f40bfc17a66e7def562fa29f4c2dc6b1e9 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Fri, 22 Mar 2024 19:27:57 -0600 Subject: [PATCH] Add an operation to get details for updating a video Fixes railbird/railbird#1164 --- src/index.tsx | 116 +++++++++++++++++++++++++++++++++++++++ src/operations/video.gql | 17 +++++- src/schema.gql | 10 ++++ 3 files changed, 142 insertions(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index e700165..3ae0f79 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -428,6 +428,7 @@ export type VideoGql = { shots: Array; startTime?: Maybe; stream?: Maybe; + tags: Array; totalShots: Scalars["Int"]["output"]; totalShotsMade: Scalars["Int"]["output"]; updatedAt?: Maybe; @@ -442,6 +443,17 @@ export type VideoMetadataInput = { videoName?: InputMaybe; }; +export type VideoTag = { + __typename?: "VideoTag"; + name: Scalars["String"]["output"]; + tagClasses: Array; +}; + +export type VideoTagClass = { + __typename?: "VideoTagClass"; + name: Scalars["String"]["output"]; +}; + export enum WallTypeEnum { Long = "LONG", Short = "SHORT", @@ -682,6 +694,27 @@ export type GetStreamMonitoringDetailsQuery = { }; }; +export type GetVideoUpdatePageDetailsQueryVariables = Exact<{ + videoId: Scalars["Int"]["input"]; +}>; + +export type GetVideoUpdatePageDetailsQuery = { + __typename?: "Query"; + getVideo: { + __typename?: "VideoGQL"; + id: number; + name?: string | null; + totalShots: number; + makePercentage: number; + elapsedTime?: number | null; + tags: Array<{ + __typename?: "VideoTag"; + name: string; + tagClasses: Array<{ __typename?: "VideoTagClass"; name: string }>; + }>; + }; +}; + export type DeleteVideoMutationVariables = Exact<{ videoId: Scalars["Int"]["input"]; }>; @@ -1480,6 +1513,89 @@ export type GetStreamMonitoringDetailsQueryResult = Apollo.QueryResult< GetStreamMonitoringDetailsQuery, GetStreamMonitoringDetailsQueryVariables >; +export const GetVideoUpdatePageDetailsDocument = gql` + query GetVideoUpdatePageDetails($videoId: Int!) { + getVideo(videoId: $videoId) { + id + name + totalShots + makePercentage + elapsedTime + tags { + tagClasses { + name + } + name + } + } + } +`; + +/** + * __useGetVideoUpdatePageDetailsQuery__ + * + * To run a query within a React component, call `useGetVideoUpdatePageDetailsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetVideoUpdatePageDetailsQuery` 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 } = useGetVideoUpdatePageDetailsQuery({ + * variables: { + * videoId: // value for 'videoId' + * }, + * }); + */ +export function useGetVideoUpdatePageDetailsQuery( + baseOptions: Apollo.QueryHookOptions< + GetVideoUpdatePageDetailsQuery, + GetVideoUpdatePageDetailsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery< + GetVideoUpdatePageDetailsQuery, + GetVideoUpdatePageDetailsQueryVariables + >(GetVideoUpdatePageDetailsDocument, options); +} +export function useGetVideoUpdatePageDetailsLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + GetVideoUpdatePageDetailsQuery, + GetVideoUpdatePageDetailsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + GetVideoUpdatePageDetailsQuery, + GetVideoUpdatePageDetailsQueryVariables + >(GetVideoUpdatePageDetailsDocument, options); +} +export function useGetVideoUpdatePageDetailsSuspenseQuery( + baseOptions?: Apollo.SuspenseQueryHookOptions< + GetVideoUpdatePageDetailsQuery, + GetVideoUpdatePageDetailsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery< + GetVideoUpdatePageDetailsQuery, + GetVideoUpdatePageDetailsQueryVariables + >(GetVideoUpdatePageDetailsDocument, options); +} +export type GetVideoUpdatePageDetailsQueryHookResult = ReturnType< + typeof useGetVideoUpdatePageDetailsQuery +>; +export type GetVideoUpdatePageDetailsLazyQueryHookResult = ReturnType< + typeof useGetVideoUpdatePageDetailsLazyQuery +>; +export type GetVideoUpdatePageDetailsSuspenseQueryHookResult = ReturnType< + typeof useGetVideoUpdatePageDetailsSuspenseQuery +>; +export type GetVideoUpdatePageDetailsQueryResult = Apollo.QueryResult< + GetVideoUpdatePageDetailsQuery, + GetVideoUpdatePageDetailsQueryVariables +>; export const DeleteVideoDocument = gql` mutation DeleteVideo($videoId: Int!) { deleteVideo(videoId: $videoId) diff --git a/src/operations/video.gql b/src/operations/video.gql index e131646..948733a 100644 --- a/src/operations/video.gql +++ b/src/operations/video.gql @@ -4,7 +4,6 @@ query GetStreamMonitoringDetails($videoId: Int!) { totalShots makePercentage elapsedTime - stream { homographyHistory { crop { @@ -53,6 +52,22 @@ query GetStreamMonitoringDetails($videoId: Int!) { } } +query GetVideoUpdatePageDetails($videoId: Int!) { + getVideo(videoId: $videoId) { + id + name + totalShots + makePercentage + elapsedTime + tags { + tagClasses { + name + } + name + } + } +} + mutation DeleteVideo($videoId: Int!) { deleteVideo(videoId: $videoId) } diff --git a/src/schema.gql b/src/schema.gql index 41cf56d..9b0e18e 100644 --- a/src/schema.gql +++ b/src/schema.gql @@ -155,6 +155,7 @@ type VideoGQL { elapsedTime: Float framesPerSecond: Int! stream: UploadStreamGQL + tags: [VideoTag!]! } type ShotGQL { @@ -258,6 +259,15 @@ type StreamErrorGQL { message: String! } +type VideoTag { + tagClasses: [VideoTagClass!]! + name: String! +} + +type VideoTagClass { + name: String! +} + type BucketSetGQL { keyName: String! feature: String!