Client
Table of contents
See how to create a $factory
List clients
Returns a list of your clients
Usage
$response = $factory->clients()->listClients($isActive, $updatedSince, $meta);
$meta = $response->getMeta();
$meta instanceof \Lsv\TimeharvestSdk\Response\MetaResponse
foreach ($response->getData() as $client) {
$client instanceof \Lsv\TimeharvestSdk\Response\Client\ClientData
}
Parameters
Parameter |
Required |
Type |
Description |
$isActive |
false |
bool |
Select only active or inactive clients |
$updatedSince |
false |
DateTimeInterface |
Only select clients 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\ClientData
Retrieve client
Usage
$response = $factory->clients()->retrieveClient($client);
Parameters
Parameter |
Required |
Type |
Description |
$client |
true |
int | \Lsv\TimeharvestSdk\Response\Client\ClientInfoResponse |
The ID or a ClientResponse of the client needed to be retrieved |
Response
$response->getData() instanceof \Lsv\TimeharvestSdk\Response\Client\ClientData
Create client
Usage
$dto = new \Lsv\TimeharvestSdk\Dto\Clients\CreateClientDto($name, $isActive, $address, $currency);
$response = $factory->clients()->createClient($dto);
Parameters
Parameter |
Required |
Type |
Description |
$name |
true |
string |
Name of the client |
$isActive |
false |
bool |
Is the client active |
$address |
false |
string |
Address of the client |
$currency |
false |
string |
Currency for the client |
Response
$response->getData() instanceof \Lsv\TimeharvestSdk\Response\Client\ClientData
Update client
Usage
$dto = new \Lsv\TimeharvestSdk\Dto\Clients\UpdateClientDto($name, $isActive, $address, $currency);
$response = $factory->clients()->updateClient($client, $dto);
Parameters
Parameter |
Required |
Type |
Description |
$client |
true |
int | \Lsv\TimeharvestSdk\Response\Client\ClientInfoResponse |
The ID or a ClientResponse of the client needed to be updated |
$name |
false |
string |
Name of the client |
$isActive |
false |
bool |
Is the client active |
$address |
false |
string |
Address of the client |
$currency |
false |
string |
Currency for the client |
Response
$response->getData() instanceof \Lsv\TimeharvestSdk\Response\Client\ClientData
Delete client
Usage
$factory->clients()->deleteClient($client);
Parameters
Parameter |
Required |
Type |
Description |
$client |
true |
int | \Lsv\TimeharvestSdk\Response\Client\ClientInfoResponse |
The ID or a ClientResponse of the client needed to be deleted |