Class GHIssueBuilder

java.lang.Object
io.github.coho04.githubapi.bases.GHBase
io.github.coho04.githubapi.builders.GHIssueBuilder
All Implemented Interfaces:
HttpRequestInterface, JSONHelper

public class GHIssueBuilder extends GHBase
The GHIssueBuilder class is used to build and create GitHub issues. This class provides methods to set various properties of an issue such as title, body, assignee, milestone, and labels. It extends the GHBase class and implements the JSONHelper and HttpRequestInterface interfaces. This class is part of the builder pattern to simplify issue creation on GitHub.
  • Constructor Details

    • GHIssueBuilder

      public GHIssueBuilder(Github github, String url, String title)
      Constructs a new GHIssueBuilder instance with the specified GitHub instance and title.
      Parameters:
      github - the GitHub instance
      title - the title of the issue
    • GHIssueBuilder

      public GHIssueBuilder(Github github, String url, String title, String body)
      Constructs a new GHIssueBuilder instance with the specified GitHub instance, title, and body.
      Parameters:
      github - the GitHub instance
      title - the title of the issue
      body - the body of the issue
  • Method Details

    • setTitle

      public void setTitle(String title)
      Sets the title of the issue.
      Parameters:
      title - the title to set
    • assignee

      public GHIssueBuilder assignee(String user)
      Sets the assignee of the issue.
      Parameters:
      user - the username of the assignee
      Returns:
      the current instance of GHIssueBuilder
    • addLabel

      public GHIssueBuilder addLabel(String label)
      Adds a label to the issue.
      Parameters:
      label - the label to be added to the issue
      Returns:
      the current instance of GHIssueBuilder
    • create

      public GHIssue create()
      Creates a new GHIssue instance based on the current state of the builder.
      Returns:
      a new GHIssue instance
    • getTitle

      public String getTitle()
      Returns the title of the issue.
      Returns:
      the title of the issue
    • getBody

      public String getBody()
    • setBody

      public void setBody(String body)
    • setMilestone

      public void setMilestone(GHMilestone milestone)
    • getGithub

      public Github getGithub()
    • getUrl

      public String getUrl()
    • getLabels

      public List<String> getLabels()
    • getMilestone

      public GHMilestone getMilestone()
    • getState

      public GHState getState()
    • getAssignees

      public List<String> getAssignees()
    • toJSONObject

      public org.json.JSONObject toJSONObject()
      Converts the current state of the builder to a JSONObject.
      Overrides:
      toJSONObject in class GHBase
      Returns:
      a JSONObject representing the current state of the builder