Nordsense Code Challenge - GitHub Issue Manager.pdf


Analysis

The functional requirements can be divided in two parts:

Authentication

After looking into the official rest.js library, seems authentication can be as easy as using a personal access token (create by user, specify repo scope) generated on GitHub, and this should fit the bare minimum requirement.

The personal access token can be used in request as Authorization header:

curl -H "Authorization: token PERSONAL-ACCESS-TOKEN" https://api.github.com/...

GitHub API v3

Doc on auth

Issues API

Get issues

Use GET /user/issues to get a list of issues of current user. Can specify state, sort, direction.

Update issue

Use PATCH /repos/:owner/:repo/issues/:issue_number (the URL can be obtained from the get issues response, url field), set body:

{
	"state": "closed"
}

Pagination

GitHub API automatically handles pagination, by using the link response header

Link: <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=2>; rel="next",
  <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=34>; rel="last"

To specify the number of items in the response, use the per_page query parameter.