github-user-data
Version:
Simple Github API wrapper
130 lines (94 loc) • 2.34 kB
Markdown
# 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
```sh
npm install github-user-data
```
## Dependencies
This code requires the following dependencies:
1. axios
2. log-symbols
# GithubUserData Function
### Parameters
1. `username` (required): the GitHub username of the user to retrieve information for
2. `option` (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:
1. `login`
2. `id`
3. `node_id`
4. `avatar_url`
5. `gravatar_id`
6. `url`
7. `type`
8. `site_admin`
9. `name`
10. `company`
11. `blog`
12. `location`
13. `email`
14. `hireable`
15. `bio`
16. `twitter_username`
17. `public_repos`
18. `public_gists`
19. `followers`
20. `following`
21. `created_at`
22. `updated_at`
23. `all - (returns all personal information)`
## Example
```js
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
1. `username` (required): the GitHub username of the user to count stars for
## Example
```js
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
1. `username` (required): the GitHub username of the user, all of his public repositories will be saved in array
## Example
```js
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.