Skip to content

Commit

Permalink
fix: fix languages and developers API
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `languages` API no longer provide `popular` and `all` arrays, not it respond a list
of languages

Closes #48
  • Loading branch information
huchenme committed Jun 27, 2019
1 parent 0a09d6f commit 72f6d52
Show file tree
Hide file tree
Showing 9 changed files with 14,410 additions and 8,141 deletions.
94 changes: 46 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
- [Install](#install)
- [Usage](#usage)
- [API](#api)
- [fetchAllLanguages()](#fetchalllanguages)
- [fetchRepositories(params)](#fetchrepositoriesparams)
- [fetchDevelopers(params)](#fetchdevelopersparams)
- [languages](#languages)
- [fetchRepositories(params)](#fetchrepositoriesparams)
- [fetchDevelopers(params)](#fetchdevelopersparams)
- [License](#license)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->
Expand Down Expand Up @@ -170,24 +170,24 @@ https://github-trending-api.now.sh/languages
**Response:**

```json
{
"popular": [
...
{
"urlParam": "html",
"name": "HTML"
}
...
],
"all": [
...
{
"urlParam": "javascript",
"name": "JavaScript"
}
...
]
}
[
{
"id": "1c-enterprise",
"name": "1C Enterprise"
},
{
"id": "abap",
"name": "ABAP"
},
{
"id": "abnf",
"name": "ABNF"
},
{
"id": "actionscript",
"name": "ActionScript"
}
]
```

## NPM Package
Expand All @@ -204,52 +204,50 @@ $ npm install --save @huchenme/github-trending

```js
import {
fetchAllLanguages,
languages,
fetchRepositories,
fetchDevelopers,
} from '@huchenme/github-trending';

fetchAllLanguages().then(languages => {
console.log(languages);
});

fetchRepositories({ language: 'ruby', since: 'monthly' }).then(repositories => {
console.log(repositories);
});

fetchDevelopers({ language: 'javascript' }).then(developers => {
console.log(developers);
});

console.log(languages);
```

### API

### fetchAllLanguages()
#### languages

Return popular languages and all languages.
List all languages

```js
{
popular: [
...
{
urlParam: 'html',
name: 'HTML'
}
...
],
all: [
...
{
urlParam: 'javascript',
name: 'JavaScript'
}
...
]
}
[
{
id: '1c-enterprise',
name: '1C Enterprise',
},
{
id: 'abap',
name: 'ABAP',
},
{
id: 'abnf',
name: 'ABNF',
},
{
id: 'actionscript',
name: 'ActionScript',
},
];
```

### fetchRepositories(params)
#### fetchRepositories(params)

Receive an array of trending repositories.

Expand Down Expand Up @@ -284,7 +282,7 @@ Receive an array of trending repositories.
]
```

### fetchDevelopers(params)
#### fetchDevelopers(params)

Receive an array of trending developers.

Expand Down
84 changes: 18 additions & 66 deletions apiary.apib
Original file line number Diff line number Diff line change
Expand Up @@ -160,69 +160,21 @@ GitHub Trending API is a simple API to fetch trending repositories and developer

+ Response 200 (application/json)

{
"popular": [
{
"id": "c++",
"name": "C++"
},
{
"id": "html",
"name": "HTML"
},
{
"id": "java",
"name": "Java"
},
{
"id": "javascript",
"name": "JavaScript"
},
{
"id": "php",
"name": "PHP"
},
{
"id": "python",
"name": "Python"
},
{
"id": "ruby",
"name": "Ruby"
}
],
"all": [
{
"id": "1c-enterprise",
"name": "1C Enterprise"
},
{
"id": "abap",
"name": "ABAP"
},
{
"id": "abnf",
"name": "ABNF"
},
{
"id": "actionscript",
"name": "ActionScript"
},
{
"id": "ada",
"name": "Ada"
},
{
"id": "adobe-font-metrics",
"name": "Adobe Font Metrics"
},
{
"id": "agda",
"name": "Agda"
},
{
"id": "ags-script",
"name": "AGS Script"
}
]
}
[
{
"id": "1c-enterprise",
"name": "1C Enterprise"
},
{
"id": "abap",
"name": "ABAP"
},
{
"id": "abnf",
"name": "ABNF"
},
{
"id": "actionscript",
"name": "ActionScript"
}
]
Loading

0 comments on commit 72f6d52

Please sign in to comment.