Package javiergs.tulip
Class GitHubHandler
java.lang.Object
javiergs.tulip.GitHubHandler
A utility class for interacting with public GitHub repositories using the GitHub REST API.
Supports listing files in a folder and retrieving file contents.
- Version:
- 1.0
- Author:
- Javier Gonzalez-Sanchez
-
Constructor Summary
ConstructorsConstructorDescriptionGitHubHandler
(String owner, String repo) Constructor to initialize the GitHubHandler with a specific repository. -
Method Summary
-
Constructor Details
-
GitHubHandler
Constructor to initialize the GitHubHandler with a specific repository.- Parameters:
owner
- the GitHub username or organizationrepo
- the name of the repository
-
-
Method Details
-
listFiles
Lists all file names in a given folder of a public GitHub repository.- Parameters:
path
- the folder path inside the repository- Returns:
- a list of file paths (relative to the root)
- Throws:
IOException
- if the API call fails
-
getFileContent
Retrieves the raw content of a file in a public GitHub repository.- Parameters:
path
- the full file path inside the repository- Returns:
- the decoded content of the file as a String
- Throws:
IOException
- if the file cannot be retrieved or is not base64-encoded
-