Class GHBranch
java.lang.Object
io.github.coho04.githubapi.bases.GHBase
io.github.coho04.githubapi.entities.repositories.GHBranch
- All Implemented Interfaces:
HttpRequestInterface,JSONHelper
This class represents a GitHub branch.
It provides methods for fetching data about the branch such as its name, commit SHA, commit URL, and protection status.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.coho04.githubapi.interfaces.JSONHelper
JSONHelper.JSONToObject<T> -
Constructor Summary
ConstructorsConstructorDescriptionGHBranch(org.json.JSONObject jsonObject) Constructs a new GHBranch instance with the provided JSON object. -
Method Summary
Modifier and TypeMethodDescriptionReturns the commit SHA.Returns the commit URL.getName()Returns the branch name.booleanReturns the branch protection status.org.json.JSONObjectConverts this GHBranch instance to a JSONObject.Methods inherited from class io.github.coho04.githubapi.bases.GHBase
fetchArrayData, fetchArrayData, fetchPaginatedData, fetchPaginatedData, fetchPaginatedData, getBaseUrlMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.coho04.githubapi.interfaces.HttpRequestInterface
extractNextPageUrl, sendDeleteRequest, sendDeleteRequestWithResponseCode, sendGetRequest, sendGetRequestWithLinkHeader, sendGetRequestWithResponseCode, sendPatchRequest, sendPostRequest, sendPutRequestMethods inherited from interface io.github.coho04.githubapi.interfaces.JSONHelper
getArrayOrNull, getBooleanOrNull, getIntOrNull, getJSONArrayToStringList, getJSONObjectOrNull, getLocalDateOrNull, getLongOrNull, getStringOrNull
-
Constructor Details
-
GHBranch
public GHBranch(org.json.JSONObject jsonObject) Constructs a new GHBranch instance with the provided JSON object.- Parameters:
jsonObject- the JSON object containing the branch data
-
-
Method Details
-
toJSONObject
public org.json.JSONObject toJSONObject()Converts this GHBranch instance to a JSONObject.- Overrides:
toJSONObjectin classGHBase- Returns:
- the JSONObject representation of this GHBranch instance
-
getName
Returns the branch name.- Returns:
- the branch name
-
getCommitSha
Returns the commit SHA.- Returns:
- the commit SHA
-
getCommitUrl
Returns the commit URL.- Returns:
- the commit URL
-
isProtected
public boolean isProtected()Returns the branch protection status.- Returns:
- true if the branch is protected, false otherwise
-