angular-github-api-factory
v0.5.2
Published
angularjs factory for github json rest api requests
Downloads
7
Maintainers
Readme
angular-github-api-factory is an angularjs module with a github api factory.
Author: Jonathan Hornung (JohnnyTheTank)
Usage
Install via either bower, npm or downloaded files:
bower install --save angular-github-api-factory
npm install --save angular-github-api-factory
- download angular-github-api-factory.zip
Include dependencies in your HTML.
- When using bower:
<script src="bower_components/angular-github-api-factory/dist/angular-github-api-factory.min.js"></script>
- When using npm:
<script src="node_modules/angular-github-api-factory/dist/angular-github-api-factory.min.js"></script>
- when using downloaded files
<script src="angular-github-api-factory.min.js"></script>
Add
jtt_github
to your application's module dependencies.Use the factory
githubFactory
factory methods
getUser
githubFactory.getUser({
user:"<USERNAME_NAME>",
access_token:"<ACCESS_TOKEN>" // (optional)
}).then(function(_data){
//on success
}).catch(function (_data) {
//on error
});
//https://developer.github.com/v3/search/#search-users
githubFactory.getUsers({
q:"<SEARCH_STRING>", // (optional)
sort:"<SORT_STRING>", // (optional) 'followers', 'repositories', 'joined'
order:"<SORT_ORDER>", // (optional) 'desc', 'asc'
per_page:"<ITEMS_PER_PAGE>", // (optional) valid values: 1-100 | default: 30
}).then(function(_data){
//on success
}).catch(function (_data) {
//on error
});
getRepo
githubFactory.getRepoByUserAndName({
user:"<USER_NAME>",
repo:"<REPO_NAME>",
access_token:"<ACCESS_TOKEN>" // (optional)
}).then(function(_data){
//on success
}).catch(function (_data) {
//on error
});
getRepos
// https://developer.github.com/v3/search/#search-repositories
githubFactory.getReposByName({
q:"<SEARCH_STRING>",
sort:"<SORT_STRING>", // (optional) 'stars', 'forks', or 'updated'
order:"<SORT_ORDER>", // (optional) 'desc', 'asc'
per_page:"<ITEMS_PER_PAGE>", // (optional) valid values: 1-100 | default: 30
access_token:"<ACCESS_TOKEN>" // (optional)
}).then(function(_data){
//on success
}).catch(function (_data) {
//on error
});
githubFactory.getReposByUser({
user:"<USER_NAME>",
q:"<SEARCH_STRING>", // (optional)
sort:"<SORT_STRING>", // (optional) 'stars', 'forks', or 'updated'
order:"<SORT_ORDER>", // (optional) 'desc', 'asc'
per_page:"<ITEMS_PER_PAGE>", // (optional) valid values: 1-100 | default: 30
access_token:"<ACCESS_TOKEN>" // (optional)
}).then(function(_data){
//on success
}).catch(function (_data) {
//on error
});
getEvents
githubFactory.getEventsFromRepoByUserAndName({
user:"<USER_NAME>",
repo:"<REPO_NAME>",
q:"<SEARCH_STRING>", // (optional)
sort:"<SORT_STRING>", // (optional)
order:"<SORT_ORDER>", // (optional) 'desc', 'asc'
per_page:"<ITEMS_PER_PAGE>", // (optional) valid values: 1-100 | default: 30
access_token:"<ACCESS_TOKEN>" // (optional)
}).then(function(_data){
//on success
}).catch(function (_data) {
//on error
});
githubFactory.getEventsByUser({
user:"<USER_NAME>",
q:"<SEARCH_STRING>", // (optional)
sort:"<SORT_STRING>", // (optional)
order:"<SORT_ORDER>", // (optional) 'desc', 'asc'
per_page:"<ITEMS_PER_PAGE>", // (optional) valid values: 1-100 | default: 30
access_token:"<ACCESS_TOKEN>" // (optional)
}).then(function(_data){
//on success
}).catch(function (_data) {
//on error
});
Github JSON API
- docs: https://developer.github.com/v3/
More angular-api-factories
bandsintown - dailymotion - facebook - footballdata - flickr - github - openweathermap - tumblr - vimeo - wikipedia - youtube
License
MIT