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) { |
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 |
|
*/ |
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 |
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 |
|
} |
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, |
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, |
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=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' => $title_data, |
193 |
> |
'title_data' => is_array($title_data) ? json_encode($title_data) : $title_data, |
194 |
|
'body_template' => $body_template, |
195 |
< |
'body_data' => $body_data, |
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, |
201 |
|
'image_3' => $image_3, |
202 |
|
'image_3_link' => $image_3_link, |
203 |
|
'image_4' => $image_4, |
204 |
< |
'image_4_link' => $image_4_link |
204 |
> |
'image_4_link' => $image_4_link, |
205 |
|
'target_ids' => $target_ids)); |
206 |
|
} |
207 |
|
|
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 |
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. |
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. |
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) { |
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 |
|
*/ |
287 |
|
} |
288 |
|
|
289 |
|
/** |
290 |
< |
* Sends a request to the specified user (e.g. "you have 1 event invitation") |
291 |
< |
* @param array $to_ids user ids to receive the request (must be friends with sender, capped at 10) |
292 |
< |
* @param string $type type of request, e.g. "event" (as in "You have an event invitation.") |
293 |
< |
* @param string $content fbml content of the request. really stripped down fbml - just |
294 |
< |
* text/names/links. also, use the special tag <fb:req-choice url="" label="" /> |
295 |
< |
* to specify the buttons to be included. |
296 |
< |
* @param string $image url of an image to show beside the request |
297 |
< |
* @param bool $invite whether to call it an "invitation" or a "request" |
298 |
< |
* @return string url which you should send the logged in user to to finalize the message. |
290 |
> |
* Returns the requested info fields for the requested set of pages |
291 |
> |
* @param array $page_ids an array of page ids |
292 |
> |
* @param array $fields an array of strings describing the info fields desired |
293 |
> |
* @param int $uid Optionally, limit results to pages of which this user is a fan. |
294 |
> |
* @param string type limits results to a particular type of page. |
295 |
> |
* @return array of pages |
296 |
> |
*/ |
297 |
> |
public function pages_getInfo($page_ids, $fields, $uid, $type) { |
298 |
> |
return $this->call_method('facebook.pages.getInfo', array('page_ids' => $page_ids, 'fields' => $fields, 'uid' => $uid, 'type' => $type)); |
299 |
> |
} |
300 |
> |
|
301 |
> |
/** |
302 |
> |
* Returns true if logged in user is an admin for the passed page |
303 |
> |
* @param int $page_id target page id |
304 |
> |
* @return boolean |
305 |
> |
*/ |
306 |
> |
public function pages_isAdmin($page_id) { |
307 |
> |
return $this->call_method('facebook.pages.isAdmin', array('page_id' => $page_id)); |
308 |
> |
} |
309 |
> |
|
310 |
> |
/** |
311 |
> |
* Returns whether or not the page corresponding to the current session object has the app installed |
312 |
> |
* @return boolean |
313 |
|
*/ |
314 |
< |
public function notifications_sendRequest($to_ids, $type, $content, $image, $invite) { |
315 |
< |
return $this->call_method('facebook.notifications.sendRequest', |
316 |
< |
array('to_ids' => $to_ids, 'type' => $type, 'content' => $content, |
317 |
< |
'image' => $image, 'invite' => $invite)); |
314 |
> |
public function pages_isAppAdded() { |
315 |
> |
if (isset($this->added)) { |
316 |
> |
return $this->added; |
317 |
> |
} |
318 |
> |
return $this->call_method('facebook.pages.isAppAdded', array()); |
319 |
> |
} |
320 |
> |
|
321 |
> |
/** |
322 |
> |
* Returns true if logged in user is a fan for the passed page |
323 |
> |
* @param int $page_id target page id |
324 |
> |
* @param int $uid user to compare. If empty, the logged in user. |
325 |
> |
* @return bool |
326 |
> |
*/ |
327 |
> |
public function pages_isFan($page_id, $uid) { |
328 |
> |
return $this->call_method('facebook.pages.isFan', array('page_id' => $page_id, 'uid' => $uid)); |
329 |
|
} |
330 |
|
|
331 |
|
/** |
332 |
|
* Returns photos according to the filters specified. |
333 |
|
* @param int $subj_id Optional: Filter by uid of user tagged in the photos. |
334 |
< |
* @param int $aid Optional: Filter by an album, as returned by |
334 |
> |
* @param int $aid Optional: Filter by an album, as returned by |
335 |
|
* photos_getAlbums. |
336 |
< |
* @param array $pids Optional: Restrict to a list of pids |
337 |
< |
* Note that at least one of these parameters needs to be specified, or an |
336 |
> |
* @param array $pids Optional: Restrict to a list of pids |
337 |
> |
* Note that at least one of these parameters needs to be specified, or an |
338 |
|
* error is returned. |
339 |
|
* @return array of photo objects. |
340 |
|
*/ |
341 |
|
public function photos_get($subj_id, $aid, $pids) { |
342 |
< |
return $this->call_method('facebook.photos.get', |
342 |
> |
return $this->call_method('facebook.photos.get', |
343 |
|
array('subj_id' => $subj_id, 'aid' => $aid, 'pids' => $pids)); |
344 |
|
} |
345 |
|
|
352 |
|
* @returns an array of album objects. |
353 |
|
*/ |
354 |
|
public function photos_getAlbums($uid, $aids) { |
355 |
< |
return $this->call_method('facebook.photos.getAlbums', |
355 |
> |
return $this->call_method('facebook.photos.getAlbums', |
356 |
|
array('uid' => $uid, |
357 |
|
'aids' => $aids)); |
358 |
|
} |
364 |
|
* and two floating-point numbers (xcoord, ycoord) for tag pixel location |
365 |
|
*/ |
366 |
|
public function photos_getTags($pids) { |
367 |
< |
return $this->call_method('facebook.photos.getTags', |
367 |
> |
return $this->call_method('facebook.photos.getTags', |
368 |
|
array('pids' => $pids)); |
369 |
|
} |
370 |
|
|
371 |
|
/** |
372 |
|
* Returns the requested info fields for the requested set of users |
373 |
< |
* @param array $uids an array of user ids |
373 |
> |
* @param array $uids an array of user ids |
374 |
|
* @param array $fields an array of strings describing the info fields desired |
375 |
|
* @return array of users |
376 |
|
*/ |
382 |
|
* Returns the user corresponding to the current session object. |
383 |
|
* @return integer uid |
384 |
|
*/ |
385 |
< |
public function users_getLoggedInUser(){ |
385 |
> |
public function users_getLoggedInUser() { |
386 |
|
return $this->call_method('facebook.users.getLoggedInUser', array()); |
387 |
|
} |
388 |
|
|
389 |
< |
|
390 |
< |
/** |
391 |
< |
* Returns whether or not the user corresponding to the current session object has the app installed |
392 |
< |
* @return boolean |
389 |
> |
|
390 |
> |
/** |
391 |
> |
* Returns whether or not the user corresponding to the current session object has the app installed |
392 |
> |
* @return boolean |
393 |
|
*/ |
394 |
|
public function users_isAppAdded() { |
395 |
|
if (isset($this->added)) { |
400 |
|
|
401 |
|
/** |
402 |
|
* Sets the FBML for the profile of the user attached to this session |
403 |
< |
* @param string $markup The FBML that describes the profile presence of this app for the user |
403 |
> |
* @param string $markup The FBML that describes the profile presence of this app for the user |
404 |
> |
* @param int $uid The user |
405 |
> |
* @param string $profile Profile FBML |
406 |
> |
* @param string $profile_action Profile action FBML |
407 |
> |
* @param string $mobile_profile Mobile profile FBML |
408 |
|
* @return array A list of strings describing any compile errors for the submitted FBML |
409 |
|
*/ |
410 |
< |
public function profile_setFBML($markup, $uid = null) { |
411 |
< |
return $this->call_method('facebook.profile.setFBML', array('markup' => $markup, 'uid' => $uid)); |
410 |
> |
function profile_setFBML($markup, $uid = null, $profile='', $profile_action='', $mobile_profile='') { |
411 |
> |
return $this->call_method('facebook.profile.setFBML', array('markup' => $markup, |
412 |
> |
'uid' => $uid, |
413 |
> |
'profile' => $profile, |
414 |
> |
'profile_action' => $profile_action, |
415 |
> |
'mobile_profile' => $mobile_profile)); |
416 |
|
} |
417 |
|
|
418 |
|
public function profile_getFBML($uid) { |
431 |
|
return $this->call_method('facebook.fbml.setRefHandle', array('handle' => $handle, 'fbml' => $fbml)); |
432 |
|
} |
433 |
|
|
434 |
+ |
/** |
435 |
+ |
* Get all the marketplace categories |
436 |
+ |
* |
437 |
+ |
* @return array A list of category names |
438 |
+ |
*/ |
439 |
+ |
function marketplace_getCategories() { |
440 |
+ |
return $this->call_method('facebook.marketplace.getCategories', array()); |
441 |
+ |
} |
442 |
+ |
|
443 |
+ |
/** |
444 |
+ |
* Get all the marketplace subcategories for a particular category |
445 |
+ |
* |
446 |
+ |
* @param category The category for which we are pulling subcategories |
447 |
+ |
* @return array A list of subcategory names |
448 |
+ |
*/ |
449 |
+ |
function marketplace_getSubCategories($category) { |
450 |
+ |
return $this->call_method('facebook.marketplace.getSubCategories', array('category' => $category)); |
451 |
+ |
} |
452 |
+ |
|
453 |
+ |
/** |
454 |
+ |
* Get listings by either listing_id or user |
455 |
+ |
* |
456 |
+ |
* @param listing_ids An array of listing_ids (optional) |
457 |
+ |
* @param uids An array of user ids (optional) |
458 |
+ |
* @return array The data for matched listings |
459 |
+ |
*/ |
460 |
+ |
function marketplace_getListings($listing_ids, $uids) { |
461 |
+ |
return $this->call_method('facebook.marketplace.getListings', array('listing_ids' => $listing_ids, 'uids' => $uids)); |
462 |
+ |
} |
463 |
+ |
|
464 |
+ |
/** |
465 |
+ |
* Search for Marketplace listings. All arguments are optional, though at least |
466 |
+ |
* one must be filled out to retrieve results. |
467 |
+ |
* |
468 |
+ |
* @param category The category in which to search (optional) |
469 |
+ |
* @param subcategory The subcategory in which to search (optional) |
470 |
+ |
* @param query A query string (optional) |
471 |
+ |
* @return array The data for matched listings |
472 |
+ |
*/ |
473 |
+ |
function marketplace_search($category, $subcategory, $query) { |
474 |
+ |
return $this->call_method('facebook.marketplace.search', array('category' => $category, 'subcategory' => $subcategory, 'query' => $query)); |
475 |
+ |
} |
476 |
+ |
|
477 |
+ |
/** |
478 |
+ |
* Remove a listing from Marketplace |
479 |
+ |
* |
480 |
+ |
* @param listing_id The id of the listing to be removed |
481 |
+ |
* @param status 'SUCCESS', 'NOT_SUCCESS', or 'DEFAULT' |
482 |
+ |
* @return bool True on success |
483 |
+ |
*/ |
484 |
+ |
function marketplace_removeListing($listing_id, $status='DEFAULT') { |
485 |
+ |
return $this->call_method('facebook.marketplace.removeListing', |
486 |
+ |
array('listing_id'=>$listing_id, |
487 |
+ |
'status'=>$status)); |
488 |
+ |
} |
489 |
+ |
|
490 |
+ |
/** |
491 |
+ |
* Create/modify a Marketplace listing for the loggedinuser |
492 |
+ |
* |
493 |
+ |
* @param int listing_id The id of a listing to be modified, 0 for a new listing. |
494 |
+ |
* @param show_on_profile bool Should we show this listing on the user's profile |
495 |
+ |
* @param listing_attrs array An array of the listing data |
496 |
+ |
* @return int The listing_id (unchanged if modifying an existing listing) |
497 |
+ |
*/ |
498 |
+ |
function marketplace_createListing($listing_id, $show_on_profile, $attrs) { |
499 |
+ |
return $this->call_method('facebook.marketplace.createListing', |
500 |
+ |
array('listing_id'=>$listing_id, |
501 |
+ |
'show_on_profile'=>$show_on_profile, |
502 |
+ |
'listing_attrs'=>json_encode($attrs))); |
503 |
+ |
} |
504 |
+ |
|
505 |
+ |
|
506 |
+ |
///////////////////////////////////////////////////////////////////////////// |
507 |
+ |
// Data Store API |
508 |
+ |
|
509 |
+ |
/** |
510 |
+ |
* Set a user preference. |
511 |
+ |
* |
512 |
+ |
* @param pref_id preference identifier (0-200) |
513 |
+ |
* @param value preferece's value |
514 |
+ |
* @error |
515 |
+ |
* API_EC_DATA_DATABASE_ERROR |
516 |
+ |
* API_EC_PARAM |
517 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
518 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
519 |
+ |
*/ |
520 |
+ |
public function data_setUserPreference($pref_id, $value) { |
521 |
+ |
return $this->call_method |
522 |
+ |
('facebook.data.setUserPreference', |
523 |
+ |
array('pref_id' => $pref_id, |
524 |
+ |
'value' => $value)); |
525 |
+ |
} |
526 |
+ |
|
527 |
+ |
/** |
528 |
+ |
* Set a user's all preferences for this application. |
529 |
+ |
* |
530 |
+ |
* @param values preferece values in an associative arrays |
531 |
+ |
* @param replace whether to replace all existing preferences or |
532 |
+ |
* merge into them. |
533 |
+ |
* @error |
534 |
+ |
* API_EC_DATA_DATABASE_ERROR |
535 |
+ |
* API_EC_PARAM |
536 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
537 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
538 |
+ |
*/ |
539 |
+ |
public function data_setUserPreferences($values, $replace = false) { |
540 |
+ |
return $this->call_method |
541 |
+ |
('facebook.data.setUserPreferences', |
542 |
+ |
array('values' => json_encode($values), |
543 |
+ |
'replace' => $replace)); |
544 |
+ |
} |
545 |
+ |
|
546 |
+ |
/** |
547 |
+ |
* Get a user preference. |
548 |
+ |
* |
549 |
+ |
* @param pref_id preference identifier (0-200) |
550 |
+ |
* @return preference's value |
551 |
+ |
* @error |
552 |
+ |
* API_EC_DATA_DATABASE_ERROR |
553 |
+ |
* API_EC_PARAM |
554 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
555 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
556 |
+ |
*/ |
557 |
+ |
public function data_getUserPreference($pref_id) { |
558 |
+ |
return $this->call_method |
559 |
+ |
('facebook.data.getUserPreference', |
560 |
+ |
array('pref_id' => $pref_id)); |
561 |
+ |
} |
562 |
+ |
|
563 |
+ |
/** |
564 |
+ |
* Get a user preference. |
565 |
+ |
* |
566 |
+ |
* @return preference values |
567 |
+ |
* @error |
568 |
+ |
* API_EC_DATA_DATABASE_ERROR |
569 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
570 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
571 |
+ |
*/ |
572 |
+ |
public function data_getUserPreferences() { |
573 |
+ |
return $this->call_method |
574 |
+ |
('facebook.data.getUserPreferences', |
575 |
+ |
array()); |
576 |
+ |
} |
577 |
+ |
|
578 |
+ |
/** |
579 |
+ |
* Create a new object type. |
580 |
+ |
* |
581 |
+ |
* @param name object type's name |
582 |
+ |
* @error |
583 |
+ |
* API_EC_DATA_DATABASE_ERROR |
584 |
+ |
* API_EC_DATA_OBJECT_ALREADY_EXISTS |
585 |
+ |
* API_EC_PARAM |
586 |
+ |
* API_EC_PERMISSION |
587 |
+ |
* API_EC_DATA_INVALID_OPERATION |
588 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
589 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
590 |
+ |
*/ |
591 |
+ |
public function data_createObjectType($name) { |
592 |
+ |
return $this->call_method |
593 |
+ |
('facebook.data.createObjectType', |
594 |
+ |
array('name' => $name)); |
595 |
+ |
} |
596 |
+ |
|
597 |
+ |
/** |
598 |
+ |
* Delete an object type. |
599 |
+ |
* |
600 |
+ |
* @param obj_type object type's name |
601 |
+ |
* @error |
602 |
+ |
* API_EC_DATA_DATABASE_ERROR |
603 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
604 |
+ |
* API_EC_PARAM |
605 |
+ |
* API_EC_PERMISSION |
606 |
+ |
* API_EC_DATA_INVALID_OPERATION |
607 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
608 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
609 |
+ |
*/ |
610 |
+ |
public function data_dropObjectType($obj_type) { |
611 |
+ |
return $this->call_method |
612 |
+ |
('facebook.data.dropObjectType', |
613 |
+ |
array('obj_type' => $obj_type)); |
614 |
+ |
} |
615 |
+ |
|
616 |
+ |
/** |
617 |
+ |
* Rename an object type. |
618 |
+ |
* |
619 |
+ |
* @param obj_type object type's name |
620 |
+ |
* @param new_name new object type's name |
621 |
+ |
* @error |
622 |
+ |
* API_EC_DATA_DATABASE_ERROR |
623 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
624 |
+ |
* API_EC_DATA_OBJECT_ALREADY_EXISTS |
625 |
+ |
* API_EC_PARAM |
626 |
+ |
* API_EC_PERMISSION |
627 |
+ |
* API_EC_DATA_INVALID_OPERATION |
628 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
629 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
630 |
+ |
*/ |
631 |
+ |
public function data_renameObjectType($obj_type, $new_name) { |
632 |
+ |
return $this->call_method |
633 |
+ |
('facebook.data.renameObjectType', |
634 |
+ |
array('obj_type' => $obj_type, |
635 |
+ |
'new_name' => $new_name)); |
636 |
+ |
} |
637 |
+ |
|
638 |
+ |
/** |
639 |
+ |
* Add a new property to an object type. |
640 |
+ |
* |
641 |
+ |
* @param obj_type object type's name |
642 |
+ |
* @param prop_name name of the property to add |
643 |
+ |
* @param prop_type 1: integer; 2: string; 3: text blob |
644 |
+ |
* @error |
645 |
+ |
* API_EC_DATA_DATABASE_ERROR |
646 |
+ |
* API_EC_DATA_OBJECT_ALREADY_EXISTS |
647 |
+ |
* API_EC_PARAM |
648 |
+ |
* API_EC_PERMISSION |
649 |
+ |
* API_EC_DATA_INVALID_OPERATION |
650 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
651 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
652 |
+ |
*/ |
653 |
+ |
public function data_defineObjectProperty($obj_type, $prop_name, $prop_type) { |
654 |
+ |
return $this->call_method |
655 |
+ |
('facebook.data.defineObjectProperty', |
656 |
+ |
array('obj_type' => $obj_type, |
657 |
+ |
'prop_name' => $prop_name, |
658 |
+ |
'prop_type' => $prop_type)); |
659 |
+ |
} |
660 |
+ |
|
661 |
+ |
/** |
662 |
+ |
* Remove a previously defined property from an object type. |
663 |
+ |
* |
664 |
+ |
* @param obj_type object type's name |
665 |
+ |
* @param prop_name name of the property to remove |
666 |
+ |
* @error |
667 |
+ |
* API_EC_DATA_DATABASE_ERROR |
668 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
669 |
+ |
* API_EC_PARAM |
670 |
+ |
* API_EC_PERMISSION |
671 |
+ |
* API_EC_DATA_INVALID_OPERATION |
672 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
673 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
674 |
+ |
*/ |
675 |
+ |
public function data_undefineObjectProperty($obj_type, $prop_name) { |
676 |
+ |
return $this->call_method |
677 |
+ |
('facebook.data.undefineObjectProperty', |
678 |
+ |
array('obj_type' => $obj_type, |
679 |
+ |
'prop_name' => $prop_name)); |
680 |
+ |
} |
681 |
+ |
|
682 |
+ |
/** |
683 |
+ |
* Rename a previously defined property of an object type. |
684 |
+ |
* |
685 |
+ |
* @param obj_type object type's name |
686 |
+ |
* @param prop_name name of the property to rename |
687 |
+ |
* @param new_name new name to use |
688 |
+ |
* @error |
689 |
+ |
* API_EC_DATA_DATABASE_ERROR |
690 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
691 |
+ |
* API_EC_DATA_OBJECT_ALREADY_EXISTS |
692 |
+ |
* API_EC_PARAM |
693 |
+ |
* API_EC_PERMISSION |
694 |
+ |
* API_EC_DATA_INVALID_OPERATION |
695 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
696 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
697 |
+ |
*/ |
698 |
+ |
public function data_renameObjectProperty($obj_type, $prop_name, |
699 |
+ |
$new_name) { |
700 |
+ |
return $this->call_method |
701 |
+ |
('facebook.data.renameObjectProperty', |
702 |
+ |
array('obj_type' => $obj_type, |
703 |
+ |
'prop_name' => $prop_name, |
704 |
+ |
'new_name' => $new_name)); |
705 |
+ |
} |
706 |
+ |
|
707 |
+ |
/** |
708 |
+ |
* Retrieve a list of all object types that have defined for the application. |
709 |
+ |
* |
710 |
+ |
* @return a list of object type names |
711 |
+ |
* @error |
712 |
+ |
* API_EC_DATA_DATABASE_ERROR |
713 |
+ |
* API_EC_PERMISSION |
714 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
715 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
716 |
+ |
*/ |
717 |
+ |
public function data_getObjectTypes() { |
718 |
+ |
return $this->call_method |
719 |
+ |
('facebook.data.getObjectTypes', |
720 |
+ |
array()); |
721 |
+ |
} |
722 |
+ |
|
723 |
+ |
/** |
724 |
+ |
* Get definitions of all properties of an object type. |
725 |
+ |
* |
726 |
+ |
* @param obj_type object type's name |
727 |
+ |
* @return pairs of property name and property types |
728 |
+ |
* @error |
729 |
+ |
* API_EC_DATA_DATABASE_ERROR |
730 |
+ |
* API_EC_PARAM |
731 |
+ |
* API_EC_PERMISSION |
732 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
733 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
734 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
735 |
+ |
*/ |
736 |
+ |
public function data_getObjectType($obj_type) { |
737 |
+ |
return $this->call_method |
738 |
+ |
('facebook.data.getObjectType', |
739 |
+ |
array('obj_type' => $obj_type)); |
740 |
+ |
} |
741 |
+ |
|
742 |
+ |
/** |
743 |
+ |
* Create a new object. |
744 |
+ |
* |
745 |
+ |
* @param obj_type object type's name |
746 |
+ |
* @param properties (optional) properties to set initially |
747 |
+ |
* @return newly created object's id |
748 |
+ |
* @error |
749 |
+ |
* API_EC_DATA_DATABASE_ERROR |
750 |
+ |
* API_EC_PARAM |
751 |
+ |
* API_EC_PERMISSION |
752 |
+ |
* API_EC_DATA_INVALID_OPERATION |
753 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
754 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
755 |
+ |
*/ |
756 |
+ |
public function data_createObject($obj_type, $properties = null) { |
757 |
+ |
return $this->call_method |
758 |
+ |
('facebook.data.createObject', |
759 |
+ |
array('obj_type' => $obj_type, |
760 |
+ |
'properties' => json_encode($properties))); |
761 |
+ |
} |
762 |
+ |
|
763 |
+ |
/** |
764 |
+ |
* Update an existing object. |
765 |
+ |
* |
766 |
+ |
* @param obj_id object's id |
767 |
+ |
* @param properties new properties |
768 |
+ |
* @param replace true for replacing existing properties; false for merging |
769 |
+ |
* @error |
770 |
+ |
* API_EC_DATA_DATABASE_ERROR |
771 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
772 |
+ |
* API_EC_PARAM |
773 |
+ |
* API_EC_PERMISSION |
774 |
+ |
* API_EC_DATA_INVALID_OPERATION |
775 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
776 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
777 |
+ |
*/ |
778 |
+ |
public function data_updateObject($obj_id, $properties, $replace = false) { |
779 |
+ |
return $this->call_method |
780 |
+ |
('facebook.data.updateObject', |
781 |
+ |
array('obj_id' => $obj_id, |
782 |
+ |
'properties' => json_encode($properties), |
783 |
+ |
'replace' => $replace)); |
784 |
+ |
} |
785 |
+ |
|
786 |
+ |
/** |
787 |
+ |
* Delete an existing object. |
788 |
+ |
* |
789 |
+ |
* @param obj_id object's id |
790 |
+ |
* @error |
791 |
+ |
* API_EC_DATA_DATABASE_ERROR |
792 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
793 |
+ |
* API_EC_PARAM |
794 |
+ |
* API_EC_PERMISSION |
795 |
+ |
* API_EC_DATA_INVALID_OPERATION |
796 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
797 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
798 |
+ |
*/ |
799 |
+ |
public function data_deleteObject($obj_id) { |
800 |
+ |
return $this->call_method |
801 |
+ |
('facebook.data.deleteObject', |
802 |
+ |
array('obj_id' => $obj_id)); |
803 |
+ |
} |
804 |
+ |
|
805 |
+ |
/** |
806 |
+ |
* Delete a list of objects. |
807 |
+ |
* |
808 |
+ |
* @param obj_ids objects to delete |
809 |
+ |
* @error |
810 |
+ |
* API_EC_DATA_DATABASE_ERROR |
811 |
+ |
* API_EC_PARAM |
812 |
+ |
* API_EC_PERMISSION |
813 |
+ |
* API_EC_DATA_INVALID_OPERATION |
814 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
815 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
816 |
+ |
*/ |
817 |
+ |
public function data_deleteObjects($obj_ids) { |
818 |
+ |
return $this->call_method |
819 |
+ |
('facebook.data.deleteObjects', |
820 |
+ |
array('obj_ids' => json_encode($obj_ids))); |
821 |
+ |
} |
822 |
+ |
|
823 |
+ |
/** |
824 |
+ |
* Get a single property value of an object. |
825 |
+ |
* |
826 |
+ |
* @param obj_id object's id |
827 |
+ |
* @param prop_name individual property's name |
828 |
+ |
* @return individual property's value |
829 |
+ |
* @error |
830 |
+ |
* API_EC_DATA_DATABASE_ERROR |
831 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
832 |
+ |
* API_EC_PARAM |
833 |
+ |
* API_EC_PERMISSION |
834 |
+ |
* API_EC_DATA_INVALID_OPERATION |
835 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
836 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
837 |
+ |
*/ |
838 |
+ |
public function data_getObjectProperty($obj_id, $prop_name) { |
839 |
+ |
return $this->call_method |
840 |
+ |
('facebook.data.getObjectProperty', |
841 |
+ |
array('obj_id' => $obj_id, |
842 |
+ |
'prop_name' => $prop_name)); |
843 |
+ |
} |
844 |
+ |
|
845 |
+ |
/** |
846 |
+ |
* Get properties of an object. |
847 |
+ |
* |
848 |
+ |
* @param obj_id object's id |
849 |
+ |
* @param prop_names (optional) properties to return; null for all. |
850 |
+ |
* @return specified properties of an object |
851 |
+ |
* @error |
852 |
+ |
* API_EC_DATA_DATABASE_ERROR |
853 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
854 |
+ |
* API_EC_PARAM |
855 |
+ |
* API_EC_PERMISSION |
856 |
+ |
* API_EC_DATA_INVALID_OPERATION |
857 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
858 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
859 |
+ |
*/ |
860 |
+ |
public function data_getObject($obj_id, $prop_names = null) { |
861 |
+ |
return $this->call_method |
862 |
+ |
('facebook.data.getObject', |
863 |
+ |
array('obj_id' => $obj_id, |
864 |
+ |
'prop_names' => json_encode($prop_names))); |
865 |
+ |
} |
866 |
+ |
|
867 |
+ |
/** |
868 |
+ |
* Get properties of a list of objects. |
869 |
+ |
* |
870 |
+ |
* @param obj_ids object ids |
871 |
+ |
* @param prop_names (optional) properties to return; null for all. |
872 |
+ |
* @return specified properties of an object |
873 |
+ |
* @error |
874 |
+ |
* API_EC_DATA_DATABASE_ERROR |
875 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
876 |
+ |
* API_EC_PARAM |
877 |
+ |
* API_EC_PERMISSION |
878 |
+ |
* API_EC_DATA_INVALID_OPERATION |
879 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
880 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
881 |
+ |
*/ |
882 |
+ |
public function data_getObjects($obj_ids, $prop_names = null) { |
883 |
+ |
return $this->call_method |
884 |
+ |
('facebook.data.getObjects', |
885 |
+ |
array('obj_ids' => json_encode($obj_ids), |
886 |
+ |
'prop_names' => json_encode($prop_names))); |
887 |
+ |
} |
888 |
+ |
|
889 |
+ |
/** |
890 |
+ |
* Set a single property value of an object. |
891 |
+ |
* |
892 |
+ |
* @param obj_id object's id |
893 |
+ |
* @param prop_name individual property's name |
894 |
+ |
* @param prop_value new value to set |
895 |
+ |
* @error |
896 |
+ |
* API_EC_DATA_DATABASE_ERROR |
897 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
898 |
+ |
* API_EC_PARAM |
899 |
+ |
* API_EC_PERMISSION |
900 |
+ |
* API_EC_DATA_INVALID_OPERATION |
901 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
902 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
903 |
+ |
*/ |
904 |
+ |
public function data_setObjectProperty($obj_id, $prop_name, |
905 |
+ |
$prop_value) { |
906 |
+ |
return $this->call_method |
907 |
+ |
('facebook.data.setObjectProperty', |
908 |
+ |
array('obj_id' => $obj_id, |
909 |
+ |
'prop_name' => $prop_name, |
910 |
+ |
'prop_value' => $prop_value)); |
911 |
+ |
} |
912 |
+ |
|
913 |
+ |
/** |
914 |
+ |
* Read hash value by key. |
915 |
+ |
* |
916 |
+ |
* @param obj_type object type's name |
917 |
+ |
* @param key hash key |
918 |
+ |
* @param prop_name (optional) individual property's name |
919 |
+ |
* @return hash value |
920 |
+ |
* @error |
921 |
+ |
* API_EC_DATA_DATABASE_ERROR |
922 |
+ |
* API_EC_PARAM |
923 |
+ |
* API_EC_PERMISSION |
924 |
+ |
* API_EC_DATA_INVALID_OPERATION |
925 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
926 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
927 |
+ |
*/ |
928 |
+ |
public function data_getHashValue($obj_type, $key, $prop_name = null) { |
929 |
+ |
return $this->call_method |
930 |
+ |
('facebook.data.getHashValue', |
931 |
+ |
array('obj_type' => $obj_type, |
932 |
+ |
'key' => $key, |
933 |
+ |
'prop_name' => $prop_name)); |
934 |
+ |
} |
935 |
+ |
|
936 |
+ |
/** |
937 |
+ |
* Write hash value by key. |
938 |
+ |
* |
939 |
+ |
* @param obj_type object type's name |
940 |
+ |
* @param key hash key |
941 |
+ |
* @param value hash value |
942 |
+ |
* @param prop_name (optional) individual property's name |
943 |
+ |
* @error |
944 |
+ |
* API_EC_DATA_DATABASE_ERROR |
945 |
+ |
* API_EC_PARAM |
946 |
+ |
* API_EC_PERMISSION |
947 |
+ |
* API_EC_DATA_INVALID_OPERATION |
948 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
949 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
950 |
+ |
*/ |
951 |
+ |
public function data_setHashValue($obj_type, $key, $value, $prop_name = null) { |
952 |
+ |
return $this->call_method |
953 |
+ |
('facebook.data.setHashValue', |
954 |
+ |
array('obj_type' => $obj_type, |
955 |
+ |
'key' => $key, |
956 |
+ |
'value' => $value, |
957 |
+ |
'prop_name' => $prop_name)); |
958 |
+ |
} |
959 |
+ |
|
960 |
+ |
/** |
961 |
+ |
* Increase a hash value by specified increment atomically. |
962 |
+ |
* |
963 |
+ |
* @param obj_type object type's name |
964 |
+ |
* @param key hash key |
965 |
+ |
* @param prop_name individual property's name |
966 |
+ |
* @param increment (optional) default is 1 |
967 |
+ |
* @return incremented hash value |
968 |
+ |
* @error |
969 |
+ |
* API_EC_DATA_DATABASE_ERROR |
970 |
+ |
* API_EC_PARAM |
971 |
+ |
* API_EC_PERMISSION |
972 |
+ |
* API_EC_DATA_INVALID_OPERATION |
973 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
974 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
975 |
+ |
*/ |
976 |
+ |
public function data_incHashValue($obj_type, $key, $prop_name, $increment = 1) { |
977 |
+ |
return $this->call_method |
978 |
+ |
('facebook.data.incHashValue', |
979 |
+ |
array('obj_type' => $obj_type, |
980 |
+ |
'key' => $key, |
981 |
+ |
'prop_name' => $prop_name, |
982 |
+ |
'increment' => $increment)); |
983 |
+ |
} |
984 |
+ |
|
985 |
+ |
/** |
986 |
+ |
* Remove a hash key and its values. |
987 |
+ |
* |
988 |
+ |
* @param obj_type object type's name |
989 |
+ |
* @param key hash key |
990 |
+ |
* @error |
991 |
+ |
* API_EC_DATA_DATABASE_ERROR |
992 |
+ |
* API_EC_PARAM |
993 |
+ |
* API_EC_PERMISSION |
994 |
+ |
* API_EC_DATA_INVALID_OPERATION |
995 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
996 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
997 |
+ |
*/ |
998 |
+ |
public function data_removeHashKey($obj_type, $key) { |
999 |
+ |
return $this->call_method |
1000 |
+ |
('facebook.data.removeHashKey', |
1001 |
+ |
array('obj_type' => $obj_type, |
1002 |
+ |
'key' => $key)); |
1003 |
+ |
} |
1004 |
+ |
|
1005 |
+ |
/** |
1006 |
+ |
* Remove hash keys and their values. |
1007 |
+ |
* |
1008 |
+ |
* @param obj_type object type's name |
1009 |
+ |
* @param keys hash keys |
1010 |
+ |
* @error |
1011 |
+ |
* API_EC_DATA_DATABASE_ERROR |
1012 |
+ |
* API_EC_PARAM |
1013 |
+ |
* API_EC_PERMISSION |
1014 |
+ |
* API_EC_DATA_INVALID_OPERATION |
1015 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
1016 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
1017 |
+ |
*/ |
1018 |
+ |
public function data_removeHashKeys($obj_type, $keys) { |
1019 |
+ |
return $this->call_method |
1020 |
+ |
('facebook.data.removeHashKeys', |
1021 |
+ |
array('obj_type' => $obj_type, |
1022 |
+ |
'keys' => json_encode($keys))); |
1023 |
+ |
} |
1024 |
+ |
|
1025 |
+ |
|
1026 |
+ |
/** |
1027 |
+ |
* Define an object association. |
1028 |
+ |
* |
1029 |
+ |
* @param name name of this association |
1030 |
+ |
* @param assoc_type 1: one-way 2: two-way symmetric 3: two-way asymmetric |
1031 |
+ |
* @param assoc_info1 needed info about first object type |
1032 |
+ |
* @param assoc_info2 needed info about second object type |
1033 |
+ |
* @param inverse (optional) name of reverse association |
1034 |
+ |
* @error |
1035 |
+ |
* API_EC_DATA_DATABASE_ERROR |
1036 |
+ |
* API_EC_DATA_OBJECT_ALREADY_EXISTS |
1037 |
+ |
* API_EC_PARAM |
1038 |
+ |
* API_EC_PERMISSION |
1039 |
+ |
* API_EC_DATA_INVALID_OPERATION |
1040 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
1041 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
1042 |
+ |
*/ |
1043 |
+ |
public function data_defineAssociation($name, $assoc_type, $assoc_info1, |
1044 |
+ |
$assoc_info2, $inverse = null) { |
1045 |
+ |
return $this->call_method |
1046 |
+ |
('facebook.data.defineAssociation', |
1047 |
+ |
array('name' => $name, |
1048 |
+ |
'assoc_type' => $assoc_type, |
1049 |
+ |
'assoc_info1' => json_encode($assoc_info1), |
1050 |
+ |
'assoc_info2' => json_encode($assoc_info2), |
1051 |
+ |
'inverse' => $inverse)); |
1052 |
+ |
} |
1053 |
+ |
|
1054 |
+ |
/** |
1055 |
+ |
* Undefine an object association. |
1056 |
+ |
* |
1057 |
+ |
* @param name name of this association |
1058 |
+ |
* @error |
1059 |
+ |
* API_EC_DATA_DATABASE_ERROR |
1060 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
1061 |
+ |
* API_EC_PARAM |
1062 |
+ |
* API_EC_PERMISSION |
1063 |
+ |
* API_EC_DATA_INVALID_OPERATION |
1064 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
1065 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
1066 |
+ |
*/ |
1067 |
+ |
public function data_undefineAssociation($name) { |
1068 |
+ |
return $this->call_method |
1069 |
+ |
('facebook.data.undefineAssociation', |
1070 |
+ |
array('name' => $name)); |
1071 |
+ |
} |
1072 |
+ |
|
1073 |
+ |
/** |
1074 |
+ |
* Rename an object association or aliases. |
1075 |
+ |
* |
1076 |
+ |
* @param name name of this association |
1077 |
+ |
* @param new_name (optional) new name of this association |
1078 |
+ |
* @param new_alias1 (optional) new alias for object type 1 |
1079 |
+ |
* @param new_alias2 (optional) new alias for object type 2 |
1080 |
+ |
* @error |
1081 |
+ |
* API_EC_DATA_DATABASE_ERROR |
1082 |
+ |
* API_EC_DATA_OBJECT_ALREADY_EXISTS |
1083 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
1084 |
+ |
* API_EC_PARAM |
1085 |
+ |
* API_EC_PERMISSION |
1086 |
+ |
* API_EC_DATA_INVALID_OPERATION |
1087 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
1088 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
1089 |
+ |
*/ |
1090 |
+ |
public function data_renameAssociation($name, $new_name, $new_alias1 = null, |
1091 |
+ |
$new_alias2 = null) { |
1092 |
+ |
return $this->call_method |
1093 |
+ |
('facebook.data.renameAssociation', |
1094 |
+ |
array('name' => $name, |
1095 |
+ |
'new_name' => $new_name, |
1096 |
+ |
'new_alias1' => $new_alias1, |
1097 |
+ |
'new_alias2' => $new_alias2)); |
1098 |
+ |
} |
1099 |
+ |
|
1100 |
+ |
/** |
1101 |
+ |
* Get definition of an object association. |
1102 |
+ |
* |
1103 |
+ |
* @param name name of this association |
1104 |
+ |
* @return specified association |
1105 |
+ |
* @error |
1106 |
+ |
* API_EC_DATA_DATABASE_ERROR |
1107 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
1108 |
+ |
* API_EC_PARAM |
1109 |
+ |
* API_EC_PERMISSION |
1110 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
1111 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
1112 |
+ |
*/ |
1113 |
+ |
public function data_getAssociationDefinition($name) { |
1114 |
+ |
return $this->call_method |
1115 |
+ |
('facebook.data.getAssociationDefinition', |
1116 |
+ |
array('name' => $name)); |
1117 |
+ |
} |
1118 |
+ |
|
1119 |
+ |
/** |
1120 |
+ |
* Get definition of all associations. |
1121 |
+ |
* |
1122 |
+ |
* @return all defined associations |
1123 |
+ |
* @error |
1124 |
+ |
* API_EC_DATA_DATABASE_ERROR |
1125 |
+ |
* API_EC_PERMISSION |
1126 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
1127 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
1128 |
+ |
*/ |
1129 |
+ |
public function data_getAssociationDefinitions() { |
1130 |
+ |
return $this->call_method |
1131 |
+ |
('facebook.data.getAssociationDefinitions', |
1132 |
+ |
array()); |
1133 |
+ |
} |
1134 |
+ |
|
1135 |
+ |
/** |
1136 |
+ |
* Create or modify an association between two objects. |
1137 |
+ |
* |
1138 |
+ |
* @param name name of association |
1139 |
+ |
* @param obj_id1 id of first object |
1140 |
+ |
* @param obj_id2 id of second object |
1141 |
+ |
* @param data (optional) extra string data to store |
1142 |
+ |
* @param assoc_time (optional) extra time data; default to creation time |
1143 |
+ |
* @error |
1144 |
+ |
* API_EC_DATA_DATABASE_ERROR |
1145 |
+ |
* API_EC_PARAM |
1146 |
+ |
* API_EC_PERMISSION |
1147 |
+ |
* API_EC_DATA_INVALID_OPERATION |
1148 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
1149 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
1150 |
+ |
*/ |
1151 |
+ |
public function data_setAssociation($name, $obj_id1, $obj_id2, $data = null, |
1152 |
+ |
$assoc_time = null) { |
1153 |
+ |
return $this->call_method |
1154 |
+ |
('facebook.data.setAssociation', |
1155 |
+ |
array('name' => $name, |
1156 |
+ |
'obj_id1' => $obj_id1, |
1157 |
+ |
'obj_id2' => $obj_id2, |
1158 |
+ |
'data' => $data, |
1159 |
+ |
'assoc_time' => $assoc_time)); |
1160 |
+ |
} |
1161 |
+ |
|
1162 |
+ |
/** |
1163 |
+ |
* Create or modify associations between objects. |
1164 |
+ |
* |
1165 |
+ |
* @param assocs associations to set |
1166 |
+ |
* @param name (optional) name of association |
1167 |
+ |
* @error |
1168 |
+ |
* API_EC_DATA_DATABASE_ERROR |
1169 |
+ |
* API_EC_PARAM |
1170 |
+ |
* API_EC_PERMISSION |
1171 |
+ |
* API_EC_DATA_INVALID_OPERATION |
1172 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
1173 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
1174 |
+ |
*/ |
1175 |
+ |
public function data_setAssociations($assocs, $name = null) { |
1176 |
+ |
return $this->call_method |
1177 |
+ |
('facebook.data.setAssociations', |
1178 |
+ |
array('assocs' => json_encode($assocs), |
1179 |
+ |
'name' => $name)); |
1180 |
+ |
} |
1181 |
+ |
|
1182 |
+ |
/** |
1183 |
+ |
* Remove an association between two objects. |
1184 |
+ |
* |
1185 |
+ |
* @param name name of association |
1186 |
+ |
* @param obj_id1 id of first object |
1187 |
+ |
* @param obj_id2 id of second object |
1188 |
+ |
* @error |
1189 |
+ |
* API_EC_DATA_DATABASE_ERROR |
1190 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
1191 |
+ |
* API_EC_PARAM |
1192 |
+ |
* API_EC_PERMISSION |
1193 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
1194 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
1195 |
+ |
*/ |
1196 |
+ |
public function data_removeAssociation($name, $obj_id1, $obj_id2) { |
1197 |
+ |
return $this->call_method |
1198 |
+ |
('facebook.data.removeAssociation', |
1199 |
+ |
array('name' => $name, |
1200 |
+ |
'obj_id1' => $obj_id1, |
1201 |
+ |
'obj_id2' => $obj_id2)); |
1202 |
+ |
} |
1203 |
+ |
|
1204 |
+ |
/** |
1205 |
+ |
* Remove associations between objects by specifying pairs of object ids. |
1206 |
+ |
* |
1207 |
+ |
* @param assocs associations to remove |
1208 |
+ |
* @param name (optional) name of association |
1209 |
+ |
* @error |
1210 |
+ |
* API_EC_DATA_DATABASE_ERROR |
1211 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
1212 |
+ |
* API_EC_PARAM |
1213 |
+ |
* API_EC_PERMISSION |
1214 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
1215 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
1216 |
+ |
*/ |
1217 |
+ |
public function data_removeAssociations($assocs, $name = null) { |
1218 |
+ |
return $this->call_method |
1219 |
+ |
('facebook.data.removeAssociations', |
1220 |
+ |
array('assocs' => json_encode($assocs), |
1221 |
+ |
'name' => $name)); |
1222 |
+ |
} |
1223 |
+ |
|
1224 |
+ |
/** |
1225 |
+ |
* Remove associations between objects by specifying one object id. |
1226 |
+ |
* |
1227 |
+ |
* @param name name of association |
1228 |
+ |
* @param obj_id who's association to remove |
1229 |
+ |
* @error |
1230 |
+ |
* API_EC_DATA_DATABASE_ERROR |
1231 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
1232 |
+ |
* API_EC_PARAM |
1233 |
+ |
* API_EC_PERMISSION |
1234 |
+ |
* API_EC_DATA_INVALID_OPERATION |
1235 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
1236 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
1237 |
+ |
*/ |
1238 |
+ |
public function data_removeAssociatedObjects($name, $obj_id) { |
1239 |
+ |
return $this->call_method |
1240 |
+ |
('facebook.data.removeAssociatedObjects', |
1241 |
+ |
array('name' => $name, |
1242 |
+ |
'obj_id' => $obj_id)); |
1243 |
+ |
} |
1244 |
+ |
|
1245 |
+ |
/** |
1246 |
+ |
* Retrieve a list of associated objects. |
1247 |
+ |
* |
1248 |
+ |
* @param name name of association |
1249 |
+ |
* @param obj_id who's association to retrieve |
1250 |
+ |
* @param no_data only return object ids |
1251 |
+ |
* @return associated objects |
1252 |
+ |
* @error |
1253 |
+ |
* API_EC_DATA_DATABASE_ERROR |
1254 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
1255 |
+ |
* API_EC_PARAM |
1256 |
+ |
* API_EC_PERMISSION |
1257 |
+ |
* API_EC_DATA_INVALID_OPERATION |
1258 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
1259 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
1260 |
+ |
*/ |
1261 |
+ |
public function data_getAssociatedObjects($name, $obj_id, $no_data = true) { |
1262 |
+ |
return $this->call_method |
1263 |
+ |
('facebook.data.getAssociatedObjects', |
1264 |
+ |
array('name' => $name, |
1265 |
+ |
'obj_id' => $obj_id, |
1266 |
+ |
'no_data' => $no_data)); |
1267 |
+ |
} |
1268 |
+ |
|
1269 |
+ |
/** |
1270 |
+ |
* Count associated objects. |
1271 |
+ |
* |
1272 |
+ |
* @param name name of association |
1273 |
+ |
* @param obj_id who's association to retrieve |
1274 |
+ |
* @return associated object's count |
1275 |
+ |
* @error |
1276 |
+ |
* API_EC_DATA_DATABASE_ERROR |
1277 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
1278 |
+ |
* API_EC_PARAM |
1279 |
+ |
* API_EC_PERMISSION |
1280 |
+ |
* API_EC_DATA_INVALID_OPERATION |
1281 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
1282 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
1283 |
+ |
*/ |
1284 |
+ |
public function data_getAssociatedObjectCount($name, $obj_id) { |
1285 |
+ |
return $this->call_method |
1286 |
+ |
('facebook.data.getAssociatedObjectCount', |
1287 |
+ |
array('name' => $name, |
1288 |
+ |
'obj_id' => $obj_id)); |
1289 |
+ |
} |
1290 |
+ |
|
1291 |
+ |
/** |
1292 |
+ |
* Get a list of associated object counts. |
1293 |
+ |
* |
1294 |
+ |
* @param name name of association |
1295 |
+ |
* @param obj_ids whose association to retrieve |
1296 |
+ |
* @return associated object counts |
1297 |
+ |
* @error |
1298 |
+ |
* API_EC_DATA_DATABASE_ERROR |
1299 |
+ |
* API_EC_DATA_OBJECT_NOT_FOUND |
1300 |
+ |
* API_EC_PARAM |
1301 |
+ |
* API_EC_PERMISSION |
1302 |
+ |
* API_EC_DATA_INVALID_OPERATION |
1303 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
1304 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
1305 |
+ |
*/ |
1306 |
+ |
public function data_getAssociatedObjectCounts($name, $obj_ids) { |
1307 |
+ |
return $this->call_method |
1308 |
+ |
('facebook.data.getAssociatedObjectCounts', |
1309 |
+ |
array('name' => $name, |
1310 |
+ |
'obj_ids' => json_encode($obj_ids))); |
1311 |
+ |
} |
1312 |
+ |
|
1313 |
+ |
/** |
1314 |
+ |
* Find all associations between two objects. |
1315 |
+ |
* |
1316 |
+ |
* @param obj_id1 id of first object |
1317 |
+ |
* @param obj_id2 id of second object |
1318 |
+ |
* @param no_data only return association names without data |
1319 |
+ |
* @return all associations between objects |
1320 |
+ |
* @error |
1321 |
+ |
* API_EC_DATA_DATABASE_ERROR |
1322 |
+ |
* API_EC_PARAM |
1323 |
+ |
* API_EC_PERMISSION |
1324 |
+ |
* API_EC_DATA_QUOTA_EXCEEDED |
1325 |
+ |
* API_EC_DATA_UNKNOWN_ERROR |
1326 |
+ |
*/ |
1327 |
+ |
public function data_getAssociations($obj_id1, $obj_id2, $no_data = true) { |
1328 |
+ |
return $this->call_method |
1329 |
+ |
('facebook.data.getAssociations', |
1330 |
+ |
array('obj_id1' => $obj_id1, |
1331 |
+ |
'obj_id2' => $obj_id2, |
1332 |
+ |
'no_data' => $no_data)); |
1333 |
+ |
} |
1334 |
+ |
|
1335 |
|
/* UTILITY FUNCTIONS */ |
1336 |
|
|
1337 |
|
public function call_method($method, $params) { |
1443 |
|
return $arr; |
1444 |
|
} else { |
1445 |
|
return (string)$sxml; |
1446 |
< |
} |
1446 |
> |
} |
1447 |
|
} |
1448 |
|
} |
1449 |
|
|
1494 |
|
const FQL_EC_UNKNOWN_FIELD = 602; |
1495 |
|
const FQL_EC_UNKNOWN_TABLE = 603; |
1496 |
|
const FQL_EC_NOT_INDEXABLE = 604; |
1497 |
< |
|
1497 |
> |
|
1498 |
> |
/** |
1499 |
> |
* DATA STORE API ERRORS |
1500 |
> |
*/ |
1501 |
> |
const API_EC_DATA_UNKNOWN_ERROR = 800; |
1502 |
> |
const API_EC_DATA_INVALID_OPERATION = 801; |
1503 |
> |
const API_EC_DATA_QUOTA_EXCEEDED = 802; |
1504 |
> |
const API_EC_DATA_OBJECT_NOT_FOUND = 803; |
1505 |
> |
const API_EC_DATA_OBJECT_ALREADY_EXISTS = 804; |
1506 |
> |
const API_EC_DATA_DATABASE_ERROR = 805; |
1507 |
> |
|
1508 |
|
public static $api_error_descriptions = array( |
1509 |
|
API_EC_SUCCESS => 'Success', |
1510 |
|
API_EC_UNKNOWN => 'An unknown error occurred', |
1531 |
|
FQL_EC_NOT_INDEXABLE => 'FQL: Statement not indexable', |
1532 |
|
FQL_EC_UNKNOWN_FUNCTION => 'FQL: Attempted to call unknown function', |
1533 |
|
FQL_EC_INVALID_PARAM => 'FQL: Invalid parameter passed in', |
1534 |
+ |
API_EC_DATA_UNKNOWN_ERROR => 'Unknown data store API error', |
1535 |
+ |
API_EC_DATA_INVALID_OPERATION => 'Invalid operation', |
1536 |
+ |
API_EC_DATA_QUOTA_EXCEEDED => 'Data store allowable quota was exceeded', |
1537 |
+ |
API_EC_DATA_OBJECT_NOT_FOUND => 'Specified object cannot be found', |
1538 |
+ |
API_EC_DATA_OBJECT_ALREADY_EXISTS => 'Specified object already exists', |
1539 |
+ |
API_EC_DATA_DATABASE_ERROR => 'A database error occurred. Please try again', |
1540 |
|
); |
1541 |
|
} |
1542 |
|
|
1568 |
|
"quotes", |
1569 |
|
"relationship_status", |
1570 |
|
"religion", |
1571 |
< |
"sex", |
1571 |
> |
"sex", |
1572 |
|
"significant_other_id", |
1573 |
|
"status", |
1574 |
|
"timezone", |
1575 |
|
"tv", |
1576 |
< |
"wall_count", |
1576 |
> |
"wall_count", |
1577 |
|
"work_history"); |
1578 |
|
?> |