Skip to content
Top Dog edited this page Apr 6, 2019 · 15 revisions

Properties

id

The ID of the user (String)

username

The username of the user (String)

joinedTimestamp

When the user joined (String)

loginTimestamp

When the user last logged in (String)

profile

Profile information like status, country etc. (Object)

  • avatar

The main 90x90 avatar for the user (Image)

  • avatars

A list of different sizes of avatars for the user (Array<Image>)

  • id

The ID of the profile

  • status

The "What i'm working on" section of the profile (String)

  • bio

The "About me" section of the profile (String)

  • country

What country the user set when they first joined (String)

Methods

getProjects([options])

Get all projects by the user. Returns Promise<Array<Project>>

  • options
    • fetchAll

    Whether to fetch all projects or not NOTE: Can take a while if the user has alot of projects (Boolean)

    • limit

    Amount of projects to return. Default 20. NOTE: Max is 40, use offset to get more (Number)

    • offset

    Offset of projects to return. Default 0. (Number)

User.getProjects({
  fetchAll: true
}).then(projects => {
  console.log(projects);
});

/*
[Project, Project, Project, Project, Project, ...]
*/

getProject(project)

Get project by the user. Returns Promise<Project>

  • project

The project to get (Project, String)

User.getProject(10128407).then(project => {
  console.log("Project title is " + project.title);
});

/*
Project title is Paper Minecraft v11.3 (Minecraft 2D)
*/

getCurating([options])

Get all studios the user is curating. Returns Promise<Array<Studio>>

  • options
    • fetchAll

    Whether to fetch all studios or not NOTE: Can take a while if the user is curating alot of studios (Boolean)

    • limit

    Amount of studios to return. Default 20. NOTE: Max is 40, use offset to get more (Number)

    • offset

    Offset of studios to return. Default 0. (Number)

User.getCurating({
  fetchAll: true
}).then(studios => {
  console.log(studios);
});

/*
[Studio, Studio, Studio, Studio, Studio, ...]
*/

getFavorited([options])

Get all projects the user has favorited. Returns Promise<Array<Project>>

  • options
    • fetchAll

    Whether to fetch all projects or not NOTE: Can take a while if the user has favorited alot of projects (Boolean)

    • limit

    Amount of projects to return. Default 20. NOTE: Max is 40, use offset to get more (Number)

    • offset

    Offset of projects to return. Default 0. (Number)

User.getFavorited({
  fetchAll: true
}).then(projects => {
  console.log(projects);
});

/*
[Project, Project, Project, Project, Project, ...]
*/

getFollowers([options])

Get all users that are following the user. Returns Promise<Array<User>>

  • options
    • fetchAll

    Whether to fetch all users or not NOTE: Can take a while if the user has alot of followers cough griffpatch cough (Boolean)

    • limit

    Amount of users to return. Default 20. NOTE: Max is 40, use offset to get more (Number)

    • offset

    Offset of users to return. Default 0. (Number)

User.getFollowers({
  fetchAll: true
}).then(followers => {
  console.log(followers);
});

/*
[User, User, User, User, User, ...]
*/

getFollowing([options])

Get all users that the user is following. Returns Promise<Array<User>>

  • options
    • fetchAll

    Whether to fetch all users or not NOTE: Can take a while if the user is following alot of people(Boolean)

    • limit

    Amount of users to return. Default 20. NOTE: Max is 40, use offset to get more (Number)

    • offset

    Offset of users to return. Default 0. (Number)

User.getFollowing({
  fetchAll: true
}).then(followers => {
  console.log(followers);
});

/*
[User, User, User, User, User, ...]
*/

getMessageCount()

Get project by the user. Returns Promise<Number>

User.getMessageCount().then(count => {
  console.log("User " + User.username + " has " + count + " messages");
});

/*
User griffpatch has 53781 messages
*/

postComment(content[, parent])

Post a comment on the users profile NOTE: Authorisation required, uses old site-api endpoint, not recommended and is subject to change soon. Returns Promise<>

  • content

The content of the comment (String)

  • parent

Parent id of comment to reply to (String)

User.postComment("Hi griffpatch!").then(() => {
  console.log("griffpatch is happy");
});

/*
griffpatch is happy
*/

report(field)

Report the account NOTE: Authorisation required, uses old site-api endpoint, not recommended and is subject to change soon, I'm not responsible for any negative impact this has on your account. Returns Promise<>

  • field

The field that is considered offensive (String) Accepts "description", "working_on", "username", "aboutme", "workingon", "avatar", "name"

User.report("username").then(() => {
  console.log("User " + User.username + " has been reported");
});

/*
User griffpatch has been reported
*/

Clone this wiki locally