public function api($name, array $params = array(), $method = 'GET', array $options = array()) { if (!$this->getClient() || !$this->client->conn) { $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, "Could not load rest.modRestClient for FlickrSource media source (request {$name})."); return false; } $params['api_key'] = $this->getProperty('api_key'); $params['method'] = 'flickr.' . $name; $params['format'] = 'json'; $params['nojsoncallback'] = 1; return $this->client->request($this->endpoint, $this->path, $method, $params, $options); }
/** * Send a REST request * * @access public * @param string $host The host of the REST server. * @param string $path The path to request to on the REST server. * @param string $method The HTTP method to use for the request. May be GET, * PUT or POST. * @param array $params An array of parameters to send with the request. * @param array $options An array of options to pass to the request. * @return modRestResponse The response object. */ public function request($host,$path,$method = 'GET',array $params = array(),array $options = array()) { if (!is_object($this->conn)) { $loaded = $this->getConnection(); if (!$loaded) return false; } $this->host = $host; $response = $this->conn->request($this->host,$path,$method,$params,$options); $responseClass = $this->modx->getOption(modRestClient::OPT_RESPONSE_CLASS,$this->config,'modRestResponse'); $this->response = new $responseClass($this,$response,$this->responseType); return $this->response; }