Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Commit

Permalink
Added all leaves endpoints to the item base class.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbart committed Dec 29, 2012
1 parent 54a867e commit e6245f4
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion Server/Library/ItemAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ abstract class Plex_Server_Library_ItemAbstract
* Endpoint for listing the child items of a parent or grandparent item.
*/
const ENDPOINT_CHILDREN = 'children';


/**
* Endpoint for listing all the grandchild items of an item.
*/
const ENDPOINT_ALL_LEAVES = 'allLeaves';

/**
* Sets an array of attribues, if they exist, to the corresponding class
* member.
Expand Down Expand Up @@ -274,6 +279,25 @@ protected function buildChildrenEndpoint()
);
}

/**
* Builds an endpoint for an item to retrieve all of its grandchildren.
*
* @uses Plex_Server_Library::ENDPOINT_METADATA
* @uses Plex_Server_Library_SectionAbstract::ENDPOINT_ALL_LEAVES
* @uses Plex_Server_Library_ItemAbstract::getRatingKey()
*
* @return string The requested grandchildren endpoint.
*/
protected function buildAllLeavesEndpoint()
{
return sprintf(
'%s/%d/%s',
Plex_Server_Library::ENDPOINT_METADATA,
$this->getRatingKey(),
self::ENDPOINT_ALL_LEAVES
);
}

/**
* Static factory method used to instantiate child item classes by their
* type.
Expand Down

0 comments on commit e6245f4

Please sign in to comment.