diff --git a/README.md b/README.md index bf85fa8..3b1a660 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,13 @@ Ce projet est basé sur **composer**. Pensez à installer les dependences :) Jusqu'a présent, les fonctionalités suivantes ont été implémentées : - AirMedia +- Call + - CallEntry + - ContactEntry + - ContactAddress + - ContactEmail + - ContactNumber + - ContactUrl - FileSystem - FileSystem (Core) - FsTask @@ -90,6 +97,9 @@ alphayax\freebox\api\v3\models\SystemConfig Object Les exemples sont disponibles dans le repertoire `exemple`. Ils sont classés par services : - `AirMedia` : Exemple de lancement d'une video sur le Freebox Player +- `Call` : + - `Call` : Liste les appels recus et emis sur la freebox (avec exemple de supression et de marquage comme lu) + - `Contact` : Liste les contacts, ajoute et retire un numéro de téléphone au premier contact de la liste - `FileSystem` - `fileSharing` : Un exemple de partage de fichier sur le net - `fsListing` : Un exemple de scan de repertoires de la freebox diff --git a/exemple/Call/Call.php b/exemple/Call/Call.php new file mode 100644 index 0000000..4dafc50 --- /dev/null +++ b/exemple/Call/Call.php @@ -0,0 +1,31 @@ +authorize(); +$App->openSession(); + +$CallService = new \alphayax\freebox\api\v3\services\Call\CallEntry( $App); + +/// Get last 100 call entries +$CallEntries = $CallService->getAll(); +//print_r( $CallEntries); + +/// Get a specific call entry +$CallEntry = $CallService->getFromId( $CallEntries[0]->getId()); +print_r( $CallEntry); + +/// Delete a specific call entry +$isDeleted = $CallService->deleteFromId( $CallEntries[0]->getId()); +print_r( $isDeleted); + +/// Update a specific call entry +$CallEntries[1]->setNew( false); +$CallEntry = $CallService->update( $CallEntries[1]); +print_r( $CallEntry); + + + diff --git a/exemple/Call/Contact.php b/exemple/Call/Contact.php new file mode 100644 index 0000000..632e3bd --- /dev/null +++ b/exemple/Call/Contact.php @@ -0,0 +1,65 @@ +authorize(); +$App->openSession(); + +$ContactService = new \alphayax\freebox\api\v3\services\Call\ContactEntry( $App); + +$ContactEntries = $ContactService->getAll(); +print_r( $ContactEntries); + + +/* +$ContactNumber = new \alphayax\freebox\api\v3\models\Call\ContactNumber(); +$ContactNumber->setContactId( 1); +$ContactNumber->setNumber( '0213456789'); +$ContactNumber->setType( \alphayax\freebox\api\v3\symbols\Call\ContactNumberType::HOME); + +$ContactNumber = $ContactService->addContactNumber( $ContactNumber); +print_r( $ContactNumber); + +$ContactNumbers = $ContactService->getContactNumbersFromContactId( 1); +print_r( $ContactNumbers); +*/ + +/* +$ContactAddressService = new \alphayax\freebox\api\v3\services\Call\ContactAddress( $App); + +$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); +*/ + + +$ContactNumbersService = new \alphayax\freebox\api\v3\services\Call\ContactNumber( $App); + +$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); + + diff --git a/freebox/Exception/InvalidRequestException.php b/freebox/Exception/InvalidRequestException.php new file mode 100644 index 0000000..5195b52 --- /dev/null +++ b/freebox/Exception/InvalidRequestException.php @@ -0,0 +1,55 @@ +http_request_header; + } + + /** + * @param mixed $http_method + */ + public function setHttpRequestHeader( $http_method) { + $this->http_request_header = $http_method; + } + + /** + * @return mixed + */ + public function getHttpUrl() { + return $this->http_url; + } + + /** + * @param mixed $http_url + */ + public function setHttpUrl( $http_url) { + $this->http_url = $http_url; + } + + /** + * @return mixed + */ + public function getHttpParams() { + return $this->http_params; + } + + /** + * @param mixed $http_params + */ + public function setHttpParams( $http_params) { + $this->http_params = $http_params; + } + +} \ No newline at end of file diff --git a/freebox/api/v3/models/Call/CallEntry.php b/freebox/api/v3/models/Call/CallEntry.php new file mode 100644 index 0000000..bf61fe4 --- /dev/null +++ b/freebox/api/v3/models/Call/CallEntry.php @@ -0,0 +1,103 @@ +id; + } + + /** + * @return string + */ + public function getType() { + return $this->type; + } + + /** + * @return int + */ + public function getDatetime() { + return $this->datetime; + } + + /** + * @return string + */ + public function getNumber() { + return $this->number; + } + + /** + * @return string + */ + public function getName() { + return $this->name; + } + + /** + * @return int + */ + public function getDuration() { + return $this->duration; + } + + /** + * @return boolean + */ + public function isNew() { + return $this->new; + } + + /** + * @param boolean $new + */ + public function setNew( $new) { + $this->new = $new; + } + + /** + * @return int + */ + public function getContactId() { + return $this->contact_id; + } + +} diff --git a/freebox/api/v3/models/Call/ContactAddress.php b/freebox/api/v3/models/Call/ContactAddress.php new file mode 100644 index 0000000..bfd5760 --- /dev/null +++ b/freebox/api/v3/models/Call/ContactAddress.php @@ -0,0 +1,167 @@ +id; + } + + /** + * @param int $id + */ + public function setId($id) { + $this->id = $id; + } + + /** + * @return int + */ + public function getContactId() { + return $this->contact_id; + } + + /** + * @param int $contact_id + */ + public function setContactId( $contact_id) { + $this->contact_id = $contact_id; + } + + /** + * @return string + */ + public function getType() { + return $this->type; + } + + /** + * @param string $type + */ + public function setType( $type) { + $this->type = $type; + } + + /** + * @return string + */ + public function getNumber() { + return $this->number; + } + + /** + * @param string $number + */ + public function setNumber( $number) { + $this->number = $number; + } + + /** + * @return string + */ + public function getStreet() { + return $this->street; + } + + /** + * @param string $street + */ + public function setStreet( $street) { + $this->street = $street; + } + + /** + * @return string + */ + public function getStreet2() { + return $this->street2; + } + + /** + * @param string $street2 + */ + public function setStreet2( $street2) { + $this->street2 = $street2; + } + + /** + * @return string + */ + public function getCity() { + return $this->city; + } + + /** + * @param string $city + */ + public function setCity( $city) { + $this->city = $city; + } + + /** + * @return string + */ + public function getZipcode() { + return $this->zipcode; + } + + /** + * @param string $zipcode + */ + public function setZipcode( $zipcode) { + $this->zipcode = $zipcode; + } + + /** + * @return string + */ + public function getCountry() { + return $this->country; + } + + /** + * @param string $country + */ + public function setCountry( $country) { + $this->country = $country; + } + +} \ No newline at end of file diff --git a/freebox/api/v3/models/Call/ContactEmail.php b/freebox/api/v3/models/Call/ContactEmail.php new file mode 100644 index 0000000..4493df3 --- /dev/null +++ b/freebox/api/v3/models/Call/ContactEmail.php @@ -0,0 +1,82 @@ +id; + } + + /** + * @param int $id + */ + public function setId( $id) { + $this->id = $id; + } + + /** + * @return int + */ + public function getContactId() { + return $this->contact_id; + } + + /** + * @param int $contact_id + */ + public function setContactId( $contact_id) { + $this->contact_id = $contact_id; + } + + /** + * @return string + */ + public function getType() { + return $this->type; + } + + /** + * @param string $type + */ + public function setType( $type) { + $this->type = $type; + } + + /** + * @return string + */ + public function getEmail() { + return $this->email; + } + + /** + * @param string $email + */ + public function setEmail( $email) { + $this->email = $email; + } + +} diff --git a/freebox/api/v3/models/Call/ContactEntry.php b/freebox/api/v3/models/Call/ContactEntry.php new file mode 100644 index 0000000..67c715f --- /dev/null +++ b/freebox/api/v3/models/Call/ContactEntry.php @@ -0,0 +1,255 @@ +initPropertyArray( 'addresses', ContactAddress::class); + $this->initPropertyArray( 'emails' , ContactEmail::class); + $this->initPropertyArray( 'numbers' , ContactNumber::class); + $this->initPropertyArray( 'urls' , ContactUrl::class); + } + + /** + * @return int + */ + public function getId() { + return $this->id; + } + + /** + * @param int $id + */ + public function setId( $id) { + $this->id = $id; + } + + /** + * @return string + */ + public function getDisplayName() { + return $this->display_name; + } + + /** + * @param string $display_name + */ + public function setDisplayName( $display_name) { + $this->display_name = $display_name; + } + + /** + * @return string + */ + public function getFirstName() { + return $this->first_name; + } + + /** + * @param string $first_name + */ + public function setFirstName( $first_name) { + $this->first_name = $first_name; + } + + /** + * @return string + */ + public function getLastName() { + return $this->last_name; + } + + /** + * @param string $last_name + */ + public function setLastName( $last_name) { + $this->last_name = $last_name; + } + + /** + * @return string + */ + public function getCompany() { + return $this->company; + } + + /** + * @param string $company + */ + public function setCompany( $company) { + $this->company = $company; + } + + /** + * @return string + */ + public function getPhotoUrl() { + return $this->photo_url; + } + + /** + * @param string $photo_url + */ + public function setPhotoUrl( $photo_url) { + $this->photo_url = $photo_url; + } + + /** + * @return int + */ + public function getLastUpdate() { + return $this->last_update; + } + + /** + * @param int $last_update + */ + public function setLastUpdate( $last_update) { + $this->last_update = $last_update; + } + + /** + * @return string + */ + public function getNotes() { + return $this->notes; + } + + /** + * @param string $notes + */ + public function setNotes( $notes) { + $this->notes = $notes; + } + + /** + * @return ContactAddress[] + */ + public function getAddresses() { + return $this->addresses; + } + + /** + * @param ContactAddress[] $addresses + */ + public function setAddresses( array $addresses) { + $this->addresses = $addresses; + } + + /** + * @param ContactAddress $address + */ + public function addAddress( ContactAddress $address) { + $this->addresses[] = $address; + } + + /** + * @return ContactEmail[] + */ + public function getEmails() { + return $this->emails; + } + + /** + * @param ContactEmail[] $emails + */ + public function setEmails( array $emails) { + $this->emails = $emails; + } + + /** + * @param ContactEmail $email + */ + public function addEmail( ContactEmail $email) { + $this->emails[] = $email; + } + + /** + * @return ContactNumber[] + */ + public function getNumbers() { + return $this->numbers; + } + + /** + * @param ContactNumber[] $numbers + */ + public function setNumbers( array $numbers) { + $this->numbers = $numbers; + } + + /** + * @param ContactNumber $number + */ + public function addNumbers( ContactNumber $number) { + $this->numbers[] = $number; + } + + /** + * @return ContactUrl[] + */ + public function getUrls() { + return $this->urls; + } + + /** + * @param ContactUrl[] $urls + */ + public function setUrls( array $urls) { + $this->urls = $urls; + } + + /** + * @param ContactUrl $url + */ + public function addUrl( ContactUrl $url) { + $this->urls[] = $url; + } + +} diff --git a/freebox/api/v3/models/Call/ContactNumber.php b/freebox/api/v3/models/Call/ContactNumber.php new file mode 100644 index 0000000..b7be0b3 --- /dev/null +++ b/freebox/api/v3/models/Call/ContactNumber.php @@ -0,0 +1,116 @@ +id; + } + + /** + * @param int $id + */ + public function setId($id) { + $this->id = $id; + } + + /** + * @return int + */ + public function getContactId() { + return $this->contact_id; + } + + /** + * @param int $contact_id + */ + public function setContactId($contact_id) { + $this->contact_id = $contact_id; + } + + /** + * @return string + */ + public function getType() { + return $this->type; + } + + /** + * @param string $type + */ + public function setType($type) { + $this->type = $type; + } + + /** + * @return string + */ + public function getNumber() { + return $this->number; + } + + /** + * @param string $number + */ + public function setNumber($number) { + $this->number = $number; + } + + /** + * @return boolean + */ + public function isIsDefault() { + return $this->is_default; + } + + /** + * @param boolean $is_default + */ + public function setIsDefault($is_default) { + $this->is_default = $is_default; + } + + /** + * @return boolean + */ + public function isIsOwn() { + return $this->is_own; + } + + /** + * @param boolean $is_own + */ + public function setIsOwn($is_own) { + $this->is_own = $is_own; + } + +} diff --git a/freebox/api/v3/models/Call/ContactUrl.php b/freebox/api/v3/models/Call/ContactUrl.php new file mode 100644 index 0000000..ae0d333 --- /dev/null +++ b/freebox/api/v3/models/Call/ContactUrl.php @@ -0,0 +1,82 @@ +id; + } + + /** + * @param int $id + */ + public function setId( $id) { + $this->id = $id; + } + + /** + * @return int + */ + public function getContactId() { + return $this->contact_id; + } + + /** + * @param int $contact_id + */ + public function setContactId( $contact_id) { + $this->contact_id = $contact_id; + } + + /** + * @return string + */ + public function getType() { + return $this->type; + } + + /** + * @param string $type + */ + public function setType( $type) { + $this->type = $type; + } + + /** + * @return string + */ + public function getUrl() { + return $this->url; + } + + /** + * @param string $url + */ + public function setUrl( $url) { + $this->url = $url; + } + +} diff --git a/freebox/api/v3/services/Call/CallEntry.php b/freebox/api/v3/services/Call/CallEntry.php new file mode 100644 index 0000000..ed74552 --- /dev/null +++ b/freebox/api/v3/services/Call/CallEntry.php @@ -0,0 +1,77 @@ +getAuthService( self::API_CALL_LOG); + $rest->GET(); + + $CallEntry_xs = $rest->getCurlResponse()['result']; + $CallEntries = []; + foreach( $CallEntry_xs as $CallEntry_x) { + $CallEntries[] = new models\Call\CallEntry( $CallEntry_x); + } + return $CallEntries; + } + + /** + * Access a given call entry + * @param int $CallId + * @return models\Call\CallEntry[] + */ + public function getFromId( $CallId){ + $rest = $this->getAuthService( self::API_CALL_LOG . $CallId); + $rest->GET(); + + return new models\Call\CallEntry( $rest->getCurlResponse()['result']); + } + + /** + * Delete a call entry + * @param models\Call\CallEntry $CallEntry + * @return bool + */ + public function delete( models\Call\CallEntry $CallEntry){ + return $this->deleteFromId( $CallEntry->getId()); + } + + /** + * Delete a call entry + * @param int $CallId + * @return bool + */ + public function deleteFromId( $CallId){ + $rest = $this->getAuthService( self::API_CALL_LOG . $CallId); + $rest->DELETE(); + + return (bool) $rest->getCurlResponse()['success']; + } + + /** + * Update a given call entry + * @param models\Call\CallEntry $CallEntry + * @return models\Call\CallEntry + */ + public function update( models\Call\CallEntry $CallEntry){ + $rest = $this->getAuthService( self::API_CALL_LOG . $CallEntry->getId()); + $rest->PUT( $CallEntry->toArray()); + + return new models\Call\CallEntry( $rest->getCurlResponse()['result']); + } + +} diff --git a/freebox/api/v3/services/Call/ContactAddress.php b/freebox/api/v3/services/Call/ContactAddress.php new file mode 100644 index 0000000..e0e5fc0 --- /dev/null +++ b/freebox/api/v3/services/Call/ContactAddress.php @@ -0,0 +1,67 @@ +getAuthService( self::API_ADDRESS . $contactAddressId); + $rest->GET(); + + return new models\Call\ContactAddress ( $rest->getCurlResponse()['result']); + } + + /** + * @param models\Call\ContactAddress $contactAddress + * @return models\Call\ContactAddress + */ + public function create( models\Call\ContactAddress $contactAddress){ + $rest = $this->getAuthService( self::API_ADDRESS); + $rest->POST( $contactAddress->toArray()); + + return new models\Call\ContactAddress ( $rest->getCurlResponse()['result']); + } + + /** + * @param models\Call\ContactAddress $contactAddress + * @return bool + */ + public function delete( models\Call\ContactAddress $contactAddress){ + return $this->deleteFromId( $contactAddress->getId()); + } + + /** + * @param int $contactAddressId + * @return bool + */ + public function deleteFromId( $contactAddressId){ + $rest = $this->getAuthService( self::API_ADDRESS . $contactAddressId); + $rest->DELETE(); + + return (bool) $rest->getCurlResponse()['success']; + } + + /** + * @param models\Call\ContactAddress $contactAddress + * @return models\Call\ContactAddress + */ + public function update( models\Call\ContactAddress $contactAddress){ + $rest = $this->getAuthService( self::API_ADDRESS . $contactAddress->getId()); + $rest->PUT( $contactAddress->toArray()); + + return new models\Call\ContactAddress( $rest->getCurlResponse()['result']); + } + +} diff --git a/freebox/api/v3/services/Call/ContactEmail.php b/freebox/api/v3/services/Call/ContactEmail.php new file mode 100644 index 0000000..ec3e312 --- /dev/null +++ b/freebox/api/v3/services/Call/ContactEmail.php @@ -0,0 +1,67 @@ +getAuthService( self::API_EMAIL . $ContactEmailId); + $rest->GET(); + + return new models\Call\ContactEmail( $rest->getCurlResponse()['result']); + } + + /** + * @param models\Call\ContactEmail $ContactEmail + * @return models\Call\ContactEmail + */ + public function create( models\Call\ContactEmail $ContactEmail){ + $rest = $this->getAuthService( self::API_EMAIL); + $rest->POST( $ContactEmail->toArray()); + + return new models\Call\ContactEmail( $rest->getCurlResponse()['result']); + } + + /** + * @param models\Call\ContactEmail $ContactEmail + * @return bool + */ + public function delete( models\Call\ContactEmail $ContactEmail){ + return $this->deleteFromId( $ContactEmail->getId()); + } + + /** + * @param int $ContactEmailId + * @return bool + */ + public function deleteFromId( $ContactEmailId){ + $rest = $this->getAuthService( self::API_EMAIL . $ContactEmailId); + $rest->DELETE(); + + return (bool) $rest->getCurlResponse()['success']; + } + + /** + * @param models\Call\ContactEmail $ContactEmail + * @return models\Call\ContactEmail + */ + public function update( models\Call\ContactEmail $ContactEmail){ + $rest = $this->getAuthService( self::API_EMAIL . $ContactEmail->getId()); + $rest->PUT( $ContactEmail->toArray()); + + return new models\Call\ContactEmail( $rest->getCurlResponse()['result']); + } + +} diff --git a/freebox/api/v3/services/Call/ContactEntry.php b/freebox/api/v3/services/Call/ContactEntry.php new file mode 100644 index 0000000..82f61fc --- /dev/null +++ b/freebox/api/v3/services/Call/ContactEntry.php @@ -0,0 +1,155 @@ +getAuthService( self::API_CONTACT); + $rest->GET(); + + $ContactEntry_xs = $rest->getCurlResponse()['result']; + $ContactEntries = []; + foreach( $ContactEntry_xs as $ContactEntry_x) { + $ContactEntries[] = new models\Call\ContactEntry( $ContactEntry_x); + } + return $ContactEntries; + } + + /** + * @param int $ContactEntryId + * @return models\Call\ContactEntry + */ + public function getFromId( $ContactEntryId){ + $rest = $this->getAuthService( self::API_CONTACT . $ContactEntryId); + $rest->GET(); + + return new models\Call\ContactEntry( $rest->getCurlResponse()['result']); + } + + /** + * @param models\Call\ContactEntry $ContactEntry + * @return models\Call\ContactEntry + */ + public function create( models\Call\ContactEntry $ContactEntry){ + $rest = $this->getAuthService( self::API_CONTACT); + $rest->POST( $ContactEntry->toArray()); + + return new models\Call\ContactEntry( $rest->getCurlResponse()['result']); + } + + /** + * @param models\Call\ContactEntry $ContactEntry + * @return models\Call\ContactEntry + */ + public function update( models\Call\ContactEntry $ContactEntry){ + $rest = $this->getAuthService( self::API_CONTACT . $ContactEntry->getId()); + $rest->PUT( $ContactEntry->toArray()); + + return new models\Call\ContactEntry( $rest->getCurlResponse()['result']); + } + + /** + * @param models\Call\ContactEntry $ContactEntry + * @return models\Call\ContactEntry + */ + public function delete( models\Call\ContactEntry $ContactEntry){ + return $this->deleteFromId( $ContactEntry->getId()); + } + + /** + * @param int $ContactEntryId + * @return models\Call\ContactEntry + */ + public function deleteFromId( $ContactEntryId){ + $rest = $this->getAuthService( self::API_CONTACT); + $rest->DELETE( $ContactEntryId); + + return $rest->getCurlResponse()['success']; + } + + /** + * @param int $ContactEntryId + * @return models\Call\ContactNumber[] + */ + public function getContactNumbersFromContactId( $ContactEntryId){ + $service = sprintf( self::API_CONTACT_NUMBERS, $ContactEntryId); + $rest = $this->getAuthService( $service); + $rest->GET(); + + $ContactNumber_xs = @$rest->getCurlResponse()['result'] ?: []; + $ContactNumbers = []; + foreach( $ContactNumber_xs as $ContactNumber_x) { + $ContactNumbers[] = new models\Call\ContactNumber( $ContactNumber_x); + } + return $ContactNumbers; + } + + /** + * @param int $ContactEntryId + * @return models\Call\ContactAddress[] + */ + public function getContactAddressesFromContactId( $ContactEntryId){ + $service = sprintf( self::API_CONTACT_ADDRESSES, $ContactEntryId); + $rest = $this->getAuthService( $service); + $rest->GET(); + + $ContactAddress_xs = @$rest->getCurlResponse()['result'] ?: []; + $ContactAddresses = []; + foreach( $ContactAddress_xs as $ContactAddress_x) { + $ContactAddresses[] = new models\Call\ContactAddress( $ContactAddress_x); + } + return $ContactAddresses; + } + + /** + * @param int $ContactEntryId + * @return models\Call\ContactEmail[] + */ + public function getContactEmailsFromContactId( $ContactEntryId){ + $service = sprintf( self::API_CONTACT_EMAILS, $ContactEntryId); + $rest = $this->getAuthService( $service); + $rest->GET(); + + $ContactEmail_xs = @$rest->getCurlResponse()['result'] ?: []; + $ContactEmails = []; + foreach( $ContactEmail_xs as $ContactEmail_x) { + $ContactEmails[] = new models\Call\ContactEmail( $ContactEmail_x); + } + return $ContactEmails; + } + + /** + * @param int $ContactEntryId + * @return models\Call\ContactUrl[] + */ + public function getContactUrlsFromContactId( $ContactEntryId){ + $service = sprintf( self::API_CONTACT_URLS, $ContactEntryId); + $rest = $this->getAuthService( $service); + $rest->GET(); + + $ContactUrl_xs = @$rest->getCurlResponse()['result'] ?: []; + $ContactUrls = []; + foreach( $ContactUrl_xs as $ContactUrl_x) { + $ContactUrls[] = new models\Call\ContactUrl( $ContactUrl_x); + } + return $ContactUrls; + } + +} diff --git a/freebox/api/v3/services/Call/ContactNumber.php b/freebox/api/v3/services/Call/ContactNumber.php new file mode 100644 index 0000000..0f66349 --- /dev/null +++ b/freebox/api/v3/services/Call/ContactNumber.php @@ -0,0 +1,67 @@ +getAuthService( self::API_NUMBER . $ContactNumberId); + $rest->GET(); + + return new models\Call\ContactNumber( $rest->getCurlResponse()['result']); + } + + /** + * @param models\Call\ContactNumber $ContactNumber + * @return models\Call\ContactNumber + */ + public function create( models\Call\ContactNumber $ContactNumber){ + $rest = $this->getAuthService( self::API_NUMBER); + $rest->POST( $ContactNumber->toArray()); + + return new models\Call\ContactNumber( $rest->getCurlResponse()['result']); + } + + /** + * @param models\Call\ContactNumber $ContactNumber + * @return bool + */ + public function delete( models\Call\ContactNumber $ContactNumber){ + return $this->deleteFromId( $ContactNumber->getId()); + } + + /** + * @param int $ContactNumberId + * @return bool + */ + public function deleteFromId( $ContactNumberId){ + $rest = $this->getAuthService( self::API_NUMBER . $ContactNumberId); + $rest->DELETE(); + + return (bool) $rest->getCurlResponse()['success']; + } + + /** + * @param models\Call\ContactNumber $ContactNumber + * @return models\Call\ContactNumber + */ + public function update( models\Call\ContactNumber $ContactNumber){ + $rest = $this->getAuthService( self::API_NUMBER . $ContactNumber->getId()); + $rest->PUT( $ContactNumber->toArray()); + + return new models\Call\ContactNumber( $rest->getCurlResponse()['result']); + } + +} diff --git a/freebox/api/v3/services/Call/ContactUrl.php b/freebox/api/v3/services/Call/ContactUrl.php new file mode 100644 index 0000000..995b4ac --- /dev/null +++ b/freebox/api/v3/services/Call/ContactUrl.php @@ -0,0 +1,67 @@ +getAuthService( self::API_URL . $ContactUrlId); + $rest->GET(); + + return new models\Call\ContactUrl( $rest->getCurlResponse()['result']); + } + + /** + * @param models\Call\ContactUrl $ContactUrl + * @return models\Call\ContactUrl + */ + public function create( models\Call\ContactUrl $ContactUrl){ + $rest = $this->getAuthService( self::API_URL); + $rest->POST( $ContactUrl->toArray()); + + return new models\Call\ContactUrl( $rest->getCurlResponse()['result']); + } + + /** + * @param models\Call\ContactUrl $ContactUrl + * @return bool + */ + public function delete( models\Call\ContactUrl $ContactUrl){ + return $this->deleteFromId( $ContactUrl->getId()); + } + + /** + * @param int $ContactUrlId + * @return bool + */ + public function deleteFromId( $ContactUrlId){ + $rest = $this->getAuthService( self::API_URL . $ContactUrlId); + $rest->DELETE(); + + return (bool) $rest->getCurlResponse()['success']; + } + + /** + * @param models\Call\ContactUrl $ContactUrl + * @return models\Call\ContactUrl + */ + public function update( models\Call\ContactUrl $ContactUrl){ + $rest = $this->getAuthService( self::API_URL . $ContactUrl->getId()); + $rest->PUT( $ContactUrl->toArray()); + + return new models\Call\ContactUrl( $rest->getCurlResponse()['result']); + } + +} diff --git a/freebox/api/v3/symbols/Call/CallEntryType.php b/freebox/api/v3/symbols/Call/CallEntryType.php new file mode 100644 index 0000000..6490193 --- /dev/null +++ b/freebox/api/v3/symbols/Call/CallEntryType.php @@ -0,0 +1,20 @@ +