Package io.github.coho04.githubapi
Class Github
java.lang.Object
io.github.coho04.githubapi.bases.GHBase
io.github.coho04.githubapi.Github
- All Implemented Interfaces:
HttpRequestInterface
,JSONHelper
This class represents the main entry point for interacting with the GitHub API.
It provides methods for fetching data about users, organizations, advisories, and gitignore templates.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.coho04.githubapi.interfaces.JSONHelper
JSONHelper.JSONToObject<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindOrganisationByName
(String name) Finds an organization by its name.findUserByName
(String name) Finds a user by their username.getGitignoreTemplate
(String name) Gets a gitignore template by its name.Gets a global advisory by its ID.static Logger
Lists all user advisories.getToken()
Returns the GitHub token.Lists all gitignore templates.Lists all global advisories.Methods inherited from class io.github.coho04.githubapi.bases.GHBase
fetchArrayData, fetchArrayData, fetchPaginatedData, fetchPaginatedData, fetchPaginatedData, getBaseUrl, toJSONObject
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
-
Github
Constructs a new GitHub instance with the provided username and token.- Parameters:
token
- the GitHub token
-
-
Method Details
-
findOrganisationByName
Finds an organization by its name.- Parameters:
name
- the name of the organization- Returns:
- the organization
-
findUserByName
Finds a user by their username.- Parameters:
name
- the username of the user- Returns:
- the user
-
getToken
Returns the GitHub token.- Returns:
- the GitHub token
-
listGlobalAdvisories
Lists all global advisories.- Returns:
- a list of all global advisories
-
getGlobalAdvisories
Gets a global advisory by its ID.- Parameters:
id
- the ID of the advisory- Returns:
- the advisory
-
listGitignoreTemplates
Lists all gitignore templates.- Returns:
- a list of all gitignore templates
-
getGitignoreTemplate
Gets a gitignore template by its name.- Parameters:
name
- the name of the template- Returns:
- the gitignore template
-
getSelfUser
Lists all user advisories.- Returns:
- a list of all user advisories
-
getLogger
-