Contact

Table of contents

See how to create a $factory

List contacts

Returns a list of the contacts

Usage

$response = $factory->clients()->contacts()->listContacts($clientId, $updatedSince, $meta);
$response->getMeta() instanceof \Lsv\TimeharvestSdk\Response\MetaResponse
foreach ($response->getData() as $client) {
    $client instanceof \Lsv\TimeharvestSdk\Response\Client\Contact\ContactData
}

Parameters

Parameter Required Type Description
$clientId false int | ClientInfoResponse Select only contacts that belongs to this client
$updatedSince false DateTimeInterface Only select contacts updated after this date
$meta false \Lsv\TimeharvestSdk\Response\MetaResponse Pagination

Response

$response->getMeta() instanceof \Lsv\TimeharvestSdk\Response\MetaResponse;
$response->getData() array of \Lsv\TimeharvestSdk\Response\Client\Contact\ContactData

Retrieve contact

Usage

$response = $factory->clients()->contacts()->getContact($contact);

Parameters

Parameter Required Type Description
$contact true int | \Lsv\TimeharvestSdk\Response\Client\Contact\ContactData The ID or a ContactResponse of the contact needed to be retrieved

Response

$response->getData() instanceof \Lsv\TimeharvestSdk\Response\Client\Contact\ContactData

Create contact

Usage

$dto = new \Lsv\TimeharvestSdk\Dto\Clients\Contact\CreateContactDto(
    $clientId,
    $firstName,
    $lastName,
    $title,
    $email,
    $phoneOffice,
    $phoneMobile,
    $fax
);
$response = $factory->clients()->contacts()->createContact($dto);

Parameters

Parameter Required Type Description
$clientId true int | \Lsv\TimeharvestSdk\Response\Client\ClientInfoResponse The ID or a ClientResponse of the client the contact needs to be associated with
$firstName true string First name of the contact
$lastName false string Last name of the contact
$title false string Title of the contact
$email false string Email of the contact
$phoneOffice false string Office phone of the contact
$phoneMobile false string Mobile phone of the contact
$fax false string Fax of the contact

Response

$response->getData() instanceof \Lsv\TimeharvestSdk\Response\Client\Contact\ContactData

Update contact

Usage

$dto = new \Lsv\TimeharvestSdk\Dto\Clients\Contact\UpdateContactDto(
    $clientId,
    $firstName,
    $lastName,
    $title,
    $email,
    $phoneOffice,
    $phoneMobile,
    $fax
);
$response = $factory->clients()->contacts()->updateContact($contact, $dto);

Parameters

Parameter Required Type Description
$contact true int | \Lsv\TimeharvestSdk\Response\Client\Contact\ContactData The ID or a ContactResponse of the contact needed to be updated
$clientId false int | \Lsv\TimeharvestSdk\Response\Client\ClientInfoResponse The ID or a ClientResponse of the client the contact needs to be associated with
$firstName false string First name of the contact
$lastName false string Last name of the contact
$title false string Title of the contact
$email false string Email of the contact
$phoneOffice false string Office phone of the contact
$phoneMobile false string Mobile phone of the contact
$fax false string Fax of the contact

Response

$response->getData() instanceof \Lsv\TimeharvestSdk\Response\Client\Contact\ContactData

Delete contact

Usage

$factory->clients()->contacts()->deleteContact($contact);

Parameters

Parameter Required Type Description
$contact true int | \Lsv\TimeharvestSdk\Response\Client\Contact\ContactData The ID or a ContactResponse of the contact needed to be deleted