Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 69 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,13 @@ export async function getGithubTopicsFromGithub() {
// run the example
await getGithubTopicsFromGithub();

// TODO ...
// if you need a part of the project information
// github-api.project.topics

// if you need a part of the user information
// github-api.user.avatar_url

---
```

## Usage of other APIs

look in the tests: test.ts

## github API has a hourly based rate limit

if this limit is reached in a hour, then
Expand All @@ -72,7 +69,9 @@ see [github - rest - resources-in-the-rest-api - rate-limiting](https://docs.git

### getGithubTopics(loginName, projectName, infoLog, isProd)

get project topics as a Array
get github project topics as a Array

deprecated: use githubApiGetProject() with pathExpression constant GITHUB_PROJECT_TOPICS

#### loginName

Expand Down Expand Up @@ -117,25 +116,31 @@ i.e.

look in the tests: test.ts

## API - not yet implemented
## API - new implemented

### github-api(loginName, projectName?, infoLog, isProd)
### githubApiGetProject(loginName, projectName, pathExpression, infoLog, isProd)

get project info or user info
get github project info - reduce with pathExpression constants

Returns a `Promise<any>` with the project info or user info
Returns a `Promise<any>` with the project info

#### loginName

Type: `String`

The github login name

#### projectName (optional)
#### projectName

Type: `String`

The github project name of the project of a user login

#### pathExpression

Type: `String`

The github project namen of the project of a user login
filter the project name of the project of a user login

#### infoLog

Expand All @@ -153,13 +158,47 @@ true Calls fetch to github api, false returns mock data with same structure

Returns a `Promise<any>`

with a Json / Object of a project
with a Json / Object of a project reduced with pathExpression

or
see Example answer Json / Object of a project

with a Json / Object of a user login if only loginName is set
### githubApiGetLogin(loginName, pathExpression, infoLog, isProd)

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

#### loginName

Type: `String`

The github login name

#### pathExpression

Type: `String`

filter the project namen of the project of a user login

#### infoLog

Type: `boolean`

true Logs group and info into the console

#### isProd

Type: `boolean`

true Calls fetch to github api, false returns mock data with same structure

#### return

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

## Example answer Json / Object of a project

Expand All @@ -173,8 +212,17 @@ Github Meta Data of project 'roebi/01-01-vanilla-HTML5-starter-page'
"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",
Expand All @@ -195,6 +243,9 @@ Github Meta Data of user login 'roebi'
...
"avatar_url": "...",
...
"url": "https://api.github.com/users/roebi",
"html_url": "https://github.com/roebi",
...
"location": "Switzerland",
...
"bio": "..."
Expand Down
2 changes: 2 additions & 0 deletions consts.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export declare const GITHUB_PROJECT_TOPICS = "$.topics[*]";
export declare const GITHUB_LOGIN_AVATAR_URL = "$.avatar_url";
export declare const GITHUB_API_BASE_URL = "https://api.github.com/";
export declare const GITHUB_HTML_BASE_URL = "https://github.com/";
8 changes: 8 additions & 0 deletions consts.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
// Place any global data in this file.
// You can import this data from anywhere in your project by using the `import` keyword.
// pathExpression constant for github-api-get-project
export const GITHUB_PROJECT_TOPICS = "$.topics[*]";
// pathExpression constant for github-api-get-login
export const GITHUB_LOGIN_AVATAR_URL = "$.avatar_url";
// github constants
// github api base url
export const GITHUB_API_BASE_URL = "https://api.github.com/";
// github HTML base url
// example https://github.com/roebi/01-02-Webserver-in-Go-on-Podman
export const GITHUB_HTML_BASE_URL = "https://github.com/";
// examples
// export const GITHUB_LOGIN = "roebi";
// export const GITHUB_OWNER_HTML_URL = GITHUB_HTML_BASE_URL + GITHUB_LOGIN + "/";
14 changes: 14 additions & 0 deletions consts.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
// Place any global data in this file.
// You can import this data from anywhere in your project by using the `import` keyword.

// pathExpression constant for github-api-get-project

export const GITHUB_PROJECT_TOPICS = "$.topics[*]";

// pathExpression constant for github-api-get-login

export const GITHUB_LOGIN_AVATAR_URL = "$.avatar_url";

// github constants

// github api base url
export const GITHUB_API_BASE_URL = "https://api.github.com/";

// github HTML base url
// example https://github.com/roebi/01-02-Webserver-in-Go-on-Podman
export const GITHUB_HTML_BASE_URL = "https://github.com/";

// examples

// export const GITHUB_LOGIN = "roebi";
// export const GITHUB_OWNER_HTML_URL = GITHUB_HTML_BASE_URL + GITHUB_LOGIN + "/";
32 changes: 28 additions & 4 deletions coverage/consts.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h1><a href="index.html">All files</a> consts.js</h1>
<div class="fl pad1y space-right2">
<span class="strong">100% </span>
<span class="quiet">Statements</span>
<span class="fraction">7/7</span>
<span class="fraction">15/15</span>
</div>

<div class="fl pad1y space-right2">
Expand All @@ -40,7 +40,7 @@ <h1><a href="index.html">All files</a> consts.js</h1>
<div class="fl pad1y space-right2">
<span class="strong">100% </span>
<span class="quiet">Lines</span>
<span class="fraction">7/7</span>
<span class="fraction">15/15</span>
</div>
</div>
<p class="quiet">
Expand All @@ -63,7 +63,23 @@ <h1><a href="index.html">All files</a> consts.js</h1>
<a name='L5'></a><a href='#L5'>5</a>
<a name='L6'></a><a href='#L6'>6</a>
<a name='L7'></a><a href='#L7'>7</a>
<a name='L8'></a><a href='#L8'>8</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
<a name='L8'></a><a href='#L8'>8</a>
<a name='L9'></a><a href='#L9'>9</a>
<a name='L10'></a><a href='#L10'>10</a>
<a name='L11'></a><a href='#L11'>11</a>
<a name='L12'></a><a href='#L12'>12</a>
<a name='L13'></a><a href='#L13'>13</a>
<a name='L14'></a><a href='#L14'>14</a>
<a name='L15'></a><a href='#L15'>15</a>
<a name='L16'></a><a href='#L16'>16</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
Expand All @@ -72,9 +88,17 @@ <h1><a href="index.html">All files</a> consts.js</h1>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">// Place any global data in this file.
// You can import this data from anywhere in your project by using the `import` keyword.
// pathExpression constant for github-api-get-project
export const GITHUB_PROJECT_TOPICS = "$.topics[*]";
// pathExpression constant for github-api-get-login
export const GITHUB_LOGIN_AVATAR_URL = "$.avatar_url";
// github constants
// github api base url
export const GITHUB_API_BASE_URL = "https://api.github.com/";
// github HTML base url
// example https://github.com/roebi/01-02-Webserver-in-Go-on-Podman
export const GITHUB_HTML_BASE_URL = "https://github.com/";
// examples
// export const GITHUB_LOGIN = "roebi";
// export const GITHUB_OWNER_HTML_URL = GITHUB_HTML_BASE_URL + GITHUB_LOGIN + "/";
&nbsp;</pre></td></tr></table></pre>
Expand All @@ -86,7 +110,7 @@ <h1><a href="index.html">All files</a> consts.js</h1>
<div class="footer quiet pad2 space-top1 center small">
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2023-09-20T10:23:53.845Z
at 2023-10-07T19:41:57.282Z
</div>
<script src="prettify.js"></script>
<script>
Expand Down
Loading