/** * Gets the response from the api in string format * * @param int $id * @param array $properties array of properties to add to querystring * @param array $fields array of fields to add to querystring * @param string $format either "xml" or "json" * @return string * @throws InvalidArgumentException */ private function GetArticleRaw($id, $properties, $fields, $format) { switch ($format) { case "xml": $uri = $this->GetUri($id, null, "xml", $properties, $fields, null, null); break; case "json": $uri = $this->GetUri($id, null, "json", $properties, $fields, null, null); break; default: throw new InvalidArgumentException($format . 'format not supported'); break; } $uri = "http://" . $this->credentials->getPublicKey() . ":" . $this->credentials->getSecretKey() . "@" . str_replace("http://", "", $uri); return AdferoHelpers::GetRawResponse($uri); }
/** * Lists the categories under a particular article. * * @param int feedId * @param int $offset offset to skip * @param int $limit The limit to apply to the list (maximum 100) * @param array $properties array of properties to add to querystring * @param array $fields array of fields to add to querystring * @return AdferoCategoryList */ private function ListCategoriesForArticle($articleId, $offset, $limit, $properties, $fields) { $uri = $this->GetUri($articleId, "articleId", "xml", $properties, $fields, $offset, $limit); $uri = "http://" . $this->credentials->getPublicKey() . ":" . $this->credentials->getSecretKey() . "@" . str_replace("http://", "", $uri); $xmlString = AdferoHelpers::GetXMLFromUri($uri); $categories = $this->ListCategoriesFromXmlString($xmlString); $categories->limit = $limit; $categories->offset = $offset; return $categories; }
/** * Lists the feeds. * * @param int $offset offset to apply to the list * @param int $limit The limit to apply to the list (maximum 100) * @param array $properties array of properties to add to querystring * @param array $fields array of fields to add to querystring * @return AdferoFeedList */ private function ListFeedsForFeed($offset, $limit, $properties, $fields) { $uri = $this->GetUri(null, null, "xml", $properties, null, $offset, $limit); $uri = "http://" . $this->credentials->getPublicKey() . ":" . $this->credentials->getSecretKey() . "@" . str_replace("http://", "", $uri); $xmlString = AdferoHelpers::GetXMLFromUri($uri); $feeds = $this->ListFeedsFromXmlString($xmlString); $feeds->limit = $limit; $feeds->offset = $offset; return $feeds; }