From f3ea44755cf5d2ff56cb714b629c5f46bb221b14 Mon Sep 17 00:00:00 2001 From: Kat Huang Date: Sun, 27 Oct 2024 12:22:22 -0600 Subject: [PATCH] Follow, unfollow mutation --- src/index.tsx | 128 ++++++++++++++++++++++++++++++++++++++++ src/operations/user.gql | 16 +++++ 2 files changed, 144 insertions(+) diff --git a/src/index.tsx b/src/index.tsx index f0215f6..07f251e 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3167,6 +3167,30 @@ export type GetUserTagsQuery = { getUserTags: Array<{ __typename?: "TagGQL"; id: number; name: string }>; }; +export type FollowUserMutationVariables = Exact<{ + followedUserId: Scalars["Int"]["input"]; +}>; + +export type FollowUserMutation = { + __typename?: "Mutation"; + followUser: { + __typename?: "UserGQL"; + followers?: Array<{ __typename?: "UserGQL"; username: string }> | null; + }; +}; + +export type UnfollowUserMutationVariables = Exact<{ + followedUserId: Scalars["Int"]["input"]; +}>; + +export type UnfollowUserMutation = { + __typename?: "Mutation"; + unfollowUser: { + __typename?: "UserGQL"; + followers?: Array<{ __typename?: "UserGQL"; username: string }> | null; + }; +}; + export type GetStreamMonitoringDetailsQueryVariables = Exact<{ videoId: Scalars["Int"]["input"]; debuggingJson?: InputMaybe; @@ -5297,6 +5321,110 @@ export type GetUserTagsQueryResult = Apollo.QueryResult< GetUserTagsQuery, GetUserTagsQueryVariables >; +export const FollowUserDocument = gql` + mutation followUser($followedUserId: Int!) { + followUser(followedUserId: $followedUserId) { + followers { + username + } + } + } +`; +export type FollowUserMutationFn = Apollo.MutationFunction< + FollowUserMutation, + FollowUserMutationVariables +>; + +/** + * __useFollowUserMutation__ + * + * To run a mutation, you first call `useFollowUserMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useFollowUserMutation` 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 [followUserMutation, { data, loading, error }] = useFollowUserMutation({ + * variables: { + * followedUserId: // value for 'followedUserId' + * }, + * }); + */ +export function useFollowUserMutation( + baseOptions?: Apollo.MutationHookOptions< + FollowUserMutation, + FollowUserMutationVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useMutation( + FollowUserDocument, + options, + ); +} +export type FollowUserMutationHookResult = ReturnType< + typeof useFollowUserMutation +>; +export type FollowUserMutationResult = + Apollo.MutationResult; +export type FollowUserMutationOptions = Apollo.BaseMutationOptions< + FollowUserMutation, + FollowUserMutationVariables +>; +export const UnfollowUserDocument = gql` + mutation unfollowUser($followedUserId: Int!) { + unfollowUser(followedUserId: $followedUserId) { + followers { + username + } + } + } +`; +export type UnfollowUserMutationFn = Apollo.MutationFunction< + UnfollowUserMutation, + UnfollowUserMutationVariables +>; + +/** + * __useUnfollowUserMutation__ + * + * To run a mutation, you first call `useUnfollowUserMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useUnfollowUserMutation` 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 [unfollowUserMutation, { data, loading, error }] = useUnfollowUserMutation({ + * variables: { + * followedUserId: // value for 'followedUserId' + * }, + * }); + */ +export function useUnfollowUserMutation( + baseOptions?: Apollo.MutationHookOptions< + UnfollowUserMutation, + UnfollowUserMutationVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useMutation< + UnfollowUserMutation, + UnfollowUserMutationVariables + >(UnfollowUserDocument, options); +} +export type UnfollowUserMutationHookResult = ReturnType< + typeof useUnfollowUserMutation +>; +export type UnfollowUserMutationResult = + Apollo.MutationResult; +export type UnfollowUserMutationOptions = Apollo.BaseMutationOptions< + UnfollowUserMutation, + UnfollowUserMutationVariables +>; export const GetStreamMonitoringDetailsDocument = gql` query GetStreamMonitoringDetails($videoId: Int!, $debuggingJson: JSON) { getVideo(videoId: $videoId, debuggingJson: $debuggingJson) { diff --git a/src/operations/user.gql b/src/operations/user.gql index c79ae20..a561d69 100644 --- a/src/operations/user.gql +++ b/src/operations/user.gql @@ -86,3 +86,19 @@ query GetUserTags { name } } + +mutation followUser($followedUserId: Int!) { + followUser(followedUserId: $followedUserId) { + followers { + username + } + } +} + +mutation unfollowUser($followedUserId: Int!) { + unfollowUser(followedUserId: $followedUserId) { + followers { + username + } + } +}