}
/**
- * Returns whether or not pairs of users are friends.
- * Note that the Facebook friend relationship is symmetric.
- *
- * @param string $uids1 comma-separated list of ids (id_1, id_2,...)
- * of some length X
- * @param string $uids2 comma-separated list of ids (id_A, id_B,...)
- * of SAME length X
- *
- * @return array An array with uid1, uid2, and bool if friends, e.g.:
- * array(0 => array('uid1' => id_1, 'uid2' => id_A, 'are_friends' => 1),
- * 1 => array('uid1' => id_2, 'uid2' => id_B, 'are_friends' => 0)
- * ...)
- * @error
- * API_EC_PARAM_USER_ID_LIST
- */
- public function &friends_areFriends($uids1, $uids2)
- {
- return $this->call_method('facebook.friends.areFriends',
- array('uids1' => $uids1, 'uids2' => $uids2));
- }
-
- /**
- * Returns the friends of the current session user.
- *
- * @param int $flid (Optional) Only return friends on this friend list.
- * @param int $uid (Optional) Return friends for this user.
- *
- * @return array An array of friends
- */
- public function &friends_get($flid=null, $uid = null)
- {
- $params = array();
- if ($uid) {
- $params['uid'] = $uid;
- }
- if ($flid) {
- $params['flid'] = $flid;
- }
-
- return $this->call_method('facebook.friends.get', $params);
- }
-
- /**
- * Returns the set of friend lists for the current session user.
- *
- * @return array An array of friend list objects
- */
- public function &friends_getLists()
- {
- return $this->call_method('facebook.friends.getLists');
- }
-
- /**
* Returns groups according to the filters specified.
*
* @param int $uid (Optional) User associated with groups. A null
--- /dev/null
+<?php
+/**
+ * Friends methods for Horde_Service_Facebook
+ *
+ * Copyright 2009 The Horde Project (http://www.horde.org)
+ *
+ * @author Michael J. Rubinsky <mrubinsk@horde.org>
+ * @category Horde
+ * @package Horde_Service_Facebook
+ */
+class Horde_Servce_Facebook_Friends extends Horde_Service_Facebook_Base
+{
+ /**
+ * Returns whether or not pairs of users are friends.
+ * Note that the Facebook friend relationship is symmetric.
+ *
+ * @param string $uids1 comma-separated list of ids (id_1, id_2,...)
+ * of some length X
+ * @param string $uids2 comma-separated list of ids (id_A, id_B,...)
+ * of SAME length X
+ *
+ * @return array An array with uid1, uid2, and bool if friends, e.g.:
+ * array(0 => array('uid1' => id_1, 'uid2' => id_A, 'are_friends' => 1),
+ * 1 => array('uid1' => id_2, 'uid2' => id_B, 'are_friends' => 0)
+ * ...)
+ * @error
+ * API_EC_PARAM_USER_ID_LIST
+ */
+ public function &areFriends($uids1, $uids2)
+ {
+ // Session key is *required*
+ if (empty($this->_sessionKey)) {
+ throw new Horde_FaceBook_Exception('session_key is required',
+ Horde_Service_Facebook_ErrorCodes::API_EC_SESSION_REQUIRED);
+ }
+
+ return $this->_facebook->call_method('facebook.friends.areFriends',
+ array('uids1' => $uids1,
+ 'uids2' => $uids2,
+ 'session_key' => $this->_sessionKey));
+ }
+
+ /**
+ * Returns the friends of the current session user.
+ *
+ * @param int $flid (Optional) Only return friends on this friend list.
+ * @param int $uid (Optional) Return friends for this user.
+ *
+ * @return array An array of friends
+ */
+ public function &get($flid = null, $uid = null)
+ {
+ // Session key is *required*
+ if (empty($this->_sessionKey)) {
+ throw new Horde_FaceBook_Exception('session_key is required',
+ Horde_Service_Facebook_ErrorCodes::API_EC_SESSION_REQUIRED);
+ }
+ $params = array();
+ if ($uid) {
+ $params['uid'] = $uid;
+ }
+ if ($flid) {
+ $params['flid'] = $flid;
+ }
+
+ return $this->_facebook->call_method('facebook.friends.get', $params);
+ }
+
+ /**
+ * Returns the set of friend lists for the current session user.
+ *
+ * @return array An array of friend list objects
+ */
+ public function &getLists()
+ {
+ // Session key is *required*
+ if (empty($this->_sessionKey)) {
+ throw new Horde_FaceBook_Exception('session_key is required',
+ Horde_Service_Facebook_ErrorCodes::API_EC_SESSION_REQUIRED);
+ }
+ return $this->_facebook->call_method('facebook.friends.getLists',
+ array('session_key' => $this->_sessionKey));
+ }
+
+}
\ No newline at end of file
<dir name="Facebook">
<file name="Base.php" role="php" />
<file name="Fql.php" role="php" />
+ <file name="Friends.php" role="php" />
<file name="Exception.php" role="php" />
<file name="ErrorCodes.php" role="php" />
<file name="Request.php" role="php" />
<filelist>
<install name="lib/Horde/Service/Facebook/Base.php" as="Horde/Service/Facebook/Base.php" />
<install name="lib/Horde/Service/Facebook/Fql.php" as="Horde/Service/Facebook/Fql.php" />
+ <install name="lib/Horde/Service/Facebook/Friends.php" as="Horde/Service/Facebook/Friends.php" />
<install name="lib/Horde/Service/Facebook/Exception.php" as="Horde/Service/Facebook/Exception.php" />
<install name="lib/Horde/Service/Facebook/ErrorCodes.php" as="Horde/Service/Facebook/ErrorCodes.php" />
<install name="lib/Horde/Service/Facebook/Request.php" as="Horde/Service/Facebook/Request.php" />
<install name="lib/Horde/Service/Facebook/BatchRequest.php" as="Horde/Service/Facebook/BatchRequest.php" />
<install name="lib/Horde/Service/Facebook/Auth.php" as="Horde/Service/Facebook/Auth.php" />
<install name="lib/Horde/Service/Facebook.php" as="Horde/Service/Facebook.php" />
-
</filelist>
</phprelease>
</package>