Merge pull request 'Follow and unfollow mutation' (#95) from kat/user-relationships-result into master

Reviewed-on: #95
This commit is contained in:
Kat Huang 2024-10-27 13:53:22 -06:00
commit 79784faba1
2 changed files with 144 additions and 0 deletions

View File

@ -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<Scalars["JSON"]["input"]>;
@ -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<FollowUserMutation, FollowUserMutationVariables>(
FollowUserDocument,
options,
);
}
export type FollowUserMutationHookResult = ReturnType<
typeof useFollowUserMutation
>;
export type FollowUserMutationResult =
Apollo.MutationResult<FollowUserMutation>;
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<UnfollowUserMutation>;
export type UnfollowUserMutationOptions = Apollo.BaseMutationOptions<
UnfollowUserMutation,
UnfollowUserMutationVariables
>;
export const GetStreamMonitoringDetailsDocument = gql`
query GetStreamMonitoringDetails($videoId: Int!, $debuggingJson: JSON) {
getVideo(videoId: $videoId, debuggingJson: $debuggingJson) {

View File

@ -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
}
}
}