simpleTAPI is Broken
Apparently I’ve completely broken simpleTAPI somewhere between Build 27 and Build 30. I thought I had fixed it with Build 29, but it seems that I was mistaken.
In lieu of this, I am putting simpleTAPI on a temporary hiatus. I will be re-constructing it from scratch (though, probably looking back and using a good bit of the original code). The next version should have several configurable options, and will hopefully interact with the Twitter API much better than the previous versions.
Build 30 was supposed to return results as an array([“TAPI”] => data, [“result”] => data). But all I’m getting from it at the moment is “Unable to Authenticate User.”
Those wanting to use simpleTAPI should use Build 27, though you will have to deal with some minor quirks in the way results are returned. (the TAPI array is simply appended to the results array, making things slightly complicated if you don’t unset($result[“TAPI”]);
What will be simpleTAPI 0.4 should have better error handling, better return data, and better built-in caching. I’m also hoping to build in support for xAuth and Delegated OAuth, if at all possible. (Though probably not since simpleTAPI is built upon another OAuth library).
So, I’m asking for any and all feature requests. Is there something about simpleTAPI you don’t like or want to be improved? Please, post in the comments below!
simpleTAPI v0.2.1 – Build 16 (Twitter API Library)
I’ve renamed the Twitter API Library to “simpleTAPI.” Yes, I’m not very good at names when it comes to this sort of thing. We’ve jumped forward two builds since my last post here.
Build 15
- The addition of a quick variable, bool Twitter::geo_enabled.
Returns TRUE if the user has turned on geo functionality, FALSE if not.
Version 0.2.1
- Re-Organized classes. Separated TwitterOAuth and OAuth into separate files, and moved them along with Twitter into a “twitter” folder. All classes can be loaded simply by including Twitter.lib.php.
Build 16
- Fixed a minor inconsistency in TWML where different functions returned different links to a twitter user’s profile.
- Fixed a bug where specifying screennameonly=TRUE for TWML::name resulted in an empty hyperlink.
Examples
- Started work on Example files to teach how to use simpleTAPI. Currently, the only one included is a basic Update script. This file includes logging in, updating a status, and returning the same status as well as some basic TWML examples.
So, enjoy! I will continue to improve this library. Please remember to post all issues and feature requests either on this blog or the github page.
Twitter API Library Build 13 (Breaking Change)
I pushed Build 13 today. This build adds the recent addition of descriptions to a user’s list.
This change breaks:
- TwitterAPI::lists_create and
- TwitterAPI::lists_update
The new profiles for these commands are as follows:
TwitterAPI::lists_create( str $name [, str $description = NULL [, bool $privacy = TWITTER_PRIVACY_PUBLIC ] ] )
TwitterAPI::lists_update( str $name [, str $new_name = NULL [, str $description = NULL [, bool $privacy = NULL ] ] ] )
Twitter API Library Build 12
If you’ve been watching this blog, you’ll notice I skipped Build 11 – It was small, and was trumped by its quick replacement – Build 12. Builds 11 and 12 fixed five previous known issues, while build 12 fixed a non-issue with build 11. Fixes listed below:
- The following now work with all users:
- Twitter::get_sn_from_id()
- Twitter::get_name_from_id()
- Twitter::get_id_from_sn()
- TWML::name()
- TWML::profile_pic()
- Addition of User Cache commands for use by TWML and the get_x_from_y() commands.
As always, the most recent build is available at github.
Twitter API Library Version 0.2 Build 10
I pushed Version 2 Build 10 of the Twitter API Library to github. This new version still does not fix any of the previous errors, so the changelog is quite minor.
- Updated to TwitterOAuth v0.2-beta
- "fixes several bugs"
- Support for OAuth 1.0a
- Added a boolean return to require_login().
Twitter API Library Build 9
I’ve pushed Build 9 of the Twitter API Library to github today. Interesting thing, it adds a few missing API features but does not yet fix any of the previous problems.
New features are all Authenticated API Calls:
- search
- trends
- trends_current
- trends_daily
- trends_weekly
- users_search
- trends_available
- trends_location
Yes, that means that we’ve added support for the following portions of the twitter api:
- Search
- Trends
- User Search
- Local Trends
Enjoy, and as always please report any and all errors you get.
Twitter API Library 0.2 in Near Future
Some of the current issues with the Twitter API Library seem to be with the Twitter OAuth library we’re using courtesy of Abraham Williams. I looked into simply updating the code to the newer version of TwitterOAuth, but it seems that are multiple incompatibilities that prevent us from doing so, requiring a rewrite of some of the automated authentication code. As much of a bad thing that this is, it is a good thing as well, and hopefully the newer version of our library will add some much desired features.
Until then, v0.1 will still work for most things.
Twitter API Library – Build 8
I’d like to introduce Build 8 to the masses. Sorry for the long delay in posting, but I was working on a new Twitter Client, TwCLI (which uses the Twitter API Library and is Open Source).
Build 8 contains unsupported support for Twitter Lists. Basically, we have built Twitter lists into the library, but a large number of functions are not working for what seems to be an incompatibility between our OAuth Libraries and Twitter.
Change Log:
- Added array api->lists_update( string $old_name, string $new_name = null, string $privacy = null) [Working]
- Added array api->lists_get( string $screen_name = null, int $cursor = null)
$screen_name defaults to the logged in user if set as null. [Working] - Added array api->lists_display( string $screen_name, string $list_slug) [Unverified]
- Added array api->lists_statuses( string $screen_name, string $list_slug, int $since_id = null, int $max_id = null, int $count = null, int $page = null) [Working]
- Added array api->lists_memberships( string $screen_name, string $list_slug, int $cursor = null) [Unverified]
- Added array api->lists_subscriptions( string $screen_name = null )
$screen_name defaults to the logged in user if set as null. [Unverified] - Added array api->lists_destroy( string $list_slug ) [Not Working]
- Added array api->list_members( string $screen_name, string $list_slug, int $cursor = null ) [Unverified]
- Added array api->list_membersAdd( string $list_slug, int $user_id ) [Working]
- Added array api->list_membersDelete( string $list_slug, int $user_id ) [Unverified]
- Added array api->list_isMember( string $screen_name, string $list_slug, string $screen_name_to_check ) [Unverified]
- Added array api->list_subscribers( string $screen_name, string $list_slug, int $cursor = null) [Unverified]
- Added array api->list_subscribe( string $screen_name, string $list_slug ) [Unverified]
- Added array api->list_unsubscribe( string $screen_name, string $list_slug ) [Unverified]
- Added array api->isSubscriber( string $screen_name, string $list_slug, string $screen_name_to_check ) [Unverified]
Known Issues:
- No Support for Unauthenticated Requests.
- $tw->name() does not support users other than the currently logged in user.
- $tw->profile_pic() does not support users other than the currently logged in user.
- $twitter->get_sn_from_id() does not support users other than the currently logged in user.
- $twitter->get_name_from_id() does not support users other than the currently logged in user.
- Two instances of Twitter API Library can not co-exist on the same sub-domain.
- $twitter->api->lists_destroy() is returning “Incorrect Signature.”
Twitter API Library – Build 7
Well, this is going to break some things if you’re using an older build. Primarily any method that required the ID/Screen Name/User ID of a user. I thought I had pushed out this change before the Build 4 release, but apparently it was still on my computer.
Now, any API methods that were function( mixed $id = NULL, string $screen_name = NULL, int $user_id = NULL ) are now: function( mixed $id, int $id_type = TWITTER_ID ). $id_type can be one of “TWITTER_ID” (lets twitter decide if you’re using a screen name or user id), “TWITTER_SN” (tells twitter you’re using a screen name) or “TWITTER_UID” (tells twitter you’re using a user ID). This parameter may be omitted and will default to TWITTER_ID.
URI: http://sandbox.gtaero.net/twitter_api/code.php?b=7
Change Log:
- Changed Tri-optional User Identification procedure in the API methods to Two Parameters $id and $id_type.
- Added array api->lists_create( string $name [, int $privacy = TWITTER_PRIVACY_PUBLIC ] )
- $privacy may be one of TWITTER_PRIVACY_PUBLIC or TWITTER_PRIVACY_PRIVATE
Known Issues:
- No Support for Unauthenticated Requests.
- $tw->name() does not support users other than the currently logged in user.
- $tw->profile_pic() does not support users other than the currently logged in user.
- $twitter->get_sn_from_id() does not support users other than the currently logged in user.
- $twitter->get_name_from_id() does not support users other than the currently logged in user.
- Two instances of Twitter API Library can not co-exist on the same sub-domain. (All Versions)
Twitter API Library – Build 6
Decided to push out one last, though much smaller, build tonight – Build 6. Build 6 moves from Authorize to Authenticate and adds a TWML function. There are some other small changes in Build 6 from the other builds, but these are not documented yet, and will probably require the help of someone who knows more about OAuth than I to become supported (yes, I’m talking about setup_login() and set_cache_dir()).
URI: http://sandbox.gtaero.net/twitter_api/code.php?b=6
Change Log:
- Moved from using OAuth Authorize to OAuth Authenticate. Users will no longer have to continually click “Allow this application.” Now they just do it once and Twitter API Library will auto-magically log them in next time.
- Added bool $tw->if_is_user( int $user_id ) which returns true if the current user is the same as the inserted ID, and false if they aren’t.
Known Issues:
- No Support for Unauthenticated Requests.
- $tw->name() does not support users other than the currently logged in user.
- $tw->profile_pic() does not support users other than the currently logged in user.
- $twitter->get_sn_from_id() does not support users other than the currently logged in user.
- $twitter->get_name_from_id() does not support users other than the currently logged in user.