Read all messages in conversation.

@param int $id - conversation ID

@return bool

@throws InvalidArgumentException
@throws Exception
427676
public function readMessages($id)
    {
        if ($this->isEmptyId($id)) {
            throw new InvalidArgumentException;
        }

        $res = $this->call('conversations/' . $id . '/markread', [], 'post');

        if ($res) {
            return true;
        }

        return false;
    }
189960
public function show($id = null)
    {
        // Check the ID
        if (!isset($id)) {
            throw new \InvalidArgumentException('Undefined ID', 400);
        }

        // Get record
        $item = $this->model->find($id);

        // Abort if the record is not found
        if (!$item) {
            throw new \Exception('Element not found', 404);
        }

        // Return response
        return [
            'success' => true,
            'data' => $item
        ];
    }
1290649
public function sendUserMessage($id, $message, $type = 'popup_chat')
    {
        if ($this->isEmptyId($id)) {
            throw new InvalidArgumentException;
        }

        if (!$message) {
            throw new InvalidArgumentException;
        }

        if (!in_array($type, ['popup_chat', 'popup_small', 'popup_big', 'email'])) {
            throw new InvalidArgumentException;
        }

        $params = [
            'body' => $message,
            'type' => $type
        ];
        $res = $this->call('users/' . $id . '/sendmessage', $params, 'post');

        if ($res) {
            return true;
        }

        return false;
    }
1225373
public function read($id)
    {
        $items = [];
        $items = $this->select('data')->where('session_id', '=', $id)
            ->limit('1')
            ->findAll('assoc');

        return isset($items[0]['data']) ? @$items[0]['data'] : null;
    }
910875
public static function can_mark_all_messages_as_read(int $userid, int $conversationid) : bool {
        global $USER;

        $systemcontext = \context_system::instance();

        if (has_capability('moodle/site:readallmessages', $systemcontext)) {
            return true;
        }

        if (!self::is_user_in_conversation($userid, $conversationid)) {
            return false;
        }

        if ($USER->id == $userid) {
            return true;
        }

        return false;
    }
418962
public function getMessage($id)
    {
        $bodyLines = 0;
        $header = $this->_protocol->top($id, $bodyLines, true);
        $message = $message = $this->getRawContent($id);
        return new Message($header, $message, $id);
    }
206942
public function actionRead($id)
    {
        $notification = $this->getNotification($id);

        $notification->seen = 1;
        $notification->save();

        return $notification;
    }
218917
public function read($id) {
        if ($this->overrideAction('read', $id)) {
            return;
        }

        $this->Model->id = $id;

        $result = $this->AdminToolbar->getRecordById($this->Model, $id);

        if (!$result) {
            throw new NotFoundException(__d('admin', '%s Not Found', $this->Model->singularName));
        }

        $this->Model->set($result);
        $this->AdminToolbar->logAction(ActionLog::READ, $this->Model, $id);

        $this->AdminToolbar->setAssociationCounts($this->Model);

        $this->set('result', $result);
        $this->overrideView('read');
    }
1317353
public function offsetGet($id)
    {
        $this->lock();

        if (!empty($this->resolving[$id])) {
            $chain = implode(' -> ', array_keys($this->resolving));
            throw new InvalidArgumentException("Circular dependency found: $chain -> $id");
        }

        $this->resolving[$id] = true;
        $return = $this->getServiceOrParameter($id);
        unset($this->resolving[$id]);

        return $return;
    }
928696
private function checkMessageId($id)
    {
        if(!is_int($id)){
            throw new ImapClientException('$id must be an integer!');
        };
        if($id <= 0){
            throw new ImapClientException('$id must be greater then 0!');
        };
        if($id > $this->countMessages()){
            throw new ImapClientException('$id does not exist');
        }
    }
1262688
public function deleteConversations($id)
    {
        $deleteConversation = $this->conversation->delete($id);
        if ($deleteConversation) {
            return $this->message->deleteMessages($id);
        }

        return false;
    }
768798
public function read($id)
    {
        // Get the session data from the database table.
        $query = $this->db->getQuery(true);
        $query->select($this->db->quoteName($this->options['data_col']))
            ->from($this->db->quoteName($this->options['table']))
            ->where($this->db->quoteName($this->options['id_col']) . ' = ' . $this->db->quote($id));

        $this->db->setQuery($query);

        return (string) $this->db->loadResult();
    }
505628
public function read( $id )
	{
		$this->inital_session_id = $id;
		
		if ( $data = \DB::select( $this->table )->where( 'id', $id )->one( $this->database ) )
		{
			$session_data = unserialize( $data->content );
			
			foreach( $this->index_fields as $field ) 
			{
				$session_data[$field] = $data->$field;
			}
			
			return $session_data;
		}
		
		return array();
	}
513885
public function read($id, $next)
    {
        $encrypted = $next( $id );

        return empty( $encrypted ) ? $encrypted : $this->decrypt( $next( $id ) );
    }
646038
public function read($id) {
		// read
		$model = $this->get($id);

		// check existence
		if ($model === null) {
			return new NotFound(['message' => 'Skill not found.']);
		}

		return new Found(['model' => $model]);
	}
131978
public function read($id)
    {
        if (!$data = $this->getCache()->load($this->normalizeId($id))) {
            return null;
        }

        return $data;
    }
1247523
public function read($id) {
        $tmp      = $_SESSION;
        $key      = $this->getKey($id);
        $_SESSION = json_decode($this->mem->get($key, false, ''), true);


        // TODO: replace all of this with custom session data modifiers to be executed one by one
        // TODO: Create CachedSessionHandler that accepts AbstractStorage as its storage
        // TODO: Refactor this to extend CachedSessionHandler and use JSON encode/decode where needed
        $user = $this->getUser();

        if ($user instanceof UserInterface) {
            $roles = array();
            /** @var RoleInterface $role */
            foreach ($user->getRoles() as $role) {
                $roles[] = $role->getRole();
            }
            $userData         = array(
                'username' => $user->getUsername(),
                'roles'    => $roles
            );
            $_SESSION['user'] = $userData;
        }

        if (isset($_SESSION) && !empty($_SESSION) && $_SESSION != null) {
            $new_data = session_encode();
            $_SESSION = $tmp;
            return $new_data;
        }
        return '';
    }