Gets a contact's history by contact ID

List all calls and texts associated with a contact.

@api
@param int                       $ContactId         Contact to get history
@param Request\GetContactHistory $GetContactHistory
542605
public function GetContactHistory($ContactId, Request\GetContactHistory $GetContactHistory)
    {
        $uri = $this->getUri('/contact/%s/history', array($ContactId));

        return $this->get($uri, $GetContactHistory);
    }
1110729
public function getEngagementCount(
        Contact $contact,
        \DateTime $dateFrom = null,
        \DateTime $dateTo = null,
        $unit = 'm',
        ChartQuery $chartQuery = null
    ) {
        $event = new ContactSourceTimelineEvent($contact);
        $event->setCountOnly($dateFrom, $dateTo, $unit, $chartQuery);

        $this->dispatcher->dispatch(ContactSourceEvents::TIMELINE_ON_GENERATE, $event);

        return $event->getEventCounter();
    }
1173345
public static function is_contact(int $userid, int $contactid) : bool {
        global $DB;

        $sql = "SELECT id
                  FROM {message_contacts} mc
                 WHERE (mc.userid = ? AND mc.contactid = ?)
                    OR (mc.userid = ? AND mc.contactid = ?)";
        return $DB->record_exists_sql($sql, [$userid, $contactid, $contactid, $userid]);
    }
274957
public function getContactsImportReport($importId)
    {
        $url = $this->getApiEndpoint() . self::REST_CONTACTS_IMPORT . $importId
            . '/report';
        $this->setUrl($url)
            ->setVerb('GET');

        $response = $this->execute();

        if (isset($response->message)) {
            $message = 'GET CONTACTS IMPORT REPORT  . ' . $url . ' message : '
                . $response->message;
            $this->helper->debug('getContactsImportReport', [$message]);
        }

        return $response;
    }
150259
public function getFromId( $ContactUrlId){
        $rest = $this->getService( self::API_URL . $ContactUrlId);
        $rest->GET();

        return $rest->getResult( models\Call\ContactUrl::class);
    }
588193
public function updateContact($contactId, array $data = [])
	{
		return $this->sendRequest(
			$this->createRequest('PATCH', sprintf('contacts/%d', $contactId), [], $data)
		);
	}
577496
public function history($id)
    {
        $event = $this->repository->find($id);

        return view('cms::modules.events.history')
            ->with('event', $event);
    }
758275
public function getEvents($contactSourceId, $eventType = null, \DateTime $dateAdded = null)
    {
        $q = $this->getEntityManager()->getConnection()->createQueryBuilder()
            ->from(MAUTIC_TABLE_PREFIX.'contactsource_events', 'c')
            ->select('c.*');

        $expr = $q->expr()->eq('c.contactsource_id', ':contactSource');
        $q->where($expr)
            ->setParameter('contactSource', (int) $contactSourceId);

        if ($dateAdded) {
            $expr->add(
                $q->expr()->gte('c.date_added', ':dateAdded')
            );
            $q->setParameter('dateAdded', $dateAdded);
        }

        if ($eventType) {
            $expr->add(
                $q->expr()->eq('c.type', ':type')
            );
            $q->setParameter('type', $eventType);
        }

        return $q->execute()->fetchAll();
    }
218949
@Override
	public synchronized List<RecordTag> getTagsForHistoryID (long historyId) throws DatabaseException {
    	try {
			List<RecordTag> result = new ArrayList<>();
			psGetTagsForHistoryId.setLong(1, historyId);
			try (ResultSet rs = psGetTagsForHistoryId.executeQuery()) {
				while (rs.next()) {
					result.add(new RecordTag(rs.getLong(TAGID), rs.getLong(TAGID), rs.getString(TAG)));
				}
			}
			
			return result;
		} catch (SQLException e) {
			throw new DatabaseException(e);
		}
    }
165041
public function getFromId( $contactAddressId){
        $rest = $this->getService( self::API_ADDRESS . $contactAddressId);
        $rest->GET();

        return $rest->getResult( models\Call\ContactAddress::class);
    }
257549
public function deleteContactsAction($accountId, $contactId)
    {
        try {
            // Check if relation exists.
            /** @var AccountContactEntity $accountContact */
            $accountContact = $this->getDoctrine()
                ->getRepository(self::$accountContactEntityName)
                ->findByForeignIds($accountId, $contactId);

            if (!$accountContact) {
                throw new EntityNotFoundException('AccountContact', $accountId . $contactId);
            }
            $id = $accountContact->getId();

            $account = $accountContact->getAccount();

            // Remove main contact when relation with main was removed.
            if ($account->getMainContact() && strval($account->getMainContact()->getId()) === $contactId) {
                $account->setMainContact(null);
            }

            // Remove accountContact.
            $em = $this->getDoctrine()->getManager();
            $em->remove($accountContact);
            $em->flush();

            $view = $this->view($id, 200);
        } catch (EntityNotFoundException $enfe) {
            $view = $this->view($enfe->toArray(), 404);
        }

        return $this->handleView($view);
    }
1097546
function getById($contactId){
        return new Contact(
            $this->getContext(),
            new ResourcePathEntity($this->getContext(),$this->getResourcePath(),$contactId)
        );
    }
315943
public function get_rooms_history($room_id, $date = 'recent') {
     $response = $this->make_request('rooms/history', array(
      'room_id' => $room_id,
      'date' => $date
     ));
     return $response->messages;
   }
331098
@GET
    @Path("{id}/history")
    public Response fetchHistory(@PathParam("id") URI_ID id) throws Exception {
        return super.fetchHistory(id);
    }
678623
public function editContactEvent($contactId, $eventId, array $parameters)
    {
        return $this->makeRequest($this->endpoint.'/'.$eventId.'/contact/'.$contactId.'/edit', $parameters, 'PUT');
    }
575197
public function deleteFromId( $ContactUrlId){
        $rest = $this->getService( self::API_URL . $ContactUrlId);
        $rest->DELETE();

        return $rest->getSuccess();
    }
766629
public function getContactNumbersFromContactId( $ContactEntryId){
        $service = sprintf( self::API_CONTACT_NUMBERS, $ContactEntryId);
        $rest = $this->getService( $service);
        $rest->GET();

        return $rest->getResultAsArray( models\Call\ContactNumber::class);
    }