/** * Update the properties of a message * * @method getMessagesDelta * * @param {string} state - State to get delta from * * @return {Response} Returns Response object * @throws ServiceException if API request was not successful. */ public function getMessagesDelta($state) { $token = $this->getSessionConsentToken('IMMN'); $immnSrvc = new IMMNService($this->base_url, $token); return $immnSrvc->getMessagesDelta($state, true); }
public function handleGetDelta() { $vnames = array('getDelta', 'state'); $this->copyToSession($vnames); if (!isset($_SESSION['getDelta'])) { return; } try { $state = $_SESSION['state']; $immnSrvc = new IMMNService($this->apiFQDN, $this->getSessionToken()); $this->clearSession(array('getDelta')); $delta = $immnSrvc->getMessagesDelta($state); $this->results[C_GET_DELTA] = $delta; } catch (Exception $e) { $this->errors[C_GET_DELTA] = $e->getMessage(); $this->clearSession(array('getDelta')); } }
* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ session_start(); require_once __DIR__ . '/common.php'; require_once __DIR__ . '/../lib/IMMN/IMMNService.php'; use Att\Api\IMMN\IMMNService; $arr = null; try { envinit(); $immnSrvc = new IMMNService(getFqdn(), getSessionToken()); $msgState = $_POST['msgState']; $deltaResponse = $immnSrvc->getMessagesDelta($msgState); $tables = array(); foreach ($deltaResponse->getDeltas() as $delta) { $values = array(); foreach ($delta->getAdds() as $add) { $values[] = array('Add', $add->getMessageId(), $add->isFavorite(), $add->isUnread()); } foreach ($delta->getDeletes() as $delete) { $values[] = array('Delete', $delete->getMessageId(), $delete->isFavorite(), $delete->isUnread()); } foreach ($delta->getUpdates() as $update) { $values[] = array('Update', $update->getMessageId(), $update->isFavorite(), $update->isUnread()); } $tables[] = array('caption' => 'Delta Type: ' . $delta->getDeltaType(), 'headers' => array('Delta Operation', 'MessageId', 'Favorite', 'Unread'), 'values' => $values); } $arr = array('success' => true, 'tables' => $tables);
try { // Enter the id of the message. $msgId = 'ENTER VALUE!'; // Enter the id of the content to retrieve. $partId = 'ENTER VALUE!'; // Send the request to get the message content. $msgContent = $immnSrvc->getMessageContent($msgId, $partId); } catch (ServiceException $se) { echo $se->getErrorResponse(); } /* This try/catch block tests the getMessagesDelta method. */ try { // Enter message state. $state = 'ENTER VALUE!'; // Send the request to get the delta of the messages. $msgsDelta = $immnSrvc->getMessagesDelta($state); echo "state: " . $msgsDelta->getState() . "\n"; } catch (ServiceException $se) { echo $se->getErrorResponse(); } /* This try/catch block tests the updateMessages method. */ try { // Specify the id of the message to update. $msgId = 'ENTER VALUE'; // Update the message's Favorite status to true. $favorite = true; // Update the message's Unread status to true. $unread = true; // Create an array that contains an IMMNDeltaChange object to pass to the // IMMNService object. $immnDeltaChange = array(new IMMNDeltaChange($msgId, $favorite, $unread));