Klasse GHFileBuilder

java.lang.Object
de.coho04.githubapi.bases.GHBase
de.coho04.githubapi.builders.GHFileBuilder
Alle implementierten Schnittstellen:
HttpRequestInterface, JSONHelper

public class GHFileBuilder extends GHBase
GHFileBuilder is a class that extends GHBase. It represents a builder for creating and committing files to a GitHub repository. It contains several properties such as branch, path, content, message, and repository. These properties are initialized through the constructor and can be set using the provided setter methods.
Seit:
2024-1.2
Version:
1.0
Autor:
Coho04
  • Konstruktordetails

    • GHFileBuilder

      public GHFileBuilder(GHRepository repository, Github github)
      Constructs a new GHFileBuilder object for a given repository.
      Parameter:
      repository - a GHRepository object representing the repository to which the file will be committed.
    • GHFileBuilder

      public GHFileBuilder(GHRepository repository, GHBranch branch, Github github)
      Constructs a new GHFileBuilder object for a given repository and branch.
      Parameter:
      repository - a GHRepository object representing the repository to which the file will be committed.
      branch - a GHBranch object representing the branch to which the file will be committed.
    • GHFileBuilder

      public GHFileBuilder(GHRepository repository, GHBranch branch, String path, String content, String message, Github github)
      Constructs a new GHFileBuilder object with all properties set.
      Parameter:
      repository - a GHRepository object representing the repository to which the file will be committed.
      branch - a GHBranch object representing the branch to which the file will be committed.
      path - a String representing the path of the file.
      content - a String representing the content of the file.
      message - a String representing the commit message.
  • Methodendetails

    • setBranch

      public GHFileBuilder setBranch(GHBranch branch)
      Sets the branch to which the file will be committed.
      Parameter:
      branch - a GHBranch object representing the branch to which the file will be committed.
      Gibt zurück:
      the current GHFileBuilder object.
    • setBranch

      public GHFileBuilder setBranch(String branch)
      Sets the branch to which the file will be committed.
      Parameter:
      branch - a String representing the name of the branch to which the file will be committed.
      Gibt zurück:
      the current GHFileBuilder object.
    • setContent

      public GHFileBuilder setContent(String content)
      Sets the content of the file.
      Parameter:
      content - a String representing the content of the file.
      Gibt zurück:
      the current GHFileBuilder object.
    • setMessage

      public GHFileBuilder setMessage(String message)
      Sets the commit message.
      Parameter:
      message - a String representing the commit message.
      Gibt zurück:
      the current GHFileBuilder object.
    • setPath

      public GHFileBuilder setPath(String path)
      Sets the path of the file.
      Parameter:
      path - a String representing the path of the file.
      Gibt zurück:
      the current GHFileBuilder object.
    • getGithub

      public Github getGithub()
      Returns the GitHub instance associated with this file builder.
      Gibt zurück:
      the GitHub instance
    • getRepository

      public GHRepository getRepository()
      Returns the repository where this file will be committed.
      Gibt zurück:
      the GHRepository instance
    • getBranch

      public GHBranch getBranch()
      Returns the branch where this file will be committed.
      Gibt zurück:
      the GHBranch instance
    • getContent

      public String getContent()
      Returns the content of the file to be committed.
      Gibt zurück:
      the content of the file
    • getMessage

      public String getMessage()
      Returns the commit message for the file commit.
      Gibt zurück:
      the commit message
    • getPath

      public String getPath()
      Returns the path where the file will be committed.
      Gibt zurück:
      the path of the file
    • commit

      public void commit(String email, String name)
      Commits the file to the repository. This method is not yet implemented.
    • commit

      public void commit()
      Commits the file to the repository using the authenticated user's email and login as the committer's details. This method first sends a GET request to retrieve the authenticated user's email. Then, it calls the overloaded commit method with the retrieved email and the authenticated user's login.