Class SelfUser

All Implemented Interfaces:
HttpRequestInterface, JSONHelper

public class SelfUser extends GHUser
This class represents a GitHub user. It provides methods for fetching data about the user such as their issues, blocked users, and public keys, and for following and unfollowing users.
  • Constructor Details

    • SelfUser

      public SelfUser(Github github, org.json.JSONObject jsonObject)
      Constructs a new GHUser instance with the provided JSON object.
      Parameters:
      jsonObject - the JSON object containing the user data
  • Method Details

    • getSelfUser

      public static SelfUser getSelfUser(Github github)
      Returns the GitHub user associated with the provided GitHub instance.
      Parameters:
      github - the GitHub instance
      Returns:
      the GitHub user
    • getIssues

      public List<GHIssue> getIssues()
      Returns the issues of the user.
      Returns:
      the issues of the user
    • getBlockedUsers

      public List<GHUser> getBlockedUsers()
      Returns the users blocked by the user.
      Returns:
      the users blocked by the user
    • followUser

      public void followUser(String username)
      Follows the user with the provided username.
      Parameters:
      username - the username of the user to follow
    • unfollowUser

      public void unfollowUser(String username)
      Unfollows the user with the provided username.
      Parameters:
      username - the username of the user to unfollow
    • addPublicKey

      public GHPublicKeyBuilder addPublicKey()
      Returns a new GHPublicKeyBuilder instance associated with the user's GitHub instance.
      Returns:
      a new GHPublicKeyBuilder instance
    • addPublicKey

      public GHPublicKey addPublicKey(String title, String key)
      Returns a new GHPublicKey instance with the provided title and key, associated with the user's GitHub instance.
      Parameters:
      title - the title of the public key
      key - the key of the public key
      Returns:
      a new GHPublicKey instance
    • getPublicKey

      public GHPublicKey getPublicKey(int id)
      Returns the public key with the provided id.
      Parameters:
      id - the id of the public key
      Returns:
      the public key
    • deletePublicKey

      public void deletePublicKey(int id)
      Deletes the public key with the provided id.
      Parameters:
      id - the id of the public key
    • listCreatedRepositories

      public List<GHRepository> listCreatedRepositories()
      Returns a list of repositories created by the user.
      Returns:
      a list of repositories created by the user
    • listRepositoriesWithAccess

      public List<GHRepository> listRepositoriesWithAccess()
      Returns a list of repositories the user has access to.
      Returns:
      a list of repositories the user has access to
    • getEmail

      public String getEmail()
      Returns the email of the user.
      Returns:
      the email of the user
    • createProject

      public GHProjectBuilder createProject()
      Returns a new GHProjectBuilder instance for creating a project in the organization.
      Returns:
      a new GHProjectBuilder instance
    • createProject

      public GHProject createProject(String name, String body)
      Creates a project in the organization with the provided name and body.
      Parameters:
      name - the name of the project
      body - the body of the project
      Returns:
      the created project