Package io.github.coho04.githubapi
Class SelfUser
- All Implemented Interfaces:
HttpRequestInterface
,JSONHelper
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.coho04.githubapi.interfaces.JSONHelper
JSONHelper.JSONToObject<T>
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a new GHPublicKeyBuilder instance associated with the user's GitHub instance.addPublicKey
(String title, String key) Returns a new GHPublicKey instance with the provided title and key, associated with the user's GitHub instance.Returns a new GHProjectBuilder instance for creating a project in the organization.createProject
(String name, String body) Creates a project in the organization with the provided name and body.void
deletePublicKey
(int id) Deletes the public key with the provided id.void
followUser
(String username) Follows the user with the provided username.Returns the users blocked by the user.getEmail()
Returns the email of the user.Returns the issues of the user.getPublicKey
(int id) Returns the public key with the provided id.static SelfUser
getSelfUser
(Github github) Returns the GitHub user associated with the provided GitHub instance.Returns a list of repositories created by the user.Returns a list of repositories the user has access to.void
unfollowUser
(String username) Unfollows the user with the provided username.Methods inherited from class io.github.coho04.githubapi.entities.GHUser
findRepositoryByName, getContributions, getFollowers, getFollowersUrl, getFollowing, getFollowingUrl, getGistsUrl, getGravatarId, getOrganizationsUrl, getPublicKeys, getReceivedEventsUrl, getStarredUrl, getSubscriptionsUrl, getUser, isSiteAdmin, listRepositories, toJSONObject
Methods inherited from class io.github.coho04.githubapi.bases.EntityBase
getAvatarUrl, getLogin, getReposUrl, getType, getUsername
Methods inherited from class io.github.coho04.githubapi.bases.ClassBase
getEventsUrl, getHtmlUrl, getId, getNodeId, getUrl
Methods inherited from class io.github.coho04.githubapi.bases.GHBase
fetchArrayData, fetchArrayData, fetchPaginatedData, fetchPaginatedData, fetchPaginatedData, getBaseUrl
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.coho04.githubapi.interfaces.HttpRequestInterface
extractNextPageUrl, sendDeleteRequest, sendDeleteRequestWithResponseCode, sendGetRequest, sendGetRequestWithLinkHeader, sendGetRequestWithResponseCode, sendPatchRequest, sendPostRequest, sendPutRequest
Methods inherited from interface io.github.coho04.githubapi.interfaces.JSONHelper
getArrayOrNull, getBooleanOrNull, getIntOrNull, getJSONArrayToStringList, getJSONObjectOrNull, getLocalDateOrNull, getLongOrNull, getStringOrNull
-
Constructor Details
-
SelfUser
Constructs a new GHUser instance with the provided JSON object.- Parameters:
jsonObject
- the JSON object containing the user data
-
-
Method Details
-
getSelfUser
Returns the GitHub user associated with the provided GitHub instance.- Parameters:
github
- the GitHub instance- Returns:
- the GitHub user
-
getIssues
Returns the issues of the user.- Returns:
- the issues of the user
-
getBlockedUsers
Returns the users blocked by the user.- Returns:
- the users blocked by the user
-
followUser
Follows the user with the provided username.- Parameters:
username
- the username of the user to follow
-
unfollowUser
Unfollows the user with the provided username.- Parameters:
username
- the username of the user to unfollow
-
addPublicKey
Returns a new GHPublicKeyBuilder instance associated with the user's GitHub instance.- Returns:
- a new GHPublicKeyBuilder instance
-
addPublicKey
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 keykey
- the key of the public key- Returns:
- a new GHPublicKey instance
-
getPublicKey
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
Returns a list of repositories created by the user.- Returns:
- a list of repositories created by the user
-
listRepositoriesWithAccess
Returns a list of repositories the user has access to.- Returns:
- a list of repositories the user has access to
-
getEmail
Returns the email of the user.- Returns:
- the email of the user
-
createProject
Returns a new GHProjectBuilder instance for creating a project in the organization.- Returns:
- a new GHProjectBuilder instance
-
createProject
Creates a project in the organization with the provided name and body.- Parameters:
name
- the name of the projectbody
- the body of the project- Returns:
- the created project
-