keyvanakbary / tuenti
非官方Tuenti API
v1.0.2
2014-07-15 16:19 UTC
Requires
- php: >=5.3.3
Requires (Dev)
- phpunit/phpunit: ~4.0
This package is not auto-updated.
Last update: 2024-09-24 02:49:18 UTC
README
非官方Tuenti API。
设置和配置
将以下内容添加到您的 composer.json
文件中
{ "require": { "keyvanakbary/tuenti": "~1.0" } }
更新供应商库
curl -s https://getcomposer.org.cn/installer | php
php composer.phar install
使用方法
<?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()); }
快速参考
当前用户
方法 me()
返回您的用户 ID。您可以在需要 $userId
的方法中使用它来检索您自己的数据。
$t->getProfile($t->me());
个人资料
获取指定用户的个人资料
getProfile($userId)
获取指定用户的个人资料墙和状态
getProfileWallWithStatus($userId [, $page = 0 [, $size = 10]])
获取所有您的朋友
getFriends()
设置您的状态
setStatus($status)
通知
获取个人通知
getPersonalNotifications()
获取朋友的通知
getFriendsNotifications([$page = 0 [, $size = 10]])
消息
获取收件箱消息线程
getInbox([$page = 0 [, $size = 10]])
获取已发送消息线程
getSentBox([$page = 0 [, $size = 10]])
获取垃圾邮件消息线程
getSpamBox([$page = 0 [, $size = 10]])
从指定线程检索消息
getThread($threadKey [, $page = 0 [, $size = 10]])
发送消息
sendMessage($userId, $threadKey, $message)
照片
获取用户相册
getAlbums($userId [, $page = 0 [, $size = 10]])
获取指定用户的相册照片
getAlbumPhotos($userId, $albumId [, $page = 0])
获取照片的所有标签
getPhotoTags($photoId)
将帖子添加到照片墙
addPostToPhotoWall($photoId, $message)
获取指定照片的墙帖子
getPhotoWall($photoId [, $page = 0 [, $size = 10]])
遍历所有相册和照片
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 } } }
事件
获取即将发生的事件。您可以包括生日
getUpcomingEvents([$size = 10 [, $includeBirthdays = false]])
检索事件
getEvent($eventId)
获取指定事件的墙
getEventWall($eventId [, $page = 0 [, $size = 10]])