export const USER_CONTEST_RANKING_QUERY = ` query userContestRankingInfo($username: String!) { userContestRanking(username: $username) { attendedContestsCount rating globalRanking totalParticipants topPercentage badge { name } } userContestRankingHistory(username: $username) { attended trendDirection problemsSolved totalProblems finishTimeInSeconds rating ranking contest { title startTime } } } `; export const USER_RATING_QUERY = ` query getUserContestRanking($username: String!) { userContestRanking(username: $username) { rating attendedContestsCount badge { name } globalRanking topPercentage } } `; export const CONTEST_HISTOGRAM_QUERY = ` query contestRatingHistogram { contestRatingHistogram { userCount ratingStart ratingEnd topPercentage } } `; export const ALL_CONTESTS_QUERY = ` query allContests { allContests { title titleSlug startTime duration originStartTime isVirtual containsPremium } } `; export const DAILY_PROBLEM_QUERY = ` query getDailyProblem { activeDailyCodingChallengeQuestion { date link question { questionId questionFrontendId boundTopicId title titleSlug content translatedTitle translatedContent isPaidOnly difficulty likes dislikes isLiked similarQuestions exampleTestcases contributors { username profileUrl avatarUrl } topicTags { name slug translatedName } companyTagStats codeSnippets { lang langSlug code } stats hints solution { id canSeeDetail paidOnly hasVideoSolution paidOnlyVideo } status sampleTestCase metaData judgerAvailable judgeType mysqlSchemas enableRunCode enableTestMode enableDebugger envInfo libraryUrl adminUrl challengeQuestion { id date incompleteChallengeCount streakCount type } note } } }`; export const SELECT_PROBLEM_QUERY = ` query selectProblem($titleSlug: String!) { question(titleSlug: $titleSlug) { questionId questionFrontendId boundTopicId title titleSlug content translatedTitle translatedContent isPaidOnly difficulty likes dislikes isLiked similarQuestions exampleTestcases contributors { username profileUrl avatarUrl } topicTags { name slug translatedName } companyTagStats codeSnippets { lang langSlug code } stats hints solution { id canSeeDetail paidOnly hasVideoSolution paidOnlyVideo } status sampleTestCase metaData judgerAvailable judgeType mysqlSchemas enableRunCode enableTestMode enableDebugger envInfo libraryUrl adminUrl challengeQuestion { id date incompleteChallengeCount streakCount type } note } }`; export const PROBLEM_LIST_QUERY = ` query getProblems($categorySlug: String, $limit: Int, $skip: Int, $filters: QuestionListFilterInput) { problemsetQuestionList: questionList( categorySlug: $categorySlug limit: $limit skip: $skip filters: $filters ) { total: totalNum questions: data { acRate difficulty freqBar questionFrontendId isFavor isPaidOnly status title titleSlug topicTags { name id slug } hasSolution hasVideoSolution } } }`; export const OFFICIAL_SOLUTION_QUERY = ` query OfficialSolution($titleSlug: String!) { question(titleSlug: $titleSlug) { solution { id title content contentTypeId paidOnly hasVideoSolution paidOnlyVideo canSeeDetail rating { count average userRating { score } } topic { id commentCount topLevelCommentCount viewCount subscribed solutionTags { name slug } post { id status creationDate author { username isActive profile { userAvatar reputation } } } } } } } `; export const TRENDING_DISCUSS_QUERY = ` query trendingDiscuss($first: Int!) { cachedTrendingCategoryTopics(first: $first) { id title post { id creationDate contentPreview author { username isActive profile { userAvatar } } } } } `; export const DISCUSS_TOPIC_QUERY = ` query DiscussTopic($topicId: Int!) { topic(id: $topicId) { id viewCount topLevelCommentCount subscribed title pinned tags hideFromTrending post { ...DiscussPost } } } fragment DiscussPost on PostNode { id voteCount voteStatus content updationDate creationDate status isHidden coinRewards { ...CoinReward } author { isDiscussAdmin isDiscussStaff username nameColor activeBadge { displayName icon } profile { userAvatar reputation } isActive } authorIsModerator isOwnPost } fragment CoinReward on ScoreNode { id score description date } `; export const DISCUSS_COMMENTS_QUERY = ` query discussComments($topicId: Int!, $orderBy: String = "newest_to_oldest", $pageNo: Int = 1, $numPerPage: Int = 10) { topicComments(topicId: $topicId, orderBy: $orderBy, pageNo: $pageNo, numPerPage: $numPerPage) { data { id pinned pinnedBy { username } post { ...DiscussPost } numChildren } } } fragment DiscussPost on PostNode { id voteCount voteStatus content updationDate creationDate status isHidden coinRewards { ...CoinReward } author { isDiscussAdmin isDiscussStaff username nameColor activeBadge { displayName icon } profile { userAvatar reputation } isActive } authorIsModerator isOwnPost } fragment CoinReward on ScoreNode { id score description date } `; export const USER_PROFILE_QUERY = ` query getUserProfile($username: String!) { allQuestionsCount { difficulty count } matchedUser(username: $username) { username githubUrl twitterUrl linkedinUrl contributions { points questionCount testcaseCount } profile { realName userAvatar birthday ranking reputation websites countryName company school skillTags aboutMe starRating } badges { id displayName icon creationDate } upcomingBadges { name icon } activeBadge { id displayName icon creationDate } submitStats { totalSubmissionNum { difficulty count submissions } acSubmissionNum { difficulty count submissions } } submissionCalendar } recentSubmissionList(username: $username, limit: 20) { title titleSlug timestamp statusDisplay lang } }`; export const USER_PROFILE_CALENDAR_QUERY = ` query UserProfileCalendar($username: String!, $year: Int!) { matchedUser(username: $username) { userCalendar(year: $year) { activeYears streak totalActiveDays dccBadges { timestamp badge { name icon } } submissionCalendar } } } `; export const USER_QUESTION_PROGRESS_QUERY = ` query userProfileUserQuestionProgressV2($username: String!) { userProfileUserQuestionProgressV2(userSlug: $username) { numAcceptedQuestions { count difficulty } numFailedQuestions { count difficulty } numUntouchedQuestions { count difficulty } userSessionBeatsPercentage { difficulty percentage } } } `; export const SKILL_STATS_QUERY = ` query skillStats($username: String!) { matchedUser(username: $username) { tagProblemCounts { advanced { tagName tagSlug problemsSolved } intermediate { tagName tagSlug problemsSolved } fundamental { tagName tagSlug problemsSolved } } } } `; export const LANGUAGE_STATS_QUERY = ` query languageStats($username: String!) { matchedUser(username: $username) { languageProblemCount { languageName problemsSolved } } } `; export const AC_SUBMISSION_QUERY = ` query getACSubmissions ($username: String!, $limit: Int) { recentAcSubmissionList(username: $username, limit: $limit) { title titleSlug timestamp statusDisplay lang } }`; export const SUBMISSION_QUERY = ` query getRecentSubmissions($username: String!, $limit: Int) { recentSubmissionList(username: $username, limit: $limit) { title titleSlug timestamp statusDisplay lang } }`; export const GET_USER_PROFILE_QUERY = ` query getUserProfile($username: String!) { allQuestionsCount { difficulty count } matchedUser(username: $username) { contributions { points } profile { reputation ranking } submissionCalendar submitStats { acSubmissionNum { difficulty count submissions } totalSubmissionNum { difficulty count submissions } } } recentSubmissionList(username: $username) { title titleSlug timestamp statusDisplay lang __typename } matchedUserStats: matchedUser(username: $username) { submitStats: submitStatsGlobal { acSubmissionNum { difficulty count submissions __typename } totalSubmissionNum { difficulty count submissions __typename } __typename } } } `; export const CONTEST_QUERY = ` query getUserContestRanking ($username: String!) { userContestRanking(username: $username) { attendedContestsCount rating globalRanking totalParticipants topPercentage badge { name } } userContestRankingHistory(username: $username) { attended rating ranking trendDirection problemsSolved totalProblems finishTimeInSeconds contest { title startTime } } }`; export const USER_BADGES_QUERY = ` query userBadges($username: String!) { matchedUser(username: $username) { badges { id displayName icon creationDate } upcomingBadges { name icon } activeBadge { id displayName icon creationDate } } } `; export const USER_SOLVED_QUERY = ` query userSolved($username: String!) { allQuestionsCount { difficulty count } matchedUser(username: $username) { submitStats { acSubmissionNum { difficulty count submissions } totalSubmissionNum { difficulty count submissions } } } } `;