declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Components;
use Apideck\Unify\Models\Operations;
$sdk = Unify\Apideck::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->setConsumerId('<insert-consumer-id-here>')
->setAppId('<insert-application-id-here>')
->build();
$request = new Operations\CrmContactsAllRequest(
serviceId: 'salesforce',
filter: new Components\ContactsFilter(
firstName: 'Elon',
lastName: 'Musk',
email: 'elon@tesla.com',
companyId: '12345',
ownerId: '12345',
),
sort: new Components\ContactsSort(
by: Components\ContactsSortBy::CreatedAt,
direction: Components\SortDirection::Desc,
),
passThrough: [
'search' => 'San Francisco',
],
fields: 'id,updated_at',
);
$responses = $sdk->crm->contacts->list(
request: $request
);
foreach ($responses as $response) {
if ($response->httpMeta->response->getStatusCode() === 200) {
// handle response
}
}