本文整理汇总了PHP中Http::prepare方法的典型用法代码示例。如果您正苦于以下问题:PHP Http::prepare方法的具体用法?PHP Http::prepare怎么用?PHP Http::prepare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Http
的用法示例。
在下文中一共展示了Http::prepare方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: activate
public function activate(array $params) {
$endPoint = Http::prepare('/mail/activate.json');
$response = json_decode(Http::send($this->apicaller, $endPoint, $params, 'GET'));
if (!is_object($response)) {
throw new ResponseException(__METHOD__);
}
return $response;
}
示例2: getDnsRecords
public function getDnsRecords(array $params) {
$endPoint = Http::prepare('domainforward/dns-records.json');
$response = json_decode(Http::send($this->apicaller, $endPoint, $params, 'GET'));
if (!is_object($response)) {
throw new ResponseException(__METHOD__);
}
return $response;
}
示例3: delete
/**
* Unregister the mobile devices that are receiving push notifications
*
* @param array $devices
*
* @throws MissingParametersException
* @throws ResponseException
* @throws \Exception
*
* @return bool
*/
public function delete(array $devices = array())
{
$endPoint = Http::prepare('push_notification_devices/destroy_many.json');
$response = Http::send($this->client, $endPoint, array("push_notification_devices" => $devices), 'POST');
if ($this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return true;
}
示例4: update
/**
* Update one or more settings
*
* @param array $params
*
* @throws ResponseException
* @throws \Exception
*
* @return mixed
*/
public function update(array $params)
{
$endPoint = Http::prepare('account/settings.json');
$response = Http::send($this->client, $endPoint, array(self::OBJ_NAME => $params), 'PUT');
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return $response;
}
示例5: findAll
/**
* Returns a list of sharing agreements
*
* @param array $params
*
* @throws ResponseException
* @throws \Exception
*
* @return mixed
*/
public function findAll(array $params = array())
{
$endPoint = Http::prepare('sharing_agreements.json', null, $params);
$response = Http::send($this->client, $endPoint);
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return $response;
}
示例6: importMany
/**
* Create multiple new tickets
*
* @param array $params
*
* @throws ResponseException
* @throws \Exception
*
* @return mixed
*/
public function importMany(array $params)
{
$endPoint = Http::prepare('imports/tickets/create_many.json');
$response = Http::send($this->client, $endPoint, array(self::OBJ_NAME_PLURAL => $params), 'POST');
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return $response;
}
示例7: create
/**
* Create a voice or voicemail ticket
*
* @param array $params
*
* @throws ResponseException
* @throws \Exception
*
* @return mixed
*/
public function create(array $params)
{
$endPoint = Http::prepare('channels/voice/tickets.json');
$response = Http::send($this->client, $endPoint, $params, 'POST');
// note: specify the whole package
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 201) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return $response;
}
示例8: anonymousSearch
/**
* Perform an anonymous search
*
* @param array $params
*
* @throws MissingParametersException
* @throws ResponseException
* @throws \Exception
*
* @return mixed
*/
public function anonymousSearch(array $params)
{
if (!$this->hasKeys($params, array('query'))) {
throw new MissingParametersException(__METHOD__, array('query'));
}
$endPoint = Http::prepare('portal/search.json', null, $params);
$response = Http::send($this->client, $endPoint, $params, 'GET');
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return $response;
}
示例9: detectBest
/**
* Detect the best locale from the supplied list
*
* @param array $params
*
* @throws MissingParametersException
* @throws ResponseException
* @throws \Exception
*
* @return mixed
*/
public function detectBest(array $params)
{
if (!$this->hasKeys($params, array('available_locales'))) {
throw new MissingParametersException(__METHOD__, array('available_locales'));
}
$endPoint = Http::prepare('locales/detect_best_locale.json', null, $params);
$response = Http::send($this->client, $endPoint, array('available_locales' => $params['available_locales']), 'GET');
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return $response;
}
示例10: tags
/**
* Submits a request for matching tags
*
* @param array $params
*
* @throws MissingParametersException
* @throws ResponseException
* @throws \Exception
* @return mixed
*/
public function tags(array $params)
{
if (!$this->hasKeys($params, array('name'))) {
throw new MissingParametersException(__METHOD__, array('name'));
}
$endPoint = Http::prepare('autocomplete/tags.json');
$response = Http::send($this->client, $endPoint, array(self::OBJ_NAME => $params['name']), 'POST');
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return $response;
}
示例11: openTicket
/**
* Opens a ticket in an agent's browser
*
* @param array $params
*
* @throws MissingParametersException
* @throws ResponseException
* @throws \Exception
*
* @return bool
*/
public function openTicket(array $params = array())
{
if (!$this->hasKeys($params, array('agent_id', 'ticket_id'))) {
throw new MissingParametersException(__METHOD__, array('agent_id', 'ticket_id'));
}
$endPoint = Http::prepare('channels/voice/agents/' . $params['agent_id'] . '/tickets/' . $params['ticket_id'] . '/display.json');
$response = Http::send($this->client, $endPoint, null, 'POST');
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return true;
}
示例12: findAll
/**
* List all stats
*
* @param array $params
*
* @throws MissingParametersException
* @throws ResponseException
* @throws \Exception
*
* @return mixed
*/
public function findAll(array $params = array())
{
if (!$this->hasAnyKey($params, array('current_queue_activity', 'historical_queue_activity', 'agents_activity'))) {
throw new MissingParametersException(__METHOD__, array('current_queue_activity', 'historical_queue_activity', 'agents_activity'));
}
$endPoint = Http::prepare(isset($params['current_queue_activity']) ? 'channels/voice/stats/current_queue_activity.json' : (isset($params['historical_queue_activity']) ? 'channels/voice/stats/historical_queue_activity.json' : (isset($params['agents_activity']) ? 'channels/voice/stats/agents_activity.json' : '')), null, $params);
$response = Http::send($this->client, $endPoint);
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return $response;
}
示例13: find
/**
* Find a specific article by id
*
* @param array $params
*
* @throws MissingParametersException
* @throws ResponseException
* @throws \Exception
*
* @return mixed
*/
public function find(array $params = array())
{
if (!$this->hasKeys($params, array('id'))) {
throw new MissingParametersException(__METHOD__, array('id'));
}
$url = sprintf('help_center/%sarticles/%d.json', isset($params['locale']) ? $params['locale'] . '/' : '', $params['id']);
$endPoint = Http::prepare($url, $this->client->getSideload($params));
$response = Http::send($this->client, $endPoint);
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__);
}
$this->client->setSideload(null);
return $response;
}
示例14: create
/**
* Create a new satisfaction rating (authorised end user credentials only please!)
*
* @param array $params
*
* @throws ResponseException
* @throws \Exception
*
* @return mixed
*/
public function create(array $params)
{
if ($this->client->tickets()->getLastId() != null) {
$params['ticket_id'] = $this->client->tickets()->getLastId();
$this->client->tickets()->setLastId(null);
}
$endPoint = Http::prepare('tickets/' . $params['ticket_id'] . '/satisfaction_rating.json');
$response = Http::send($this->client, $endPoint, array(self::OBJ_NAME => $params), 'POST');
if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) {
throw new ResponseException(__METHOD__, $this->client->getDebug()->lastResponseCode == 403 ? ' (hint: you need to authenticate as a verified end user for this method)' : '');
}
$this->client->setSideload(null);
return $response;
}
示例15: find
/**
* Show a specific audit log
*
* @param array $params
*
* @throws MissingParametersException
* @throws ResponseException
* @throws \Exception
*
* @return mixed
*/
public function find(array $params = array())
{
if ($this->lastId != null) {
$params['id'] = $this->lastId;
$this->lastId = null;
}
if (!$this->hasKeys($params, array('id'))) {
throw new MissingParametersException(__METHOD__, array('id'));
}
$endPoint = Http::prepare('audit_logs/' . $params['id'] . '.json');
$response = Http::send($this->client, $endPoint);
$this->client->setSideload(null);
return $response;
}