github-user-data
v1.2.0
Published
Simple Github API wrapper
Maintainers
Readme
Documentation for github-user-data
The purpose of this code is to make a simple GitHub API wrapper and help user retrieve valuable information.
Installation
npm install github-user-dataDependencies
This code requires the following dependencies:
- axios
- log-symbols
GithubUserData Function
Parameters
username(required): the GitHub username of the user to retrieve information foroption(optional): a string indicating the type of user information to retrieve. If this parameter is not provided, all available user information will be returned. This parameter is case-insensitive.
Returned. Possible options are:
loginidnode_idavatar_urlgravatar_idurltypesite_adminnamecompanybloglocationemailhireablebiotwitter_usernamepublic_repospublic_gistsfollowersfollowingcreated_atupdated_atall - (returns all personal information)
Example
import { GithubUserData } from "github-user-data";
async function main() {
const username = "octocat";
const option = "location";
const userData = await GithubUserData(username, option);
console.log(userData);
}
main();
// Outputs { 'San Francisco' }CountStars Function
Parameters
username(required): the GitHub username of the user to count stars for
Example
import { CountStars } from "github-user-data";
async function main() {
const username = "octocat";
const stars = await CountStars(username);
console.log(stars);
}
main();
// Status as of 3/29/2023 Outputs { 15044 }GetNamesOfAllRepos Function
Parameters
username(required): the GitHub username of the user, all of his public repositories will be saved in array
Example
import { GetNamesOfAllRepos } from "github-user-data";
async function main() {
const username = "octocat";
const names = await GetNamesOfAllRepos(username);
console.log(names);
console.log(names.length);
}
main();
/*
Status as of 4/11/2023 Outputs:
[
'boysenberry-repo-1',
'git-consortium',
'hello-worId',
'Hello-World',
'linguist',
'octocat.github.io',
'Spoon-Knife',
'test-repo1'
]
8
*/License
This package is licensed under the MIT License.
