BP_REST_Activity_Endpoint::get_item_schema()
Get the plugin schema, conforming to JSON Schema.
Description
Return
(array)
Source
File: bp-activity/classes/class-bp-rest-activity-endpoint.php
1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 | public function get_item_schema() { $schema = array ( 'title' => 'bp_activity' , 'type' => 'object' , 'properties' => array ( 'id' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'A unique numeric ID for the activity.' , 'buddyboss' ), 'readonly' => true, 'type' => 'integer' , ), 'primary_item_id' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'The ID of some other object primarily associated with this one.' , 'buddyboss' ), 'type' => 'integer' , ), 'secondary_item_id' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'The ID of some other object also associated with this one.' , 'buddyboss' ), 'type' => 'integer' , ), 'user_id' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'The ID for the author of the activity.' , 'buddyboss' ), 'type' => 'integer' , ), 'name' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'User\'s display name for the activity.' , 'buddyboss' ), 'type' => 'string' , ), 'link' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'The permalink to this activity on the site.' , 'buddyboss' ), 'format' => 'uri' , 'type' => 'string' , ), 'component' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'The active BuddyPress component the activity relates to.' , 'buddyboss' ), 'type' => 'string' , 'enum' => array_keys ( buddypress()->active_components ), 'arg_options' => array ( 'sanitize_callback' => 'sanitize_key' , ), ), 'type' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'The activity type of the activity.' , 'buddyboss' ), 'type' => 'string' , 'enum' => array_keys ( bp_activity_get_types() ), 'arg_options' => array ( 'sanitize_callback' => 'sanitize_key' , ), ), 'title' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'The description of the activity\'s type (eg: Username posted an update)' , 'buddyboss' ), 'type' => 'string' , 'readonly' => true, 'arg_options' => array ( 'sanitize_callback' => 'sanitize_text_field' , ), ), 'content' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'Allowed HTML content for the activity.' , 'buddyboss' ), 'type' => 'object' , 'arg_options' => array ( 'sanitize_callback' => null, // Note: sanitization implemented in self::prepare_item_for_database(). 'validate_callback' => null, // Note: validation implemented in self::prepare_item_for_database(). ), 'properties' => array ( 'raw' => array ( 'description' => __( 'Content for the activity, as it exists in the database.' , 'buddyboss' ), 'type' => 'string' , 'context' => array ( 'embed' , 'edit' ), ), 'rendered' => array ( 'description' => __( 'HTML content for the activity, transformed for display.' , 'buddyboss' ), 'type' => 'string' , 'context' => array ( 'embed' , 'view' , 'edit' ), 'readonly' => true, ), ), ), 'date' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( "The date the activity was published, in the site's timezone." , 'buddyboss' ), 'type' => 'string' , 'format' => 'date-time' , ), 'status' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'Whether the activity has been marked as spam or not.' , 'buddyboss' ), 'type' => 'string' , 'enum' => array ( 'published' , 'spam' ), 'readonly' => true, 'arg_options' => array ( 'sanitize_callback' => 'sanitize_key' , ), ), 'comments' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'A list of objects children of the activity object.' , 'buddyboss' ), 'type' => 'array' , 'readonly' => true, ), 'comment_count' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'Total number of comments of the activity object.' , 'buddyboss' ), 'type' => 'integer' , 'readonly' => true, ), 'hidden' => array ( 'context' => array ( 'edit' ), 'description' => __( 'Whether the activity object should be sitewide hidden or not.' , 'buddyboss' ), 'type' => 'boolean' , ), 'favorited' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'Whether the activity object has been favorited by the current user.' , 'buddyboss' ), 'type' => 'boolean' , 'readonly' => true, ), 'can_favorite' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'Whether or not user have the favorite access for the activity object.' , 'buddyboss' ), 'type' => 'boolean' , 'readonly' => true, ), 'favorite_count' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'Favorite count for the activity object.' , 'buddyboss' ), 'type' => 'boolean' , 'readonly' => true, ), 'can_comment' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'Whether or not user have the comment access for the activity object.' , 'buddyboss' ), 'type' => 'boolean' , 'readonly' => true, ), 'comment_count' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'Comment count for the activity object.' , 'buddyboss' ), 'type' => 'boolean' , 'readonly' => true, ), 'can_delete' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'Whether or not user have the delete access for the activity object.' , 'buddyboss' ), 'type' => 'boolean' , 'readonly' => true, ), 'content_stripped' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'Content for the activity without HTML tags.' , 'buddyboss' ), 'type' => 'string' , 'readonly' => true, ), 'privacy' => array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'Privacy of the activity.' , 'buddyboss' ), 'type' => 'string' , 'enum' => array ( 'public' , 'loggedin' , 'onlyme' , 'friends' , 'media' ), ), ), ); // Avatars. if ( true === buddypress()->avatar->show_avatars ) { $avatar_properties = array (); $avatar_properties [ 'full' ] = array ( 'context' => array ( 'embed' , 'view' , 'edit' ), /* translators: 1: Full avatar width in pixels. 2: Full avatar height in pixels */ 'description' => sprintf( __( 'Avatar URL with full image size (%1$d x %2$d pixels).' , 'buddyboss' ), number_format_i18n( bp_core_avatar_full_width() ), number_format_i18n( bp_core_avatar_full_height() ) ), 'type' => 'string' , 'format' => 'uri' , ); $avatar_properties [ 'thumb' ] = array ( 'context' => array ( 'embed' , 'view' , 'edit' ), /* translators: 1: Thumb avatar width in pixels. 2: Thumb avatar height in pixels */ 'description' => sprintf( __( 'Avatar URL with thumb image size (%1$d x %2$d pixels).' , 'buddyboss' ), number_format_i18n( bp_core_avatar_thumb_width() ), number_format_i18n( bp_core_avatar_thumb_height() ) ), 'type' => 'string' , 'format' => 'uri' , ); $schema [ 'properties' ][ 'user_avatar' ] = array ( 'context' => array ( 'embed' , 'view' , 'edit' ), 'description' => __( 'Avatar URLs for the author of the activity.' , 'buddyboss' ), 'type' => 'object' , 'readonly' => true, 'properties' => $avatar_properties , ); } /** * Filters the activity schema. * * @param string $schema The endpoint schema. */ return apply_filters( 'bp_rest_activity_schema' , $this ->add_additional_fields_schema( $schema ) ); } |
Changelog
Version | Description |
---|---|
0.1.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.