java.lang.Object
io.github.coho04.githubapi.bases.GHBase
io.github.coho04.githubapi.entities.repositories.GHBranch
All Implemented Interfaces:
HttpRequestInterface, JSONHelper

public class GHBranch extends GHBase
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.
  • 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:
      toJSONObject in class GHBase
      Returns:
      the JSONObject representation of this GHBranch instance
    • getName

      public String getName()
      Returns the branch name.
      Returns:
      the branch name
    • getCommitSha

      public String getCommitSha()
      Returns the commit SHA.
      Returns:
      the commit SHA
    • getCommitUrl

      public String 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