2016-05-21 22:39:24 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/// Require Composer AutoLoader
|
|
|
|
require_once '../../vendor/autoload.php';
|
|
|
|
|
|
|
|
/// Define our application
|
|
|
|
$App = new \alphayax\freebox\utils\Application( 'com.alphayax.freebox.call', 'PHP API Example (Call)', '1.0.0');
|
|
|
|
$App->authorize();
|
|
|
|
$App->openSession();
|
|
|
|
|
2016-06-11 21:28:52 +02:00
|
|
|
/// Get calls
|
|
|
|
$ContactService = new \alphayax\freebox\api\v3\services\Call\Contact\ContactEntry( $App);
|
2016-05-21 22:39:24 +02:00
|
|
|
$ContactEntries = $ContactService->getAll();
|
|
|
|
print_r( $ContactEntries);
|
|
|
|
|
|
|
|
|
2016-06-11 21:28:52 +02:00
|
|
|
/// Contact Address
|
|
|
|
$ContactAddressService = new \alphayax\freebox\api\v3\services\Call\Contact\ContactAddress( $App);
|
2016-05-21 22:39:24 +02:00
|
|
|
|
|
|
|
$ContactAddress = new \alphayax\freebox\api\v3\models\Call\ContactAddress();
|
|
|
|
$ContactAddress->setContactId( $ContactEntries[0]->getId());
|
|
|
|
$ContactAddress->setType( \alphayax\freebox\api\v3\symbols\Call\ContactAdressType::WORK);
|
|
|
|
$ContactAddress->setCity( 'Montpellier');
|
|
|
|
$ContactAddress->setCountry( 'France');
|
|
|
|
|
|
|
|
$ContactAddressCreated = $ContactAddressService->create( $ContactAddress);
|
|
|
|
print_r( $ContactAddressCreated);
|
|
|
|
|
|
|
|
$ContactAddressDeleted = $ContactAddressService->delete( $ContactAddressCreated);
|
|
|
|
print_r( $ContactAddressDeleted);
|
|
|
|
|
|
|
|
|
2016-06-11 21:28:52 +02:00
|
|
|
/// Contact number
|
|
|
|
$ContactNumbersService = new \alphayax\freebox\api\v3\services\Call\Contact\ContactNumber( $App);
|
2016-05-21 22:39:24 +02:00
|
|
|
|
|
|
|
$Number = new \alphayax\freebox\api\v3\models\Call\ContactNumber();
|
|
|
|
$Number->setType(\alphayax\freebox\api\v3\symbols\Call\ContactNumberType::HOME);
|
|
|
|
$Number->setNumber('0456123789');
|
|
|
|
$Number->setContactId( $ContactEntries[0]->getId());
|
|
|
|
|
|
|
|
$Number = $ContactNumbersService->create( $Number);
|
|
|
|
|
|
|
|
|
|
|
|
$ContactNumbers = $ContactService->getContactNumbersFromContactId( $ContactEntries[0]->getId());
|
|
|
|
print_r( $ContactNumbers);
|
|
|
|
|
|
|
|
$ContactNumbersService->delete( $Number);
|
|
|
|
|
|
|
|
$ContactNumbers = $ContactService->getContactNumbersFromContactId( $ContactEntries[0]->getId());
|
|
|
|
print_r( $ContactNumbers);
|
|
|
|
|
|
|
|
|