Skip to content

Commit

Permalink
removed unneeded access token
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnnyTheTank committed Jun 1, 2016
1 parent 443a16a commit 5e8ec22
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 25 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Author: Jonathan Hornung ([JohnnyTheTank](https://github.com/JohnnyTheTank))
```js
githubFactory.getUser({
user:"<USERNAME_NAME>",
access_token:"<ACCESS_TOKEN>"
access_token:"<ACCESS_TOKEN>" // (optional)
}).then(function(_data){
//on success
}).catch(function (_data) {
Expand All @@ -47,7 +47,7 @@ githubFactory.getUser({
githubFactory.getRepoByUserAndName({
user:"<USER_NAME>",
repo:"<REPO_NAME>",
access_token:"<ACCESS_TOKEN>"
access_token:"<ACCESS_TOKEN>" // (optional)
}).then(function(_data){
//on success
}).catch(function (_data) {
Expand All @@ -63,7 +63,7 @@ githubFactory.getReposByName({
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>"
access_token:"<ACCESS_TOKEN>" // (optional)
}).then(function(_data){
//on success
}).catch(function (_data) {
Expand All @@ -78,7 +78,7 @@ githubFactory.getReposByUser({
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>"
access_token:"<ACCESS_TOKEN>" // (optional)
}).then(function(_data){
//on success
}).catch(function (_data) {
Expand All @@ -95,7 +95,7 @@ githubFactory.getEventsFromRepoByUserAndName({
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>"
access_token:"<ACCESS_TOKEN>" // (optional)
}).then(function(_data){
//on success
}).catch(function (_data) {
Expand All @@ -110,7 +110,7 @@ githubFactory.getEventsByUser({
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>"
access_token:"<ACCESS_TOKEN>" // (optional)
}).then(function(_data){
//on success
}).catch(function (_data) {
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "angular-github-api-factory",
"description": "angularjs factory for github json rest api requests",
"version": "0.5.0",
"version": "0.5.1",
"main": "dist/angular-github-api-factory.js",
"authors": [
"Jonathan Hornung"
Expand Down
11 changes: 3 additions & 8 deletions demo/js/app.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
var app = angular.module("app", ['jtt_github']);
app.controller('controller', ['$scope', 'githubFactory', function($scope, githubFactory) {

var _access_token = '<YOUR_GITHUB_ACCESS_TOKEN>';

githubFactory.getUser({
user:"xremix",
access_token:_access_token
}).then(function(_data){
console.info("user", _data);
});


githubFactory.getReposByUser({
user:"JohnnyTheTank",
per_page: 100,
access_token:_access_token
}).success(function(_data){
console.info("repos by user", _data);
});


githubFactory.getReposByName({
q:"apiNG-plugin",
per_page: 20,
access_token:_access_token
}).then(function(_data){
console.info("repos by name", _data);
});


githubFactory.getEventsByUser({
user:"xremix",
per_page: 20,
access_token:_access_token
}).then(function(_data){
console.info("events by user", _data);
});
Expand All @@ -38,7 +35,6 @@ app.controller('controller', ['$scope', 'githubFactory', function($scope, github
user:"JohnnyTheTank",
repo:"apiNG",
per_page: 100,
access_token:_access_token
}).then(function(_data){
console.info("events from repo by user and name", _data);
});
Expand All @@ -47,7 +43,6 @@ app.controller('controller', ['$scope', 'githubFactory', function($scope, github
user:"xremix",
repo:"xGallerify",
per_page: 20,
access_token:_access_token
}).then(function(_data){
console.info("repo by user and name", _data);
});
Expand Down
10 changes: 6 additions & 4 deletions dist/angular-github-api-factory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
@name: angular-github-api-factory
@version: 0.5.0 (17-02-2016)
@version: 0.5.1 (01-06-2016)
@author: Jonathan Hornung
@url: https://github.com/JohnnyTheTank/angular-github-api-factory#readme
@license: MIT
Expand Down Expand Up @@ -86,16 +86,18 @@ angular.module("jtt_github", [])

this.getNew = function (_type, _params) {
var githubSearchData = {
object: {
access_token: _params.access_token,
},
object: {},
url: "",
};

if (angular.isDefined(_params.per_page)) {
githubSearchData.object.per_page = _params.per_page;
}

if (angular.isDefined(_params.access_token)) {
githubSearchData.object.access_token = _params.access_token;
}

switch (_type) {
case "user":
githubSearchData.object.per_page = undefined;
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-github-api-factory.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-github-api-factory",
"version": "0.5.0",
"version": "0.5.1",
"description": "angularjs factory for github json rest api requests",
"main": "dist/angular-github-api-factory.js",
"scripts": {
Expand Down
8 changes: 5 additions & 3 deletions src/angular-github-api-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,18 @@ angular.module("jtt_github", [])

this.getNew = function (_type, _params) {
var githubSearchData = {
object: {
access_token: _params.access_token,
},
object: {},
url: "",
};

if (angular.isDefined(_params.per_page)) {
githubSearchData.object.per_page = _params.per_page;
}

if (angular.isDefined(_params.access_token)) {
githubSearchData.object.access_token = _params.access_token;
}

switch (_type) {
case "user":
githubSearchData.object.per_page = undefined;
Expand Down

0 comments on commit 5e8ec22

Please sign in to comment.