A command-line application written in C# and .NET for retrieving and displaying GitHub repository and activity data through the GitHub REST API.
The project focuses on API integration, asynchronous HTTP communication, JSON processing, configuration management, and separation of application responsibilities.
- Retrieve repositories associated with the authenticated GitHub account
- View recent public GitHub activity
- Look up another user's public repositories and recent activity
- Authenticate GitHub API requests using a personal access token
- Dynamically construct GitHub API endpoints from usernames
- Parse API responses using
System.Text.Json - Display repository and event data through a console interface
- Unit tests for URL generation and user interaction logic
C# .NET 10 GitHub REST API HttpClient System.Text.Json xUnit DotNetEnv
User selects operation
|
v
Dialogue / Request
|
v
Construct GitHub API endpoint
|
v
GitHubService
|
v
HTTP GET request
|
v
JSON response
|
v
Parse repository / event data
|
v
Console output
The application only requests the API resources required for the selected operation.
For example, requesting recent activity fetches the GitHub events endpoint without making an unnecessary repository request.
GitHubService wraps communication with the GitHub REST API using HttpClient.
The client configures:
- GitHub-compatible
User-Agent application/vnd.github+jsonresponse format- Optional Bearer-token authentication
- HTTP status validation
- Asynchronous JSON retrieval
Responses are converted into JsonDocument objects before being processed by the output layer.
The CLI currently supports three workflows:
Retrieves repository data associated with the configured authenticated-user endpoint.
Retrieves recent GitHub events and displays:
timestamp | event type | repository
Given a username, the application builds GitHub API endpoints for that user's:
- Public repositories
- Public activity
and retrieves both resources asynchronously.
The application separates user interaction, API communication, request representation, and output formatting.
ConsoleApp/
├── Program.cs
├── Dialogue.cs
├── Request.cs
├── Output.cs
│
├── Services/
│ └── GitHubService.cs
│
├── Helpers/
│ └── ParseUrl.cs
│
└── Models/
├── Repos.cs
└── Events.cs
ConsoleApp.Tests/
└── UnitTest1.cs
| Component | Responsibility |
|---|---|
Program.cs |
Application orchestration and dependency setup |
Dialogue.cs |
CLI interaction and operation selection |
Request.cs |
Represents the requested API resources |
GitHubService.cs |
HTTP communication with GitHub |
ParseUrl.cs |
Builds user-specific GitHub API URLs |
Output.cs |
Parses and renders API data |
ConsoleApp.Tests |
Unit tests for core application behavior |
---------------
username's Repositories:
---------------
* repository-one
* repository-two
---------------
username's Recent Activities:
---------------
2026-01-01T12:30:00Z | PushEvent | username/repository-one
2026-01-01T10:15:00Z | CreateEvent | username/repository-two
git clone https://github.com/jungwonenjoyericl/git_activity_tracker.git
cd git_activity_trackerdotnet restoreCreate a .env file and configure the GitHub API endpoints and token used by the application.
GITHUB_TOKEN=your_github_token
PRIVATE_URL=https://api.github.com/user/repos
MY_EVENTS_URL=https://api.github.com/users/YOUR_USERNAME/events
USER_URL=https://api.github.com/users/placeholder/repos
USER_EVENTS_URL=https://api.github.com/users/placeholder/eventsplaceholder is replaced with the username entered through the CLI.
dotnet run --project ConsoleAppThe project contains xUnit tests covering:
- Repository URL generation
- Activity URL generation
- CLI option handling
- Construction of user-specific requests
Run the tests with:
dotnet testThis project demonstrates practical use of:
- REST API integration
- Asynchronous programming with
async/await HttpClient- JSON parsing
- HTTP authentication and request headers
- Environment-based configuration
- Separation of concerns
- Dependency injection through constructors
- Unit testing in .NET