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; }
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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
/** * Find a specific activity * * @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('activities/' . $params['id'] . '.json'); $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; }
/** * Delete a token * * @param array $params * * @throws MissingParametersException * @throws ResponseException * @throws \Exception * * @return bool */ public function revoke(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')); } $id = $params['id']; $endPoint = Http::prepare('oauth/tokens/' . $id . '.json'); $response = Http::send($this->client, $endPoint, null, 'DELETE'); if ($this->client->getDebug()->lastResponseCode != 200) { throw new ResponseException(__METHOD__); } $this->client->setSideload(null); return true; }
/** * Show a specific ticket metric * * @param array $params * * @throws MissingParametersException * @throws ResponseException * @throws \Exception * * @return mixed */ public function find(array $params = array()) { if ($this->client->tickets()->getLastId() != null) { $params['ticket_id'] = $this->client->tickets()->getLastId(); $this->client->tickets()->setLastId(null); } if ($this->lastId != null) { $params['id'] = $this->lastId; $this->lastId = null; } if (!$this->hasAnyKey($params, array('id', 'ticket_id'))) { throw new MissingParametersException(__METHOD__, array('id', 'ticket_id')); } $endPoint = Http::prepare(isset($params['ticket_id']) ? 'tickets/' . $params['ticket_id'] . '/metrics.json' : 'ticket_metrics/' . $params['id'] . '.json'); $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; }
/** * Make the specified comment private * * @param array $params * * @throws MissingParametersException * @throws ResponseException * @throws \Exception * * @return mixed */ public function makePrivate(array $params = array()) { if ($this->client->tickets()->getLastId() != null) { $params['ticket_id'] = $this->client->tickets()->getLastId(); $this->client->tickets()->setLastId(null); } if ($this->lastId != null) { $params['id'] = $this->lastId; $this->lastId = null; } if (!$this->hasKeys($params, array('id', 'ticket_id'))) { throw new MissingParametersException(__METHOD__, array('id', 'ticket_id')); } $endPoint = Http::prepare('tickets/' . $params['ticket_id'] . '/comments/' . $params['id'] . '/make_private.json'); $response = Http::send($this->client, $endPoint, null, 'PUT'); if ($this->client->getDebug()->lastResponseCode != 200) { throw new ResponseException(__METHOD__, ' (hint: you can\'t make a private ticket private again)'); } $this->client->setSideload(null); return $response; }
public function searchArchived(array $params) { $endPoint = Http::prepare('actions/search-archived.json'); $response = Http::send($this->apicaller, $endPoint, $params, 'GET'); return $response; }
public function deleteModerators(array $params) { $endPoint = Http::prepare('mail/mailinglist/delete-moderators.json'); $response = json_decode(Http::send($this->apicaller, $endPoint, $params, 'GET')); if (!is_object($response)) { throw new ResponseException(__METHOD__); } return $response; }
/** * Delete a topic vote * * @param array $params * * @throws MissingParametersException * @throws ResponseException * @throws \Exception * * @return bool */ public function delete(array $params = array()) { if ($this->client->topics()->getLastId() != null) { $params['topic_id'] = $this->client->topics()->getLastId(); $this->client->topics()->setLastId(null); } if ($this->client->users()->getLastId() != null) { $params['user_id'] = $this->client->users()->getLastId(); $this->client->users()->setLastId(null); } if (!$this->hasKeys($params, array('topic_id'))) { throw new MissingParametersException(__METHOD__, array('topic_id')); } $endPoint = Http::prepare('topics/' . $params['topic_id'] . '/vote.json' . (isset($params['user_id']) ? '?user_id=' . $params['user_id'] : '')); $response = Http::send($this->client, $endPoint, null, 'DELETE'); if ($this->client->getDebug()->lastResponseCode != 200) { throw new ResponseException(__METHOD__); } $this->client->setSideload(null); return true; }
/** * Reorder user fields * * @param array $params * * @throws ResponseException * @throws \Exception * * @return mixed */ public function reorder(array $params) { $endPoint = Http::prepare('user_fields/reorder.json'); $response = Http::send($this->client, $endPoint, array('user_field_ids' => $params), 'PUT'); if ($this->client->getDebug()->lastResponseCode != 200) { throw new ResponseException(__METHOD__); } $this->client->setSideload(null); return $response; }
/** * Clones an existing form (can't use 'clone' as method name) * * @param array $params * * @throws MissingParametersException * @throws ResponseException * @throws \Exception * * @return mixed */ function cloneForm(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')); } $id = $params['id']; $endPoint = Http::prepare('ticket_forms/' . $id . '/clone.json'); $response = Http::send($this->client, $endPoint, null, 'POST'); if ($this->client->getDebug()->lastResponseCode != 201) { throw new ResponseException(__METHOD__); } $this->client->setSideload(null); return $response; }
public function deleteUserForwards(array $params) { $endPoint = Http::prepare('mail/user/delete-user-forwards.json'); $response = json_decode(Http::send($this->apicaller, $endPoint, $params, 'GET')); return $response; }
/** * Ticket count for a view preview * * @param array $params * * @throws ResponseException * @throws \Exception * * @return mixed */ public function previewCount(array $params) { $endPoint = Http::prepare('views/preview/count.json', $this->client->getSideload($params), $params); $response = Http::send($this->client, $endPoint, array('view' => $params), 'POST'); if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) { throw new ResponseException(__METHOD__); } $this->client->setSideload(null); return $response; }
/** * Make this group membership the default * * @param array $params * * @throws MissingParametersException * @throws ResponseException * @throws \Exception * * @return mixed */ public function makeDefault(array $params = array()) { if ($this->client->users()->getLastId() != null) { $params['user_id'] = $this->client->users()->getLastId(); $this->client->users()->setLastId(null); } if ($this->lastId != null) { $params['id'] = $this->lastId; $this->lastId = null; } if (!$this->hasKeys($params, array('user_id', 'id'))) { throw new MissingParametersException(__METHOD__, array('user_id', 'id')); } $endPoint = Http::prepare('users/' . $params['user_id'] . '/group_memberships/' . $params['id'] . '/make_default.json'); $response = Http::send($this->client, $endPoint, null, 'PUT'); if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) { throw new ResponseException(__METHOD__); } $this->client->setSideload(null); return $response; }
public function deleteSRVRecord(array $params) { $endPoint = Http::prepare('dns/manage/delete-srv-record.json'); $response = Http::send($this->apicaller, $endPoint, $params, 'GET'); return $response; }
public function DNSRecord(array $params,$country){ $endPoint = Http::prepare('singledomainhosting/linux/'.$country.'/dns-record.json'); $response = Http::send($this->apicaller, $endPoint, $params, 'GET'); return $response; }
/** * Search for organizations * * @param array $params * * @throws MissingParametersException * @throws ResponseException * @throws \Exception * * @return mixed */ public function search(array $params) { if (!$this->hasKeys($params, array('external_id'))) { throw new MissingParametersException(__METHOD__, array('external_id')); } $endPoint = Http::prepare('organizations/search.json', $this->client->getSideload($params), $params); $response = Http::send($this->client, $endPoint, array('external_id' => $params['external_id']), 'GET'); if (!is_object($response) || $this->client->getDebug()->lastResponseCode != 200) { throw new ResponseException(__METHOD__); } $this->client->setSideload(null); return $response; }