From 5f33fae3d7fa9bc9c8d07e2d56d93b4f7696bf90 Mon Sep 17 00:00:00 2001 From: Loewy Date: Thu, 18 Apr 2024 21:19:36 -0700 Subject: [PATCH 1/4] scaffold + operations --- src/index.tsx | 7 ++++++- src/operations/feed.gql | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index 1c1445d..fd58200 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -506,7 +506,11 @@ export type GetFeedQuery = { endTime?: any | null; elapsedTime?: number | null; owner?: { __typename?: "UserGQL"; username: string } | null; - stream?: { __typename?: "UploadStreamGQL"; isCompleted: boolean } | null; + stream?: { + __typename?: "UploadStreamGQL"; + isCompleted: boolean; + lowestUnuploadedSegmentIndex: number; + } | null; tags: Array<{ __typename?: "VideoTag"; name: string; @@ -957,6 +961,7 @@ export const GetFeedDocument = gql` elapsedTime stream { isCompleted + lowestUnuploadedSegmentIndex } tags { tagClasses { diff --git a/src/operations/feed.gql b/src/operations/feed.gql index f8f416f..f0b3719 100644 --- a/src/operations/feed.gql +++ b/src/operations/feed.gql @@ -20,6 +20,7 @@ query GetFeed( elapsedTime stream { isCompleted + lowestUnuploadedSegmentIndex } tags { tagClasses { From d51d2491caf13bdad7b8bb9c9252ce11c2cc05d8 Mon Sep 17 00:00:00 2001 From: Loewy Date: Tue, 23 Apr 2024 11:49:42 -0700 Subject: [PATCH 2/4] new lighter weight queries --- src/index.tsx | 210 ++++++++++++++++++++++++++++++++ src/operations/video_upload.gql | 30 +++++ 2 files changed, 240 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index fd58200..e39d435 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -786,6 +786,50 @@ export type EditUploadStreamMutation = { editUploadStream: boolean; }; +export type GetUploadStreamsQueryVariables = Exact<{ + limit?: Scalars["Int"]["input"]; + after?: InputMaybe; + filters?: InputMaybe; +}>; + +export type GetUploadStreamsQuery = { + __typename?: "Query"; + getUserVideos: { + __typename?: "VideoHistoryGQL"; + videos: Array<{ + __typename?: "VideoGQL"; + id: number; + stream?: { + __typename?: "UploadStreamGQL"; + isCompleted: boolean; + lowestUnuploadedSegmentIndex: number; + } | null; + }>; + pageInfo: { + __typename?: "PageInfoGQL"; + hasNextPage: boolean; + endCursor?: string | null; + }; + }; +}; + +export type GetUploadStreamDetailsQueryVariables = Exact<{ + videoId: Scalars["Int"]["input"]; +}>; + +export type GetUploadStreamDetailsQuery = { + __typename?: "Query"; + getVideo: { + __typename?: "VideoGQL"; + id: number; + stream?: { + __typename?: "UploadStreamGQL"; + isCompleted: boolean; + lowestUnuploadedSegmentIndex: number; + } | null; + }; +}; + export const GetAggregatedShotMetricsDocument = gql` query GetAggregatedShotMetrics($aggregateInput: AggregateInputGQL!) { getAggregatedShotMetrics(aggregateInput: $aggregateInput) { @@ -1986,3 +2030,169 @@ export type EditUploadStreamMutationOptions = Apollo.BaseMutationOptions< EditUploadStreamMutation, EditUploadStreamMutationVariables >; +export const GetUploadStreamsDocument = gql` + query GetUploadStreams( + $limit: Int! = 5 + $after: String = null + $filters: VideoFilterInput = null + ) { + getUserVideos(limit: $limit, after: $after, filters: $filters) { + videos { + id + stream { + isCompleted + lowestUnuploadedSegmentIndex + } + } + pageInfo { + hasNextPage + endCursor + } + } + } +`; + +/** + * __useGetUploadStreamsQuery__ + * + * To run a query within a React component, call `useGetUploadStreamsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetUploadStreamsQuery` 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 } = useGetUploadStreamsQuery({ + * variables: { + * limit: // value for 'limit' + * after: // value for 'after' + * filters: // value for 'filters' + * }, + * }); + */ +export function useGetUploadStreamsQuery( + baseOptions?: Apollo.QueryHookOptions< + GetUploadStreamsQuery, + GetUploadStreamsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + GetUploadStreamsDocument, + options, + ); +} +export function useGetUploadStreamsLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + GetUploadStreamsQuery, + GetUploadStreamsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + GetUploadStreamsQuery, + GetUploadStreamsQueryVariables + >(GetUploadStreamsDocument, options); +} +export function useGetUploadStreamsSuspenseQuery( + baseOptions?: Apollo.SuspenseQueryHookOptions< + GetUploadStreamsQuery, + GetUploadStreamsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery< + GetUploadStreamsQuery, + GetUploadStreamsQueryVariables + >(GetUploadStreamsDocument, options); +} +export type GetUploadStreamsQueryHookResult = ReturnType< + typeof useGetUploadStreamsQuery +>; +export type GetUploadStreamsLazyQueryHookResult = ReturnType< + typeof useGetUploadStreamsLazyQuery +>; +export type GetUploadStreamsSuspenseQueryHookResult = ReturnType< + typeof useGetUploadStreamsSuspenseQuery +>; +export type GetUploadStreamsQueryResult = Apollo.QueryResult< + GetUploadStreamsQuery, + GetUploadStreamsQueryVariables +>; +export const GetUploadStreamDetailsDocument = gql` + query GetUploadStreamDetails($videoId: Int!) { + getVideo(videoId: $videoId) { + id + stream { + isCompleted + lowestUnuploadedSegmentIndex + } + } + } +`; + +/** + * __useGetUploadStreamDetailsQuery__ + * + * To run a query within a React component, call `useGetUploadStreamDetailsQuery` and pass it any options that fit your needs. + * When your component renders, `useGetUploadStreamDetailsQuery` 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 } = useGetUploadStreamDetailsQuery({ + * variables: { + * videoId: // value for 'videoId' + * }, + * }); + */ +export function useGetUploadStreamDetailsQuery( + baseOptions: Apollo.QueryHookOptions< + GetUploadStreamDetailsQuery, + GetUploadStreamDetailsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery< + GetUploadStreamDetailsQuery, + GetUploadStreamDetailsQueryVariables + >(GetUploadStreamDetailsDocument, options); +} +export function useGetUploadStreamDetailsLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + GetUploadStreamDetailsQuery, + GetUploadStreamDetailsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + GetUploadStreamDetailsQuery, + GetUploadStreamDetailsQueryVariables + >(GetUploadStreamDetailsDocument, options); +} +export function useGetUploadStreamDetailsSuspenseQuery( + baseOptions?: Apollo.SuspenseQueryHookOptions< + GetUploadStreamDetailsQuery, + GetUploadStreamDetailsQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery< + GetUploadStreamDetailsQuery, + GetUploadStreamDetailsQueryVariables + >(GetUploadStreamDetailsDocument, options); +} +export type GetUploadStreamDetailsQueryHookResult = ReturnType< + typeof useGetUploadStreamDetailsQuery +>; +export type GetUploadStreamDetailsLazyQueryHookResult = ReturnType< + typeof useGetUploadStreamDetailsLazyQuery +>; +export type GetUploadStreamDetailsSuspenseQueryHookResult = ReturnType< + typeof useGetUploadStreamDetailsSuspenseQuery +>; +export type GetUploadStreamDetailsQueryResult = Apollo.QueryResult< + GetUploadStreamDetailsQuery, + GetUploadStreamDetailsQueryVariables +>; diff --git a/src/operations/video_upload.gql b/src/operations/video_upload.gql index 50ca82f..04b9e1f 100644 --- a/src/operations/video_upload.gql +++ b/src/operations/video_upload.gql @@ -20,3 +20,33 @@ mutation EditUploadStream( ) { editUploadStream(videoId: $videoId, videoMetadata: $videoMetadataInput) } + +query GetUploadStreams( + $limit: Int! = 5 + $after: String = null + $filters: VideoFilterInput = null +) { + getUserVideos(limit: $limit, after: $after, filters: $filters) { + videos { + id + stream { + isCompleted + lowestUnuploadedSegmentIndex + } + } + pageInfo { + hasNextPage + endCursor + } + } +} + +query GetUploadStreamDetails($videoId: Int!) { + getVideo(videoId: $videoId) { + id + stream { + isCompleted + lowestUnuploadedSegmentIndex + } + } +} From 422bb77f6126ce76390b1e2524be1f7ada96d2fd Mon Sep 17 00:00:00 2001 From: Loewy Date: Tue, 23 Apr 2024 12:37:31 -0700 Subject: [PATCH 3/4] trim gql call, comments, plug in queries --- src/index.tsx | 14 +------------- src/operations/video_upload.gql | 4 ---- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index e39d435..1674d52 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -796,15 +796,7 @@ export type GetUploadStreamsQuery = { __typename?: "Query"; getUserVideos: { __typename?: "VideoHistoryGQL"; - videos: Array<{ - __typename?: "VideoGQL"; - id: number; - stream?: { - __typename?: "UploadStreamGQL"; - isCompleted: boolean; - lowestUnuploadedSegmentIndex: number; - } | null; - }>; + videos: Array<{ __typename?: "VideoGQL"; id: number }>; pageInfo: { __typename?: "PageInfoGQL"; hasNextPage: boolean; @@ -2039,10 +2031,6 @@ export const GetUploadStreamsDocument = gql` getUserVideos(limit: $limit, after: $after, filters: $filters) { videos { id - stream { - isCompleted - lowestUnuploadedSegmentIndex - } } pageInfo { hasNextPage diff --git a/src/operations/video_upload.gql b/src/operations/video_upload.gql index 04b9e1f..70e505f 100644 --- a/src/operations/video_upload.gql +++ b/src/operations/video_upload.gql @@ -29,10 +29,6 @@ query GetUploadStreams( getUserVideos(limit: $limit, after: $after, filters: $filters) { videos { id - stream { - isCompleted - lowestUnuploadedSegmentIndex - } } pageInfo { hasNextPage From f7c0dff73c317d2f816e68361d965e8f70562501 Mon Sep 17 00:00:00 2001 From: Loewy Date: Tue, 23 Apr 2024 13:21:54 -0700 Subject: [PATCH 4/4] remove feed, add method to videofilemanager --- src/index.tsx | 7 +------ src/operations/feed.gql | 1 - 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 1674d52..94056f3 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -506,11 +506,7 @@ export type GetFeedQuery = { endTime?: any | null; elapsedTime?: number | null; owner?: { __typename?: "UserGQL"; username: string } | null; - stream?: { - __typename?: "UploadStreamGQL"; - isCompleted: boolean; - lowestUnuploadedSegmentIndex: number; - } | null; + stream?: { __typename?: "UploadStreamGQL"; isCompleted: boolean } | null; tags: Array<{ __typename?: "VideoTag"; name: string; @@ -997,7 +993,6 @@ export const GetFeedDocument = gql` elapsedTime stream { isCompleted - lowestUnuploadedSegmentIndex } tags { tagClasses { diff --git a/src/operations/feed.gql b/src/operations/feed.gql index f0b3719..f8f416f 100644 --- a/src/operations/feed.gql +++ b/src/operations/feed.gql @@ -20,7 +20,6 @@ query GetFeed( elapsedTime stream { isCompleted - lowestUnuploadedSegmentIndex } tags { tagClasses {