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

Comparing facebook/trunk/facebookapi_php5_restlib.php (file contents):
Revision 953 by douglas, 2007-10-10T19:27:07-07:00 vs.
Revision 956 by douglas, 2007-10-11T02:45:01-07:00

# Line 186 | Line 186 | function toggleDisplay(id, type) {
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,
# Line 398 | Line 398 | function toggleDisplay(id, type) {
398      return $this->call_method('facebook.fbml.setRefHandle', array('handle' => $handle, 'fbml' => $fbml));
399    }
400  
401 +  /**
402 +   * Get all the marketplace categories
403 +   *
404 +   * @return array  A list of category names
405 +   */
406 +  function marketplace_getCategories() {
407 +    return $this->call_method('facebook.marketplace.getCategories', array());
408 +  }
409 +
410 +  /**
411 +   * Get all the marketplace subcategories for a particular category
412 +   *
413 +   * @param  category  The category for which we are pulling subcategories
414 +   * @return array     A list of subcategory names
415 +   */
416 +  function marketplace_getSubCategories($category) {
417 +    return $this->call_method('facebook.marketplace.getSubCategories', array('category' => $category));
418 +  }
419 +
420 +  /**
421 +   * Get listings by either listing_id or user
422 +   *
423 +   * @param listing_ids   An array of listing_ids (optional)
424 +   * @param uids          An array of user ids (optional)
425 +   * @return array        The data for matched listings
426 +   */
427 +  function marketplace_getListings($listing_ids, $uids) {
428 +    return $this->call_method('facebook.marketplace.getListings', array('listing_ids' => $listing_ids, 'uids' => $uids));
429 +  }
430 +
431 +  /**
432 +   * Search for Marketplace listings.  All arguments are optional, though at least
433 +   * one must be filled out to retrieve results.
434 +   *
435 +   * @param category     The category in which to search (optional)
436 +   * @param subcategory  The subcategory in which to search (optional)
437 +   * @param query        A query string (optional)
438 +   * @return array       The data for matched listings
439 +   */
440 +  function marketplace_search($category, $subcategory, $query) {
441 +    return $this->call_method('facebook.marketplace.search', array('category' => $category, 'subcategory' => $subcategory, 'query' => $query));
442 +  }
443 +
444 +  /**
445 +   * Remove a listing from Marketplace
446 +   *
447 +   * @param listing_id  The id of the listing to be removed
448 +   * @param status      'SUCCESS', 'NOT_SUCCESS', or 'DEFAULT'
449 +   * @return bool       True on success
450 +   */
451 +  function marketplace_removeListing($listing_id, $status='DEFAULT') {
452 +    return $this->call_method('facebook.marketplace.removeListing',
453 +                              array('listing_id'=>$listing_id,
454 +                                    'status'=>$status));
455 +  }
456 +
457 +  /**
458 +   * Create/modify a Marketplace listing for the loggedinuser
459 +   *
460 +   * @param int              listing_id   The id of a listing to be modified, 0 for a new listing.
461 +   * @param show_on_profile  bool         Should we show this listing on the user's profile
462 +   * @param attrs            array        An array of the listing data
463 +   * @return                 int          The listing_id (unchanged if modifying an existing listing)
464 +   */
465 +  function marketplace_createListing($listing_id, $show_on_profile, $attrs) {
466 +    return $this->call_method('facebook.marketplace.createListing',
467 +                              array('listing_id'=>$listing_id,
468 +                                    'show_on_profile'=>$show_on_profile,
469 +                                    'attrs'=>json_encode($attrs)));
470 +  }
471 +
472 +
473 +  /////////////////////////////////////////////////////////////////////////////
474 +  // Data Store API
475 +  
476 +  /**
477 +   * Set a user preference.
478 +   *
479 +   * @param  pref_id    preference identifier (0-200)
480 +   * @param  value      preferece's value
481 +   * @error
482 +   *    API_EC_DATA_DATABASE_ERROR
483 +   *    API_EC_PARAM
484 +   *    API_EC_DATA_QUOTA_EXCEEDED
485 +   *    API_EC_DATA_UNKNOWN_ERROR
486 +   */
487 +  public function data_setUserPreference($pref_id, $value) {
488 +    return $this->call_method
489 +      ('facebook.data.setUserPreference',
490 +       array('pref_id' => $pref_id,
491 +             'value' => $value));
492 +  }
493 +
494 +  /**
495 +   * Set a user's all preferences for this application.
496 +   *
497 +   * @param  values     preferece values in an associative arrays
498 +   * @param  replace    whether to replace all existing preferences or
499 +   *                    merge into them.
500 +   * @error
501 +   *    API_EC_DATA_DATABASE_ERROR
502 +   *    API_EC_PARAM
503 +   *    API_EC_DATA_QUOTA_EXCEEDED
504 +   *    API_EC_DATA_UNKNOWN_ERROR
505 +   */
506 +  public function data_setUserPreferences($values, $replace = false) {
507 +    return $this->call_method
508 +      ('facebook.data.setUserPreferences',
509 +       array('values' => json_encode($values),
510 +             'replace' => $replace));
511 +  }
512 +
513 +  /**
514 +   * Get a user preference.
515 +   *
516 +   * @param  pref_id    preference identifier (0-200)
517 +   * @return            preference's value
518 +   * @error
519 +   *    API_EC_DATA_DATABASE_ERROR
520 +   *    API_EC_PARAM
521 +   *    API_EC_DATA_QUOTA_EXCEEDED
522 +   *    API_EC_DATA_UNKNOWN_ERROR
523 +   */
524 +  public function data_getUserPreference($pref_id) {
525 +    return $this->call_method
526 +      ('facebook.data.getUserPreference',
527 +       array('pref_id' => $pref_id));
528 +  }
529 +
530 +  /**
531 +   * Get a user preference.
532 +   *
533 +   * @return           preference values
534 +   * @error
535 +   *    API_EC_DATA_DATABASE_ERROR
536 +   *    API_EC_DATA_QUOTA_EXCEEDED
537 +   *    API_EC_DATA_UNKNOWN_ERROR
538 +   */
539 +  public function data_getUserPreferences() {
540 +    return $this->call_method
541 +      ('facebook.data.getUserPreferences',
542 +       array());
543 +  }
544 +
545 +  /**
546 +   * Create a new object type.
547 +   *
548 +   * @param  name       object type's name
549 +   * @error
550 +   *    API_EC_DATA_DATABASE_ERROR
551 +   *    API_EC_DATA_OBJECT_ALREADY_EXISTS
552 +   *    API_EC_PARAM
553 +   *    API_EC_PERMISSION
554 +   *    API_EC_DATA_INVALID_OPERATION
555 +   *    API_EC_DATA_QUOTA_EXCEEDED
556 +   *    API_EC_DATA_UNKNOWN_ERROR
557 +   */
558 +  public function data_createObjectType($name) {
559 +    return $this->call_method
560 +      ('facebook.data.createObjectType',
561 +       array('name' => $name));
562 +  }
563 +
564 +  /**
565 +   * Delete an object type.
566 +   *
567 +   * @param  obj_type       object type's name
568 +   * @error
569 +   *    API_EC_DATA_DATABASE_ERROR
570 +   *    API_EC_DATA_OBJECT_NOT_FOUND
571 +   *    API_EC_PARAM
572 +   *    API_EC_PERMISSION
573 +   *    API_EC_DATA_INVALID_OPERATION
574 +   *    API_EC_DATA_QUOTA_EXCEEDED
575 +   *    API_EC_DATA_UNKNOWN_ERROR
576 +   */
577 +  public function data_dropObjectType($obj_type) {
578 +    return $this->call_method
579 +      ('facebook.data.dropObjectType',
580 +       array('obj_type' => $obj_type));
581 +  }
582 +
583 +  /**
584 +   * Rename an object type.
585 +   *
586 +   * @param  obj_type       object type's name
587 +   * @param  new_name       new object type's name
588 +   * @error
589 +   *    API_EC_DATA_DATABASE_ERROR
590 +   *    API_EC_DATA_OBJECT_NOT_FOUND
591 +   *    API_EC_DATA_OBJECT_ALREADY_EXISTS
592 +   *    API_EC_PARAM
593 +   *    API_EC_PERMISSION
594 +   *    API_EC_DATA_INVALID_OPERATION
595 +   *    API_EC_DATA_QUOTA_EXCEEDED
596 +   *    API_EC_DATA_UNKNOWN_ERROR
597 +   */
598 +  public function data_renameObjectType($obj_type, $new_name) {
599 +    return $this->call_method
600 +      ('facebook.data.renameObjectType',
601 +       array('obj_type' => $obj_type,
602 +             'new_name' => $new_name));
603 +  }
604 +
605 +  /**
606 +   * Add a new property to an object type.
607 +   *
608 +   * @param  obj_type       object type's name
609 +   * @param  prop_name      name of the property to add
610 +   * @param  prop_type      1: integer; 2: string; 3: text blob
611 +   * @error
612 +   *    API_EC_DATA_DATABASE_ERROR
613 +   *    API_EC_DATA_OBJECT_ALREADY_EXISTS
614 +   *    API_EC_PARAM
615 +   *    API_EC_PERMISSION
616 +   *    API_EC_DATA_INVALID_OPERATION
617 +   *    API_EC_DATA_QUOTA_EXCEEDED
618 +   *    API_EC_DATA_UNKNOWN_ERROR
619 +   */
620 +  public function data_defineObjectProperty($obj_type, $prop_name, $prop_type){
621 +    return $this->call_method
622 +      ('facebook.data.defineObjectProperty',
623 +       array('obj_type' => $obj_type,
624 +             'prop_name' => $prop_name,
625 +             'prop_type' => $prop_type));
626 +  }
627 +
628 +  /**
629 +   * Remove a previously defined property from an object type.
630 +   *
631 +   * @param  obj_type      object type's name
632 +   * @param  prop_name     name of the property to remove
633 +   * @error
634 +   *    API_EC_DATA_DATABASE_ERROR
635 +   *    API_EC_DATA_OBJECT_NOT_FOUND
636 +   *    API_EC_PARAM
637 +   *    API_EC_PERMISSION
638 +   *    API_EC_DATA_INVALID_OPERATION
639 +   *    API_EC_DATA_QUOTA_EXCEEDED
640 +   *    API_EC_DATA_UNKNOWN_ERROR
641 +   */
642 +  public function data_undefineObjectProperty($obj_type, $prop_name) {
643 +    return $this->call_method
644 +      ('facebook.data.undefineObjectProperty',
645 +       array('obj_type' => $obj_type,
646 +             'prop_name' => $prop_name));
647 +  }
648 +
649 +  /**
650 +   * Rename a previously defined property of an object type.
651 +   *
652 +   * @param  obj_type      object type's name
653 +   * @param  prop_name     name of the property to rename
654 +   * @param  new_name      new name to use
655 +   * @error
656 +   *    API_EC_DATA_DATABASE_ERROR
657 +   *    API_EC_DATA_OBJECT_NOT_FOUND
658 +   *    API_EC_DATA_OBJECT_ALREADY_EXISTS
659 +   *    API_EC_PARAM
660 +   *    API_EC_PERMISSION
661 +   *    API_EC_DATA_INVALID_OPERATION
662 +   *    API_EC_DATA_QUOTA_EXCEEDED
663 +   *    API_EC_DATA_UNKNOWN_ERROR
664 +   */
665 +  public function data_renameObjectProperty($obj_type, $prop_name,
666 +                                            $new_name) {
667 +    return $this->call_method
668 +      ('facebook.data.renameObjectProperty',
669 +       array('obj_type' => $obj_type,
670 +             'prop_name' => $prop_name,
671 +             'new_name' => $new_name));
672 +  }
673 +
674 +  /**
675 +   * Retrieve a list of all object types that have defined for the application.
676 +   *
677 +   * @return               a list of object type names
678 +   * @error
679 +   *    API_EC_DATA_DATABASE_ERROR
680 +   *    API_EC_PERMISSION
681 +   *    API_EC_DATA_QUOTA_EXCEEDED
682 +   *    API_EC_DATA_UNKNOWN_ERROR
683 +   */
684 +  public function data_getObjectTypes() {
685 +    return $this->call_method
686 +      ('facebook.data.getObjectTypes',
687 +       array());
688 +  }
689 +
690 +  /**
691 +   * Get definitions of all properties of an object type.
692 +   *
693 +   * @param obj_type       object type's name
694 +   * @return               pairs of property name and property types
695 +   * @error
696 +   *    API_EC_DATA_DATABASE_ERROR
697 +   *    API_EC_PARAM
698 +   *    API_EC_PERMISSION
699 +   *    API_EC_DATA_OBJECT_NOT_FOUND
700 +   *    API_EC_DATA_QUOTA_EXCEEDED
701 +   *    API_EC_DATA_UNKNOWN_ERROR
702 +   */
703 +  public function data_getObjectType($obj_type) {
704 +    return $this->call_method
705 +      ('facebook.data.getObjectType',
706 +       array('obj_type' => $obj_type));
707 +  }
708 +
709 +  /**
710 +   * Create a new object.
711 +   *
712 +   * @param  obj_type      object type's name
713 +   * @param  properties    (optional) properties to set initially
714 +   * @return               newly created object's id
715 +   * @error
716 +   *    API_EC_DATA_DATABASE_ERROR
717 +   *    API_EC_PARAM
718 +   *    API_EC_PERMISSION
719 +   *    API_EC_DATA_INVALID_OPERATION
720 +   *    API_EC_DATA_QUOTA_EXCEEDED
721 +   *    API_EC_DATA_UNKNOWN_ERROR
722 +   */
723 +  public function data_createObject($obj_type, $properties = null) {
724 +    return $this->call_method
725 +      ('facebook.data.createObject',
726 +       array('obj_type' => $obj_type,
727 +             'properties' => json_encode($properties)));
728 +  }
729 +
730 +  /**
731 +   * Update an existing object.
732 +   *
733 +   * @param  obj_id        object's id
734 +   * @param  properties    new properties
735 +   * @param  replace       true for replacing existing properties; false for merging
736 +   * @error
737 +   *    API_EC_DATA_DATABASE_ERROR
738 +   *    API_EC_DATA_OBJECT_NOT_FOUND
739 +   *    API_EC_PARAM
740 +   *    API_EC_PERMISSION
741 +   *    API_EC_DATA_INVALID_OPERATION
742 +   *    API_EC_DATA_QUOTA_EXCEEDED
743 +   *    API_EC_DATA_UNKNOWN_ERROR
744 +   */
745 +  public function data_updateObject($obj_id, $properties, $replace = false) {
746 +    return $this->call_method
747 +      ('facebook.data.updateObject',
748 +       array('obj_id' => $obj_id,
749 +             'properties' => json_encode($properties),
750 +             'replace' => $replace));
751 +  }
752 +
753 +  /**
754 +   * Delete an existing object.
755 +   *
756 +   * @param  obj_id        object's id
757 +   * @error
758 +   *    API_EC_DATA_DATABASE_ERROR
759 +   *    API_EC_DATA_OBJECT_NOT_FOUND
760 +   *    API_EC_PARAM
761 +   *    API_EC_PERMISSION
762 +   *    API_EC_DATA_INVALID_OPERATION
763 +   *    API_EC_DATA_QUOTA_EXCEEDED
764 +   *    API_EC_DATA_UNKNOWN_ERROR
765 +   */
766 +  public function data_deleteObject($obj_id) {
767 +    return $this->call_method
768 +      ('facebook.data.deleteObject',
769 +       array('obj_id' => $obj_id));
770 +  }
771 +
772 +  /**
773 +   * Delete a list of objects.
774 +   *
775 +   * @param  obj_ids       objects to delete
776 +   * @error
777 +   *    API_EC_DATA_DATABASE_ERROR
778 +   *    API_EC_PARAM
779 +   *    API_EC_PERMISSION
780 +   *    API_EC_DATA_INVALID_OPERATION
781 +   *    API_EC_DATA_QUOTA_EXCEEDED
782 +   *    API_EC_DATA_UNKNOWN_ERROR
783 +   */
784 +  public function data_deleteObjects($obj_ids) {
785 +    return $this->call_method
786 +      ('facebook.data.deleteObjects',
787 +       array('obj_ids' => json_encode($obj_ids)));
788 +  }
789 +
790 +  /**
791 +   * Get a single property value of an object.
792 +   *
793 +   * @param  obj_id        object's id
794 +   * @param  prop_name     individual property's name
795 +   * @return               individual property's value
796 +   * @error
797 +   *    API_EC_DATA_DATABASE_ERROR
798 +   *    API_EC_DATA_OBJECT_NOT_FOUND
799 +   *    API_EC_PARAM
800 +   *    API_EC_PERMISSION
801 +   *    API_EC_DATA_INVALID_OPERATION
802 +   *    API_EC_DATA_QUOTA_EXCEEDED
803 +   *    API_EC_DATA_UNKNOWN_ERROR
804 +   */
805 +  public function data_getObjectProperty($obj_id, $prop_name) {
806 +    return $this->call_method
807 +      ('facebook.data.getObjectProperty',
808 +       array('obj_id' => $obj_id,
809 +             'prop_name' => $prop_name));
810 +  }
811 +
812 +  /**
813 +   * Get properties of an object.
814 +   *
815 +   * @param  obj_id      object's id
816 +   * @param  prop_names  (optional) properties to return; null for all.
817 +   * @return             specified properties of an object
818 +   * @error
819 +   *    API_EC_DATA_DATABASE_ERROR
820 +   *    API_EC_DATA_OBJECT_NOT_FOUND
821 +   *    API_EC_PARAM
822 +   *    API_EC_PERMISSION
823 +   *    API_EC_DATA_INVALID_OPERATION
824 +   *    API_EC_DATA_QUOTA_EXCEEDED
825 +   *    API_EC_DATA_UNKNOWN_ERROR
826 +   */
827 +  public function data_getObject($obj_id, $prop_names = null) {
828 +    return $this->call_method
829 +      ('facebook.data.getObject',
830 +       array('obj_id' => $obj_id,
831 +             'prop_names' => json_encode($prop_names)));
832 +  }
833 +
834 +  /**
835 +   * Get properties of a list of objects.
836 +   *
837 +   * @param  obj_ids     object ids
838 +   * @param  prop_names  (optional) properties to return; null for all.
839 +   * @return             specified properties of an object
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_getObjects($obj_ids, $prop_names = null) {
850 +    return $this->call_method
851 +      ('facebook.data.getObjects',
852 +       array('obj_ids' => json_encode($obj_ids),
853 +             'prop_names' => json_encode($prop_names)));
854 +  }
855 +
856 +  /**
857 +   * Set a single property value of an object.
858 +   *
859 +   * @param  obj_id        object's id
860 +   * @param  prop_name     individual property's name
861 +   * @param  prop_value    new value to set
862 +   * @error
863 +   *    API_EC_DATA_DATABASE_ERROR
864 +   *    API_EC_DATA_OBJECT_NOT_FOUND
865 +   *    API_EC_PARAM
866 +   *    API_EC_PERMISSION
867 +   *    API_EC_DATA_INVALID_OPERATION
868 +   *    API_EC_DATA_QUOTA_EXCEEDED
869 +   *    API_EC_DATA_UNKNOWN_ERROR
870 +   */
871 +  public function data_setObjectProperty($obj_id, $prop_name,
872 +                                         $prop_value) {
873 +    return $this->call_method
874 +      ('facebook.data.setObjectProperty',
875 +       array('obj_id' => $obj_id,
876 +             'prop_name' => $prop_name,
877 +             'prop_value' => $prop_value));
878 +  }
879 +
880 +  /**
881 +   * Read hash value by key.
882 +   *
883 +   * @param  obj_type      object type's name
884 +   * @param  key           hash key
885 +   * @param  prop_name     (optional) individual property's name
886 +   * @return               hash value
887 +   * @error
888 +   *    API_EC_DATA_DATABASE_ERROR
889 +   *    API_EC_PARAM
890 +   *    API_EC_PERMISSION
891 +   *    API_EC_DATA_INVALID_OPERATION
892 +   *    API_EC_DATA_QUOTA_EXCEEDED
893 +   *    API_EC_DATA_UNKNOWN_ERROR
894 +   */
895 +  public function data_getHashValue($obj_type, $key, $prop_name = null) {
896 +    return $this->call_method
897 +      ('facebook.data.getHashValue',
898 +       array('obj_type' => $obj_type,
899 +             'key' => $key,
900 +             'prop_name' => $prop_name));
901 +  }
902 +
903 +  /**
904 +   * Write hash value by key.
905 +   *
906 +   * @param  obj_type      object type's name
907 +   * @param  key           hash key
908 +   * @param  value         hash value
909 +   * @param  prop_name     (optional) individual property's name
910 +   * @error
911 +   *    API_EC_DATA_DATABASE_ERROR
912 +   *    API_EC_PARAM
913 +   *    API_EC_PERMISSION
914 +   *    API_EC_DATA_INVALID_OPERATION
915 +   *    API_EC_DATA_QUOTA_EXCEEDED
916 +   *    API_EC_DATA_UNKNOWN_ERROR
917 +   */
918 +  public function data_setHashValue($obj_type, $key, $value, $prop_name = null) {
919 +    return $this->call_method
920 +      ('facebook.data.setHashValue',
921 +       array('obj_type' => $obj_type,
922 +             'key' => $key,
923 +             'value' => $value,
924 +             'prop_name' => $prop_name));
925 +  }
926 +
927 +  /**
928 +   * Increase a hash value by specified increment atomically.
929 +   *
930 +   * @param  obj_type      object type's name
931 +   * @param  key           hash key
932 +   * @param  prop_name     individual property's name
933 +   * @param  increment     (optional) default is 1
934 +   * @return               incremented hash value
935 +   * @error
936 +   *    API_EC_DATA_DATABASE_ERROR
937 +   *    API_EC_PARAM
938 +   *    API_EC_PERMISSION
939 +   *    API_EC_DATA_INVALID_OPERATION
940 +   *    API_EC_DATA_QUOTA_EXCEEDED
941 +   *    API_EC_DATA_UNKNOWN_ERROR
942 +   */
943 +  public function data_incHashValue($obj_type, $key, $prop_name, $increment = 1) {
944 +    return $this->call_method
945 +      ('facebook.data.incHashValue',
946 +       array('obj_type' => $obj_type,
947 +             'key' => $key,
948 +             'prop_name' => $prop_name,
949 +             'increment' => $increment));
950 +  }
951 +
952 +  /**
953 +   * Remove a hash key and its values.
954 +   *
955 +   * @param  obj_type    object type's name
956 +   * @param  key         hash key
957 +   * @error
958 +   *    API_EC_DATA_DATABASE_ERROR
959 +   *    API_EC_PARAM
960 +   *    API_EC_PERMISSION
961 +   *    API_EC_DATA_INVALID_OPERATION
962 +   *    API_EC_DATA_QUOTA_EXCEEDED
963 +   *    API_EC_DATA_UNKNOWN_ERROR
964 +   */
965 +  public function data_removeHashKey($obj_type, $key) {
966 +    return $this->call_method
967 +      ('facebook.data.removeHashKey',
968 +       array('obj_type' => $obj_type,
969 +             'key' => $key));
970 +  }
971 +
972 +  /**
973 +   * Remove hash keys and their values.
974 +   *
975 +   * @param  obj_type    object type's name
976 +   * @param  keys        hash keys
977 +   * @error
978 +   *    API_EC_DATA_DATABASE_ERROR
979 +   *    API_EC_PARAM
980 +   *    API_EC_PERMISSION
981 +   *    API_EC_DATA_INVALID_OPERATION
982 +   *    API_EC_DATA_QUOTA_EXCEEDED
983 +   *    API_EC_DATA_UNKNOWN_ERROR
984 +   */
985 +  public function data_removeHashKeys($obj_type, $keys) {
986 +    return $this->call_method
987 +      ('facebook.data.removeHashKeys',
988 +       array('obj_type' => $obj_type,
989 +             'keys' => json_encode($keys)));
990 +  }
991 +
992 +
993 +  /**
994 +   * Define an object association.
995 +   *
996 +   * @param  name        name of this association
997 +   * @param  assoc_type  1: one-way 2: two-way symmetric 3: two-way asymmetric
998 +   * @param  assoc_info1 needed info about first object type
999 +   * @param  assoc_info2 needed info about second object type
1000 +   * @param  inverse     (optional) name of reverse association
1001 +   * @error
1002 +   *    API_EC_DATA_DATABASE_ERROR
1003 +   *    API_EC_DATA_OBJECT_ALREADY_EXISTS
1004 +   *    API_EC_PARAM
1005 +   *    API_EC_PERMISSION
1006 +   *    API_EC_DATA_INVALID_OPERATION
1007 +   *    API_EC_DATA_QUOTA_EXCEEDED
1008 +   *    API_EC_DATA_UNKNOWN_ERROR
1009 +   */
1010 +  public function data_defineAssociation($name, $assoc_type, $assoc_info1,
1011 +                                         $assoc_info2, $inverse = null) {
1012 +    return $this->call_method
1013 +      ('facebook.data.defineAssociation',
1014 +       array('name' => $name,
1015 +             'assoc_type' => $assoc_type,
1016 +             'assoc_info1' => json_encode($assoc_info1),
1017 +             'assoc_info2' => json_encode($assoc_info2),
1018 +             'inverse' => $inverse));
1019 +  }
1020 +  
1021 +  /**
1022 +   * Undefine an object association.
1023 +   *
1024 +   * @param  name        name of this association
1025 +   * @error
1026 +   *    API_EC_DATA_DATABASE_ERROR
1027 +   *    API_EC_DATA_OBJECT_NOT_FOUND
1028 +   *    API_EC_PARAM
1029 +   *    API_EC_PERMISSION
1030 +   *    API_EC_DATA_INVALID_OPERATION
1031 +   *    API_EC_DATA_QUOTA_EXCEEDED
1032 +   *    API_EC_DATA_UNKNOWN_ERROR
1033 +   */
1034 +  public function data_undefineAssociation($name) {
1035 +    return $this->call_method
1036 +      ('facebook.data.undefineAssociation',
1037 +       array('name' => $name));
1038 +  }
1039 +
1040 +  /**
1041 +   * Rename an object association or aliases.
1042 +   *
1043 +   * @param  name        name of this association
1044 +   * @param  new_name    (optional) new name of this association
1045 +   * @param  new_alias1  (optional) new alias for object type 1
1046 +   * @param  new_alias2  (optional) new alias for object type 2
1047 +   * @error
1048 +   *    API_EC_DATA_DATABASE_ERROR
1049 +   *    API_EC_DATA_OBJECT_ALREADY_EXISTS
1050 +   *    API_EC_DATA_OBJECT_NOT_FOUND
1051 +   *    API_EC_PARAM
1052 +   *    API_EC_PERMISSION
1053 +   *    API_EC_DATA_INVALID_OPERATION
1054 +   *    API_EC_DATA_QUOTA_EXCEEDED
1055 +   *    API_EC_DATA_UNKNOWN_ERROR
1056 +   */
1057 +  public function data_renameAssociation($name, $new_name, $new_alias1 = null,
1058 +                                         $new_alias2 = null) {
1059 +    return $this->call_method
1060 +      ('facebook.data.renameAssociation',
1061 +       array('name' => $name,
1062 +             'new_name' => $new_name,
1063 +             'new_alias1' => $new_alias1,
1064 +             'new_alias2' => $new_alias2));
1065 +  }
1066 +  
1067 +  /**
1068 +   * Get definition of an object association.
1069 +   *
1070 +   * @param  name        name of this association
1071 +   * @return             specified association
1072 +   * @error
1073 +   *    API_EC_DATA_DATABASE_ERROR
1074 +   *    API_EC_DATA_OBJECT_NOT_FOUND
1075 +   *    API_EC_PARAM
1076 +   *    API_EC_PERMISSION
1077 +   *    API_EC_DATA_QUOTA_EXCEEDED
1078 +   *    API_EC_DATA_UNKNOWN_ERROR
1079 +   */
1080 +  public function data_getAssociationDefinition($name) {
1081 +    return $this->call_method
1082 +      ('facebook.data.getAssociationDefinition',
1083 +       array('name' => $name));
1084 +  }
1085 +  
1086 +  /**
1087 +   * Get definition of all associations.
1088 +   *
1089 +   * @return             all defined associations
1090 +   * @error
1091 +   *    API_EC_DATA_DATABASE_ERROR
1092 +   *    API_EC_PERMISSION
1093 +   *    API_EC_DATA_QUOTA_EXCEEDED
1094 +   *    API_EC_DATA_UNKNOWN_ERROR
1095 +   */
1096 +  public function data_getAssociationDefinitions() {
1097 +    return $this->call_method
1098 +      ('facebook.data.getAssociationDefinitions',
1099 +       array());
1100 +  }
1101 +
1102 +  /**
1103 +   * Create or modify an association between two objects.
1104 +   *
1105 +   * @param  name        name of association
1106 +   * @param  obj_id1     id of first object
1107 +   * @param  obj_id2     id of second object
1108 +   * @param  data        (optional) extra string data to store
1109 +   * @param  assoc_time  (optional) extra time data; default to creation time
1110 +   * @error
1111 +   *    API_EC_DATA_DATABASE_ERROR
1112 +   *    API_EC_PARAM
1113 +   *    API_EC_PERMISSION
1114 +   *    API_EC_DATA_INVALID_OPERATION
1115 +   *    API_EC_DATA_QUOTA_EXCEEDED
1116 +   *    API_EC_DATA_UNKNOWN_ERROR
1117 +   */
1118 +  public function data_setAssociation($name, $obj_id1, $obj_id2, $data = null,
1119 +                                      $assoc_time = null) {
1120 +    return $this->call_method
1121 +      ('facebook.data.setAssociation',
1122 +       array('name' => $name,
1123 +             'obj_id1' => $obj_id1,
1124 +             'obj_id2' => $obj_id2,
1125 +             'data' => $data,
1126 +             'assoc_time' => $assoc_time));
1127 +  }
1128 +
1129 +  /**
1130 +   * Create or modify associations between objects.
1131 +   *
1132 +   * @param  assocs      associations to set
1133 +   * @param  name        (optional) name of association
1134 +   * @error
1135 +   *    API_EC_DATA_DATABASE_ERROR
1136 +   *    API_EC_PARAM
1137 +   *    API_EC_PERMISSION
1138 +   *    API_EC_DATA_INVALID_OPERATION
1139 +   *    API_EC_DATA_QUOTA_EXCEEDED
1140 +   *    API_EC_DATA_UNKNOWN_ERROR
1141 +   */
1142 +  public function data_setAssociations($assocs, $name = null) {
1143 +    return $this->call_method
1144 +      ('facebook.data.setAssociations',
1145 +       array('assocs' => json_encode($assocs),
1146 +             'name' => $name));
1147 +  }
1148 +
1149 +  /**
1150 +   * Remove an association between two objects.
1151 +   *
1152 +   * @param  name        name of association
1153 +   * @param  obj_id1     id of first object
1154 +   * @param  obj_id2     id of second object
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_removeAssociation($name, $obj_id1, $obj_id2) {
1164 +    return $this->call_method
1165 +      ('facebook.data.removeAssociation',
1166 +       array('obj_id1' => $obj_id1,
1167 +             'obj_id2' => $obj_id2));
1168 +  }
1169 +
1170 +  /**
1171 +   * Remove associations between objects by specifying pairs of object ids.
1172 +   *
1173 +   * @param  assocs      associations to remove
1174 +   * @param  name        (optional) name of association
1175 +   * @error
1176 +   *    API_EC_DATA_DATABASE_ERROR
1177 +   *    API_EC_DATA_OBJECT_NOT_FOUND
1178 +   *    API_EC_PARAM
1179 +   *    API_EC_PERMISSION
1180 +   *    API_EC_DATA_QUOTA_EXCEEDED
1181 +   *    API_EC_DATA_UNKNOWN_ERROR
1182 +   */
1183 +  public function data_removeAssociations($assocs, $name = null) {
1184 +    return $this->call_method
1185 +      ('facebook.data.removeAssociations',
1186 +       array('assocs' => json_encode($assocs),
1187 +             'name' => $name));
1188 +  }
1189 +
1190 +  /**
1191 +   * Remove associations between objects by specifying one object id.
1192 +   *
1193 +   * @param  name        name of association
1194 +   * @param  obj_id      who's association to remove
1195 +   * @error
1196 +   *    API_EC_DATA_DATABASE_ERROR
1197 +   *    API_EC_DATA_OBJECT_NOT_FOUND
1198 +   *    API_EC_PARAM
1199 +   *    API_EC_PERMISSION
1200 +   *    API_EC_DATA_INVALID_OPERATION
1201 +   *    API_EC_DATA_QUOTA_EXCEEDED
1202 +   *    API_EC_DATA_UNKNOWN_ERROR
1203 +   */
1204 +  public function data_removeAssociatedObjects($name, $obj_id) {
1205 +    return $this->call_method
1206 +      ('facebook.data.removeAssociatedObjects',
1207 +       array('name' => $name,
1208 +             'obj_id' => $obj_id));
1209 +  }
1210 +
1211 +  /**
1212 +   * Retrieve a list of associated objects.
1213 +   *
1214 +   * @param  name        name of association
1215 +   * @param  obj_id      who's association to retrieve
1216 +   * @param  no_data     only return object ids
1217 +   * @return             associated objects
1218 +   * @error
1219 +   *    API_EC_DATA_DATABASE_ERROR
1220 +   *    API_EC_DATA_OBJECT_NOT_FOUND
1221 +   *    API_EC_PARAM
1222 +   *    API_EC_PERMISSION
1223 +   *    API_EC_DATA_INVALID_OPERATION
1224 +   *    API_EC_DATA_QUOTA_EXCEEDED
1225 +   *    API_EC_DATA_UNKNOWN_ERROR
1226 +   */
1227 +  public function data_getAssociatedObjects($name, $obj_id, $no_data = true) {
1228 +    return $this->call_method
1229 +      ('facebook.data.getAssociatedObjects',
1230 +       array('obj_id' => $obj_id,
1231 +             'no_data' => $no_data));
1232 +  }
1233 +
1234 +  /**
1235 +   * Count associated objects.
1236 +   *
1237 +   * @param  name        name of association
1238 +   * @param  obj_id      who's association to retrieve
1239 +   * @return             associated object's count
1240 +   * @error
1241 +   *    API_EC_DATA_DATABASE_ERROR
1242 +   *    API_EC_DATA_OBJECT_NOT_FOUND
1243 +   *    API_EC_PARAM
1244 +   *    API_EC_PERMISSION
1245 +   *    API_EC_DATA_INVALID_OPERATION
1246 +   *    API_EC_DATA_QUOTA_EXCEEDED
1247 +   *    API_EC_DATA_UNKNOWN_ERROR
1248 +   */
1249 +  public function data_getAssociatedObjectCount($name, $obj_id) {
1250 +    return $this->call_method
1251 +      ('facebook.data.getAssociatedObjectCount',
1252 +       array('name' => $name,
1253 +             'obj_id' => $obj_id));
1254 +  }
1255 +
1256 +  /**
1257 +   * Get a list of associated object counts.
1258 +   *
1259 +   * @param  name        name of association
1260 +   * @param  obj_ids     whose association to retrieve
1261 +   * @return             associated object counts
1262 +   * @error
1263 +   *    API_EC_DATA_DATABASE_ERROR
1264 +   *    API_EC_DATA_OBJECT_NOT_FOUND
1265 +   *    API_EC_PARAM
1266 +   *    API_EC_PERMISSION
1267 +   *    API_EC_DATA_INVALID_OPERATION
1268 +   *    API_EC_DATA_QUOTA_EXCEEDED
1269 +   *    API_EC_DATA_UNKNOWN_ERROR
1270 +   */
1271 +  public function data_getAssociatedObjectCounts($name, $obj_ids) {
1272 +    return $this->call_method
1273 +      ('facebook.data.getAssociatedObjectCounts',
1274 +       array('name' => $name,
1275 +             'obj_ids' => json_encode($obj_ids)));
1276 +  }
1277 +
1278 +  /**
1279 +   * Find all associations between two objects.
1280 +   *
1281 +   * @param  obj_id1     id of first object
1282 +   * @param  obj_id2     id of second object
1283 +   * @param  no_data     only return association names without data
1284 +   * @return             all associations between objects
1285 +   * @error
1286 +   *    API_EC_DATA_DATABASE_ERROR
1287 +   *    API_EC_PARAM
1288 +   *    API_EC_PERMISSION
1289 +   *    API_EC_DATA_QUOTA_EXCEEDED
1290 +   *    API_EC_DATA_UNKNOWN_ERROR
1291 +   */
1292 +  public function data_getAssociations($obj_id1, $obj_id2, $no_data = true) {
1293 +    return $this->call_method
1294 +      ('facebook.data.getAssociations',
1295 +       array('obj_id1' => $obj_id1,
1296 +             'obj_id2' => $obj_id2,
1297 +             'no_data' => $no_data));
1298 +  }
1299 +
1300    /* UTILITY FUNCTIONS */
1301  
1302    public function call_method($method, $params) {
# Line 560 | Line 1459 | class FacebookAPIErrorCodes {
1459    const FQL_EC_UNKNOWN_FIELD = 602;
1460    const FQL_EC_UNKNOWN_TABLE = 603;
1461    const FQL_EC_NOT_INDEXABLE = 604;
1462 +
1463 +  /**
1464 +   * DATA STORE API ERRORS
1465 +   */
1466 +  const API_EC_DATA_UNKNOWN_ERROR = 800;
1467 +  const API_EC_DATA_INVALID_OPERATION = 801;
1468 +  const API_EC_DATA_QUOTA_EXCEEDED = 802;
1469 +  const API_EC_DATA_OBJECT_NOT_FOUND = 803;
1470 +  const API_EC_DATA_OBJECT_ALREADY_EXISTS = 804;
1471 +  const API_EC_DATA_DATABASE_ERROR = 805;
1472  
1473    public static $api_error_descriptions = array(
1474        API_EC_SUCCESS           => 'Success',
# Line 587 | Line 1496 | class FacebookAPIErrorCodes {
1496        FQL_EC_NOT_INDEXABLE     => 'FQL: Statement not indexable',
1497        FQL_EC_UNKNOWN_FUNCTION  => 'FQL: Attempted to call unknown function',
1498        FQL_EC_INVALID_PARAM     => 'FQL: Invalid parameter passed in',
1499 +      API_EC_DATA_UNKNOWN_ERROR => 'Unknown data store API error',
1500 +      API_EC_DATA_INVALID_OPERATION => 'Invalid operation',
1501 +      API_EC_DATA_QUOTA_EXCEEDED => 'Data store allowable quota was exceeded',
1502 +      API_EC_DATA_OBJECT_NOT_FOUND => 'Specified object cannot be found',
1503 +      API_EC_DATA_OBJECT_ALREADY_EXISTS => 'Specified object already exists',
1504 +      API_EC_DATA_DATABASE_ERROR => 'A database error occurred. Please try again',
1505    );
1506   }
1507  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines