|
| 1 | +/** |
| 2 | + * GraphQL query to fetch user profile information from LeetCode. |
| 3 | + * |
| 4 | + * This query retrieves various details about a user, including: |
| 5 | + * |
| 6 | + * - `allQuestionsCount`: The count of all questions categorized by difficulty. |
| 7 | + * - `matchedUser`: Detailed information about the matched user, including: |
| 8 | + * - `username`: The username of the user. |
| 9 | + * - `githubUrl`: The GitHub profile URL of the user. |
| 10 | + * - `twitterUrl`: The Twitter profile URL of the user. |
| 11 | + * - `linkedinUrl`: The LinkedIn profile URL of the user. |
| 12 | + * - `contributions`: The user's contributions, including points, question count, and testcase count. |
| 13 | + * - `profile`: The user's profile details, such as real name, avatar, birthday, ranking, reputation, websites, country, company, school, skills, about me, and star rating. |
| 14 | + * - `badges`: The badges earned by the user, including id, display name, icon, and creation date. |
| 15 | + * - `upcomingBadges`: The badges that the user is about to earn, including name and icon. |
| 16 | + * - `activeBadge`: The currently active badge of the user, including id, display name, icon, and creation date. |
| 17 | + * - `submitStats`: The user's submission statistics, including total and accepted submissions categorized by difficulty. |
| 18 | + * - `submissionCalendar`: The user's submission calendar. |
| 19 | + * - `recentSubmissionList`: The list of recent submissions by the user, including title, title slug, timestamp, status display, and language. |
| 20 | + * |
| 21 | + * @param {string} $username - The username of the user whose profile is to be fetched. |
| 22 | + */ |
| 23 | +const query = `#graphql |
| 24 | +query getUserProfile($username: String!) { |
| 25 | + allQuestionsCount { |
| 26 | + difficulty |
| 27 | + count |
| 28 | + } |
| 29 | + matchedUser(username: $username) { |
| 30 | + username |
| 31 | + githubUrl |
| 32 | + twitterUrl |
| 33 | + linkedinUrl |
| 34 | + contributions { |
| 35 | + points |
| 36 | + questionCount |
| 37 | + testcaseCount |
| 38 | + } |
| 39 | + profile { |
| 40 | + realName |
| 41 | + userAvatar |
| 42 | + birthday |
| 43 | + ranking |
| 44 | + reputation |
| 45 | + websites |
| 46 | + countryName |
| 47 | + company |
| 48 | + school |
| 49 | + skillTags |
| 50 | + aboutMe |
| 51 | + starRating |
| 52 | + } |
| 53 | + badges { |
| 54 | + id |
| 55 | + displayName |
| 56 | + icon |
| 57 | + creationDate |
| 58 | + } |
| 59 | + upcomingBadges { |
| 60 | + name |
| 61 | + icon |
| 62 | + } |
| 63 | + activeBadge { |
| 64 | + id |
| 65 | + displayName |
| 66 | + icon |
| 67 | + creationDate |
| 68 | + } |
| 69 | + submitStats { |
| 70 | + totalSubmissionNum { |
| 71 | + difficulty |
| 72 | + count |
| 73 | + submissions |
| 74 | + } |
| 75 | + acSubmissionNum { |
| 76 | + difficulty |
| 77 | + count |
| 78 | + submissions |
| 79 | + } |
| 80 | + } |
| 81 | + submissionCalendar |
| 82 | + } |
| 83 | + recentSubmissionList(username: $username, limit: 20) { |
| 84 | + title |
| 85 | + titleSlug |
| 86 | + timestamp |
| 87 | + statusDisplay |
| 88 | + lang |
| 89 | + } |
| 90 | +}`; |
| 91 | + |
| 92 | +export default query; |
0 commit comments