Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-github-api-factory

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-github-api-factory - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

2

bower.json
{
"name": "angular-github-api-factory",
"description": "angularjs factory for github json rest api requests",
"version": "0.5.1",
"version": "0.5.2",
"main": "dist/angular-github-api-factory.js",

@@ -6,0 +6,0 @@ "authors": [

@@ -10,2 +10,8 @@ var app = angular.module("app", ['jtt_github']);

githubFactory.getUsers({
q:"Johnny",
per_page: 100,
}).then(function(_data){
console.info("users", _data);
});

@@ -15,3 +21,3 @@ githubFactory.getReposByUser({

per_page: 100,
}).success(function(_data){
}).then(function(_data){
console.info("repos by user", _data);

@@ -18,0 +24,0 @@ });

/**
@name: angular-github-api-factory
@version: 0.5.1 (01-06-2016)
@version: 0.5.2 (30-08-2018)
@author: Jonathan Hornung

@@ -8,5 +8,5 @@ @url: https://github.com/JohnnyTheTank/angular-github-api-factory#readme

*/
"use strict";
'use strict';
angular.module("jtt_github", [])
angular.module('jtt_github', [])
.factory('githubFactory', ['$http', 'githubSearchDataService', function ($http, githubSearchDataService) {

@@ -16,4 +16,13 @@

githubFactory.getUsers = function (_params) {
var searchData = githubSearchDataService.getNew('users', _params);
return $http({
method: 'GET',
url: searchData.url,
params: searchData.object,
});
};
githubFactory.getUser = function (_params) {
var searchData = githubSearchDataService.getNew("user", _params);
var searchData = githubSearchDataService.getNew('user', _params);
return $http({

@@ -27,3 +36,3 @@ method: 'GET',

githubFactory.getReposByUser = function (_params) {
var searchData = githubSearchDataService.getNew("reposByUser", _params);
var searchData = githubSearchDataService.getNew('reposByUser', _params);
return $http({

@@ -37,3 +46,3 @@ method: 'GET',

githubFactory.getReposByName = function (_params) {
var searchData = githubSearchDataService.getNew("reposByName", _params);
var searchData = githubSearchDataService.getNew('reposByName', _params);
return $http({

@@ -47,3 +56,3 @@ method: 'GET',

githubFactory.getRepoByUserAndName = function (_params) {
var searchData = githubSearchDataService.getNew("repoByUserAndName", _params);
var searchData = githubSearchDataService.getNew('repoByUserAndName', _params);
return $http({

@@ -57,3 +66,3 @@ method: 'GET',

githubFactory.getEventsByUser = function (_params) {
var searchData = githubSearchDataService.getNew("eventsByUser", _params);
var searchData = githubSearchDataService.getNew('eventsByUser', _params);
return $http({

@@ -67,3 +76,3 @@ method: 'GET',

githubFactory.getEventsFromRepoByUserAndName = function (_params) {
var searchData = githubSearchDataService.getNew("eventsFromRepoByUserAndName", _params);
var searchData = githubSearchDataService.getNew('eventsFromRepoByUserAndName', _params);
return $http({

@@ -79,4 +88,4 @@ method: 'GET',

.service('githubSearchDataService', function () {
this.getApiBaseUrl = function (_params) {
return "https://api.github.com/";
this.getApiBaseUrl = function () {
return 'https://api.github.com/';
};

@@ -98,3 +107,3 @@

object: {},
url: "",
url: '',
};

@@ -111,23 +120,30 @@

switch (_type) {
case "user":
case 'user':
githubSearchData.object.per_page = undefined;
githubSearchData = this.fillDataInObjectByList(githubSearchData, _params, []);
githubSearchData.url = this.getApiBaseUrl() + "users/" + _params.user;
githubSearchData.url = this.getApiBaseUrl() + 'users/' + _params.user;
break;
case "reposByUser":
case 'users':
githubSearchData = this.fillDataInObjectByList(githubSearchData, _params, [
'sort', 'order', 'page'
]);
githubSearchData.url = this.getApiBaseUrl() + 'search/users?q=' + _params.q;
break;
case 'reposByUser':
githubSearchData = this.fillDataInObjectByList(githubSearchData, _params, [
'q', 'sort', 'order', 'page'
]);
githubSearchData.url = this.getApiBaseUrl() + "users/" + _params.user + "/repos";
githubSearchData.url = this.getApiBaseUrl() + 'users/' + _params.user + '/repos';
break;
case "reposByName":
case 'reposByName':
githubSearchData = this.fillDataInObjectByList(githubSearchData, _params, [
'sort', 'order', 'page'
]);
githubSearchData.url = this.getApiBaseUrl() + "search/repositories?q=" + _params.q;
githubSearchData.url = this.getApiBaseUrl() + 'search/repositories?q=' + _params.q;
break;
case "repoByUserAndName":
case 'repoByUserAndName':
githubSearchData.object = {

@@ -139,17 +155,17 @@ access_token: _params.access_token,

githubSearchData.url = this.getApiBaseUrl() + "repos/" + _params.user + "/" + _params.repo;
githubSearchData.url = this.getApiBaseUrl() + 'repos/' + _params.user + '/' + _params.repo;
break;
case "eventsByUser":
case 'eventsByUser':
githubSearchData = this.fillDataInObjectByList(githubSearchData, _params, [
'q', 'sort', 'order', 'page'
]);
githubSearchData.url = this.getApiBaseUrl() + "users/" + _params.user + "/events";
githubSearchData.url = this.getApiBaseUrl() + 'users/' + _params.user + '/events';
break;
case "eventsFromRepoByUserAndName":
case 'eventsFromRepoByUserAndName':
githubSearchData = this.fillDataInObjectByList(githubSearchData, _params, [
'q', 'sort', 'order', 'page'
]);
githubSearchData.url = this.getApiBaseUrl() + "repos/" + _params.user + "/" + _params.repo + "/events";
githubSearchData.url = this.getApiBaseUrl() + 'repos/' + _params.user + '/' + _params.repo + '/events';
break;

@@ -156,0 +172,0 @@ }

/**
@name: angular-github-api-factory
@version: 0.5.1 (01-06-2016)
@version: 0.5.2 (30-08-2018)
@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){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}});
"use strict";angular.module("jtt_github",[]).factory("githubFactory",["$http","githubSearchDataService",function(a,b){var c={};return c.getUsers=function(c){var d=b.getNew("users",c);return a({method:"GET",url:d.url,params:d.object})},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(){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"users":c=this.fillDataInObjectByList(c,b,["sort","order","page"]),c.url=this.getApiBaseUrl()+"search/users?q="+b.q;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.1",
"version": "0.5.2",
"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)
[![npm version](https://badge.fury.io/js/angular-github-api-factory.svg)](https://badge.fury.io/js/angular-github-api-factory)
[![Bower version](https://badge.fury.io/bo/angular-github-api-factory.svg)](https://badge.fury.io/bo/angular-github-api-factory)

@@ -14,11 +14,11 @@ Author: Jonathan Hornung ([JohnnyTheTank](https://github.com/JohnnyTheTank))

3. download [angular-github-api-factory.zip](https://github.com/JohnnyTheTank/angular-github-api-factory/zipball/master)
2. Add `jtt_github` to your application's module dependencies.
3. Include dependencies in your HTML.
2. Include dependencies in your HTML.
1. When using bower:
```html
<script src="bower_components/angular-github-api-factory/src/angular-github-api-factory.min.js"></script>
<script src="bower_components/angular-github-api-factory/dist/angular-github-api-factory.min.js"></script>
```
2. When using npm:
```html
<script src="node_modules/angular-github-api-factory/src/angular-github-api-factory.min.js"></script>
<script src="node_modules/angular-github-api-factory/dist/angular-github-api-factory.min.js"></script>
```

@@ -29,5 +29,5 @@ 3. when using downloaded files

```
3. Add **`jtt_github`** to your application's module dependencies.
4. Use the factory `githubFactory`
### factory methods

@@ -47,2 +47,17 @@

```js
//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

@@ -128,4 +143,5 @@ ```js

* docs: https://developer.github.com/v3/
* api playground: https://apigee.com/console/github
## More angular-api-factories
[bandsintown](https://github.com/JohnnyTheTank/angular-bandsintown-api-factory) - [dailymotion](https://github.com/JohnnyTheTank/angular-dailymotion-api-factory) - [facebook](https://github.com/JohnnyTheTank/angular-facebook-api-factory) - [footballdata](https://github.com/JohnnyTheTank/angular-footballdata-api-factory) - [flickr](https://github.com/JohnnyTheTank/angular-flickr-api-factory) - **github** - [openweathermap](https://github.com/JohnnyTheTank/angular-openweathermap-api-factory) - [tumblr](https://github.com/JohnnyTheTank/angular-tumblr-api-factory) - [vimeo](https://github.com/JohnnyTheTank/angular-vimeo-api-factory) - [wikipedia](https://github.com/JohnnyTheTank/angular-wikipedia-api-factory) - [youtube](https://github.com/JohnnyTheTank/angular-youtube-api-factory)

@@ -132,0 +148,0 @@ ## License

@@ -1,4 +0,4 @@

"use strict";
'use strict';
angular.module("jtt_github", [])
angular.module('jtt_github', [])
.factory('githubFactory', ['$http', 'githubSearchDataService', function ($http, githubSearchDataService) {

@@ -8,4 +8,13 @@

githubFactory.getUsers = function (_params) {
var searchData = githubSearchDataService.getNew('users', _params);
return $http({
method: 'GET',
url: searchData.url,
params: searchData.object,
});
};
githubFactory.getUser = function (_params) {
var searchData = githubSearchDataService.getNew("user", _params);
var searchData = githubSearchDataService.getNew('user', _params);
return $http({

@@ -19,3 +28,3 @@ method: 'GET',

githubFactory.getReposByUser = function (_params) {
var searchData = githubSearchDataService.getNew("reposByUser", _params);
var searchData = githubSearchDataService.getNew('reposByUser', _params);
return $http({

@@ -29,3 +38,3 @@ method: 'GET',

githubFactory.getReposByName = function (_params) {
var searchData = githubSearchDataService.getNew("reposByName", _params);
var searchData = githubSearchDataService.getNew('reposByName', _params);
return $http({

@@ -39,3 +48,3 @@ method: 'GET',

githubFactory.getRepoByUserAndName = function (_params) {
var searchData = githubSearchDataService.getNew("repoByUserAndName", _params);
var searchData = githubSearchDataService.getNew('repoByUserAndName', _params);
return $http({

@@ -49,3 +58,3 @@ method: 'GET',

githubFactory.getEventsByUser = function (_params) {
var searchData = githubSearchDataService.getNew("eventsByUser", _params);
var searchData = githubSearchDataService.getNew('eventsByUser', _params);
return $http({

@@ -59,3 +68,3 @@ method: 'GET',

githubFactory.getEventsFromRepoByUserAndName = function (_params) {
var searchData = githubSearchDataService.getNew("eventsFromRepoByUserAndName", _params);
var searchData = githubSearchDataService.getNew('eventsFromRepoByUserAndName', _params);
return $http({

@@ -71,4 +80,4 @@ method: 'GET',

.service('githubSearchDataService', function () {
this.getApiBaseUrl = function (_params) {
return "https://api.github.com/";
this.getApiBaseUrl = function () {
return 'https://api.github.com/';
};

@@ -90,3 +99,3 @@

object: {},
url: "",
url: '',
};

@@ -103,23 +112,30 @@

switch (_type) {
case "user":
case 'user':
githubSearchData.object.per_page = undefined;
githubSearchData = this.fillDataInObjectByList(githubSearchData, _params, []);
githubSearchData.url = this.getApiBaseUrl() + "users/" + _params.user;
githubSearchData.url = this.getApiBaseUrl() + 'users/' + _params.user;
break;
case "reposByUser":
case 'users':
githubSearchData = this.fillDataInObjectByList(githubSearchData, _params, [
'sort', 'order', 'page'
]);
githubSearchData.url = this.getApiBaseUrl() + 'search/users?q=' + _params.q;
break;
case 'reposByUser':
githubSearchData = this.fillDataInObjectByList(githubSearchData, _params, [
'q', 'sort', 'order', 'page'
]);
githubSearchData.url = this.getApiBaseUrl() + "users/" + _params.user + "/repos";
githubSearchData.url = this.getApiBaseUrl() + 'users/' + _params.user + '/repos';
break;
case "reposByName":
case 'reposByName':
githubSearchData = this.fillDataInObjectByList(githubSearchData, _params, [
'sort', 'order', 'page'
]);
githubSearchData.url = this.getApiBaseUrl() + "search/repositories?q=" + _params.q;
githubSearchData.url = this.getApiBaseUrl() + 'search/repositories?q=' + _params.q;
break;
case "repoByUserAndName":
case 'repoByUserAndName':
githubSearchData.object = {

@@ -131,17 +147,17 @@ access_token: _params.access_token,

githubSearchData.url = this.getApiBaseUrl() + "repos/" + _params.user + "/" + _params.repo;
githubSearchData.url = this.getApiBaseUrl() + 'repos/' + _params.user + '/' + _params.repo;
break;
case "eventsByUser":
case 'eventsByUser':
githubSearchData = this.fillDataInObjectByList(githubSearchData, _params, [
'q', 'sort', 'order', 'page'
]);
githubSearchData.url = this.getApiBaseUrl() + "users/" + _params.user + "/events";
githubSearchData.url = this.getApiBaseUrl() + 'users/' + _params.user + '/events';
break;
case "eventsFromRepoByUserAndName":
case 'eventsFromRepoByUserAndName':
githubSearchData = this.fillDataInObjectByList(githubSearchData, _params, [
'q', 'sort', 'order', 'page'
]);
githubSearchData.url = this.getApiBaseUrl() + "repos/" + _params.user + "/" + _params.repo + "/events";
githubSearchData.url = this.getApiBaseUrl() + 'repos/' + _params.user + '/' + _params.repo + '/events';
break;

@@ -148,0 +164,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc