ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/facebook/trunk/facebookapi_php5_restlib.php
(Generate patch)

Comparing facebook/trunk/facebookapi_php5_restlib.php (file contents):
Revision 950 by douglas, 2007-09-29T14:02:03-07:00 vs.
Revision 981 by douglas, 2008-01-16T16:47:47-08:00

# Line 48 | Line 48 | class FacebookRestClient {
48  
49    /**
50     * Create the client.
51 <   * @param string $session_key if you haven't gotten a session key yet, leave
52 <   *                            this as null and then set it later by just
53 <   *                            directly accessing the $session_key member
51 >   * @param string $session_key if you haven't gotten a session key yet, leave
52 >   *                            this as null and then set it later by just
53 >   *                            directly accessing the $session_key member
54     *                            variable.
55     */
56    public function __construct($api_key, $secret, $session_key=null) {
# Line 81 | Line 81 | function toggleDisplay(id, type) {
81  
82    /**
83     * Returns the session information available after current user logs in.
84 <   * @param string $auth_token the token returned by auth_createToken or
84 >   * @param string $auth_token the token returned by auth_createToken or
85     *  passed back to your callback_url.
86     * @return assoc array containing session_key, uid
87     */
# Line 97 | Line 97 | function toggleDisplay(id, type) {
97  
98    /**
99     * Returns events according to the filters specified.
100 <   * @param int $uid Optional: User associated with events.  
100 >   * @param int $uid Optional: User associated with events.
101     *   A null parameter will default to the session user.
102     * @param array $eids Optional: Filter by these event ids.
103     *   A null parameter will get all events for the user.
104 <   * @param int $start_time Optional: Filter with this UTC as lower bound.  
104 >   * @param int $start_time Optional: Filter with this UTC as lower bound.
105     *   A null or zero parameter indicates no lower bound.
106 <   * @param int $end_time Optional: Filter with this UTC as upper bound.
106 >   * @param int $end_time Optional: Filter with this UTC as upper bound.
107     *   A null or zero parameter indicates no upper bound.
108     * @param string $rsvp_status Optional: Only show events where the given uid
109     *   has this rsvp status.  This only works if you have specified a value for
# Line 116 | Line 116 | function toggleDisplay(id, type) {
116          array(
117          'uid' => $uid,
118          'eids' => $eids,
119 <        'start_time' => $start_time,
119 >        'start_time' => $start_time,
120          'end_time' => $end_time,
121          'rsvp_status' => $rsvp_status));
122    }
# Line 144 | Line 144 | function toggleDisplay(id, type) {
144        array('query' => $query));
145    }
146  
147 <  public function feed_publishStoryToUser($title, $body,
147 >  public function feed_publishStoryToUser($title, $body,
148                                            $image_1=null, $image_1_link=null,
149                                            $image_2=null, $image_2_link=null,
150                                            $image_3=null, $image_3_link=null,
# Line 161 | Line 161 | function toggleDisplay(id, type) {
161              'image_4' => $image_4,
162              'image_4_link' => $image_4_link));
163    }
164 <                                          
165 <  public function feed_publishActionOfUser($title, $body,
164 >
165 >  public function feed_publishActionOfUser($title, $body,
166                                             $image_1=null, $image_1_link=null,
167                                             $image_2=null, $image_2_link=null,
168                                             $image_3=null, $image_3_link=null,
# Line 180 | Line 180 | function toggleDisplay(id, type) {
180              'image_4_link' => $image_4_link));
181    }
182  
183 +  public function feed_publishTemplatizedAction($actor_id, $title_template, $title_data,
184 +                                                $body_template, $body_data, $body_general,
185 +                                                $image_1=null, $image_1_link=null,
186 +                                                $image_2=null, $image_2_link=null,
187 +                                                $image_3=null, $image_3_link=null,
188 +                                                $image_4=null, $image_4_link=null,
189 +                                                $target_ids='') {
190 +    return $this->call_method('facebook.feed.publishTemplatizedAction',
191 +      array('actor_id' => $actor_id,
192 +            'title_template' => $title_template,
193 +            'title_data' => is_array($title_data) ? json_encode($title_data) : $title_data,
194 +            'body_template' => $body_template,
195 +            'body_data' => is_array($body_data) ? json_encode($body_data) : $body_data,
196 +            'body_general' => $body_general,
197 +            'image_1' => $image_1,
198 +            'image_1_link' => $image_1_link,
199 +            'image_2' => $image_2,
200 +            'image_2_link' => $image_2_link,
201 +            'image_3' => $image_3,
202 +            'image_3_link' => $image_3_link,
203 +            'image_4' => $image_4,
204 +            'image_4_link' => $image_4_link,
205 +            'target_ids' => $target_ids));
206 +  }
207 +
208    /**
209     * Returns whether or not pairs of users are friends.
210     * Note that the Facebook friend relationship is symmetric.
# Line 187 | Line 212 | function toggleDisplay(id, type) {
212     * @param array $uids2: array of ids (id_A, id_B,...) of SAME length X
213     * @return array of uid pairs with bool, true if pair are friends, e.g.
214     *   array( 0 => array('uid1' => id_1, 'uid2' => id_A, 'are_friends' => 1),
215 <   *          1 => array('uid1' => id_2, 'uid2' => id_B, 'are_friends' => 0)
215 >   *          1 => array('uid1' => id_2, 'uid2' => id_B, 'are_friends' => 0)
216     *         ...)
217     */
218    public function friends_areFriends($uids1, $uids2) {
219      return $this->call_method('facebook.friends.areFriends',
220          array('uids1'=>$uids1, 'uids2'=>$uids2));
221    }
222 <  
222 >
223    /**
224     * Returns the friends of the current session user.
225     * @return array of friends
# Line 205 | Line 230 | function toggleDisplay(id, type) {
230      }
231      return $this->call_method('facebook.friends.get', array());
232    }
233 <  
233 >
234    /**
235     * Returns the friends of the session user, who are also users
236     * of the calling application.
# Line 217 | Line 242 | function toggleDisplay(id, type) {
242  
243    /**
244     * Returns groups according to the filters specified.
245 <   * @param int $uid Optional: User associated with groups.  
245 >   * @param int $uid Optional: User associated with groups.
246     *  A null parameter will default to the session user.
247     * @param array $gids Optional: group ids to query.
248     *   A null parameter will get all groups for the user.
# Line 233 | Line 258 | function toggleDisplay(id, type) {
258    /**
259     * Returns the membership list of a group
260     * @param int $gid : Group id
261 <   * @return assoc array of four membership lists, with keys
261 >   * @return assoc array of four membership lists, with keys
262     *  'members', 'admins', 'officers', and 'not_replied'
263     */
264    public function groups_getMembers($gid) {
# Line 243 | Line 268 | function toggleDisplay(id, type) {
268  
269    /**
270     * Returns the outstanding notifications for the session user.
271 <   * @return assoc array of
272 <   *  notification count objects for 'messages', 'pokes' and 'shares',
271 >   * @return assoc array of
272 >   *  notification count objects for 'messages', 'pokes' and 'shares',
273     *  a uid list of 'friend_requests', a gid list of 'group_invites',
274     *  and an eid list of 'event_invites'
275     */
# Line 253 | Line 278 | function toggleDisplay(id, type) {
278    }
279  
280    /**
281 <   * Sends an email notification to the specified user.
282 <   * @return string url which you should send the logged in user to to finalize the message.
281 >   * Sends a notification to the specified users.
282 >   * @return (nothing)
283     */
284 <  public function notifications_send($to_ids, $notification, $email='') {
284 >  public function notifications_send($to_ids, $notification) {
285      return $this->call_method('facebook.notifications.send',
286 <                              array('to_ids' => $to_ids, 'notification' => $notification, 'email' => $email));
286 >                              array('to_ids' => $to_ids, 'notification' => $notification));
287 >  }
288 >
289 >  /**
290 >   * Sends an email to the specified user of the application.
291 >   * @param array $recipients : id of the recipients
292 >   * @param string $subject : subject of the email
293 >   * @param string $text : (plain text) body of the email
294 >   * @param string $fbml : fbml markup if you want an html version of the email
295 >   * @return comma separated list of successful recipients
296 >   */
297 >  public function notifications_sendEmail($recipients, $subject, $text, $fbml) {
298 >    return $this->call_method('facebook.notifications.sendEmail',
299 >                              array('recipients' => $recipients,
300 >                                    'subject' => $subject,
301 >                                    'text' => $text,
302 >                                    'fbml' => $fbml));
303 >  }
304 >
305 >  /**
306 >   * Returns the requested info fields for the requested set of pages
307 >   * @param array $page_ids an array of page ids
308 >   * @param array $fields an array of strings describing the info fields desired
309 >   * @param int $uid   Optionally, limit results to pages of which this user is a fan.
310 >   * @param string type  limits results to a particular type of page.
311 >   * @return array of pages
312 >   */
313 >  public function pages_getInfo($page_ids, $fields, $uid, $type) {
314 >    return $this->call_method('facebook.pages.getInfo', array('page_ids' => $page_ids, 'fields' => $fields, 'uid' => $uid, 'type' => $type));
315 >  }
316 >
317 >  /**
318 >   * Returns true if logged in user is an admin for the passed page
319 >   * @param int $page_id target page id
320 >   * @return boolean
321 >   */
322 >  public function pages_isAdmin($page_id) {
323 >    return $this->call_method('facebook.pages.isAdmin', array('page_id' => $page_id));
324    }
325  
326    /**
327 <   * Sends a request to the specified user (e.g. "you have 1 event invitation")
328 <   * @param array $to_ids   user ids to receive the request (must be friends with sender, capped at 10)
329 <   * @param string $type    type of request, e.g. "event" (as in "You have an event invitation.")
330 <   * @param string $content fbml content of the request.  really stripped down fbml - just
331 <   *                        text/names/links.  also, use the special tag <fb:req-choice url="" label="" />
332 <   *                        to specify the buttons to be included.
333 <   * @param string $image   url of an image to show beside the request
334 <   * @param bool   $invite  whether to call it an "invitation" or a "request"
335 <   * @return string url which you should send the logged in user to to finalize the message.
336 <   */
337 <  public function notifications_sendRequest($to_ids, $type, $content, $image, $invite) {
338 <    return $this->call_method('facebook.notifications.sendRequest',
339 <                              array('to_ids' => $to_ids, 'type' => $type, 'content' => $content,
340 <                                    'image' => $image, 'invite' => $invite));
327 >   * Returns whether or not the page corresponding to the current session object has the app installed
328 >   * @return boolean
329 >   */
330 >  public function pages_isAppAdded() {
331 >    if (isset($this->added)) {
332 >      return $this->added;
333 >    }
334 >    return $this->call_method('facebook.pages.isAppAdded', array());
335 >  }
336 >
337 >  /**
338 >   * Returns true if logged in user is a fan for the passed page
339 >   * @param int $page_id target page id
340 >   * @param int $uid user to compare.  If empty, the logged in user.
341 >   * @return bool
342 >   */
343 >  public function pages_isFan($page_id, $uid) {
344 >    return $this->call_method('facebook.pages.isFan', array('page_id' => $page_id, 'uid' => $uid));
345    }
346  
347    /**
348     * Returns photos according to the filters specified.
349     * @param int $subj_id Optional: Filter by uid of user tagged in the photos.
350 <   * @param int $aid Optional: Filter by an album, as returned by
350 >   * @param int $aid Optional: Filter by an album, as returned by
351     *  photos_getAlbums.
352 <   * @param array $pids Optional: Restrict to a list of pids
353 <   * Note that at least one of these parameters needs to be specified, or an
352 >   * @param array $pids Optional: Restrict to a list of pids
353 >   * Note that at least one of these parameters needs to be specified, or an
354     * error is returned.
355     * @return array of photo objects.
356     */
357    public function photos_get($subj_id, $aid, $pids) {
358 <    return $this->call_method('facebook.photos.get',
358 >    return $this->call_method('facebook.photos.get',
359        array('subj_id' => $subj_id, 'aid' => $aid, 'pids' => $pids));
360    }
361  
# Line 302 | Line 368 | function toggleDisplay(id, type) {
368     * @returns an array of album objects.
369     */
370    public function photos_getAlbums($uid, $aids) {
371 <    return $this->call_method('facebook.photos.getAlbums',
371 >    return $this->call_method('facebook.photos.getAlbums',
372        array('uid' => $uid,
373              'aids' => $aids));
374    }
# Line 314 | Line 380 | function toggleDisplay(id, type) {
380     *  and two floating-point numbers (xcoord, ycoord) for tag pixel location
381     */
382    public function photos_getTags($pids) {
383 <    return $this->call_method('facebook.photos.getTags',
383 >    return $this->call_method('facebook.photos.getTags',
384        array('pids' => $pids));
385    }
386  
387    /**
388     * Returns the requested info fields for the requested set of users
389 <   * @param array $uids an array of user ids
389 >   * @param array $uids an array of user ids
390     * @param array $fields an array of strings describing the info fields desired
391     * @return array of users
392     */
# Line 332 | Line 398 | function toggleDisplay(id, type) {
398     * Returns the user corresponding to the current session object.
399     * @return integer uid
400     */
401 <  public function users_getLoggedInUser(){
401 >  public function users_getLoggedInUser() {
402      return $this->call_method('facebook.users.getLoggedInUser', array());
403    }
404  
405 <  
406 <  /**
407 <   * Returns whether or not the user corresponding to the current session object has the app installed
408 <   * @return boolean
405 >
406 >  /**
407 >   * Returns whether or not the user corresponding to the current session object has the app installed
408 >   * @return boolean
409     */
410    public function users_isAppAdded() {
411      if (isset($this->added)) {
# Line 350 | Line 416 | function toggleDisplay(id, type) {
416  
417    /**
418     * Sets the FBML for the profile of the user attached to this session
419 <   * @param   string   $markup     The FBML that describes the profile presence of this app for the user
419 >   * @param   string   $markup           The FBML that describes the profile presence of this app for the user
420 >   * @param   int      $uid              The user
421 >   * @param   string   $profile          Profile FBML
422 >   * @param   string   $profile_action   Profile action FBML
423 >   * @param   string   $mobile_profile   Mobile profile FBML
424     * @return  array    A list of strings describing any compile errors for the submitted FBML
425     */
426 <  public function profile_setFBML($markup, $uid = null) {
427 <    return $this->call_method('facebook.profile.setFBML', array('markup' => $markup, 'uid' => $uid));
426 >  function profile_setFBML($markup, $uid = null, $profile='', $profile_action='', $mobile_profile='') {
427 >    return $this->call_method('facebook.profile.setFBML', array('markup' => $markup,
428 >                                                                'uid' => $uid,
429 >                                                                'profile' => $profile,
430 >                                                                'profile_action' => $profile_action,
431 >                                                                'mobile_profile' => $mobile_profile));
432    }
433  
434    public function profile_getFBML($uid) {
# Line 373 | Line 447 | function toggleDisplay(id, type) {
447      return $this->call_method('facebook.fbml.setRefHandle', array('handle' => $handle, 'fbml' => $fbml));
448    }
449  
450 +  /**
451 +   * Get all the marketplace categories
452 +   *
453 +   * @return array  A list of category names
454 +   */
455 +  function marketplace_getCategories() {
456 +    return $this->call_method('facebook.marketplace.getCategories', array());
457 +  }
458 +
459 +  /**
460 +   * Get all the marketplace subcategories for a particular category
461 +   *
462 +   * @param  category  The category for which we are pulling subcategories
463 +   * @return array     A list of subcategory names
464 +   */
465 +  function marketplace_getSubCategories($category) {
466 +    return $this->call_method('facebook.marketplace.getSubCategories', array('category' => $category));
467 +  }
468 +
469 +  /**
470 +   * Get listings by either listing_id or user
471 +   *
472 +   * @param listing_ids   An array of listing_ids (optional)
473 +   * @param uids          An array of user ids (optional)
474 +   * @return array        The data for matched listings
475 +   */
476 +  function marketplace_getListings($listing_ids, $uids) {
477 +    return $this->call_method('facebook.marketplace.getListings', array('listing_ids' => $listing_ids, 'uids' => $uids));
478 +  }
479 +
480 +  /**
481 +   * Search for Marketplace listings.  All arguments are optional, though at least
482 +   * one must be filled out to retrieve results.
483 +   *
484 +   * @param category     The category in which to search (optional)
485 +   * @param subcategory  The subcategory in which to search (optional)
486 +   * @param query        A query string (optional)
487 +   * @return array       The data for matched listings
488 +   */
489 +  function marketplace_search($category, $subcategory, $query) {
490 +    return $this->call_method('facebook.marketplace.search', array('category' => $category, 'subcategory' => $subcategory, 'query' => $query));
491 +  }
492 +
493 +  /**
494 +   * Remove a listing from Marketplace
495 +   *
496 +   * @param listing_id  The id of the listing to be removed
497 +   * @param status      'SUCCESS', 'NOT_SUCCESS', or 'DEFAULT'
498 +   * @return bool       True on success
499 +   */
500 +  function marketplace_removeListing($listing_id, $status='DEFAULT') {
501 +    return $this->call_method('facebook.marketplace.removeListing',
502 +                              array('listing_id'=>$listing_id,
503 +                                    'status'=>$status));
504 +  }
505 +
506 +  /**
507 +   * Create/modify a Marketplace listing for the loggedinuser
508 +   *
509 +   * @param int              listing_id   The id of a listing to be modified, 0 for a new listing.
510 +   * @param show_on_profile  bool         Should we show this listing on the user's profile
511 +   * @param listing_attrs    array        An array of the listing data
512 +   * @return                 int          The listing_id (unchanged if modifying an existing listing)
513 +   */
514 +  function marketplace_createListing($listing_id, $show_on_profile, $attrs) {
515 +    return $this->call_method('facebook.marketplace.createListing',
516 +                              array('listing_id'=>$listing_id,
517 +                                    'show_on_profile'=>$show_on_profile,
518 +                                    'listing_attrs'=>json_encode($attrs)));
519 +  }
520 +
521 +
522 +  /////////////////////////////////////////////////////////////////////////////
523 +  // Data Store API
524 +
525 +  /**
526 +   * Set a user preference.
527 +   *
528 +   * @param  pref_id    preference identifier (0-200)
529 +   * @param  value      preferece's value
530 +   * @error
531 +   *    API_EC_DATA_DATABASE_ERROR
532 +   *    API_EC_PARAM
533 +   *    API_EC_DATA_QUOTA_EXCEEDED
534 +   *    API_EC_DATA_UNKNOWN_ERROR
535 +   */
536 +  public function data_setUserPreference($pref_id, $value) {
537 +    return $this->call_method
538 +      ('facebook.data.setUserPreference',
539 +       array('pref_id' => $pref_id,
540 +             'value' => $value));
541 +  }
542 +
543 +  /**
544 +   * Set a user's all preferences for this application.
545 +   *
546 +   * @param  values     preferece values in an associative arrays
547 +   * @param  replace    whether to replace all existing preferences or
548 +   *                    merge into them.
549 +   * @error
550 +   *    API_EC_DATA_DATABASE_ERROR
551 +   *    API_EC_PARAM
552 +   *    API_EC_DATA_QUOTA_EXCEEDED
553 +   *    API_EC_DATA_UNKNOWN_ERROR
554 +   */
555 +  public function data_setUserPreferences($values, $replace = false) {
556 +    return $this->call_method
557 +      ('facebook.data.setUserPreferences',
558 +       array('values' => json_encode($values),
559 +             'replace' => $replace));
560 +  }
561 +
562 +  /**
563 +   * Get a user preference.
564 +   *
565 +   * @param  pref_id    preference identifier (0-200)
566 +   * @return            preference's value
567 +   * @error
568 +   *    API_EC_DATA_DATABASE_ERROR
569 +   *    API_EC_PARAM
570 +   *    API_EC_DATA_QUOTA_EXCEEDED
571 +   *    API_EC_DATA_UNKNOWN_ERROR
572 +   */
573 +  public function data_getUserPreference($pref_id) {
574 +    return $this->call_method
575 +      ('facebook.data.getUserPreference',
576 +       array('pref_id' => $pref_id));
577 +  }
578 +
579 +  /**
580 +   * Get a user preference.
581 +   *
582 +   * @return           preference values
583 +   * @error
584 +   *    API_EC_DATA_DATABASE_ERROR
585 +   *    API_EC_DATA_QUOTA_EXCEEDED
586 +   *    API_EC_DATA_UNKNOWN_ERROR
587 +   */
588 +  public function data_getUserPreferences() {
589 +    return $this->call_method
590 +      ('facebook.data.getUserPreferences',
591 +       array());
592 +  }
593 +
594 +  /**
595 +   * Create a new object type.
596 +   *
597 +   * @param  name       object type's name
598 +   * @error
599 +   *    API_EC_DATA_DATABASE_ERROR
600 +   *    API_EC_DATA_OBJECT_ALREADY_EXISTS
601 +   *    API_EC_PARAM
602 +   *    API_EC_PERMISSION
603 +   *    API_EC_DATA_INVALID_OPERATION
604 +   *    API_EC_DATA_QUOTA_EXCEEDED
605 +   *    API_EC_DATA_UNKNOWN_ERROR
606 +   */
607 +  public function data_createObjectType($name) {
608 +    return $this->call_method
609 +      ('facebook.data.createObjectType',
610 +       array('name' => $name));
611 +  }
612 +
613 +  /**
614 +   * Delete an object type.
615 +   *
616 +   * @param  obj_type       object type's name
617 +   * @error
618 +   *    API_EC_DATA_DATABASE_ERROR
619 +   *    API_EC_DATA_OBJECT_NOT_FOUND
620 +   *    API_EC_PARAM
621 +   *    API_EC_PERMISSION
622 +   *    API_EC_DATA_INVALID_OPERATION
623 +   *    API_EC_DATA_QUOTA_EXCEEDED
624 +   *    API_EC_DATA_UNKNOWN_ERROR
625 +   */
626 +  public function data_dropObjectType($obj_type) {
627 +    return $this->call_method
628 +      ('facebook.data.dropObjectType',
629 +       array('obj_type' => $obj_type));
630 +  }
631 +
632 +  /**
633 +   * Rename an object type.
634 +   *
635 +   * @param  obj_type       object type's name
636 +   * @param  new_name       new object type's name
637 +   * @error
638 +   *    API_EC_DATA_DATABASE_ERROR
639 +   *    API_EC_DATA_OBJECT_NOT_FOUND
640 +   *    API_EC_DATA_OBJECT_ALREADY_EXISTS
641 +   *    API_EC_PARAM
642 +   *    API_EC_PERMISSION
643 +   *    API_EC_DATA_INVALID_OPERATION
644 +   *    API_EC_DATA_QUOTA_EXCEEDED
645 +   *    API_EC_DATA_UNKNOWN_ERROR
646 +   */
647 +  public function data_renameObjectType($obj_type, $new_name) {
648 +    return $this->call_method
649 +      ('facebook.data.renameObjectType',
650 +       array('obj_type' => $obj_type,
651 +             'new_name' => $new_name));
652 +  }
653 +
654 +  /**
655 +   * Add a new property to an object type.
656 +   *
657 +   * @param  obj_type       object type's name
658 +   * @param  prop_name      name of the property to add
659 +   * @param  prop_type      1: integer; 2: string; 3: text blob
660 +   * @error
661 +   *    API_EC_DATA_DATABASE_ERROR
662 +   *    API_EC_DATA_OBJECT_ALREADY_EXISTS
663 +   *    API_EC_PARAM
664 +   *    API_EC_PERMISSION
665 +   *    API_EC_DATA_INVALID_OPERATION
666 +   *    API_EC_DATA_QUOTA_EXCEEDED
667 +   *    API_EC_DATA_UNKNOWN_ERROR
668 +   */
669 +  public function data_defineObjectProperty($obj_type, $prop_name, $prop_type) {
670 +    return $this->call_method
671 +      ('facebook.data.defineObjectProperty',
672 +       array('obj_type' => $obj_type,
673 +             'prop_name' => $prop_name,
674 +             'prop_type' => $prop_type));
675 +  }
676 +
677 +  /**
678 +   * Remove a previously defined property from an object type.
679 +   *
680 +   * @param  obj_type      object type's name
681 +   * @param  prop_name     name of the property to remove
682 +   * @error
683 +   *    API_EC_DATA_DATABASE_ERROR
684 +   *    API_EC_DATA_OBJECT_NOT_FOUND
685 +   *    API_EC_PARAM
686 +   *    API_EC_PERMISSION
687 +   *    API_EC_DATA_INVALID_OPERATION
688 +   *    API_EC_DATA_QUOTA_EXCEEDED
689 +   *    API_EC_DATA_UNKNOWN_ERROR
690 +   */
691 +  public function data_undefineObjectProperty($obj_type, $prop_name) {
692 +    return $this->call_method
693 +      ('facebook.data.undefineObjectProperty',
694 +       array('obj_type' => $obj_type,
695 +             'prop_name' => $prop_name));
696 +  }
697 +
698 +  /**
699 +   * Rename a previously defined property of an object type.
700 +   *
701 +   * @param  obj_type      object type's name
702 +   * @param  prop_name     name of the property to rename
703 +   * @param  new_name      new name to use
704 +   * @error
705 +   *    API_EC_DATA_DATABASE_ERROR
706 +   *    API_EC_DATA_OBJECT_NOT_FOUND
707 +   *    API_EC_DATA_OBJECT_ALREADY_EXISTS
708 +   *    API_EC_PARAM
709 +   *    API_EC_PERMISSION
710 +   *    API_EC_DATA_INVALID_OPERATION
711 +   *    API_EC_DATA_QUOTA_EXCEEDED
712 +   *    API_EC_DATA_UNKNOWN_ERROR
713 +   */
714 +  public function data_renameObjectProperty($obj_type, $prop_name,
715 +                                            $new_name) {
716 +    return $this->call_method
717 +      ('facebook.data.renameObjectProperty',
718 +       array('obj_type' => $obj_type,
719 +             'prop_name' => $prop_name,
720 +             'new_name' => $new_name));
721 +  }
722 +
723 +  /**
724 +   * Retrieve a list of all object types that have defined for the application.
725 +   *
726 +   * @return               a list of object type names
727 +   * @error
728 +   *    API_EC_DATA_DATABASE_ERROR
729 +   *    API_EC_PERMISSION
730 +   *    API_EC_DATA_QUOTA_EXCEEDED
731 +   *    API_EC_DATA_UNKNOWN_ERROR
732 +   */
733 +  public function data_getObjectTypes() {
734 +    return $this->call_method
735 +      ('facebook.data.getObjectTypes',
736 +       array());
737 +  }
738 +
739 +  /**
740 +   * Get definitions of all properties of an object type.
741 +   *
742 +   * @param obj_type       object type's name
743 +   * @return               pairs of property name and property types
744 +   * @error
745 +   *    API_EC_DATA_DATABASE_ERROR
746 +   *    API_EC_PARAM
747 +   *    API_EC_PERMISSION
748 +   *    API_EC_DATA_OBJECT_NOT_FOUND
749 +   *    API_EC_DATA_QUOTA_EXCEEDED
750 +   *    API_EC_DATA_UNKNOWN_ERROR
751 +   */
752 +  public function data_getObjectType($obj_type) {
753 +    return $this->call_method
754 +      ('facebook.data.getObjectType',
755 +       array('obj_type' => $obj_type));
756 +  }
757 +
758 +  /**
759 +   * Create a new object.
760 +   *
761 +   * @param  obj_type      object type's name
762 +   * @param  properties    (optional) properties to set initially
763 +   * @return               newly created object's id
764 +   * @error
765 +   *    API_EC_DATA_DATABASE_ERROR
766 +   *    API_EC_PARAM
767 +   *    API_EC_PERMISSION
768 +   *    API_EC_DATA_INVALID_OPERATION
769 +   *    API_EC_DATA_QUOTA_EXCEEDED
770 +   *    API_EC_DATA_UNKNOWN_ERROR
771 +   */
772 +  public function data_createObject($obj_type, $properties = null) {
773 +    return $this->call_method
774 +      ('facebook.data.createObject',
775 +       array('obj_type' => $obj_type,
776 +             'properties' => json_encode($properties)));
777 +  }
778 +
779 +  /**
780 +   * Update an existing object.
781 +   *
782 +   * @param  obj_id        object's id
783 +   * @param  properties    new properties
784 +   * @param  replace       true for replacing existing properties; false for merging
785 +   * @error
786 +   *    API_EC_DATA_DATABASE_ERROR
787 +   *    API_EC_DATA_OBJECT_NOT_FOUND
788 +   *    API_EC_PARAM
789 +   *    API_EC_PERMISSION
790 +   *    API_EC_DATA_INVALID_OPERATION
791 +   *    API_EC_DATA_QUOTA_EXCEEDED
792 +   *    API_EC_DATA_UNKNOWN_ERROR
793 +   */
794 +  public function data_updateObject($obj_id, $properties, $replace = false) {
795 +    return $this->call_method
796 +      ('facebook.data.updateObject',
797 +       array('obj_id' => $obj_id,
798 +             'properties' => json_encode($properties),
799 +             'replace' => $replace));
800 +  }
801 +
802 +  /**
803 +   * Delete an existing object.
804 +   *
805 +   * @param  obj_id        object's id
806 +   * @error
807 +   *    API_EC_DATA_DATABASE_ERROR
808 +   *    API_EC_DATA_OBJECT_NOT_FOUND
809 +   *    API_EC_PARAM
810 +   *    API_EC_PERMISSION
811 +   *    API_EC_DATA_INVALID_OPERATION
812 +   *    API_EC_DATA_QUOTA_EXCEEDED
813 +   *    API_EC_DATA_UNKNOWN_ERROR
814 +   */
815 +  public function data_deleteObject($obj_id) {
816 +    return $this->call_method
817 +      ('facebook.data.deleteObject',
818 +       array('obj_id' => $obj_id));
819 +  }
820 +
821 +  /**
822 +   * Delete a list of objects.
823 +   *
824 +   * @param  obj_ids       objects to delete
825 +   * @error
826 +   *    API_EC_DATA_DATABASE_ERROR
827 +   *    API_EC_PARAM
828 +   *    API_EC_PERMISSION
829 +   *    API_EC_DATA_INVALID_OPERATION
830 +   *    API_EC_DATA_QUOTA_EXCEEDED
831 +   *    API_EC_DATA_UNKNOWN_ERROR
832 +   */
833 +  public function data_deleteObjects($obj_ids) {
834 +    return $this->call_method
835 +      ('facebook.data.deleteObjects',
836 +       array('obj_ids' => json_encode($obj_ids)));
837 +  }
838 +
839 +  /**
840 +   * Get a single property value of an object.
841 +   *
842 +   * @param  obj_id        object's id
843 +   * @param  prop_name     individual property's name
844 +   * @return               individual property's value
845 +   * @error
846 +   *    API_EC_DATA_DATABASE_ERROR
847 +   *    API_EC_DATA_OBJECT_NOT_FOUND
848 +   *    API_EC_PARAM
849 +   *    API_EC_PERMISSION
850 +   *    API_EC_DATA_INVALID_OPERATION
851 +   *    API_EC_DATA_QUOTA_EXCEEDED
852 +   *    API_EC_DATA_UNKNOWN_ERROR
853 +   */
854 +  public function data_getObjectProperty($obj_id, $prop_name) {
855 +    return $this->call_method
856 +      ('facebook.data.getObjectProperty',
857 +       array('obj_id' => $obj_id,
858 +             'prop_name' => $prop_name));
859 +  }
860 +
861 +  /**
862 +   * Get properties of an object.
863 +   *
864 +   * @param  obj_id      object's id
865 +   * @param  prop_names  (optional) properties to return; null for all.
866 +   * @return             specified properties of an object
867 +   * @error
868 +   *    API_EC_DATA_DATABASE_ERROR
869 +   *    API_EC_DATA_OBJECT_NOT_FOUND
870 +   *    API_EC_PARAM
871 +   *    API_EC_PERMISSION
872 +   *    API_EC_DATA_INVALID_OPERATION
873 +   *    API_EC_DATA_QUOTA_EXCEEDED
874 +   *    API_EC_DATA_UNKNOWN_ERROR
875 +   */
876 +  public function data_getObject($obj_id, $prop_names = null) {
877 +    return $this->call_method
878 +      ('facebook.data.getObject',
879 +       array('obj_id' => $obj_id,
880 +             'prop_names' => json_encode($prop_names)));
881 +  }
882 +
883 +  /**
884 +   * Get properties of a list of objects.
885 +   *
886 +   * @param  obj_ids     object ids
887 +   * @param  prop_names  (optional) properties to return; null for all.
888 +   * @return             specified properties of an object
889 +   * @error
890 +   *    API_EC_DATA_DATABASE_ERROR
891 +   *    API_EC_DATA_OBJECT_NOT_FOUND
892 +   *    API_EC_PARAM
893 +   *    API_EC_PERMISSION
894 +   *    API_EC_DATA_INVALID_OPERATION
895 +   *    API_EC_DATA_QUOTA_EXCEEDED
896 +   *    API_EC_DATA_UNKNOWN_ERROR
897 +   */
898 +  public function data_getObjects($obj_ids, $prop_names = null) {
899 +    return $this->call_method
900 +      ('facebook.data.getObjects',
901 +       array('obj_ids' => json_encode($obj_ids),
902 +             'prop_names' => json_encode($prop_names)));
903 +  }
904 +
905 +  /**
906 +   * Set a single property value of an object.
907 +   *
908 +   * @param  obj_id        object's id
909 +   * @param  prop_name     individual property's name
910 +   * @param  prop_value    new value to set
911 +   * @error
912 +   *    API_EC_DATA_DATABASE_ERROR
913 +   *    API_EC_DATA_OBJECT_NOT_FOUND
914 +   *    API_EC_PARAM
915 +   *    API_EC_PERMISSION
916 +   *    API_EC_DATA_INVALID_OPERATION
917 +   *    API_EC_DATA_QUOTA_EXCEEDED
918 +   *    API_EC_DATA_UNKNOWN_ERROR
919 +   */
920 +  public function data_setObjectProperty($obj_id, $prop_name,
921 +                                         $prop_value) {
922 +    return $this->call_method
923 +      ('facebook.data.setObjectProperty',
924 +       array('obj_id' => $obj_id,
925 +             'prop_name' => $prop_name,
926 +             'prop_value' => $prop_value));
927 +  }
928 +
929 +  /**
930 +   * Read hash value by key.
931 +   *
932 +   * @param  obj_type      object type's name
933 +   * @param  key           hash key
934 +   * @param  prop_name     (optional) individual property's name
935 +   * @return               hash value
936 +   * @error
937 +   *    API_EC_DATA_DATABASE_ERROR
938 +   *    API_EC_PARAM
939 +   *    API_EC_PERMISSION
940 +   *    API_EC_DATA_INVALID_OPERATION
941 +   *    API_EC_DATA_QUOTA_EXCEEDED
942 +   *    API_EC_DATA_UNKNOWN_ERROR
943 +   */
944 +  public function data_getHashValue($obj_type, $key, $prop_name = null) {
945 +    return $this->call_method
946 +      ('facebook.data.getHashValue',
947 +       array('obj_type' => $obj_type,
948 +             'key' => $key,
949 +             'prop_name' => $prop_name));
950 +  }
951 +
952 +  /**
953 +   * Write hash value by key.
954 +   *
955 +   * @param  obj_type      object type's name
956 +   * @param  key           hash key
957 +   * @param  value         hash value
958 +   * @param  prop_name     (optional) individual property's name
959 +   * @error
960 +   *    API_EC_DATA_DATABASE_ERROR
961 +   *    API_EC_PARAM
962 +   *    API_EC_PERMISSION
963 +   *    API_EC_DATA_INVALID_OPERATION
964 +   *    API_EC_DATA_QUOTA_EXCEEDED
965 +   *    API_EC_DATA_UNKNOWN_ERROR
966 +   */
967 +  public function data_setHashValue($obj_type, $key, $value, $prop_name = null) {
968 +    return $this->call_method
969 +      ('facebook.data.setHashValue',
970 +       array('obj_type' => $obj_type,
971 +             'key' => $key,
972 +             'value' => $value,
973 +             'prop_name' => $prop_name));
974 +  }
975 +
976 +  /**
977 +   * Increase a hash value by specified increment atomically.
978 +   *
979 +   * @param  obj_type      object type's name
980 +   * @param  key           hash key
981 +   * @param  prop_name     individual property's name
982 +   * @param  increment     (optional) default is 1
983 +   * @return               incremented hash value
984 +   * @error
985 +   *    API_EC_DATA_DATABASE_ERROR
986 +   *    API_EC_PARAM
987 +   *    API_EC_PERMISSION
988 +   *    API_EC_DATA_INVALID_OPERATION
989 +   *    API_EC_DATA_QUOTA_EXCEEDED
990 +   *    API_EC_DATA_UNKNOWN_ERROR
991 +   */
992 +  public function data_incHashValue($obj_type, $key, $prop_name, $increment = 1) {
993 +    return $this->call_method
994 +      ('facebook.data.incHashValue',
995 +       array('obj_type' => $obj_type,
996 +             'key' => $key,
997 +             'prop_name' => $prop_name,
998 +             'increment' => $increment));
999 +  }
1000 +
1001 +  /**
1002 +   * Remove a hash key and its values.
1003 +   *
1004 +   * @param  obj_type    object type's name
1005 +   * @param  key         hash key
1006 +   * @error
1007 +   *    API_EC_DATA_DATABASE_ERROR
1008 +   *    API_EC_PARAM
1009 +   *    API_EC_PERMISSION
1010 +   *    API_EC_DATA_INVALID_OPERATION
1011 +   *    API_EC_DATA_QUOTA_EXCEEDED
1012 +   *    API_EC_DATA_UNKNOWN_ERROR
1013 +   */
1014 +  public function data_removeHashKey($obj_type, $key) {
1015 +    return $this->call_method
1016 +      ('facebook.data.removeHashKey',
1017 +       array('obj_type' => $obj_type,
1018 +             'key' => $key));
1019 +  }
1020 +
1021 +  /**
1022 +   * Remove hash keys and their values.
1023 +   *
1024 +   * @param  obj_type    object type's name
1025 +   * @param  keys        hash keys
1026 +   * @error
1027 +   *    API_EC_DATA_DATABASE_ERROR
1028 +   *    API_EC_PARAM
1029 +   *    API_EC_PERMISSION
1030 +   *    API_EC_DATA_INVALID_OPERATION
1031 +   *    API_EC_DATA_QUOTA_EXCEEDED
1032 +   *    API_EC_DATA_UNKNOWN_ERROR
1033 +   */
1034 +  public function data_removeHashKeys($obj_type, $keys) {
1035 +    return $this->call_method
1036 +      ('facebook.data.removeHashKeys',
1037 +       array('obj_type' => $obj_type,
1038 +             'keys' => json_encode($keys)));
1039 +  }
1040 +
1041 +
1042 +  /**
1043 +   * Define an object association.
1044 +   *
1045 +   * @param  name        name of this association
1046 +   * @param  assoc_type  1: one-way 2: two-way symmetric 3: two-way asymmetric
1047 +   * @param  assoc_info1 needed info about first object type
1048 +   * @param  assoc_info2 needed info about second object type
1049 +   * @param  inverse     (optional) name of reverse association
1050 +   * @error
1051 +   *    API_EC_DATA_DATABASE_ERROR
1052 +   *    API_EC_DATA_OBJECT_ALREADY_EXISTS
1053 +   *    API_EC_PARAM
1054 +   *    API_EC_PERMISSION
1055 +   *    API_EC_DATA_INVALID_OPERATION
1056 +   *    API_EC_DATA_QUOTA_EXCEEDED
1057 +   *    API_EC_DATA_UNKNOWN_ERROR
1058 +   */
1059 +  public function data_defineAssociation($name, $assoc_type, $assoc_info1,
1060 +                                         $assoc_info2, $inverse = null) {
1061 +    return $this->call_method
1062 +      ('facebook.data.defineAssociation',
1063 +       array('name' => $name,
1064 +             'assoc_type' => $assoc_type,
1065 +             'assoc_info1' => json_encode($assoc_info1),
1066 +             'assoc_info2' => json_encode($assoc_info2),
1067 +             'inverse' => $inverse));
1068 +  }
1069 +
1070 +  /**
1071 +   * Undefine an object association.
1072 +   *
1073 +   * @param  name        name of this association
1074 +   * @error
1075 +   *    API_EC_DATA_DATABASE_ERROR
1076 +   *    API_EC_DATA_OBJECT_NOT_FOUND
1077 +   *    API_EC_PARAM
1078 +   *    API_EC_PERMISSION
1079 +   *    API_EC_DATA_INVALID_OPERATION
1080 +   *    API_EC_DATA_QUOTA_EXCEEDED
1081 +   *    API_EC_DATA_UNKNOWN_ERROR
1082 +   */
1083 +  public function data_undefineAssociation($name) {
1084 +    return $this->call_method
1085 +      ('facebook.data.undefineAssociation',
1086 +       array('name' => $name));
1087 +  }
1088 +
1089 +  /**
1090 +   * Rename an object association or aliases.
1091 +   *
1092 +   * @param  name        name of this association
1093 +   * @param  new_name    (optional) new name of this association
1094 +   * @param  new_alias1  (optional) new alias for object type 1
1095 +   * @param  new_alias2  (optional) new alias for object type 2
1096 +   * @error
1097 +   *    API_EC_DATA_DATABASE_ERROR
1098 +   *    API_EC_DATA_OBJECT_ALREADY_EXISTS
1099 +   *    API_EC_DATA_OBJECT_NOT_FOUND
1100 +   *    API_EC_PARAM
1101 +   *    API_EC_PERMISSION
1102 +   *    API_EC_DATA_INVALID_OPERATION
1103 +   *    API_EC_DATA_QUOTA_EXCEEDED
1104 +   *    API_EC_DATA_UNKNOWN_ERROR
1105 +   */
1106 +  public function data_renameAssociation($name, $new_name, $new_alias1 = null,
1107 +                                         $new_alias2 = null) {
1108 +    return $this->call_method
1109 +      ('facebook.data.renameAssociation',
1110 +       array('name' => $name,
1111 +             'new_name' => $new_name,
1112 +             'new_alias1' => $new_alias1,
1113 +             'new_alias2' => $new_alias2));
1114 +  }
1115 +
1116 +  /**
1117 +   * Get definition of an object association.
1118 +   *
1119 +   * @param  name        name of this association
1120 +   * @return             specified association
1121 +   * @error
1122 +   *    API_EC_DATA_DATABASE_ERROR
1123 +   *    API_EC_DATA_OBJECT_NOT_FOUND
1124 +   *    API_EC_PARAM
1125 +   *    API_EC_PERMISSION
1126 +   *    API_EC_DATA_QUOTA_EXCEEDED
1127 +   *    API_EC_DATA_UNKNOWN_ERROR
1128 +   */
1129 +  public function data_getAssociationDefinition($name) {
1130 +    return $this->call_method
1131 +      ('facebook.data.getAssociationDefinition',
1132 +       array('name' => $name));
1133 +  }
1134 +
1135 +  /**
1136 +   * Get definition of all associations.
1137 +   *
1138 +   * @return             all defined associations
1139 +   * @error
1140 +   *    API_EC_DATA_DATABASE_ERROR
1141 +   *    API_EC_PERMISSION
1142 +   *    API_EC_DATA_QUOTA_EXCEEDED
1143 +   *    API_EC_DATA_UNKNOWN_ERROR
1144 +   */
1145 +  public function data_getAssociationDefinitions() {
1146 +    return $this->call_method
1147 +      ('facebook.data.getAssociationDefinitions',
1148 +       array());
1149 +  }
1150 +
1151 +  /**
1152 +   * Create or modify an association between two objects.
1153 +   *
1154 +   * @param  name        name of association
1155 +   * @param  obj_id1     id of first object
1156 +   * @param  obj_id2     id of second object
1157 +   * @param  data        (optional) extra string data to store
1158 +   * @param  assoc_time  (optional) extra time data; default to creation time
1159 +   * @error
1160 +   *    API_EC_DATA_DATABASE_ERROR
1161 +   *    API_EC_PARAM
1162 +   *    API_EC_PERMISSION
1163 +   *    API_EC_DATA_INVALID_OPERATION
1164 +   *    API_EC_DATA_QUOTA_EXCEEDED
1165 +   *    API_EC_DATA_UNKNOWN_ERROR
1166 +   */
1167 +  public function data_setAssociation($name, $obj_id1, $obj_id2, $data = null,
1168 +                                      $assoc_time = null) {
1169 +    return $this->call_method
1170 +      ('facebook.data.setAssociation',
1171 +       array('name' => $name,
1172 +             'obj_id1' => $obj_id1,
1173 +             'obj_id2' => $obj_id2,
1174 +             'data' => $data,
1175 +             'assoc_time' => $assoc_time));
1176 +  }
1177 +
1178 +  /**
1179 +   * Create or modify associations between objects.
1180 +   *
1181 +   * @param  assocs      associations to set
1182 +   * @param  name        (optional) name of association
1183 +   * @error
1184 +   *    API_EC_DATA_DATABASE_ERROR
1185 +   *    API_EC_PARAM
1186 +   *    API_EC_PERMISSION
1187 +   *    API_EC_DATA_INVALID_OPERATION
1188 +   *    API_EC_DATA_QUOTA_EXCEEDED
1189 +   *    API_EC_DATA_UNKNOWN_ERROR
1190 +   */
1191 +  public function data_setAssociations($assocs, $name = null) {
1192 +    return $this->call_method
1193 +      ('facebook.data.setAssociations',
1194 +       array('assocs' => json_encode($assocs),
1195 +             'name' => $name));
1196 +  }
1197 +
1198 +  /**
1199 +   * Remove an association between two objects.
1200 +   *
1201 +   * @param  name        name of association
1202 +   * @param  obj_id1     id of first object
1203 +   * @param  obj_id2     id of second object
1204 +   * @error
1205 +   *    API_EC_DATA_DATABASE_ERROR
1206 +   *    API_EC_DATA_OBJECT_NOT_FOUND
1207 +   *    API_EC_PARAM
1208 +   *    API_EC_PERMISSION
1209 +   *    API_EC_DATA_QUOTA_EXCEEDED
1210 +   *    API_EC_DATA_UNKNOWN_ERROR
1211 +   */
1212 +  public function data_removeAssociation($name, $obj_id1, $obj_id2) {
1213 +    return $this->call_method
1214 +      ('facebook.data.removeAssociation',
1215 +       array('name' => $name,
1216 +             'obj_id1' => $obj_id1,
1217 +             'obj_id2' => $obj_id2));
1218 +  }
1219 +
1220 +  /**
1221 +   * Remove associations between objects by specifying pairs of object ids.
1222 +   *
1223 +   * @param  assocs      associations to remove
1224 +   * @param  name        (optional) name of association
1225 +   * @error
1226 +   *    API_EC_DATA_DATABASE_ERROR
1227 +   *    API_EC_DATA_OBJECT_NOT_FOUND
1228 +   *    API_EC_PARAM
1229 +   *    API_EC_PERMISSION
1230 +   *    API_EC_DATA_QUOTA_EXCEEDED
1231 +   *    API_EC_DATA_UNKNOWN_ERROR
1232 +   */
1233 +  public function data_removeAssociations($assocs, $name = null) {
1234 +    return $this->call_method
1235 +      ('facebook.data.removeAssociations',
1236 +       array('assocs' => json_encode($assocs),
1237 +             'name' => $name));
1238 +  }
1239 +
1240 +  /**
1241 +   * Remove associations between objects by specifying one object id.
1242 +   *
1243 +   * @param  name        name of association
1244 +   * @param  obj_id      who's association to remove
1245 +   * @error
1246 +   *    API_EC_DATA_DATABASE_ERROR
1247 +   *    API_EC_DATA_OBJECT_NOT_FOUND
1248 +   *    API_EC_PARAM
1249 +   *    API_EC_PERMISSION
1250 +   *    API_EC_DATA_INVALID_OPERATION
1251 +   *    API_EC_DATA_QUOTA_EXCEEDED
1252 +   *    API_EC_DATA_UNKNOWN_ERROR
1253 +   */
1254 +  public function data_removeAssociatedObjects($name, $obj_id) {
1255 +    return $this->call_method
1256 +      ('facebook.data.removeAssociatedObjects',
1257 +       array('name' => $name,
1258 +             'obj_id' => $obj_id));
1259 +  }
1260 +
1261 +  /**
1262 +   * Retrieve a list of associated objects.
1263 +   *
1264 +   * @param  name        name of association
1265 +   * @param  obj_id      who's association to retrieve
1266 +   * @param  no_data     only return object ids
1267 +   * @return             associated objects
1268 +   * @error
1269 +   *    API_EC_DATA_DATABASE_ERROR
1270 +   *    API_EC_DATA_OBJECT_NOT_FOUND
1271 +   *    API_EC_PARAM
1272 +   *    API_EC_PERMISSION
1273 +   *    API_EC_DATA_INVALID_OPERATION
1274 +   *    API_EC_DATA_QUOTA_EXCEEDED
1275 +   *    API_EC_DATA_UNKNOWN_ERROR
1276 +   */
1277 +  public function data_getAssociatedObjects($name, $obj_id, $no_data = true) {
1278 +    return $this->call_method
1279 +      ('facebook.data.getAssociatedObjects',
1280 +       array('name' => $name,
1281 +             'obj_id' => $obj_id,
1282 +             'no_data' => $no_data));
1283 +  }
1284 +
1285 +  /**
1286 +   * Count associated objects.
1287 +   *
1288 +   * @param  name        name of association
1289 +   * @param  obj_id      who's association to retrieve
1290 +   * @return             associated object's count
1291 +   * @error
1292 +   *    API_EC_DATA_DATABASE_ERROR
1293 +   *    API_EC_DATA_OBJECT_NOT_FOUND
1294 +   *    API_EC_PARAM
1295 +   *    API_EC_PERMISSION
1296 +   *    API_EC_DATA_INVALID_OPERATION
1297 +   *    API_EC_DATA_QUOTA_EXCEEDED
1298 +   *    API_EC_DATA_UNKNOWN_ERROR
1299 +   */
1300 +  public function data_getAssociatedObjectCount($name, $obj_id) {
1301 +    return $this->call_method
1302 +      ('facebook.data.getAssociatedObjectCount',
1303 +       array('name' => $name,
1304 +             'obj_id' => $obj_id));
1305 +  }
1306 +
1307 +  /**
1308 +   * Get a list of associated object counts.
1309 +   *
1310 +   * @param  name        name of association
1311 +   * @param  obj_ids     whose association to retrieve
1312 +   * @return             associated object counts
1313 +   * @error
1314 +   *    API_EC_DATA_DATABASE_ERROR
1315 +   *    API_EC_DATA_OBJECT_NOT_FOUND
1316 +   *    API_EC_PARAM
1317 +   *    API_EC_PERMISSION
1318 +   *    API_EC_DATA_INVALID_OPERATION
1319 +   *    API_EC_DATA_QUOTA_EXCEEDED
1320 +   *    API_EC_DATA_UNKNOWN_ERROR
1321 +   */
1322 +  public function data_getAssociatedObjectCounts($name, $obj_ids) {
1323 +    return $this->call_method
1324 +      ('facebook.data.getAssociatedObjectCounts',
1325 +       array('name' => $name,
1326 +             'obj_ids' => json_encode($obj_ids)));
1327 +  }
1328 +
1329 +  /**
1330 +   * Find all associations between two objects.
1331 +   *
1332 +   * @param  obj_id1     id of first object
1333 +   * @param  obj_id2     id of second object
1334 +   * @param  no_data     only return association names without data
1335 +   * @return             all associations between objects
1336 +   * @error
1337 +   *    API_EC_DATA_DATABASE_ERROR
1338 +   *    API_EC_PARAM
1339 +   *    API_EC_PERMISSION
1340 +   *    API_EC_DATA_QUOTA_EXCEEDED
1341 +   *    API_EC_DATA_UNKNOWN_ERROR
1342 +   */
1343 +  public function data_getAssociations($obj_id1, $obj_id2, $no_data = true) {
1344 +    return $this->call_method
1345 +      ('facebook.data.getAssociations',
1346 +       array('obj_id1' => $obj_id1,
1347 +             'obj_id2' => $obj_id2,
1348 +             'no_data' => $no_data));
1349 +  }
1350 +
1351 +  /**
1352 +   * Get the properties that you have set for an app.
1353 +   *
1354 +   * @param  properties  list of properties names to fetch
1355 +   * @return             a map from property name to value
1356 +   */
1357 +  public function admin_getAppProperties($properties) {
1358 +    return json_decode($this->call_method
1359 +                       ('facebook.admin.getAppProperties',
1360 +                        array('properties' => json_encode($properties))), true);
1361 +  }
1362 +
1363 +  /**
1364 +   * Set properties for an app.
1365 +   *
1366 +   * @param  properties  a map from property names to  values
1367 +   * @return             true on success
1368 +   */
1369 +  public function admin_setAppProperties($properties) {
1370 +    return $this->call_method
1371 +      ('facebook.admin.setAppProperties',
1372 +       array('properties' => json_encode($properties)));
1373 +  }
1374 +
1375 +
1376 +
1377    /* UTILITY FUNCTIONS */
1378  
1379    public function call_method($method, $params) {
# Line 484 | Line 1485 | function toggleDisplay(id, type) {
1485        return $arr;
1486      } else {
1487        return (string)$sxml;
1488 <    }
1488 >    }
1489    }
1490   }
1491  
# Line 535 | Line 1536 | class FacebookAPIErrorCodes {
1536    const FQL_EC_UNKNOWN_FIELD = 602;
1537    const FQL_EC_UNKNOWN_TABLE = 603;
1538    const FQL_EC_NOT_INDEXABLE = 604;
1539 <
1539 >
1540 >  /**
1541 >   * DATA STORE API ERRORS
1542 >   */
1543 >  const API_EC_DATA_UNKNOWN_ERROR = 800;
1544 >  const API_EC_DATA_INVALID_OPERATION = 801;
1545 >  const API_EC_DATA_QUOTA_EXCEEDED = 802;
1546 >  const API_EC_DATA_OBJECT_NOT_FOUND = 803;
1547 >  const API_EC_DATA_OBJECT_ALREADY_EXISTS = 804;
1548 >  const API_EC_DATA_DATABASE_ERROR = 805;
1549 >
1550    public static $api_error_descriptions = array(
1551        API_EC_SUCCESS           => 'Success',
1552        API_EC_UNKNOWN           => 'An unknown error occurred',
# Line 562 | Line 1573 | class FacebookAPIErrorCodes {
1573        FQL_EC_NOT_INDEXABLE     => 'FQL: Statement not indexable',
1574        FQL_EC_UNKNOWN_FUNCTION  => 'FQL: Attempted to call unknown function',
1575        FQL_EC_INVALID_PARAM     => 'FQL: Invalid parameter passed in',
1576 +      API_EC_DATA_UNKNOWN_ERROR => 'Unknown data store API error',
1577 +      API_EC_DATA_INVALID_OPERATION => 'Invalid operation',
1578 +      API_EC_DATA_QUOTA_EXCEEDED => 'Data store allowable quota was exceeded',
1579 +      API_EC_DATA_OBJECT_NOT_FOUND => 'Specified object cannot be found',
1580 +      API_EC_DATA_OBJECT_ALREADY_EXISTS => 'Specified object already exists',
1581 +      API_EC_DATA_DATABASE_ERROR => 'A database error occurred. Please try again',
1582    );
1583   }
1584  
# Line 593 | Line 1610 | $profile_field_array = array(
1610      "quotes",
1611      "relationship_status",
1612      "religion",
1613 <    "sex",
1613 >    "sex",
1614      "significant_other_id",
1615      "status",
1616      "timezone",
1617      "tv",
1618 <    "wall_count",
1618 >    "wall_count",
1619      "work_history");
1620   ?>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines