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

public class GHFile extends GHBase
This class represents a GitHub file. It provides methods for fetching data about the file such as its name, path, SHA, size, URLs, and type.
  • Constructor Details

    • GHFile

      public GHFile(Github github, org.json.JSONObject jsonObject, GHRepository repository)
      Constructs a new GHFile instance with the provided JSON object.
      Parameters:
      jsonObject - the JSON object containing the file data
  • Method Details

    • updateFile

      public GHFileBuilder updateFile()
      Creates a new GHFileBuilder instance for updating the file. The GHFileBuilder is initialized with the repository, GitHub instance, and SHA of the file.
      Returns:
      a new GHFileBuilder instance
    • getHtmlUrl

      public String getHtmlUrl()
      Returns the HTML URL of the file.
      Returns:
      the HTML URL of the file
    • getUrl

      public String getUrl()
      Returns the URL of the file.
      Returns:
      the URL of the file
    • getName

      public String getName()
      Returns the name of the file.
      Returns:
      the name of the file
    • getSize

      public int getSize()
      Returns the size of the file.
      Returns:
      the size of the file
    • getDownloadUrl

      public String getDownloadUrl()
      Returns the download URL of the file.
      Returns:
      the download URL of the file
    • getGitUrl

      public String getGitUrl()
      Returns the Git URL of the file.
      Returns:
      the Git URL of the file
    • getPath

      public String getPath()
      Returns the path of the file.
      Returns:
      the path of the file
    • getSha

      public String getSha()
      Returns the SHA of the file.
      Returns:
      the SHA of the file
    • getType

      public String getType()
      Returns the type of the file.
      Returns:
      the type of the file
    • getContent

      public String getContent()
      Returns the content of the file. The content is encoded in Base64 format.
      Returns:
      the content of the file
    • getGithub

      public Github getGithub()
      Returns the GitHub instance associated with this file. The GitHub instance is used to perform operations related to GitHub such as fetching and updating data.
      Returns:
      the GitHub instance associated with this file
    • getRepository

      public GHRepository getRepository()
      Returns the GHRepository instance associated with this file. The GHRepository instance represents the repository that this file belongs to.
      Returns:
      the GHRepository instance associated with this file