diff --git a/src/index.tsx b/src/index.tsx index e077664..7dfad59 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2166,10 +2166,10 @@ export type Query = { getShotsByIds: Array; getShotsWithMetadata: GetShotsResult; getUser?: Maybe; + getUserRelationshipsMatching: Array; getUserTags: Array; getUserVideos: VideoHistoryGql; getUsernames: Array; - getUsernamesAndFollowing: UsernamesAndFollowingResponse; getVideo: VideoGql; getVideoMakePercentageIntervals: Array; getVideos: Array; @@ -2226,6 +2226,13 @@ export type QueryGetUserArgs = { userId: Scalars["Int"]["input"]; }; +export type QueryGetUserRelationshipsMatchingArgs = { + after?: InputMaybe; + limit?: InputMaybe; + matchString?: InputMaybe; + userId: Scalars["Int"]["input"]; +}; + export type QueryGetUserVideosArgs = { after?: InputMaybe; filters?: InputMaybe; @@ -2239,13 +2246,6 @@ export type QueryGetUsernamesArgs = { matchString?: InputMaybe; }; -export type QueryGetUsernamesAndFollowingArgs = { - after?: InputMaybe; - limit?: InputMaybe; - matchString?: InputMaybe; - userId: Scalars["Int"]["input"]; -}; - export type QueryGetVideoArgs = { debuggingJson?: InputMaybe; videoId: Scalars["Int"]["input"]; @@ -2509,8 +2509,8 @@ export type UserGql = { createdAt?: Maybe; fargoRating?: Maybe; firebaseUid?: Maybe; - followers?: Maybe>; - following?: Maybe>; + followers?: Maybe>; + following?: Maybe>; id: Scalars["Int"]["output"]; isAdmin?: Maybe; profileImageUri?: Maybe; @@ -2523,11 +2523,11 @@ export type UserPlayTimeGql = { totalSeconds: Scalars["Float"]["output"]; }; -export type UsernamesAndFollowingResponse = { - __typename?: "UsernamesAndFollowingResponse"; - followers: Array; - following: Array; - users: Array; +export type UserRelationship = { + __typename?: "UserRelationship"; + following: Scalars["Boolean"]["output"]; + follows: Scalars["Boolean"]["output"]; + user: UserGql; }; export type VideoFilterInput = { @@ -3134,20 +3134,21 @@ export type GetUsernamesQuery = { getUsernames: Array; }; -export type GetUsernamesAndFollowingQueryVariables = Exact<{ +export type GetUserRelationshipsMatchingQueryVariables = Exact<{ userId: Scalars["Int"]["input"]; matchString: Scalars["String"]["input"]; limit?: InputMaybe; after?: InputMaybe; }>; -export type GetUsernamesAndFollowingQuery = { +export type GetUserRelationshipsMatchingQuery = { __typename?: "Query"; - getUsernamesAndFollowing: { - __typename?: "UsernamesAndFollowingResponse"; - followers: Array; - following: Array; - }; + getUserRelationshipsMatching: Array<{ + __typename?: "UserRelationship"; + follows: boolean; + following: boolean; + user: { __typename?: "UserGQL"; username: string; id: number }; + }>; }; export type GetUserTagsQueryVariables = Exact<{ [key: string]: never }>; @@ -5123,36 +5124,40 @@ export type GetUsernamesQueryResult = Apollo.QueryResult< GetUsernamesQuery, GetUsernamesQueryVariables >; -export const GetUsernamesAndFollowingDocument = gql` - query getUsernamesAndFollowing( +export const GetUserRelationshipsMatchingDocument = gql` + query getUserRelationshipsMatching( $userId: Int! $matchString: String! $limit: Int = null $after: String = null ) { - getUsernamesAndFollowing( + getUserRelationshipsMatching( userId: $userId matchString: $matchString limit: $limit after: $after ) { - followers + user { + username + id + } + follows following } } `; /** - * __useGetUsernamesAndFollowingQuery__ + * __useGetUserRelationshipsMatchingQuery__ * - * To run a query within a React component, call `useGetUsernamesAndFollowingQuery` and pass it any options that fit your needs. - * When your component renders, `useGetUsernamesAndFollowingQuery` returns an object from Apollo Client that contains loading, error, and data properties + * To run a query within a React component, call `useGetUserRelationshipsMatchingQuery` and pass it any options that fit your needs. + * When your component renders, `useGetUserRelationshipsMatchingQuery` 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 } = useGetUsernamesAndFollowingQuery({ + * const { data, loading, error } = useGetUserRelationshipsMatchingQuery({ * variables: { * userId: // value for 'userId' * matchString: // value for 'matchString' @@ -5161,54 +5166,54 @@ export const GetUsernamesAndFollowingDocument = gql` * }, * }); */ -export function useGetUsernamesAndFollowingQuery( +export function useGetUserRelationshipsMatchingQuery( baseOptions: Apollo.QueryHookOptions< - GetUsernamesAndFollowingQuery, - GetUsernamesAndFollowingQueryVariables + GetUserRelationshipsMatchingQuery, + GetUserRelationshipsMatchingQueryVariables >, ) { const options = { ...defaultOptions, ...baseOptions }; return Apollo.useQuery< - GetUsernamesAndFollowingQuery, - GetUsernamesAndFollowingQueryVariables - >(GetUsernamesAndFollowingDocument, options); + GetUserRelationshipsMatchingQuery, + GetUserRelationshipsMatchingQueryVariables + >(GetUserRelationshipsMatchingDocument, options); } -export function useGetUsernamesAndFollowingLazyQuery( +export function useGetUserRelationshipsMatchingLazyQuery( baseOptions?: Apollo.LazyQueryHookOptions< - GetUsernamesAndFollowingQuery, - GetUsernamesAndFollowingQueryVariables + GetUserRelationshipsMatchingQuery, + GetUserRelationshipsMatchingQueryVariables >, ) { const options = { ...defaultOptions, ...baseOptions }; return Apollo.useLazyQuery< - GetUsernamesAndFollowingQuery, - GetUsernamesAndFollowingQueryVariables - >(GetUsernamesAndFollowingDocument, options); + GetUserRelationshipsMatchingQuery, + GetUserRelationshipsMatchingQueryVariables + >(GetUserRelationshipsMatchingDocument, options); } -export function useGetUsernamesAndFollowingSuspenseQuery( +export function useGetUserRelationshipsMatchingSuspenseQuery( baseOptions?: Apollo.SuspenseQueryHookOptions< - GetUsernamesAndFollowingQuery, - GetUsernamesAndFollowingQueryVariables + GetUserRelationshipsMatchingQuery, + GetUserRelationshipsMatchingQueryVariables >, ) { const options = { ...defaultOptions, ...baseOptions }; return Apollo.useSuspenseQuery< - GetUsernamesAndFollowingQuery, - GetUsernamesAndFollowingQueryVariables - >(GetUsernamesAndFollowingDocument, options); + GetUserRelationshipsMatchingQuery, + GetUserRelationshipsMatchingQueryVariables + >(GetUserRelationshipsMatchingDocument, options); } -export type GetUsernamesAndFollowingQueryHookResult = ReturnType< - typeof useGetUsernamesAndFollowingQuery +export type GetUserRelationshipsMatchingQueryHookResult = ReturnType< + typeof useGetUserRelationshipsMatchingQuery >; -export type GetUsernamesAndFollowingLazyQueryHookResult = ReturnType< - typeof useGetUsernamesAndFollowingLazyQuery +export type GetUserRelationshipsMatchingLazyQueryHookResult = ReturnType< + typeof useGetUserRelationshipsMatchingLazyQuery >; -export type GetUsernamesAndFollowingSuspenseQueryHookResult = ReturnType< - typeof useGetUsernamesAndFollowingSuspenseQuery +export type GetUserRelationshipsMatchingSuspenseQueryHookResult = ReturnType< + typeof useGetUserRelationshipsMatchingSuspenseQuery >; -export type GetUsernamesAndFollowingQueryResult = Apollo.QueryResult< - GetUsernamesAndFollowingQuery, - GetUsernamesAndFollowingQueryVariables +export type GetUserRelationshipsMatchingQueryResult = Apollo.QueryResult< + GetUserRelationshipsMatchingQuery, + GetUserRelationshipsMatchingQueryVariables >; export const GetUserTagsDocument = gql` query GetUserTags { diff --git a/src/operations/user.gql b/src/operations/user.gql index 12e217a..adeb183 100644 --- a/src/operations/user.gql +++ b/src/operations/user.gql @@ -57,19 +57,23 @@ query getUsernames( getUsernames(matchString: $matchString, limit: $limit, after: $after) } -query getUsernamesAndFollowing( +query getUserRelationshipsMatching( $userId: Int! $matchString: String! $limit: Int = null $after: String = null ) { - getUsernamesAndFollowing( + getUserRelationshipsMatching( userId: $userId matchString: $matchString limit: $limit after: $after ) { - followers + user { + username + id + } + follows following } } diff --git a/src/schema.gql b/src/schema.gql index 23e9820..3e03b03 100644 --- a/src/schema.gql +++ b/src/schema.gql @@ -35,12 +35,12 @@ type Query { limit: Int = null after: String = null ): [String!]! - getUsernamesAndFollowing( + getUserRelationshipsMatching( userId: Int! matchString: String = null limit: Int = 100 after: String = null - ): UsernamesAndFollowingResponse! + ): [UserRelationship!]! getPlayTime(userId: Int!): UserPlayTimeGQL! getUserVideos( userId: Int = null @@ -349,8 +349,8 @@ type UserGQL { profileImageUri: String createdAt: DateTime updatedAt: DateTime - following: [Int!] - followers: [Int!] + following: [UserGQL!] + followers: [UserGQL!] } type ShotAnnotationGQL { @@ -554,10 +554,10 @@ input CreatedAfter @oneOf { createdAt: DateTime } -type UsernamesAndFollowingResponse { - users: [UserGQL!]! - following: [Int!]! - followers: [Int!]! +type UserRelationship { + user: UserGQL! + follows: Boolean! + following: Boolean! } type UserPlayTimeGQL {