|
1 | | -# apiNG-plugin-github |
2 | | -GitHub Plugin for [apiNG](https://github.com/JohnnyTheTank/apiNG) |
| 1 | +[logo]: http://aping.io/logo/320/aping-plugin.png "apiNG Plugin" |
| 2 | +![apiNG][logo] |
3 | 3 |
|
4 | | -## Promise Library |
5 | | -used promise library: [angular-github-api-factory](https://github.com/JohnnyTheTank/angular-github-api-factory) |
| 4 | +**_apiNG-plugin-github_** is a [GitHub Data API v3](https://developer.github.com/v3/) plugin for [**apiNG**](https://github.com/JohnnyTheTank/apiNG). |
6 | 5 |
|
7 | | -## supported apiNG models |
8 | | -- **`repo`** |
| 6 | +# Information |
| 7 | +* **Supported apiNG models: `repo`** |
| 8 | +* Used promise library: [angular-github-api-factory](https://github.com/JohnnyTheTank/angular-github-api-factory) _(included in minified distribution file)_ |
| 9 | + |
| 10 | +# Documentation |
| 11 | + I. INSTALLATION |
| 12 | + II. API KEY |
| 13 | + III. USAGE |
| 14 | + |
| 15 | +## I. INSTALLATION |
| 16 | + a) Get files |
| 17 | + b) Include files |
| 18 | + c) Add dependencies |
| 19 | + d) Add the plugin |
| 20 | + |
| 21 | +### a) Get files |
| 22 | +You can choose your preferred method of installation: |
| 23 | + |
| 24 | +* Via bower: `bower install apiNG-plugin-github --save` |
| 25 | +* Download from github: [apiNG-plugin-github.zip](https://github.com/JohnnyTheTank/apiNG-plugin-github/zipball/master) |
| 26 | + |
| 27 | +### b) Include files |
| 28 | +Include `apiNG-plugin-github.min.js` in your apiNG application |
| 29 | +```html |
| 30 | +<script src="bower_components/apiNG-plugin-github/dist/apiNG-plugin-github.min.js"></script> |
| 31 | +``` |
| 32 | + |
| 33 | +### c) Add dependencies |
| 34 | +Add the module `jtt_aping_github` as a dependency to your app module: |
| 35 | +```js |
| 36 | +var app = angular.module('app', ['jtt_aping', 'jtt_aping_github']); |
| 37 | +``` |
| 38 | + |
| 39 | +### d) Add the plugin |
| 40 | +Add the plugin's directive `aping-github="[]"` to your apiNG directive and configure your requests (_**III. USAGE**_) |
| 41 | +```html |
| 42 | +<aping |
| 43 | + template-url="templates/repo.html" |
| 44 | + model="repo" |
| 45 | + items="20" |
| 46 | + aping-github="[{'user':'JohnnyTheTank'}]"> |
| 47 | +</aping> |
| 48 | +``` |
| 49 | + |
| 50 | +## II. API KEY |
| 51 | + a) Generate your `access_token` |
| 52 | + b) Insert your `access_token` into `aping-config.js` |
| 53 | + |
| 54 | +### a) Generate your `access_token` |
| 55 | +1. Login on [github.com](https://github.com) |
| 56 | +2. Open [github.com/settings/tokens/new](https://github.com/settings/tokens/new) |
| 57 | + * Remove all scopes except **public_repo** |
| 58 | + * Generate your access_token |
| 59 | + |
| 60 | +### b) Insert your `access_token` into `aping-config.js` |
| 61 | +Open `js/apiNG/aping-config.js` in your application folder. It should be look like this snippet: |
| 62 | +```js |
| 63 | +apingApp.config(['$provide', function ($provide) { |
| 64 | + $provide.constant("apingApiKeys", { |
| 65 | + //... |
| 66 | + github: [ |
| 67 | + {'access_token':'<YOUR_GITHUB_ACCESS_TOKEN>'} |
| 68 | + ], |
| 69 | + //... |
| 70 | + }); |
| 71 | + |
| 72 | + $provide.constant("apingDefaultSettings", { |
| 73 | + //... |
| 74 | + }); |
| 75 | +}]); |
| 76 | +``` |
| 77 | + |
| 78 | +:warning: Replace `<YOUR_GITHUB_ACCESS_TOKEN>` with your github `access_token` |
| 79 | + |
| 80 | +## III. USAGE |
| 81 | + a) Models |
| 82 | + b) Requests |
| 83 | + c) Rate limit |
| 84 | + |
| 85 | +### a) Models |
| 86 | +Supported apiNG models |
| 87 | + |
| 88 | +| model | content | support | max items<br>per request | (native) default items<br>per request | |
| 89 | +|----------|---------|---------|--------|---------| |
| 90 | +| `rep` | **repositories** | full | `100` | `30` | |
| 91 | + |
| 92 | +**support:** |
| 93 | +* full: _the source platform provides a full list with usable results_ <br> |
| 94 | +* partly: _the source platfrom provides just partly usable results_ |
| 95 | + |
| 96 | + |
| 97 | +### b) Requests |
| 98 | +Every **apiNG plugin** expects an array of **requests** as html attribute. |
| 99 | + |
| 100 | + |
| 101 | +#### Requests by User |
| 102 | +| parameter | sample | default | description | optional | |
| 103 | +|----------|---------|---------|---------|---------| |
| 104 | +| **`user`** | `JohnnyTheTank` | | GitHub username | no | |
| 105 | +| **`repo`** | `apiNG` | | Limits the request to specific GitHub repository name | yes | |
| 106 | +| **`items`** | `75` | `30` | Items per request (`0`-`100`) | yes | |
| 107 | + |
| 108 | +Sample requests: |
| 109 | +* `[{'user':'JohnnyTheTank'}, {'user':'xremix'}]` |
| 110 | +* `[{'user':'JohnnyTheTank', 'repo':'apiNG', 'items':10}]` |
| 111 | + |
| 112 | +#### Requests by Search |
| 113 | +| parameter | sample | default | description | optional | |
| 114 | +|----------|---------|---------|---------|---------| |
| 115 | +| **`search`** | `bootstrap` | | The search keywords, as well as any qualifierse | no | |
| 116 | +| **`sort`** | `stars` | | The sort field. One of `stars`, `forks`, or `updated`. Default: results are sorted by best match | yes | |
| 117 | +| **`order`** | `asc` | `desc` | The sort order if `sort` parameter is provided. One of `asc` or `desc` | yes | |
| 118 | +| **`items`** | `75` | `30` | Items per request (`0`-`100`) | yes | |
| 119 | + |
| 120 | +Sample requests: |
| 121 | +* `[{'search':'apiNG', 'sort':'stars', 'order':'desc', 'items':50}]` |
| 122 | + |
| 123 | +### c) Rate limit |
| 124 | +Visit the official [GitHub Data API documentation](https://developer.github.com/v3/#rate-limiting) |
| 125 | +> For requests using Basic Authentication or OAuth, you can make up to 5,000 requests per hour. |
| 126 | +
|
| 127 | +# Licence |
| 128 | +MIT |
9 | 129 |
|
10 | | -## usage |
11 | | -full documentation coming soon ... |
|
0 commit comments