/** * /activities/{userId}/{groupId}/{optionalActvityId} * * examples: * /activities/john.doe/@self/1 * /activities/john.doe/@self * /activities/john.doe/@friends */ public function handleGet(RestRequestItem $requestItem) { $requestItem->parseUrlWithTemplate(self::$ACTIVITY_ID_PATH); $parameters = $requestItem->getParameters(); $optionalActivityId = in_array('activityId', $parameters) ? $parameters['activityId'] : null; // TODO: Filter by fields // TODO: do we need to add pagination and sorting support? if ($optionalActivityId != null) { return $this->service->getActivity($requestItem->getUser(), $requestItem->getGroup(), $optionalActivityId, $requestItem->getStartIndex(), $requestItem->getCount(), $requestItem->getToken()); } return $this->service->getActivities($requestItem->getUser(), $requestItem->getGroup(), $requestItem->getStartIndex(), $requestItem->getCount(), $requestItem->getToken()); }
/** * /people/{userId}/{groupId}/{optionalPersonId} * * examples: * /people/john.doe/@all * /people/john.doe/@friends * /people/john.doe/@self */ public function handleGet(RestRequestItem $requestItem) { $requestItem->parseUrlWithTemplate(self::$PEOPLE_PATH); $parameters = $requestItem->getParameters(); $optionalPersonId = in_array('personId', $parameters) ? $parameters['personId'] : null; $fields = $requestItem->getFieldsWithDefaultValue(self::$DEFAULT_PERSON_FIELDS); if ($optionalPersonId || is_object($requestItem->getGroup()) && $requestItem->getGroup()->getType() == 'self') { //FIXME same logic as the java code here, but doesn't seem to do much with the optionalPersonId which seems odd return $this->service->getPerson($requestItem->getUser(), $requestItem->getGroup(), $fields, $requestItem->getToken()); } return $this->service->getPeople($requestItem->getUser(), $requestItem->getGroup(), $requestItem->getOrderBy(), $requestItem->getFilterBy(), $requestItem->getStartIndex(), $requestItem->getCount(), $fields, $requestItem->getNetworkDistance(), $requestItem->getToken()); }
/** * Tests RestRequestItem->getStartIndex() */ public function testGetStartIndex() { $this->assertEquals('0', $this->RestRequestItem->getStartIndex()); }