diff --git a/src/index.tsx b/src/index.tsx index 1e55234..af56d2a 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2239,6 +2239,7 @@ export type Mutation = { getHlsInitUploadLink: GetUploadLinkReturn; getProfileImageUploadLink: GetProfileUploadLinkReturn; getUploadLink: GetUploadLinkReturn; + reactToVideo: Scalars["Boolean"]["output"]; retireTags: Scalars["Boolean"]["output"]; setLoggerLevel: Scalars["Boolean"]["output"]; setSegmentDuration: Scalars["Boolean"]["output"]; @@ -2309,6 +2310,11 @@ export type MutationGetUploadLinkArgs = { videoId: Scalars["Int"]["input"]; }; +export type MutationReactToVideoArgs = { + reaction?: InputMaybe; + videoId: Scalars["Int"]["input"]; +}; + export type MutationRetireTagsArgs = { tagIds: Array; }; @@ -2565,6 +2571,22 @@ export type QueryWaitForArgs = { duration: Scalars["Float"]["input"]; }; +export enum ReactionEnum { + Bullseye = "BULLSEYE", + Heart = "HEART", + Hundred = "HUNDRED", + Like = "LIKE", +} + +export type ReactionGql = { + __typename?: "ReactionGQL"; + createdAt?: Maybe; + reaction: ReactionEnum; + updatedAt?: Maybe; + user: UserGql; + videoId: Scalars["Int"]["output"]; +}; + export type RequestedMedalsGql = { __typename?: "RequestedMedalsGQL"; dailyMakes50?: Maybe; @@ -3000,6 +3022,7 @@ export type VideoGql = { owner?: Maybe; playlist?: Maybe; private: Scalars["Boolean"]["output"]; + reactions: Array; screenshotUri?: Maybe; shots: Array; startTime?: Maybe; @@ -3187,6 +3210,12 @@ export type GetFeedQuery = { status: ProcessingStatusEnum; }>; } | null; + reactions: Array<{ + __typename?: "ReactionGQL"; + videoId: number; + reaction: ReactionEnum; + user: { __typename?: "UserGQL"; id: number; username: string }; + }>; }>; pageInfo: { __typename?: "PageInfoGQL"; @@ -3240,6 +3269,12 @@ export type VideoCardFieldsFragment = { status: ProcessingStatusEnum; }>; } | null; + reactions: Array<{ + __typename?: "ReactionGQL"; + videoId: number; + reaction: ReactionEnum; + user: { __typename?: "UserGQL"; id: number; username: string }; + }>; }; export type GetVideoFeedQueryVariables = Exact<{ @@ -3302,6 +3337,12 @@ export type GetVideoFeedQuery = { status: ProcessingStatusEnum; }>; } | null; + reactions: Array<{ + __typename?: "ReactionGQL"; + videoId: number; + reaction: ReactionEnum; + user: { __typename?: "UserGQL"; id: number; username: string }; + }>; }>; pageInfo: { __typename?: "PageInfoGQL"; @@ -3505,6 +3546,16 @@ export type GetMedalsQuery = { }; }; +export type ReactToVideoMutationVariables = Exact<{ + videoId: Scalars["Int"]["input"]; + reaction?: InputMaybe; +}>; + +export type ReactToVideoMutation = { + __typename?: "Mutation"; + reactToVideo: boolean; +}; + export type GetRunsForHighlightsQueryVariables = Exact<{ filterInput: RunFilterInput; runIds?: InputMaybe | Scalars["Int"]["input"]>; @@ -4973,6 +5024,14 @@ export const VideoCardFieldsFragmentDoc = gql` status } } + reactions { + videoId + user { + id + username + } + reaction + } } `; export const MedalFieldsFragmentDoc = gql` @@ -5898,6 +5957,55 @@ export type GetMedalsQueryResult = Apollo.QueryResult< GetMedalsQuery, GetMedalsQueryVariables >; +export const ReactToVideoDocument = gql` + mutation ReactToVideo($videoId: Int!, $reaction: ReactionEnum) { + reactToVideo(videoId: $videoId, reaction: $reaction) + } +`; +export type ReactToVideoMutationFn = Apollo.MutationFunction< + ReactToVideoMutation, + ReactToVideoMutationVariables +>; + +/** + * __useReactToVideoMutation__ + * + * To run a mutation, you first call `useReactToVideoMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useReactToVideoMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [reactToVideoMutation, { data, loading, error }] = useReactToVideoMutation({ + * variables: { + * videoId: // value for 'videoId' + * reaction: // value for 'reaction' + * }, + * }); + */ +export function useReactToVideoMutation( + baseOptions?: Apollo.MutationHookOptions< + ReactToVideoMutation, + ReactToVideoMutationVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useMutation< + ReactToVideoMutation, + ReactToVideoMutationVariables + >(ReactToVideoDocument, options); +} +export type ReactToVideoMutationHookResult = ReturnType< + typeof useReactToVideoMutation +>; +export type ReactToVideoMutationResult = + Apollo.MutationResult; +export type ReactToVideoMutationOptions = Apollo.BaseMutationOptions< + ReactToVideoMutation, + ReactToVideoMutationVariables +>; export const GetRunsForHighlightsDocument = gql` query GetRunsForHighlights( $filterInput: RunFilterInput! diff --git a/src/operations/feed.gql b/src/operations/feed.gql index 0e5b7bd..a077bc9 100644 --- a/src/operations/feed.gql +++ b/src/operations/feed.gql @@ -58,6 +58,14 @@ fragment VideoCardFields on VideoGQL { status } } + reactions { + videoId + user { + id + username + } + reaction + } } query GetVideoFeed( diff --git a/src/operations/reactions.gql b/src/operations/reactions.gql new file mode 100644 index 0000000..d64d39c --- /dev/null +++ b/src/operations/reactions.gql @@ -0,0 +1,3 @@ +mutation ReactToVideo($videoId: Int!, $reaction: ReactionEnum) { + reactToVideo(videoId: $videoId, reaction: $reaction) +} diff --git a/src/schema.gql b/src/schema.gql index 7628db6..58f45b6 100644 --- a/src/schema.gql +++ b/src/schema.gql @@ -479,6 +479,7 @@ type VideoGQL { currentHomography: HomographyInfoGQL homographyHistory: [HomographyInfoGQL!]! currentProcessing: VideoProcessingGQL + reactions: [ReactionGQL!]! } type UploadStreamGQL { @@ -612,6 +613,21 @@ type VideoProcessingStatusGQL { updatedAt: DateTime } +type ReactionGQL { + videoId: Int! + user: UserGQL! + reaction: ReactionEnum! + createdAt: DateTime + updatedAt: DateTime +} + +enum ReactionEnum { + LIKE + HEART + BULLSEYE + HUNDRED +} + type RunFeaturesGQL { runId: Int! indexInRun: Int! @@ -801,6 +817,7 @@ type Mutation { editUploadStream(videoId: Int!, videoMetadata: VideoMetadataInput!): Boolean! deleteVideo(videoId: Int!): Boolean! deleteTags(videoId: Int!, tagsToDelete: [VideoTagInput!]!): Boolean! + reactToVideo(videoId: Int!, reaction: ReactionEnum): Boolean! } input CreateBucketSetInput {