angular-github-api-factory
Advanced tools
Comparing version 0.5.0 to 0.5.1
{ | ||
"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", | ||
@@ -6,0 +6,0 @@ "authors": [ |
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){ | ||
@@ -13,6 +10,6 @@ console.info("user", _data); | ||
githubFactory.getReposByUser({ | ||
user:"JohnnyTheTank", | ||
per_page: 100, | ||
access_token:_access_token | ||
}).success(function(_data){ | ||
@@ -22,6 +19,6 @@ console.info("repos by user", _data); | ||
githubFactory.getReposByName({ | ||
q:"apiNG-plugin", | ||
per_page: 20, | ||
access_token:_access_token | ||
}).then(function(_data){ | ||
@@ -31,6 +28,6 @@ console.info("repos by name", _data); | ||
githubFactory.getEventsByUser({ | ||
user:"xremix", | ||
per_page: 20, | ||
access_token:_access_token | ||
}).then(function(_data){ | ||
@@ -44,3 +41,2 @@ console.info("events by user", _data); | ||
per_page: 100, | ||
access_token:_access_token | ||
}).then(function(_data){ | ||
@@ -54,3 +50,2 @@ console.info("events from repo by user and name", _data); | ||
per_page: 20, | ||
access_token:_access_token | ||
}).then(function(_data){ | ||
@@ -57,0 +52,0 @@ console.info("repo by user and name", _data); |
/** | ||
@name: angular-github-api-factory | ||
@version: 0.5.0 (06-01-2016) | ||
@version: 0.5.1 (01-06-2016) | ||
@author: Jonathan Hornung | ||
@@ -79,3 +79,3 @@ @url: https://github.com/JohnnyTheTank/angular-github-api-factory#readme | ||
angular.forEach(_list, function (value, key) { | ||
if (typeof _params[value] !== "undefined") { | ||
if (angular.isDefined(_params[value])) { | ||
_object.object[value] = _params[value]; | ||
@@ -90,12 +90,14 @@ } | ||
var githubSearchData = { | ||
object: { | ||
access_token: _params.access_token, | ||
}, | ||
object: {}, | ||
url: "", | ||
}; | ||
if (typeof _params.per_page !== "undefined") { | ||
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) { | ||
@@ -146,5 +148,4 @@ case "user": | ||
} | ||
return githubSearchData; | ||
}; | ||
}); |
/** | ||
@name: angular-github-api-factory | ||
@version: 0.5.0 (06-01-2016) | ||
@version: 0.5.1 (01-06-2016) | ||
@author: Jonathan Hornung | ||
@@ -8,2 +8,2 @@ @url: https://github.com/JohnnyTheTank/angular-github-api-factory#readme | ||
*/ | ||
"use strict";angular.module("jtt_github",[]).factory("githubFactory",["$http","githubSearchDataService",function(a,b){var c={};return c.getUser=function(c){var d=b.getNew("user",c);return a({method:"GET",url:d.url,params:d.object})},c.getReposByUser=function(c){var d=b.getNew("reposByUser",c);return a({method:"GET",url:d.url,params:d.object})},c.getReposByName=function(c){var d=b.getNew("reposByName",c);return a({method:"GET",url:d.url,params:d.object})},c.getRepoByUserAndName=function(c){var d=b.getNew("repoByUserAndName",c);return a({method:"GET",url:d.url,params:d.object})},c.getEventsByUser=function(c){var d=b.getNew("eventsByUser",c);return a({method:"GET",url:d.url,params:d.object})},c.getEventsFromRepoByUserAndName=function(c){var d=b.getNew("eventsFromRepoByUserAndName",c);return a({method:"GET",url:d.url,params:d.object})},c}]).service("githubSearchDataService",function(){this.getApiBaseUrl=function(a){return"https://api.github.com/"},this.fillDataInObjectByList=function(a,b,c){return angular.forEach(c,function(c,d){"undefined"!=typeof b[c]&&(a.object[c]=b[c])}),a},this.getNew=function(a,b){var c={object:{access_token:b.access_token},url:""};switch("undefined"!=typeof b.per_page&&(c.object.per_page=b.per_page),a){case"user":c.object.per_page=void 0,c=this.fillDataInObjectByList(c,b,[]),c.url=this.getApiBaseUrl()+"users/"+b.user;break;case"reposByUser":c=this.fillDataInObjectByList(c,b,["q","sort","order","page"]),c.url=this.getApiBaseUrl()+"users/"+b.user+"/repos";break;case"reposByName":c=this.fillDataInObjectByList(c,b,["sort","order","page"]),c.url=this.getApiBaseUrl()+"search/repositories?q="+b.q;break;case"repoByUserAndName":c.object={access_token:b.access_token},c=this.fillDataInObjectByList(c,b,[]),c.url=this.getApiBaseUrl()+"repos/"+b.user+"/"+b.repo;break;case"eventsByUser":c=this.fillDataInObjectByList(c,b,["q","sort","order","page"]),c.url=this.getApiBaseUrl()+"users/"+b.user+"/events";break;case"eventsFromRepoByUserAndName":c=this.fillDataInObjectByList(c,b,["q","sort","order","page"]),c.url=this.getApiBaseUrl()+"repos/"+b.user+"/"+b.repo+"/events"}return c}}); | ||
"use strict";angular.module("jtt_github",[]).factory("githubFactory",["$http","githubSearchDataService",function(a,b){var c={};return c.getUser=function(c){var d=b.getNew("user",c);return a({method:"GET",url:d.url,params:d.object})},c.getReposByUser=function(c){var d=b.getNew("reposByUser",c);return a({method:"GET",url:d.url,params:d.object})},c.getReposByName=function(c){var d=b.getNew("reposByName",c);return a({method:"GET",url:d.url,params:d.object})},c.getRepoByUserAndName=function(c){var d=b.getNew("repoByUserAndName",c);return a({method:"GET",url:d.url,params:d.object})},c.getEventsByUser=function(c){var d=b.getNew("eventsByUser",c);return a({method:"GET",url:d.url,params:d.object})},c.getEventsFromRepoByUserAndName=function(c){var d=b.getNew("eventsFromRepoByUserAndName",c);return a({method:"GET",url:d.url,params:d.object})},c}]).service("githubSearchDataService",function(){this.getApiBaseUrl=function(a){return"https://api.github.com/"},this.fillDataInObjectByList=function(a,b,c){return angular.forEach(c,function(c,d){angular.isDefined(b[c])&&(a.object[c]=b[c])}),a},this.getNew=function(a,b){var c={object:{},url:""};switch(angular.isDefined(b.per_page)&&(c.object.per_page=b.per_page),angular.isDefined(b.access_token)&&(c.object.access_token=b.access_token),a){case"user":c.object.per_page=void 0,c=this.fillDataInObjectByList(c,b,[]),c.url=this.getApiBaseUrl()+"users/"+b.user;break;case"reposByUser":c=this.fillDataInObjectByList(c,b,["q","sort","order","page"]),c.url=this.getApiBaseUrl()+"users/"+b.user+"/repos";break;case"reposByName":c=this.fillDataInObjectByList(c,b,["sort","order","page"]),c.url=this.getApiBaseUrl()+"search/repositories?q="+b.q;break;case"repoByUserAndName":c.object={access_token:b.access_token},c=this.fillDataInObjectByList(c,b,[]),c.url=this.getApiBaseUrl()+"repos/"+b.user+"/"+b.repo;break;case"eventsByUser":c=this.fillDataInObjectByList(c,b,["q","sort","order","page"]),c.url=this.getApiBaseUrl()+"users/"+b.user+"/events";break;case"eventsFromRepoByUserAndName":c=this.fillDataInObjectByList(c,b,["q","sort","order","page"]),c.url=this.getApiBaseUrl()+"repos/"+b.user+"/"+b.repo+"/events"}return c}}); |
{ | ||
"name": "angular-github-api-factory", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "angularjs factory for github json rest api requests", | ||
@@ -5,0 +5,0 @@ "main": "dist/angular-github-api-factory.js", |
**angular-github-api-factory** is an angularjs module with a github api factory. | ||
[![npm version](https://badge.fury.io/js/angular-github-api-factory.png)](https://badge.fury.io/js/angular-github-api-factory) | ||
[![Bower version](https://badge.fury.io/bo/angular-github-api-factory.png)](https://badge.fury.io/bo/angular-github-api-factory) | ||
Author: Jonathan Hornung ([JohnnyTheTank](https://github.com/JohnnyTheTank)) | ||
@@ -34,3 +37,3 @@ | ||
user:"<USERNAME_NAME>", | ||
access_token:"<ACCESS_TOKEN>" | ||
access_token:"<ACCESS_TOKEN>" // (optional) | ||
}).then(function(_data){ | ||
@@ -48,3 +51,3 @@ //on success | ||
repo:"<REPO_NAME>", | ||
access_token:"<ACCESS_TOKEN>" | ||
access_token:"<ACCESS_TOKEN>" // (optional) | ||
}).then(function(_data){ | ||
@@ -65,3 +68,3 @@ //on success | ||
per_page:"<ITEMS_PER_PAGE>", // (optional) valid values: 1-100 | default: 30 | ||
access_token:"<ACCESS_TOKEN>" | ||
access_token:"<ACCESS_TOKEN>" // (optional) | ||
}).then(function(_data){ | ||
@@ -81,3 +84,3 @@ //on success | ||
per_page:"<ITEMS_PER_PAGE>", // (optional) valid values: 1-100 | default: 30 | ||
access_token:"<ACCESS_TOKEN>" | ||
access_token:"<ACCESS_TOKEN>" // (optional) | ||
}).then(function(_data){ | ||
@@ -99,3 +102,3 @@ //on success | ||
per_page:"<ITEMS_PER_PAGE>", // (optional) valid values: 1-100 | default: 30 | ||
access_token:"<ACCESS_TOKEN>" | ||
access_token:"<ACCESS_TOKEN>" // (optional) | ||
}).then(function(_data){ | ||
@@ -115,3 +118,3 @@ //on success | ||
per_page:"<ITEMS_PER_PAGE>", // (optional) valid values: 1-100 | default: 30 | ||
access_token:"<ACCESS_TOKEN>" | ||
access_token:"<ACCESS_TOKEN>" // (optional) | ||
}).then(function(_data){ | ||
@@ -118,0 +121,0 @@ //on success |
@@ -72,3 +72,3 @@ "use strict"; | ||
angular.forEach(_list, function (value, key) { | ||
if (typeof _params[value] !== "undefined") { | ||
if (angular.isDefined(_params[value])) { | ||
_object.object[value] = _params[value]; | ||
@@ -83,12 +83,14 @@ } | ||
var githubSearchData = { | ||
object: { | ||
access_token: _params.access_token, | ||
}, | ||
object: {}, | ||
url: "", | ||
}; | ||
if (typeof _params.per_page !== "undefined") { | ||
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) { | ||
@@ -139,5 +141,4 @@ case "user": | ||
} | ||
return githubSearchData; | ||
}; | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22551
130
361