ClientUser

ClientUser

Represents the user that is currently logged in

Constructor

new ClientUser()

Source:

Extends

Members

accessLevel :number

Source:
Overrides:
Unknown value
Type:
  • number

(nullable) avatarUrl :string

Source:
Overrides:
See:
  • hasAvatar
The link to the user's profile picture if they have any
Type:
  • string

(nullable) badge :string

Source:
Overrides:
The name of the user's badge if they have any
Type:
  • string

(nullable) email :string

Source:
Overrides:
The user's email if you have permission to view it
Type:
  • string

hasAvatar :boolean

Source:
Overrides:
See:
  • avatarUrl
Whether or not the user has set a custom profile picture
Type:
  • boolean

id :number

Source:
Overrides:
The user's ID
Type:
  • number

isPro :boolean

Source:
Overrides:
See:
  • proExpireDate
Whether or not the user has SoloLearn Pro
Type:
  • boolean

level :number

Source:
Overrides:
See:
  • xp
The user's XP level
Type:
  • number

name :string

Source:
Overrides:
The username
Type:
  • string

(nullable) proExpireDate :*

Source:
Overrides:
When SoloLearn Pro expires for this user if applicable (Unknown type)
Type:
  • *

(nullable) registerDateTime :*

Source:
Overrides:
When the user registered their account (Unknown type, sometimes null?)
Type:
  • *

xp :number

Source:
Overrides:
The amount of XP this user has
Type:
  • number

Methods

(async) createDiscussionPost(title, text, tagsopt) → {Promise.<DiscussionPost>}

Source:
Create a post in the Q&A discussions section
Parameters:
Name Type Attributes Default Description
title string The post title
text string The post text
tags Array.<string> <optional>
[] The post tags
Returns:
The post that was just created
Type
Promise.<DiscussionPost>

(async) createPost(text, backgroundopt) → {Promise.<FeedItem>}

Source:
Create a profile post
Parameters:
Name Type Attributes Default Description
text string The post text
background PostBackground | number <optional>
null The post background that will be used
Returns:
The post that was just created
Type
Promise.<FeedItem>

(async) findContestPlayers(count, course, indexopt, queryopt, nameopt)

Source:
Search for players who are accepting challenges in a particular language
Parameters:
Name Type Attributes Default Description
count number The maximum amount of players to get
course Course | number The course the programming language you are searching for belongs to
index number <optional>
0 Amount of users to skip
query string <optional>
"" A search query
name string <optional>
"" Unknown
Returns:
Promise

(async) getCodeCoachProblems(countopt, indexopt, languageopt, difficultyopt, statusopt, queryopt) → {Promise.<Array.<Problem>>}

Source:
Get code coach problems
Parameters:
Name Type Attributes Default Description
count <optional>
20 Maximum amount of problems to get
index <optional>
0 How many problems to skip
language <optional>
"all" The language to filter the problems by (or "all" for all languages)
difficulty <optional>
"all" The difficulty to filter the problems by (or "all" for all difficulties)
status <optional>
"all" The status to filter the problems by (or "all" for all statuses)
query <optional>
"" A search query
Returns:
Type
Promise.<Array.<Problem>>

(async) getCodes(count, filteropt, indexopt, searchQueryopt, languageopt) → {Promise.<Array.<CodeItem>>}

Source:
Overrides:
Search for public codes
Parameters:
Name Type Attributes Default Description
count number The maximum amount of codes to get
filter SearchFilter <optional>
SearchFilter.MOST_RECENT The sorting filter to use
index number <optional>
0 The index of where to start
searchQuery string <optional>
A search query
language Language | "" <optional>
Which language to filter results by
Returns:
The search results
Type
Promise.<Array.<CodeItem>>

(async) getCoursesAndLevels() → {Promise.<{courses: Array.<Course>, levels: Array.<Level>}>}

Source:
Get all SoloLearn courses and level info (the same API endpoint is used for both things)
Returns:
Type
Promise.<{courses: Array.<Course>, levels: Array.<Level>}>

(async) getDashboard() → {Promise.<Dashboard>}

Source:
Get your user dashboard containing information like your position and streak status
Returns:
Type
Promise.<Dashboard>

(async) getFeed(count, fromopt, toopt) → {Promise.<Array.<Post>>}

Source:
Overrides:
See:
  • getPosts Get only posts created by this user
Get the user's feed
Parameters:
Name Type Attributes Default Description
count number The maximum amount of posts to get (includes things like achievements and completed challenges)
from Post | number <optional>
null The latest post to return
to Post | number <optional>
null The earliest post to return
Returns:
Type
Promise.<Array.<Post>>

(async) getHomeFeed(count, fromopt, toopt) → {Promise.<Array.<Post>>}

Source:
Get the posts your home feed
Parameters:
Name Type Attributes Default Description
count number The maximum amount of posts to get
from Post | number <optional>
null The latest post to return
to Post | number <optional>
null The earliest post to return
Returns:
Type
Promise.<Array.<Post>>

(async) getItemCounts() → {Promise.<ItemCounts>}

Source:
Overrides:
Get the amount of answers, codes etc. this user has
Returns:
Type
Promise.<ItemCounts>

(async) getLessons(count, index) → {Promise.<Array.<Lesson>>}

Source:
Overrides:
Get the lessons that were created by this user
Parameters:
Name Type Default Description
count number The maximum amount of lessons to get
index number 0 The offset
Returns:
Type
Promise.<Array.<Lesson>>

(async) getPostBackgrounds() → {Promise.<Array.<PostBackground>>}

Source:
Get the backgrounds that can be used to create a post
Returns:
Type
Promise.<Array.<PostBackground>>

(async) getPosts(count) → {Promise.<Array.<Post>>}

Source:
Overrides:
See:
  • getFeed Get all posts including achievements and challenges completed etc.
Get the user's user-created posts
Parameters:
Name Type Description
count number The maximum amount of posts to get
Returns:
Type
Promise.<Array.<Post>>

(async) getStreakStatus() → {Promise.<StreakStatus>}

Source:
Get the streak notification
Returns:
Type
Promise.<StreakStatus>

(async) getUnseenNotificationCount() → {Promise.<number>}

Source:
Get the amount of unseen notifications you have
Returns:
Type
Promise.<number>

(async) getUserInfo() → {Promise.<UserInfo>}

Source:
Overrides:
Get additional information about this user
Returns:
Type
Promise.<UserInfo>

(async) runCode(language, code, inputopt) → {Promise.<CodeResult>}

Source:
Compile and run a piece of code and return the result
Parameters:
Name Type Attributes Default Description
language string The programming language
code string The source code
input Array.<string> <optional>
null Strings of input to be used
Returns:
Type
Promise.<CodeResult>

(async) searchCodes(count, filter, indexopt, searchQueryopt, languageopt) → {Promise.<Array.<CodeItem>>}

Source:
Search for public codes
Parameters:
Name Type Attributes Default Description
count number The maximum amount of codes to get
filter SearchFilter The sorting filter to use
index number <optional>
0 The index of where to start
searchQuery string <optional>
A search query
language Language | "" <optional>
Which language to filter results by
Returns:
The search results
Type
Promise.<Array.<CodeItem>>

(async) searchDiscussionTags(query) → {Promise.<Array.<string>>}

Source:
Search for tags in Q&A discussions
Parameters:
Name Type Description
query The search query
Returns:
List of tags that match the search query
Type
Promise.<Array.<string>>

(async) setBio(text) → {Promise.<UserInfo>}

Source:
Edit your profile summary
Parameters:
Name Type Description
text string Your new bio
Returns:
Type
Promise.<UserInfo>

(async) startContest(course)

Source:
Start a contest with another player and get 5 challenges
Parameters:
Name Type Description
course Course | number The Course object or the course ID
Returns:
Promise