From 145c2f9558ead3ebcf031c6fcf43e3f6b836e1b2 Mon Sep 17 00:00:00 2001 From: Loewy Date: Fri, 20 Dec 2024 13:13:30 -0800 Subject: [PATCH] leaderboards operation --- src/index.tsx | 103 ++++++++++++++++++++++++++++++++ src/operations/leaderboards.gql | 12 ++++ 2 files changed, 115 insertions(+) create mode 100644 src/operations/leaderboards.gql diff --git a/src/index.tsx b/src/index.tsx index 2795c25..fa7a950 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3074,6 +3074,28 @@ export type GetVideoFeedQuery = { }; }; +export type GetMakesLeaderboardQueryVariables = Exact<{ + interval?: InputMaybe; + when?: InputMaybe; +}>; + +export type GetMakesLeaderboardQuery = { + __typename?: "Query"; + getMakesLeaderboard: { + __typename?: "CountLeaderboardGQL"; + entries: Array<{ + __typename?: "IntUserLeaderboardEntry"; + value: number; + user: { + __typename?: "UserGQL"; + id: number; + username: string; + profileImageUri?: string | null; + }; + }>; + }; +}; + export type GetVideoMakePercentageIntervalsQueryVariables = Exact<{ videoId: Scalars["ID"]["input"]; intervalDuration: Scalars["Int"]["input"]; @@ -5111,6 +5133,87 @@ export type GetVideoFeedQueryResult = Apollo.QueryResult< GetVideoFeedQuery, GetVideoFeedQueryVariables >; +export const GetMakesLeaderboardDocument = gql` + query GetMakesLeaderboard($interval: TimeInterval, $when: DateTime) { + getMakesLeaderboard(interval: $interval, when: $when) { + entries { + user { + id + username + profileImageUri + } + value + } + } + } +`; + +/** + * __useGetMakesLeaderboardQuery__ + * + * To run a query within a React component, call `useGetMakesLeaderboardQuery` and pass it any options that fit your needs. + * When your component renders, `useGetMakesLeaderboardQuery` 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 } = useGetMakesLeaderboardQuery({ + * variables: { + * interval: // value for 'interval' + * when: // value for 'when' + * }, + * }); + */ +export function useGetMakesLeaderboardQuery( + baseOptions?: Apollo.QueryHookOptions< + GetMakesLeaderboardQuery, + GetMakesLeaderboardQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery< + GetMakesLeaderboardQuery, + GetMakesLeaderboardQueryVariables + >(GetMakesLeaderboardDocument, options); +} +export function useGetMakesLeaderboardLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + GetMakesLeaderboardQuery, + GetMakesLeaderboardQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + GetMakesLeaderboardQuery, + GetMakesLeaderboardQueryVariables + >(GetMakesLeaderboardDocument, options); +} +export function useGetMakesLeaderboardSuspenseQuery( + baseOptions?: Apollo.SuspenseQueryHookOptions< + GetMakesLeaderboardQuery, + GetMakesLeaderboardQueryVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery< + GetMakesLeaderboardQuery, + GetMakesLeaderboardQueryVariables + >(GetMakesLeaderboardDocument, options); +} +export type GetMakesLeaderboardQueryHookResult = ReturnType< + typeof useGetMakesLeaderboardQuery +>; +export type GetMakesLeaderboardLazyQueryHookResult = ReturnType< + typeof useGetMakesLeaderboardLazyQuery +>; +export type GetMakesLeaderboardSuspenseQueryHookResult = ReturnType< + typeof useGetMakesLeaderboardSuspenseQuery +>; +export type GetMakesLeaderboardQueryResult = Apollo.QueryResult< + GetMakesLeaderboardQuery, + GetMakesLeaderboardQueryVariables +>; export const GetVideoMakePercentageIntervalsDocument = gql` query GetVideoMakePercentageIntervals( $videoId: ID! diff --git a/src/operations/leaderboards.gql b/src/operations/leaderboards.gql new file mode 100644 index 0000000..5227e60 --- /dev/null +++ b/src/operations/leaderboards.gql @@ -0,0 +1,12 @@ +query GetMakesLeaderboard($interval: TimeInterval, $when: DateTime) { + getMakesLeaderboard(interval: $interval, when: $when) { + entries { + user { + id + username + profileImageUri + } + value + } + } +} -- 2.47.0