Class GHUser
java.lang.Object
io.github.coho04.githubapi.bases.GHBase
io.github.coho04.githubapi.bases.ClassBase
io.github.coho04.githubapi.bases.EntityBase
io.github.coho04.githubapi.entities.GHUser
- All Implemented Interfaces:
HttpRequestInterface
,JSONHelper
- Direct Known Subclasses:
SelfUser
Represents a GitHub user.
This class provides methods and properties to access information about a user on GitHub.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.coho04.githubapi.interfaces.JSONHelper
JSONHelper.JSONToObject<T>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindRepositoryByName
(String name) Finds and returns a repository by its name for the current user.int
Returns the number of contributions made by this user.Fetches and returns a list of users who are followers of the current user.Returns the URL for fetching the followers of this user.Fetches and returns a list of users who the current user is following.Returns the URL for fetching the users followed by this user.Returns the URL for fetching the gists of this user.Returns the gravatar ID of this user.Returns the URL for fetching the organizations of this user.Fetches and returns a list of public keys associated with the current user.Returns the URL for fetching the events received by this user.Returns the URL for fetching the repositories starred by this user.Returns the URL for fetching the subscriptions of this user.static GHUser
Fetches a GitHub user by their username.boolean
Returns whether this user is a site administrator.Fetches and returns a list of repositories owned by the current user.org.json.JSONObject
Converts this user instance to a JSONObject.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
-
Field Details
-
github
-
-
Constructor Details
-
GHUser
Constructs a new GHUser instance with the provided JSON object.- Parameters:
jsonObject
- the JSON object containing the user data
-
-
Method Details
-
toJSONObject
public org.json.JSONObject toJSONObject()Converts this user instance to a JSONObject.- Overrides:
toJSONObject
in classEntityBase
- Returns:
- a JSONObject representation of this user
-
getUser
Fetches a GitHub user by their username.- Parameters:
github
- the GitHub instancename
- the username of the user to fetch- Returns:
- a GHUser instance representing the fetched user
-
getFollowersUrl
Returns the URL for fetching the followers of this user.- Returns:
- the followers URL
-
getFollowingUrl
Returns the URL for fetching the users followed by this user.- Returns:
- the following URL
-
getGistsUrl
Returns the URL for fetching the gists of this user.- Returns:
- the gists URL
-
getReceivedEventsUrl
Returns the URL for fetching the events received by this user.- Returns:
- the received events URL
-
getStarredUrl
Returns the URL for fetching the repositories starred by this user.- Returns:
- the starred URL
-
getSubscriptionsUrl
Returns the URL for fetching the subscriptions of this user.- Returns:
- the subscriptions URL
-
getGravatarId
Returns the gravatar ID of this user.- Returns:
- the gravatar ID
-
getOrganizationsUrl
Returns the URL for fetching the organizations of this user.- Returns:
- the organizations URL
-
getContributions
public int getContributions()Returns the number of contributions made by this user.- Returns:
- the number of contributions
-
isSiteAdmin
public boolean isSiteAdmin()Returns whether this user is a site administrator.- Returns:
- true if the user is a site administrator, false otherwise
-
findRepositoryByName
Finds and returns a repository by its name for the current user.- Parameters:
name
- the name of the repository to find- Returns:
- the GHRepository instance representing the found repository
-
getFollowers
Fetches and returns a list of users who are followers of the current user.- Returns:
- a list of GHUser instances representing the followers of the current user
-
getFollowing
Fetches and returns a list of users who the current user is following.- Returns:
- a list of GHUser instances representing the users the current user is following
-
getPublicKeys
Fetches and returns a list of public keys associated with the current user.- Returns:
- a list of GHPublicKey instances representing the public keys of the current user
-
listRepositories
Fetches and returns a list of repositories owned by the current user.- Returns:
- a list of GHRepository instances representing the repositories owned by the current user
-