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