0.5.2 • Published 6 years ago

angular-github-api-factory v0.5.2

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

angular-github-api-factory is an angularjs module with a github api factory.

npm version Bower version

Author: Jonathan Hornung (JohnnyTheTank)

Usage

  1. Install via either bower, npm or downloaded files:

    1. bower install --save angular-github-api-factory
    2. npm install --save angular-github-api-factory
    3. download angular-github-api-factory.zip
  2. Include dependencies in your HTML.

    1. When using bower:
    <script src="bower_components/angular-github-api-factory/dist/angular-github-api-factory.min.js"></script>
    1. When using npm:
    <script src="node_modules/angular-github-api-factory/dist/angular-github-api-factory.min.js"></script>
    1. when using downloaded files
    <script src="angular-github-api-factory.min.js"></script>
  3. Add jtt_github to your application's module dependencies.
  4. 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

More angular-api-factories

bandsintown - dailymotion - facebook - footballdata - flickr - github - openweathermap - tumblr - vimeo - wikipedia - youtube

License

MIT