From c426e753cd0b2489794934b2902e9b6db74f6712 Mon Sep 17 00:00:00 2001 From: Loewy Date: Thu, 10 Oct 2024 17:02:18 -0700 Subject: [PATCH] add lightweigth gql call to get video header info --- src/index.tsx | 89 ++++++++++++++++++++++++++++++++++++++++ src/operations/video.gql | 8 ++++ 2 files changed, 97 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index 182aa7e..edacc9d 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2970,6 +2970,20 @@ export type GetVideoForClipTimesQuery = { }; }; +export type GetHeaderInfoByVideoIdQueryVariables = Exact<{ + videoId: Scalars["Int"]["input"]; +}>; + +export type GetHeaderInfoByVideoIdQuery = { + __typename?: "Query"; + getVideo: { + __typename?: "VideoGQL"; + id: number; + name?: string | null; + startTime?: any | null; + }; +}; + export type CreateUploadStreamMutationVariables = Exact<{ videoMetadataInput: VideoMetadataInput; }>; @@ -5227,6 +5241,81 @@ export type GetVideoForClipTimesQueryResult = Apollo.QueryResult< GetVideoForClipTimesQuery, GetVideoForClipTimesQueryVariables >; +export const GetHeaderInfoByVideoIdDocument = gql` + query GetHeaderInfoByVideoId($videoId: Int!) { + getVideo(videoId: $videoId) { + id + name + startTime + } + } +`; + +/** + * __useGetHeaderInfoByVideoIdQuery__ + * + * To run a query within a React component, call `useGetHeaderInfoByVideoIdQuery` and pass it any options that fit your needs. + * When your component renders, `useGetHeaderInfoByVideoIdQuery` 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 } = useGetHeaderInfoByVideoIdQuery({ + * variables: { + * videoId: // value for 'videoId' + * }, + * }); + */ +export function useGetHeaderInfoByVideoIdQuery( + baseOptions: Apollo.QueryHookOptions< + GetHeaderInfoByVideoIdQuery, + GetHeaderInfoByVideoIdQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery< + GetHeaderInfoByVideoIdQuery, + GetHeaderInfoByVideoIdQueryVariables + >(GetHeaderInfoByVideoIdDocument, options); +} +export function useGetHeaderInfoByVideoIdLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + GetHeaderInfoByVideoIdQuery, + GetHeaderInfoByVideoIdQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + GetHeaderInfoByVideoIdQuery, + GetHeaderInfoByVideoIdQueryVariables + >(GetHeaderInfoByVideoIdDocument, options); +} +export function useGetHeaderInfoByVideoIdSuspenseQuery( + baseOptions?: Apollo.SuspenseQueryHookOptions< + GetHeaderInfoByVideoIdQuery, + GetHeaderInfoByVideoIdQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery< + GetHeaderInfoByVideoIdQuery, + GetHeaderInfoByVideoIdQueryVariables + >(GetHeaderInfoByVideoIdDocument, options); +} +export type GetHeaderInfoByVideoIdQueryHookResult = ReturnType< + typeof useGetHeaderInfoByVideoIdQuery +>; +export type GetHeaderInfoByVideoIdLazyQueryHookResult = ReturnType< + typeof useGetHeaderInfoByVideoIdLazyQuery +>; +export type GetHeaderInfoByVideoIdSuspenseQueryHookResult = ReturnType< + typeof useGetHeaderInfoByVideoIdSuspenseQuery +>; +export type GetHeaderInfoByVideoIdQueryResult = Apollo.QueryResult< + GetHeaderInfoByVideoIdQuery, + GetHeaderInfoByVideoIdQueryVariables +>; export const CreateUploadStreamDocument = gql` mutation CreateUploadStream($videoMetadataInput: VideoMetadataInput!) { createUploadStream(videoMetadata: $videoMetadataInput) { diff --git a/src/operations/video.gql b/src/operations/video.gql index 613857a..51af4b9 100644 --- a/src/operations/video.gql +++ b/src/operations/video.gql @@ -237,3 +237,11 @@ query GetVideoForClipTimes($videoId: Int!) { } } } + +query GetHeaderInfoByVideoId($videoId: Int!) { + getVideo(videoId: $videoId) { + id + name + startTime + } +}