llamerr
llamerr

Reputation: 3176

Twitter API libraries question

I looked into some php libraries for twitter

I don't understand, why this:

$creds = $twitterObj->get('/account/verify_credentials.json');
$status = $twitterObj->post('/statuses/update.json', array('status' => 'This a simple test from twitter-async at ' . date('m-d-Y h:i:s')));

Is better that this:

$resultorsomething = $twitterObj->verifyCredentials();
$resultorsomething = $twitterObj->updateStatus('This a status');
$resultorsomething = $twitterObj->postMessage('This a message');

Why I need to learn twitter addresses and commands instead of let IDE and code completion do this for me?

I don't care what method I need to use for some command, POST or GET(even if it obvious) and at what address it settled I just want to post a message or get token etc.

---EDIT:

I looked into tweepy library for python, I'm not good at python but as I can see from this file - https://github.com/tweepy/tweepy/blob/master/tweepy/api.py it does exactly what I'm talking about

""" statuses/update """
    update_status = bind_api(
        path = '/statuses/update.json',
        method = 'POST',
        payload_type = 'status',
        allowed_param = ['status', 'in_reply_to_status_id', 'lat', 'long', 'source', 'place_id'],
        require_auth = True
    )

path and method is hardcoded into method and only parameters we need is status, lat, long etc

Upvotes: 0

Views: 227

Answers (1)

fire
fire

Reputation: 21531

Those commands like updateStatus are just a wrapper to the version of using post. If the wrapper commands exist in your framework then your better off using them because if the post command were to change then you wouldn't have to change your own code (hopefully).

Upvotes: 2

Related Questions