use githubApiGetProject to get the github project info - reduce with pathExpression constants - only root GET request
i.e. its project topics
use githubApiGetLogin to get the github login info - reduce with pathExpression constants - only root GET request
i.e. its user avatar
use getGithubTopics to get the github project topics - deprecated - use githubApiGetProject with GITHUB_PROJECT_TOPICS
npm install github-api-get
---// in a moduleexport{};// import the function from the libraryimport{getGithubTopics}from"github-api-get";import{GITHUB_PROJECT_TOPICS}from'./consts.js';// define a example usage functionexportasyncfunctionrealdataTopicsWithPathExpression(){constloginName="roebi";constprojectName="01-01-vanilla-HTML5-starter-page";constinfoLog=true;constisProd=true;constgithubTopics=githubApiGetProject(loginName,projectName,GITHUB_PROJECT_TOPICS,infoLog,isProd);// as Promise<string[]>constrealGithubTopics=awaitgithubTopics;console.group("realGithubTopics, call of githubApiGetProject with constant GITHUB_PROJECT_TOPICS");console.info("realGithubTopics");console.info(realGithubTopics);console.groupEnd();}// run the exampleawaitrealdataTopicsWithPathExpression();---real demo see
https://github.com/roebi/github-api-get-nodejs-example
or direct on
https://stackblitz.com/edit/github-api-get-nodejs
look in the tests: test.ts
if this limit is reached in a hour, then
the response is in this case a 'Status is 403' Forbidden
and return this Message Object / Json:
{message: "API rate limit exceeded for nnn.nnn.nnn.nnn. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",documentation_url: 'https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting'}see github - rest - resources-in-the-rest-api - rate-limiting
get github project info - reduce with pathExpression constants
Returns a Promise<any> with the project info
Type: String
The github login name
Type: String
The github project name of the project of a user login
Type: String
filter the project name of the project of a user login
Type: boolean
true Logs group and info into the console
Type: boolean
true Calls fetch to github api, false returns mock data with same structure
Returns a Promise<any>
with a Json / Object of a project reduced with pathExpression
see Example answer Json / Object of a project
get github user info - reduce with pathExpression constants
Returns a Promise<any> with the project info or user info
Type: String
The github login name
Type: String
filter the project namen of the project of a user login
Type: boolean
true Logs group and info into the console
Type: boolean
true Calls fetch to github api, false returns mock data with same structure
Returns a Promise<any>
with a Json / Object of a user login reduced with pathExpression
see Example answer Json / Object of a login of a user
Github Meta Data of project 'roebi/01-01-vanilla-HTML5-starter-page'
{
"name": "01-01-vanilla-HTML5-starter-page",
..."owner": {
"login": "roebi",
...
},
"html_url": "https://github.com/roebi/01-01-vanilla-HTML5-starter-page",
"description": "vanilla HTML 5 starter page - Have you ever heard of this HTML 5 tags ?",
..."url": "https://api.github.com/repos/roebi/01-01-vanilla-HTML5-starter-page",
..."homepage": "https://roebi.github.io/01-01-vanilla-HTML5-starter-page/",
..."license": {
"key": "unlicense",
},
..."topics": [
"html5",
"html5-template",
"roebi",
"starter"
],
...
}Github Meta Data of user login 'roebi'
{
"login": "roebi",
..."avatar_url": "...",
..."url": "https://api.github.com/users/roebi",
"html_url": "https://github.com/roebi",
..."location": "Switzerland",
..."bio": "..."
}look in the tests: test.ts
get github project topics as a Array
deprecated: use githubApiGetProject() with pathExpression constant GITHUB_PROJECT_TOPICS
Type: String
The github login name
Type: String
The github project name of the project of a user login
Type: boolean
true Logs group and info into the console
Type: boolean
true Calls fetch to github api, false returns mock data with same structure
Returns a Promise<String[]> with the list of the project topics
i.e.
"topics": ["html5","html5-template","roebi","starter"]look in the tests: test.ts