keyvanakbary / tuenti
Unofficial Tuenti API
Requires
- php: >=5.3.3
Requires (Dev)
- phpunit/phpunit: ~4.0
This package is not auto-updated.
Last update: 2024-11-19 03:33:08 UTC
README
Unofficial Tuenti API.
Setup and Configuration
Add the following to your composer.json
file
{ "require": { "keyvanakbary/tuenti": "~1.0" } }
Update the vendor libraries
curl -s http://getcomposer.org/installer | php
php composer.phar install
Usage
<?php require 'vendor/autoload.php'; use Tuenti\Client; use Tuenti\ApiError; $t = new Client('foo@example.com', 'password'); try { $profile = $t->getProfile($t->me()); } catch (ApiError $e) { error_log($e->getMessage()); }
Quick Reference
Current User
The method me()
returns your user id. You can use it in methods that require a $userId
to retrieve your own data.
$t->getProfile($t->me());
Profile
Get profile for a given user
getProfile($userId)
Get profile wall with statuses for a given user
getProfileWallWithStatus($userId [, $page = 0 [, $size = 10]])
Get all your friends
getFriends()
Set your status
setStatus($status)
Notifications
Get personal notifications
getPersonalNotifications()
Get friends notifications
getFriendsNotifications([$page = 0 [, $size = 10]])
Messages
Get inbox message threads
getInbox([$page = 0 [, $size = 10]])
Get sent message threads
getSentBox([$page = 0 [, $size = 10]])
Get spam message threads
getSpamBox([$page = 0 [, $size = 10]])
Retrieve messages from a given thread
getThread($threadKey [, $page = 0 [, $size = 10]])
Send a message
sendMessage($userId, $threadKey, $message)
Photos
Get user albums
getAlbums($userId [, $page = 0 [, $size = 10]])
Get album photos for a given user
getAlbumPhotos($userId, $albumId [, $page = 0])
Get all the tags for a photo
getPhotoTags($photoId)
Add a post to a photo wall
addPostToPhotoWall($photoId, $message)
Get the wall posts for a given photo
getPhotoWall($photoId [, $page = 0 [, $size = 10]])
Iterate over all your albums and photos
foreach ($t->getAlbums($t->me()) as $albumId => $album) { // do something with $album for ($i = 0; $i < $album['size']; $i = $i + Client::DEFAULT_PAGE_SIZE) { $page = floor($i / Client::DEFAULT_PAGE_SIZE); $photos = current($t->getAlbumPhotos($t->me(), $albumId, $page)); foreach ($photos as $photo) { // do something with $photo } } }
Events
Get upcoming events. You can include birthays
getUpcomingEvents([$size = 10 [, $includeBirthdays = false]])
Retrieve event
getEvent($eventId)
Get the wall for a given event
getEventWall($eventId [, $page = 0 [, $size = 10]])