Class GHFile
java.lang.Object
io.github.coho04.githubapi.bases.GHBase
io.github.coho04.githubapi.entities.repositories.GHFile
- All Implemented Interfaces:
HttpRequestInterface
,JSONHelper
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.coho04.githubapi.interfaces.JSONHelper
JSONHelper.JSONToObject<T>
-
Constructor Summary
ConstructorsConstructorDescriptionGHFile
(Github github, org.json.JSONObject jsonObject, GHRepository repository) Constructs a new GHFile instance with the provided JSON object. -
Method Summary
Modifier and TypeMethodDescriptionReturns the content of the file.Returns the download URL of the file.Returns the GitHub instance associated with this file.Returns the Git URL of the file.Returns the HTML URL of the file.getName()
Returns the name of the file.getPath()
Returns the path of the file.Returns the GHRepository instance associated with this file.getSha()
Returns the SHA of the file.int
getSize()
Returns the size of the file.getType()
Returns the type of the file.getUrl()
Returns the URL of the file.Creates a new GHFileBuilder instance for updating the file.Methods inherited from class io.github.coho04.githubapi.bases.GHBase
fetchArrayData, fetchArrayData, fetchPaginatedData, fetchPaginatedData, fetchPaginatedData, getBaseUrl, toJSONObject
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.coho04.githubapi.interfaces.HttpRequestInterface
extractNextPageUrl, sendDeleteRequest, sendDeleteRequestWithResponseCode, sendGetRequest, sendGetRequestWithLinkHeader, sendGetRequestWithResponseCode, sendPatchRequest, sendPostRequest, sendPutRequest
Methods inherited from interface io.github.coho04.githubapi.interfaces.JSONHelper
getArrayOrNull, getBooleanOrNull, getIntOrNull, getJSONArrayToStringList, getJSONObjectOrNull, getLocalDateOrNull, getLongOrNull, getStringOrNull
-
Constructor Details
-
GHFile
Constructs a new GHFile instance with the provided JSON object.- Parameters:
jsonObject
- the JSON object containing the file data
-
-
Method Details
-
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
Returns the HTML URL of the file.- Returns:
- the HTML URL of the file
-
getUrl
Returns the URL of the file.- Returns:
- the URL of the file
-
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
Returns the download URL of the file.- Returns:
- the download URL of the file
-
getGitUrl
Returns the Git URL of the file.- Returns:
- the Git URL of the file
-
getPath
Returns the path of the file.- Returns:
- the path of the file
-
getSha
Returns the SHA of the file.- Returns:
- the SHA of the file
-
getType
Returns the type of the file.- Returns:
- the type of the file
-
getContent
Returns the content of the file. The content is encoded in Base64 format.- Returns:
- the content of the file
-
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
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
-