0.7.8 • Published 8 years ago

aping-plugin-codebird v0.7.8

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

apiNG

apiNG-plugin-codebird is a Twitter REST API plugin for apiNG.

npm version Bower version

Information

Documentation

  1. INSTALLATION
    1. Get file
    2. Include file
    3. Add dependency
    4. Add plugin
  2. BEARER TOKEN
    1. Generate your bearer_token
    2. Insert your bearer_token into aping-config.js
  3. USAGE
    1. Models
    2. Requests
    3. Rate limit

1. INSTALLATION

I. Get file

Install via either bower, npm, CDN (jsDelivr) or downloaded files:

II. Include file

Include aping-plugin-codebird.min.js in your apiNG application

<!-- when using bower -->
<script src="bower_components/apiNG-plugin-codebird/dist/aping-plugin-codebird.min.js"></script>

<!-- when using npm -->
<script src="node_modules/aping-plugin-codebird/dist/aping-plugin-codebird.min.js"></script>

<!-- when using cdn file -->
<script src="//cdn.jsdelivr.net/aping.plugin-codebird/latest/aping-plugin-codebird.min.js"></script>

<!-- when using downloaded files -->
<script src="aping-plugin-codebird.min.js"></script>

III. Add dependency

Add the module jtt_aping_codebird as a dependency to your app module:

angular.module('app', ['jtt_aping', 'jtt_aping_codebird']);

IV. Add the plugin

Add the plugin's directive aping-codebird="[]" to your apiNG directive and configure your requests

<aping
    template-url="templates/social.html"
    model="social"
    items="20"
    aping-codebird="[{'search':'#music'}]">
</aping>

2. BEARER TOKEN

I. Generate your bearer_token

  1. Login on dev.twitter.com
  2. Navigate to apps.twitter.com
  3. Get your bearer_token

II. Insert your bearer_token into aping-config.js

Create and open js/apiNG/aping-config.js in your application folder. It should be look like this snippet:

angular.module('jtt_aping').config(['$provide', function ($provide) {
    $provide.value("apingDefaultSettings", {
        apingApiKeys : {
            twitter: [
                {'bearer_token':'<YOUR_TWITTER_BEARER_TOKEN>'}
            ],
            //...
        }
    });
}]);

:warning: Replace <YOUR_TWITTER_BEARER_TOKEN> with your twitter bearer_token

3. USAGE

I. Models

Supported apiNG models

modelcontentsupportmax itemsper request(native) default itemsper request
socialrecent tweets, videos, imagesfull10015
imagerecent imagespartly10015

support:

  • full: the source platform provides a full list with usable results
  • partly: the source platfrom provides just partly usable results

II. Requests

Every apiNG plugin expects an array of requests as html attribute.

Requests by User

parametersampledefaultdescriptionoptional
userjqueryThe twitter screen name of the user for whom to return results forno
items2015Items per request (0-100)yes
showAvatartruefalseUse true for show users avatar as image if post has no own imageyes
exclude_repliestruefalseThis parameter will prevent replies from appearing in the returned timeline. Using exclude_replies with the items parameter will mean you will receive up-to count tweets — this is because the items parameter retrieves that many tweets before filtering out retweets and replies.yes
include_rtsfalsetrueWhen set to false, the timeline will strip any native retweets (though they will still count toward both the maximal length of the timeline and the slice selected by the count parameter).yes

Sample requests:

  • [{'user':'johnnyzeitlos'}, {'user':'jowe'}, {'user':'angularui'}]
  • [{'user':'AngularAir', 'items':10, 'showAvatar':'true', 'exclude_replies':true}]

Requests by Search

parametersampledefaultdescriptionoptional
searchjquerySearchterm. A UTF-8, URL-encoded search query of 500 characters maximum, including operators. Queries may additionally be limited by complexity.no
items2015Items per request (0-100)yes
showAvatartruefalseUse true for show users avatar as image if post has no own imageyes
result_typerecentmixedmixed include both popular and real time results in the responserecent return only the most recent results in the responsepopular return only the most popular results in the responseyes
lat-13.163333Returns tweets by users located within a given radius of the given latitude/longitudeyes
lng-72.545556Returns tweets by users located within a given radius of the given latitude/longitudeyes
distance51Returns tweets by users located within a given radius in kilometers of the given latitude/longitudeyes
languagedeRestricts tweets to the given language, given by an ISO 639-1 codeyes

Sample requests:

  • [{'search':'#eagles', 'result_type':'recent'}, {'search':'Thomas Müller', 'result_type':'popular'}]
  • [{'search':'machu picchu', 'lat':'-13.163333', 'lng':'-72.545556', 'distance':5}]

III. Rate limit

Visit the official Twitter REST API rate limit documentations

Licence

MIT

0.7.8

8 years ago

0.7.7

8 years ago

0.7.6

8 years ago

0.7.5

8 years ago

0.7.0

8 years ago