public function handleDeleteMsgs() { $vnames = array('deleteMessage', 'messageId'); $this->copyToSession($vnames); if (!isset($_SESSION['deleteMessage'])) { return; } try { $msgIds = $_SESSION['messageId']; $msgIds = explode(',', $msgIds); $immnSrvc = new IMMNService($this->apiFQDN, $this->getSessionToken()); $this->clearSession(array('deleteMessage')); if (count($msgIds) > 1) { $immnSrvc->deleteMessages($msgIds); } else { /* one message id */ $msgId = $msgIds[0]; $immnSrvc->deleteMessage($msgId); } $this->results[C_DELETE_MSGS] = true; } catch (Exception $e) { $this->errors[C_DELETE_MSGS] = $e->getMessage(); $this->clearSession(array('deleteMessage')); } }
/** * Delete the Messages from Server * * @method deleteMessages * * @param {array} messageIds - Array of MessageIds to delete * * @return {Response} Returns Response object * @throws ServiceException if API request was not successful. */ public function deleteMessages($messageIds) { $token = $this->getSessionConsentToken('MIM'); $immnSrvc = new IMMNService($this->base_url, $token); return $immnSrvc->deleteMessages($messageIds, true); }
// Update the message's Favorite status to true. $favorite = true; // Update the message's Unread status to true. $unread = true; // Send the request to update the message. $immnSrvc->updateMessage($msgId, $unread, $favorite); echo "Successfully updated message.\n"; } catch (ServiceException $se) { echo $se->getErrorResponse(); } /* This try/catch block tests the deleteMessages method. */ try { // Enter the ids of the messages to delete. $msgIds = array('ENTER VALUE!'); // Send the request to delete the specified messages. $immnSrvc->deleteMessages($msgIds); echo "Successfully deleted messages.\n"; } catch (ServiceException $se) { echo $se->getErrorResponse(); } /* This try/catch block tests the createMessageIndex method. */ try { // Send the request to create the message index. $immnSrvc->createMessageIndex(); echo "Successfully created message index.\n"; } catch (ServiceException $se) { echo $se->getErrorResponse(); } /* This try/catch block tests the getMessageIndexInfo method. */ try { // Send the request to get the message index info.