Method to delete a contact.

@param integer $contactId
@return array
431328
public function deleteContact($contactId)
    {
        if (is_null($contactId) || $contactId == '') {
            throw new Exception('The contactId is required to delete a contact.');
        }

        $params = array(
            'method' => 'sp.contact.delete',
            'contact_id' => $contactId
        );

        return $this->_makeApiRequest($params);
    }
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);
    }
619170
public function delete($attachmentId = null)
    {
        $attachment = $this->Attachments->get($attachmentId);
        $this->_checkAuthorization($attachment);
        $this->Attachments->delete($attachment);
        return new ServiceResponse('success');
    }
713426
public function replaceContact($contactId, array $data = [])
	{
		return $this->sendRequest(
			$this->createRequest('PUT', sprintf('contacts/%d', $contactId), [], $data)
		);
	}
1001841
public function getContactAddressesFromContactId( $ContactEntryId){
        $service = sprintf( self::API_CONTACT_ADDRESSES, $ContactEntryId);
        $rest = $this->getService( $service);
        $rest->GET();

        return $rest->getResultAsArray( models\Call\ContactAddress::class);
    }
480862
public function deleteContact(Contact $contact)
    {
        $this->om->remove($contact);
        $this->om->flush();
    }
586057
function remove_from_group($group_id, $contact_ids)
    {
        $group_cache = $this->_fetch_groups();
        $member_attr = $group_cache[$group_id]['member_attr'];
        $group_dn    = $group_cache[$group_id]['dn'];
        $del_attrs   = array();

        if (!is_array($contact_ids)) {
            $contact_ids = explode(',', $contact_ids);
        }

        foreach ($contact_ids as $id) {
            $del_attrs[$member_attr][] = self::dn_decode($id);
        }

        if (!$this->ldap->mod_del($group_dn, $del_attrs)) {
            $this->set_error(self::ERROR_SAVING, 'errorsaving');
            return 0;
        }

        if ($this->cache) {
            $this->cache->remove('groups');
        }

        return count($del_attrs[$member_attr]);
    }
1262688
public function deleteConversations($id)
    {
        $deleteConversation = $this->conversation->delete($id);
        if ($deleteConversation) {
            return $this->message->deleteMessages($id);
        }

        return false;
    }
578747
public function deleteFromId( $ContactEntryId){
        $rest = $this->getService( self::API_CONTACT);
        $rest->DELETE( $ContactEntryId);

        return $rest->getSuccess();
    }
101070
public function updateContactField($contactFieldId, array $data = [])
	{
		return $this->sendRequest(
			$this->createRequest('PATCH', sprintf('contact_fields/%d', $contactFieldId), [], $data)
		);
	}
1046666
def delete_contact_method(self, id, **kwargs):
        """"""
        endpoint = '{0}/{1}/contact_methods/{2}'.format(
            self.endpoint,
            self['id'],
            id,
        )
        return self.request('DELETE', endpoint=endpoint, query_params=kwargs)
698873
public function getAction($id)
    {
        $contactManager = $this->getContactManager();
        $locale = $this->getUser()->getLocale();

        try {
            $view = $this->responseGetById(
                $id,
                function($id) use ($contactManager, $locale) {
                    return $contactManager->getById($id, $locale);
                }
            );

            $context = new Context();
            $context->setGroups(static::$contactSerializationGroups);
            $view->setContext($context);
        } catch (EntityNotFoundException $e) {
            $view = $this->view($e->toArray(), 404);
        }

        return $this->handleView($view);
    }
1076016
private function batchRemoveContact(ContactsList $contactsList)
    {
        $emailsOnLists = [];
        $offset = 0;
        $limit = 1000;
        $run = true;

        // Retrieve Emails from list
        while ($run) {
            $filters = ['ContactsList'=> $contactsList->getListId(),'limit' => $limit, 'offset' => $offset];
            $response = $this->mailjet->get(Resources::$Contact, ['filters' => $filters]);
            if (!$response->success()) {
                $this->throwError("ContactsListSynchronizer:batchRemoveContact() failed", $response);
            }
            $data = $response->getData();

            foreach ($data as $key => $contact) {
                array_push($emailsOnLists, $contact['Email']);
            }

            $offset += $limit;
            if ($response->getCount() < $limit) {
                $run = false;
            }
        }

        $emailsInternal = array_map(function (Contact $contact) {
            return $contact->getEmail();
        }, $contactsList->getContacts());

        $diffEmails = array_diff($emailsOnLists, $emailsInternal);
        if (sizeof($diffEmails) == 0) {
            return [];
        }

        // Remove difference contacts
        $diffContacts = array_map(function ($email) {
            return new Contact($email);
        }, $diffEmails);

        $diffContactsList = new ContactsList($contactsList->getListId(), ContactsList::ACTION_REMOVE, $diffContacts);

        return $this->manager->manageManyContactsList($diffContactsList);
    }
1066183
public function detach($id = array(), $touch = true) {
        if (!$id instanceof Model and ! $id instanceof Collection) {
            $id = $this->modelsFromIds($id);
        } elseif (!is_array($id)) {
            $id = [$id];
        }

        // Prepare for a batch operation to take place so that we don't
        // overwhelm the database with many delete hits.
        $this->finder->prepareBatch();

        foreach ($id as $model) {
            $edge = $this->edge($model);
            $edge->delete();
        }

        $results = $this->finder->commitBatch();

        if ($touch)
            $this->touchIfTouching();

        return $results;
    }
678623
public function editContactEvent($contactId, $eventId, array $parameters)
    {
        return $this->makeRequest($this->endpoint.'/'.$eventId.'/contact/'.$contactId.'/edit', $parameters, 'PUT');
    }
119160
public static function delete_contacts($userids, $userid = 0) {
        global $CFG, $USER;

        // Check if messaging is enabled.
        if (empty($CFG->messaging)) {
            throw new moodle_exception('disabled', 'message');
        }

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

        // Validate context.
        $context = context_system::instance();
        self::validate_context($context);

        $params = array('userids' => $userids, 'userid' => $userid);
        $params = self::validate_parameters(self::delete_contacts_parameters(), $params);

        $capability = 'moodle/site:manageallmessaging';
        if (($USER->id != $params['userid']) && !has_capability($capability, $context)) {
            throw new required_capability_exception($context, $capability, 'nopermissions', '');
        }

        foreach ($params['userids'] as $id) {
            \core_message\api::remove_contact($params['userid'], $id);
        }

        return null;
    }
895757
public function removeContact(int $index): void
    {
        unset($this->contacts[$index]);
        $this->contacts = array_values($this->contacts);
    }