diff --git a/README.md b/README.md
index e597cff..17b526c 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ Author: Jonathan Hornung ([JohnnyTheTank](https://github.com/JohnnyTheTank))
```
-4. Use the factory `facebookFactory`.
+4. Use the factory `facebookFactory`
### factory methods
@@ -25,7 +25,7 @@ Author: Jonathan Hornung ([JohnnyTheTank](https://github.com/JohnnyTheTank))
```js
facebookFactory.getPostsFromPageById({
pageId:"",
- limit:"", // (optional) default: 20
+ limit:"", // (optional) valid values: 0-100 | default: 25
until:"", // (optional)
since:"", // (optional)
__previous:"", // (optional)
@@ -43,7 +43,7 @@ facebookFactory.getPostsFromPageById({
```js
facebookFactory.getPhotosFromPageById({
page:"", // ID or name
- limit:"", // (optional) default: 20
+ limit:"", // (optional) valid values: 0-100 | default: 25
before:"", // (optional)
after:"", // (optional)
access_token:""
@@ -59,7 +59,7 @@ facebookFactory.getPhotosFromPageById({
```js
facebookFactory.getVideosFromPageById({
pageId:"",
- limit:"", // (optional) default: 20
+ limit:"", // (optional) valid values: 0-100 | default: 25
before:"", // (optional)
after:"", // (optional)
access_token:""
@@ -75,7 +75,7 @@ facebookFactory.getVideosFromPageById({
```js
facebookFactory.getEventsFromPageById({
pageId:"",
- limit:"", // (optional) default: 20
+ limit:"", // (optional) valid values: 0-100 | default: 25
before:"", // (optional)
after:"", // (optional)
access_token:""
diff --git a/bower.json b/bower.json
index 97f363d..523b155 100644
--- a/bower.json
+++ b/bower.json
@@ -1,7 +1,7 @@
{
"name": "angular-facebook-api-factory",
"description": "angularjs factory for facebook json rest api requests",
- "version": "0.2.0",
+ "version": "0.2.1",
"main": "Gruntfile.js",
"authors": [
"Jonathan Hornung"
@@ -26,6 +26,6 @@
"tests"
],
"dependencies": {
- "angular": "~1.4.7"
+ "angular": "*"
}
}
diff --git a/demo/js/app.js b/demo/js/app.js
index 0154249..33b9128 100644
--- a/demo/js/app.js
+++ b/demo/js/app.js
@@ -1,12 +1,12 @@
var app = angular.module("app", ['jtt_facebook']);
app.controller('controller', ['$scope', 'facebookFactory', function($scope, facebookFactory) {
- var _acces_token = "";
+ var _access_token = '';
facebookFactory.getPostsFromPageById({
page:"147615681968982",
- limit:20,
- access_token:_acces_token,
+ limit:100,
+ access_token:_access_token,
}).success(function(_data){
console.log("posts");
console.log(_data);
@@ -14,8 +14,7 @@ app.controller('controller', ['$scope', 'facebookFactory', function($scope, face
facebookFactory.getPhotosFromPageById({
page:"147615681968982",
- limit:20,
- access_token:_acces_token,
+ access_token:_access_token,
}).success(function(_data){
console.log("photos");
console.log(_data);
@@ -23,8 +22,7 @@ app.controller('controller', ['$scope', 'facebookFactory', function($scope, face
facebookFactory.getVideosFromPageById({
page:"147615681968982",
- limit:20,
- access_token:_acces_token,
+ access_token:_access_token,
}).success(function(_data){
console.log("videos");
console.log(_data);
@@ -32,8 +30,7 @@ app.controller('controller', ['$scope', 'facebookFactory', function($scope, face
facebookFactory.getEventsFromPageById({
page:"147615681968982",
- limit:20,
- access_token:_acces_token,
+ access_token:_access_token,
}).success(function(_data){
console.log("events");
console.log(_data);
@@ -41,7 +38,7 @@ app.controller('controller', ['$scope', 'facebookFactory', function($scope, face
facebookFactory.getPageById({
page:"147615681968982",
- access_token:_acces_token,
+ access_token:_access_token,
}).success(function(_data){
console.log("page");
console.log(_data);
diff --git a/dist/angular-facebook-api-factory.min.js b/dist/angular-facebook-api-factory.min.js
index 2f651de..4e54f53 100644
--- a/dist/angular-facebook-api-factory.min.js
+++ b/dist/angular-facebook-api-factory.min.js
@@ -1,3 +1,3 @@
-/*! angular-facebook-api-factory 18-11-2015 */
-"use strict";angular.module("jtt_facebook",[]).factory("facebookFactory",["$http","facebookSearchDataService",function(a,b){var c={};return c.getPostsFromPageById=function(c){var d=b.getNew("postsFromPageById",c);return a({method:"GET",url:d.url,params:d.object})},c.getPhotosFromPageById=function(c){var d=b.getNew("photosFromPageById",c);return a({method:"GET",url:d.url,params:d.object})},c.getVideosFromPageById=function(c){var d=b.getNew("videosFromPageById",c);return a({method:"GET",url:d.url,params:d.object})},c.getEventsFromPageById=function(c){var d=b.getNew("eventsFromPageById",c);return a({method:"GET",url:d.url,params:d.object})},c.getPageById=function(c){var d=b.getNew("pageById",c);return a({method:"GET",url:d.url,params:d.object})},c}]).service("facebookSearchDataService",function(){this.getApiBaseUrl=function(a){var b;return b=a&&"undefined"!=typeof a.version?a.version+"/":"v2.5/","https://graph.facebook.com/"+b},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:{},url:""};switch(a){case"postsFromPageById":c.object={fields:"id,message,story,created_time,full_picture,from,link,description,type,shares,source,picture,object_id",limit:b.limit||20,access_token:b.access_token},c=this.fillDataInObjectByList(c,b,["__paging_token","until","since","__previous"]),c.url=this.getApiBaseUrl()+b.page+"/posts?";break;case"photosFromPageById":c.object={fields:"id,created_time,from,link,picture,album,name,images",limit:b.limit||20,access_token:b.access_token},c=this.fillDataInObjectByList(c,b,["before","after"]),c.url=this.getApiBaseUrl()+b.page+"/photos?";break;case"videosFromPageById":c.object={fields:"id,created_time,from,description,source,picture,format,title,embed_html,permalink_url",limit:b.limit||20,access_token:b.access_token},c=this.fillDataInObjectByList(c,b,["before","after"]),c.url=this.getApiBaseUrl()+b.page+"/videos?";break;case"eventsFromPageById":c.object={fields:"id,owner,description,picture{url},end_time,name,cover,category,place,start_time,ticket_uri",limit:b.limit||20,access_token:b.access_token},c=this.fillDataInObjectByList(c,b,["before","after"]),c.url=this.getApiBaseUrl()+b.page+"/events?";break;case"pageById":c.object={fields:"cover,link,picture{url},username,name",access_token:b.access_token},c.url=this.getApiBaseUrl()+b.page+"/"}return c}});
\ No newline at end of file
+/*! angular-facebook-api-factory v0.2.1 (21-12-2015) by Jonathan Hornung */
+"use strict";angular.module("jtt_facebook",[]).factory("facebookFactory",["$http","facebookSearchDataService",function(a,b){var c={};return c.getPostsFromPageById=function(c){var d=b.getNew("postsFromPageById",c);return a({method:"GET",url:d.url,params:d.object})},c.getPhotosFromPageById=function(c){var d=b.getNew("photosFromPageById",c);return a({method:"GET",url:d.url,params:d.object})},c.getVideosFromPageById=function(c){var d=b.getNew("videosFromPageById",c);return a({method:"GET",url:d.url,params:d.object})},c.getEventsFromPageById=function(c){var d=b.getNew("eventsFromPageById",c);return a({method:"GET",url:d.url,params:d.object})},c.getPageById=function(c){var d=b.getNew("pageById",c);return a({method:"GET",url:d.url,params:d.object})},c}]).service("facebookSearchDataService",function(){this.getApiBaseUrl=function(a){var b;return b=a&&"undefined"!=typeof a.version?a.version+"/":"v2.5/","https://graph.facebook.com/"+b},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||void 0},url:""};switch("undefined"!=typeof b.limit&&(c.object.limit=b.limit),a){case"postsFromPageById":c.object.fields="id,message,story,created_time,full_picture,from,link,description,type,shares,source,picture,object_id",c=this.fillDataInObjectByList(c,b,["__paging_token","until","since","__previous"]),c.url=this.getApiBaseUrl()+b.page+"/posts?";break;case"photosFromPageById":c.object.fields="id,created_time,from,link,picture,album,name,images",c=this.fillDataInObjectByList(c,b,["before","after"]),c.url=this.getApiBaseUrl()+b.page+"/photos?";break;case"videosFromPageById":c.object.fields="id,created_time,from,description,source,picture,format,title,embed_html,permalink_url",c=this.fillDataInObjectByList(c,b,["before","after"]),c.url=this.getApiBaseUrl()+b.page+"/videos?";break;case"eventsFromPageById":c.object.fields="id,owner,description,picture{url},end_time,name,cover,category,place,start_time,ticket_uri",c=this.fillDataInObjectByList(c,b,["before","after"]),c.url=this.getApiBaseUrl()+b.page+"/events?";break;case"pageById":c.object.fields="cover,link,picture{url},username,name",c.object.limit=void 0,c.url=this.getApiBaseUrl()+b.page+"/"}return c}});
\ No newline at end of file
diff --git a/package.json b/package.json
index b6941e8..dc7d973 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "angular-facebook-api-factory",
- "version": "0.2.0",
+ "version": "0.2.1",
"description": "angularjs factory for facebook json rest api requests",
"main": "Gruntfile.js",
"scripts": {
diff --git a/src/angular-facebook-api-factory.js b/src/angular-facebook-api-factory.js
index 4e12369..90d93b6 100644
--- a/src/angular-facebook-api-factory.js
+++ b/src/angular-facebook-api-factory.js
@@ -89,17 +89,19 @@ angular.module("jtt_facebook", [])
this.getNew = function (_type, _params) {
var facebookSearchData = {
- object: {},
+ object: {
+ access_token:_params.access_token || undefined,
+ },
url: "",
};
+ if (typeof _params.limit !== "undefined") {
+ facebookSearchData.object.limit = _params.limit;
+ }
+
switch (_type) {
case "postsFromPageById":
- facebookSearchData.object = {
- fields:"id,message,story,created_time,full_picture,from,link,description,type,shares,source,picture,object_id",
- limit:_params.limit || 20,
- access_token:_params.access_token,
- };
+ facebookSearchData.object.fields = "id,message,story,created_time,full_picture,from,link,description,type,shares,source,picture,object_id";
facebookSearchData = this.fillDataInObjectByList(facebookSearchData, _params, [
'__paging_token', 'until', 'since', '__previous'
@@ -110,11 +112,7 @@ angular.module("jtt_facebook", [])
case "photosFromPageById":
- facebookSearchData.object = {
- fields:"id,created_time,from,link,picture,album,name,images",
- limit:_params.limit || 20,
- access_token:_params.access_token,
- };
+ facebookSearchData.object.fields = "id,created_time,from,link,picture,album,name,images";
facebookSearchData = this.fillDataInObjectByList(facebookSearchData, _params, [
'before', 'after'
@@ -125,11 +123,7 @@ angular.module("jtt_facebook", [])
case "videosFromPageById":
- facebookSearchData.object = {
- fields:"id,created_time,from,description,source,picture,format,title,embed_html,permalink_url",
- limit:_params.limit || 20,
- access_token:_params.access_token,
- };
+ facebookSearchData.object.fields = "id,created_time,from,description,source,picture,format,title,embed_html,permalink_url";
facebookSearchData = this.fillDataInObjectByList(facebookSearchData, _params, [
'before', 'after'
@@ -140,11 +134,7 @@ angular.module("jtt_facebook", [])
case "eventsFromPageById":
- facebookSearchData.object = {
- fields:"id,owner,description,picture{url},end_time,name,cover,category,place,start_time,ticket_uri",
- limit:_params.limit || 20,
- access_token:_params.access_token,
- };
+ facebookSearchData.object.fields = "id,owner,description,picture{url},end_time,name,cover,category,place,start_time,ticket_uri";
facebookSearchData = this.fillDataInObjectByList(facebookSearchData, _params, [
'before', 'after'
@@ -155,10 +145,9 @@ angular.module("jtt_facebook", [])
case "pageById":
- facebookSearchData.object = {
- fields:"cover,link,picture{url},username,name",
- access_token:_params.access_token,
- };
+ facebookSearchData.object.fields = "cover,link,picture{url},username,name";
+
+ facebookSearchData.object.limit = undefined;
facebookSearchData.url = this.getApiBaseUrl()+_params.page+"/";
break;