The GitHub Repository Service is a Spring Boot application that provides functionality to fetch repositories and their branches from GitHub using the GitHub GraphQL API.
- Fetch repositories of a user with their repositores and branches
- Support for pagination to handle large repositories
- Error handling for invalid requests or server errors
- Java
- Spring Boot
- Spring WebFlux
- Maven
- WebClient for making HTTP requests
- Mockito for testing
- Docker
- Java 20 or higher installed on your system
- GitHub personal access token (PAT) with appropriate permissions
-
Clone the repository:
git clone https://github.com/gideonGig/tui-test.git
-
Build the project using Maven:
./mvn clean install
-
Start the application:
docker compose up
-
Access the api using an HTTP client like POSTMAN, application runs on
Before running the application, make sure to set the following configuration properties: . github.baseurl: Base URL for GitHub API. You can set these properties in the application.properties file or as environment variables.
To fetch repositories and branches for a GitHub user, send a GET request to the following endpoint:
- GET /api/v1/github/{username}
Replace {username}
with the GitHub username you want to fetch repositories for. You must also include the following headers in your request:
Authorization
: Bearer token for GitHub API authenticationAccept
: Must be set toapplication/json
The response will contain a JSON array of repositories, each containing information about the repository and its branches.
Contributions to the GitHub Repository Fetcher are welcome! If you have any ideas for improvements or new features, feel free to open an issue or submit a pull request.