Build a service using gRPC that builds on top of the GitHub API to perform queries for the
provided search phrase and allows for optional filtering down to the user level. You’ll return the
file URL and the repo it was found in.
This is the API you’ll use to perform the GitHub search:
https://docs.github.com/en/rest/reference/search
This is the API spec that should be implemented:
service GithubSearchService {
rpc Search(SearchRequest) returns (SearchResponse);
}
message SearchRequest {
string search_term = 1;
string user = 2;
}
message SearchResponse {
repeated Result results = 1;
}
message Result {
string file_url = 1;
string repo = 2;
}
Instructions
- Create a new, public GitHub repository with only a README
- Create a new branch and do all your work in that branch
- Create a PR back into the main branch and send in the URL to the Pull Request
- Make and Git:
brew install git make
- Docker:
brew install docker
- Ensure Docker is running:
If Docker is not running, start the Docker daemon manually.
open -a Docker docker info
- Make and Git:
sudo apt-get install git make
- Docker:
sudo apt-get install docker
- Ensure Docker is running:
sudo systemctl start docker sudo systemctl enable docker # Optional: Start Docker on boot sudo docker info
- Clone the repository:
git clone [email protected]:Thesohan/weaveGitHubSearchService.git
- Generate Protobuf code (if modified):
make generate
- Update environement variables file
.env
:GITHUB_API_TOKEN=<your_github_token>
- To start the gRPC server and client:
make run
- It will ask you to
Enter username
: Enter the username for user level search result (optional) - It will ask you to
Enter search term
: Enter the search term to search in the GitHub repository (required)
- To execute a test request, run:
make test
- Authentication Errors: Ensure you have set
GITHUB_API_TOKEN
with a valid GitHub token in your env variable. - Ensure docker is up and running
- Support for configurable logging
- Support for pagination
- Secret management for API tokens