项目作者: JohnnyTheTank

项目描述 :
AngularJS Factory for GitHub v3 JSON REST API requests
高级语言: JavaScript
项目地址: git://github.com/JohnnyTheTank/angular-github-api-factory.git
创建时间: 2015-12-09T10:24:32Z
项目社区:https://github.com/JohnnyTheTank/angular-github-api-factory

开源协议:MIT License

下载


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:
      1. <script src="bower_components/angular-github-api-factory/dist/angular-github-api-factory.min.js"></script>
    2. When using npm:
      1. <script src="node_modules/angular-github-api-factory/dist/angular-github-api-factory.min.js"></script>
    3. when using downloaded files
      1. <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

  1. githubFactory.getUser({
  2. user:"<USERNAME_NAME>",
  3. access_token:"<ACCESS_TOKEN>" // (optional)
  4. }).then(function(_data){
  5. //on success
  6. }).catch(function (_data) {
  7. //on error
  8. });

getUsers

  1. // https://developer.github.com/v3/search/#search-users
  2. githubFactory.getUsers({
  3. q:"<SEARCH_STRING>", // (optional)
  4. sort:"<SORT_STRING>", // (optional) 'followers', 'repositories', 'joined'
  5. order:"<SORT_ORDER>", // (optional) 'desc', 'asc'
  6. per_page:"<ITEMS_PER_PAGE>", // (optional) valid values: 1-100 | default: 30
  7. }).then(function(_data){
  8. //on success
  9. }).catch(function (_data) {
  10. //on error
  11. });

getRepo

  1. githubFactory.getRepoByUserAndName({
  2. user:"<USER_NAME>",
  3. repo:"<REPO_NAME>",
  4. access_token:"<ACCESS_TOKEN>" // (optional)
  5. }).then(function(_data){
  6. //on success
  7. }).catch(function (_data) {
  8. //on error
  9. });

getRepos

  1. // https://developer.github.com/v3/search/#search-repositories
  2. githubFactory.getReposByName({
  3. q:"<SEARCH_STRING>",
  4. sort:"<SORT_STRING>", // (optional) 'stars', 'forks', or 'updated'
  5. order:"<SORT_ORDER>", // (optional) 'desc', 'asc'
  6. per_page:"<ITEMS_PER_PAGE>", // (optional) valid values: 1-100 | default: 30
  7. access_token:"<ACCESS_TOKEN>" // (optional)
  8. }).then(function(_data){
  9. //on success
  10. }).catch(function (_data) {
  11. //on error
  12. });
  1. githubFactory.getReposByUser({
  2. user:"<USER_NAME>",
  3. q:"<SEARCH_STRING>", // (optional)
  4. sort:"<SORT_STRING>", // (optional) 'stars', 'forks', or 'updated'
  5. order:"<SORT_ORDER>", // (optional) 'desc', 'asc'
  6. per_page:"<ITEMS_PER_PAGE>", // (optional) valid values: 1-100 | default: 30
  7. access_token:"<ACCESS_TOKEN>" // (optional)
  8. }).then(function(_data){
  9. //on success
  10. }).catch(function (_data) {
  11. //on error
  12. });

getEvents

  1. githubFactory.getEventsFromRepoByUserAndName({
  2. user:"<USER_NAME>",
  3. repo:"<REPO_NAME>",
  4. q:"<SEARCH_STRING>", // (optional)
  5. sort:"<SORT_STRING>", // (optional)
  6. order:"<SORT_ORDER>", // (optional) 'desc', 'asc'
  7. per_page:"<ITEMS_PER_PAGE>", // (optional) valid values: 1-100 | default: 30
  8. access_token:"<ACCESS_TOKEN>" // (optional)
  9. }).then(function(_data){
  10. //on success
  11. }).catch(function (_data) {
  12. //on error
  13. });
  1. githubFactory.getEventsByUser({
  2. user:"<USER_NAME>",
  3. q:"<SEARCH_STRING>", // (optional)
  4. sort:"<SORT_STRING>", // (optional)
  5. order:"<SORT_ORDER>", // (optional) 'desc', 'asc'
  6. per_page:"<ITEMS_PER_PAGE>", // (optional) valid values: 1-100 | default: 30
  7. access_token:"<ACCESS_TOKEN>" // (optional)
  8. }).then(function(_data){
  9. //on success
  10. }).catch(function (_data) {
  11. //on error
  12. });

Github JSON API

More angular-api-factories

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

License

MIT