public static function fromArray($arr) { $immnMsgList = new IMMNMessageList(); // TODO: finish $msgList = $arr['messageList']; $immnMsgList->_offset = $msgList['offset']; $immnMsgList->_limit = $msgList['limit']; $immnMsgList->_total = $msgList['total']; $immnMsgList->_state = $msgList['state']; $immnMsgList->_cacheStatus = $msgList['cacheStatus']; if (isset($msgList['failedMessages'])) { $immnMsgList->_failedMessages = $msgList['failedMessages']; } $msgs = $msgList['messages']; $immnMsgs = array(); foreach ($msgs as $msg) { $immnMsgs[] = IMMNMessage::fromArray($msg); } $immnMsgList->_msgs = $immnMsgs; return $immnMsgList; }
public function getMessage($msgId) { $endpoint = $this->getFqdn() . '/myMessages/v2/messages/' . $msgId; $req = new RestfulRequest($endpoint); $result = $req->setHeader('Accept', 'application/json')->setAuthorizationHeader($this->getToken())->sendHttpGet(); $arr = Service::parseJson($result); $msgArr = $arr['message']; return IMMNMessage::fromArray($msgArr); }