Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/johnnythetank/angular-facebook-api-factory

AngularJS Factory for Facebook JSON REST API requests
https://github.com/johnnythetank/angular-facebook-api-factory

angular angular-factory angularjs api facebook facebook-graph-api factory fb

Last synced: about 1 month ago
JSON representation

AngularJS Factory for Facebook JSON REST API requests

Awesome Lists containing this project

README

        

**angular-facebook-api-factory** is an angularjs module with a facebook api factory.

[![npm version](https://badge.fury.io/js/angular-facebook-api-factory.svg)](https://badge.fury.io/js/angular-facebook-api-factory)
[![Bower version](https://badge.fury.io/bo/angular-facebook-api-factory.svg)](https://badge.fury.io/bo/angular-facebook-api-factory)

Author: Jonathan Hornung ([JohnnyTheTank](https://github.com/JohnnyTheTank))

## Usage

1. Install via either [bower](http://bower.io/), [npm](https://www.npmjs.com/) or downloaded files:
1. `bower install --save angular-facebook-api-factory`
2. `npm install --save angular-facebook-api-factory`
3. download [angular-facebook-api-factory.zip](https://github.com/JohnnyTheTank/angular-facebook-api-factory/zipball/master)
2. Add `jtt_facebook` to your application's module dependencies.
3. Include dependencies in your HTML.
1. When using bower:
```html

```
2. When using npm:
```html

```
3. when using downloaded files
```html

```
4. Use the factory `facebookFactory`

### factory methods

#### getPosts

```js
facebookFactory.getPostsFromPageById({
page:"",
limit:"", // (optional) valid values: 0-100 | default: 25
until:"", // (optional)
since:"", // (optional)
__previous:"", // (optional)
__paging_token:"", // (optional)
access_token:""
}).then(function (_data) {
//on success
}).catch(function (_data) {
//on error
});
```

#### getPhotos

```js
facebookFactory.getPhotosFromPageById({
page:"", // ID or name
limit:"", // (optional) valid values: 0-100 | default: 25
before:"", // (optional)
after:"", // (optional)
access_token:""
}).then(function (_data) {
//on success
}).catch(function (_data) {
//on error
});
```

#### getVideos

```js
facebookFactory.getVideosFromPageById({
page:"",
limit:"", // (optional) valid values: 0-100 | default: 25
before:"", // (optional)
after:"", // (optional)
access_token:""
}).then(function (_data) {
//on success
}).catch(function (_data) {
//on error
});
```

#### getEvents

```js
facebookFactory.getEventsFromPageById({
page:"",
limit:"", // (optional) valid values: 0-100 | default: 25
before:"", // (optional)
after:"", // (optional)
access_token:""
}).then(function (_data) {
//on success
}).catch(function (_data) {
//on error
});
```

#### getPage

```js
facebookFactory.getPageById({
page:"",
access_token:""
}).then(function (_data) {
//on success
}).catch(function (_data) {
//on error
});
```

## Facebook Graph JSON API

* docs: https://developers.facebook.com/docs/graph-api
* graph explorer: https://developers.facebook.com/tools/explorer/

## More angular-api-factories
[bandsintown](https://github.com/JohnnyTheTank/angular-bandsintown-api-factory) - [dailymotion](https://github.com/JohnnyTheTank/angular-dailymotion-api-factory) - **facebook** - [flickr](https://github.com/JohnnyTheTank/angular-flickr-api-factory) - [footballdata](https://github.com/JohnnyTheTank/angular-footballdata-api-factory) - [github](https://github.com/JohnnyTheTank/angular-github-api-factory) - [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)

## License

MIT