Refresh Call API

Add Call documentation
This commit is contained in:
alphayax 2016-06-09 21:52:44 +02:00
parent f0a5aa64b4
commit a8869d0dd3
10 changed files with 135 additions and 86 deletions

View File

@ -24,13 +24,7 @@ Pensez à installer les dependences :)
L'intégralité des fonctionnalités de l'API Freebox (v3) sont implémentées :
- [AirMedia](docs/AirMedia)
- Call
- CallEntry
- ContactEntry
- ContactAddress
- ContactEmail
- ContactNumber
- ContactUrl
- [Call](docs/Call)
- FileSystem
- FileSystem (Core)
- FsTask

View File

@ -1,19 +1,18 @@
# AirMedia
## Services
## AirMedia
### AirMedia
|---|
| Namespace |`alphayax\freebox\api\v3\services\AirMedia\` |
| Classe | `AirMedia`|
Namespace `alphayax\freebox\api\v3\services\AirMedia\`
Classe `AirMedia`
#### Configuration
### Configuration
- getConfiguration : Récupère la configuration courrante
- setConfiguration : Définit la configuration
#### AirMedia Receivers
### AirMedia Receivers
- getAirMediaReceivers : Retourne la liste des AirMedia Receivers connectés a la freebox
- sendRequestToAirMediaReceiver : Envoie une Requete a un AirMedia Receiver donné

86
docs/Call.md Normal file
View File

@ -0,0 +1,86 @@
# Call
- CallEntry
- ContactEntry
- ContactEmail
- ContactAddress
- ContactNumber
- ContactUrl
## CallEntry
|---|
| Namespace |`alphayax\freebox\api\v3\services\Call` |
| Classe | `CallEntry`|
- getAll : Retourne tous les appels
- getFromId : Retourne un appel donné
- delete : Supprime un appel de la liste des appels
- deleteFromId : Supprime un appel de la liste des appels
- update : Met à jour les informations d'un appel
## ContactEntry
|---|
| Namespace |`alphayax\freebox\api\v3\services\Call` |
| Classe | `ContactEntry`|
- getAll : Retourne la liste de tous les contacts
- getFromId : Retourne un contact donné
- create : Ajoute une nouveau contact
- delete : Supprime un contact
- deleteFromId : Supprime un contact
- update : Met à jour les informations d'un contact
- getContactNumbersFromContactId : Retourne les numéros associés a un contact
- getContactAddressesFromContactId : Retourne les adresses associés a un contact
- getContactEmailsFromContactId : Retourne les emails associés a un contact
- getContactUrlsFromContactId : Retourne les URLs associés a un contact
### Contact Email
|---|
| Namespace |`alphayax\freebox\api\v3\services\Call` |
| Classe | `ContactEmail`|
- getFromId
- create
- delete
- deleteFromId
- update
### Contact Address
|---|
| Namespace |`alphayax\freebox\api\v3\services\Call` |
| Classe | `ContactAddress`|
- getFromId
- create
- delete
- deleteFromId
- update
### Contact Number
|---|
| Namespace |`alphayax\freebox\api\v3\services\Call` |
| Classe | `ContactNumber`|
- getFromId
- create
- delete
- deleteFromId
- update
### Contact URL
|---|
| Namespace |`alphayax\freebox\api\v3\services\Call` |
| Classe | `ContactUrl`|
- getFromId
- create
- delete
- deleteFromId
- update

View File

@ -12,7 +12,7 @@ $CallService = new \alphayax\freebox\api\v3\services\Call\CallEntry( $App);
/// Get last 100 call entries
$CallEntries = $CallService->getAll();
//print_r( $CallEntries);
print_r( $CallEntries);
/// Get a specific call entry
$CallEntry = $CallService->getFromId( $CallEntries[0]->getId());

View File

@ -10,7 +10,7 @@ use alphayax\freebox\api\v3\models;
*/
class CallEntry extends Service {
const API_CALL_LOG = '/api/v3/call/log/';
const API_CALL_LOG = '/api/v3/call/log/';
/**
* List every calls
@ -21,12 +21,7 @@ class CallEntry extends Service {
$rest = $this->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;
return $rest->getResultAsArray( models\Call\CallEntry::class);
}
/**
@ -38,7 +33,7 @@ class CallEntry extends Service {
$rest = $this->getAuthService( self::API_CALL_LOG . $CallId);
$rest->GET();
return new models\Call\CallEntry( $rest->getCurlResponse()['result']);
return $rest->getResult( models\Call\CallEntry::class);
}
/**
@ -59,7 +54,7 @@ class CallEntry extends Service {
$rest = $this->getAuthService( self::API_CALL_LOG . $CallId);
$rest->DELETE();
return (bool) $rest->getCurlResponse()['success'];
return $rest->getSuccess();
}
/**
@ -69,9 +64,9 @@ class CallEntry extends Service {
*/
public function update( models\Call\CallEntry $CallEntry){
$rest = $this->getAuthService( self::API_CALL_LOG . $CallEntry->getId());
$rest->PUT( $CallEntry->toArray());
$rest->PUT( $CallEntry);
return new models\Call\CallEntry( $rest->getCurlResponse()['result']);
return $rest->getResult( models\Call\CallEntry::class);
}
}

View File

@ -20,7 +20,7 @@ class ContactAddress extends Service {
$rest = $this->getAuthService( self::API_ADDRESS . $contactAddressId);
$rest->GET();
return new models\Call\ContactAddress ( $rest->getCurlResponse()['result']);
return $rest->getResult( models\Call\ContactAddress::class);
}
/**
@ -29,9 +29,9 @@ class ContactAddress extends Service {
*/
public function create( models\Call\ContactAddress $contactAddress){
$rest = $this->getAuthService( self::API_ADDRESS);
$rest->POST( $contactAddress->toArray());
$rest->POST( $contactAddress);
return new models\Call\ContactAddress ( $rest->getCurlResponse()['result']);
return $rest->getResult( models\Call\ContactAddress::class);
}
/**
@ -50,7 +50,7 @@ class ContactAddress extends Service {
$rest = $this->getAuthService( self::API_ADDRESS . $contactAddressId);
$rest->DELETE();
return (bool) $rest->getCurlResponse()['success'];
return $rest->getSuccess();
}
/**
@ -59,9 +59,9 @@ class ContactAddress extends Service {
*/
public function update( models\Call\ContactAddress $contactAddress){
$rest = $this->getAuthService( self::API_ADDRESS . $contactAddress->getId());
$rest->PUT( $contactAddress->toArray());
$rest->PUT( $contactAddress);
return new models\Call\ContactAddress( $rest->getCurlResponse()['result']);
return $rest->getResult( models\Call\ContactAddress::class);
}
}

View File

@ -20,7 +20,7 @@ class ContactEmail extends Service {
$rest = $this->getAuthService( self::API_EMAIL . $ContactEmailId);
$rest->GET();
return new models\Call\ContactEmail( $rest->getCurlResponse()['result']);
return $rest->getResult( models\Call\ContactEmail::class);
}
/**
@ -29,9 +29,9 @@ class ContactEmail extends Service {
*/
public function create( models\Call\ContactEmail $ContactEmail){
$rest = $this->getAuthService( self::API_EMAIL);
$rest->POST( $ContactEmail->toArray());
$rest->POST( $ContactEmail);
return new models\Call\ContactEmail( $rest->getCurlResponse()['result']);
return $rest->getResult( models\Call\ContactEmail::class);
}
/**
@ -50,7 +50,7 @@ class ContactEmail extends Service {
$rest = $this->getAuthService( self::API_EMAIL . $ContactEmailId);
$rest->DELETE();
return (bool) $rest->getCurlResponse()['success'];
return $rest->getSuccess();
}
/**
@ -59,9 +59,9 @@ class ContactEmail extends Service {
*/
public function update( models\Call\ContactEmail $ContactEmail){
$rest = $this->getAuthService( self::API_EMAIL . $ContactEmail->getId());
$rest->PUT( $ContactEmail->toArray());
$rest->PUT( $ContactEmail);
return new models\Call\ContactEmail( $rest->getCurlResponse()['result']);
return $rest->getResult( models\Call\ContactEmail::class);
}
}

View File

@ -24,12 +24,7 @@ class ContactEntry extends Service {
$rest = $this->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;
return $rest->getResultAsArray( models\Call\ContactEntry::class);
}
/**
@ -40,7 +35,7 @@ class ContactEntry extends Service {
$rest = $this->getAuthService( self::API_CONTACT . $ContactEntryId);
$rest->GET();
return new models\Call\ContactEntry( $rest->getCurlResponse()['result']);
return $rest->getResult( models\Call\ContactEntry::class);
}
/**
@ -49,9 +44,9 @@ class ContactEntry extends Service {
*/
public function create( models\Call\ContactEntry $ContactEntry){
$rest = $this->getAuthService( self::API_CONTACT);
$rest->POST( $ContactEntry->toArray());
$rest->POST( $ContactEntry);
return new models\Call\ContactEntry( $rest->getCurlResponse()['result']);
return $rest->getResult( models\Call\ContactEntry::class);
}
/**
@ -60,9 +55,9 @@ class ContactEntry extends Service {
*/
public function update( models\Call\ContactEntry $ContactEntry){
$rest = $this->getAuthService( self::API_CONTACT . $ContactEntry->getId());
$rest->PUT( $ContactEntry->toArray());
$rest->PUT( $ContactEntry);
return new models\Call\ContactEntry( $rest->getCurlResponse()['result']);
return $rest->getResult( models\Call\ContactEntry::class);
}
/**
@ -81,7 +76,7 @@ class ContactEntry extends Service {
$rest = $this->getAuthService( self::API_CONTACT);
$rest->DELETE( $ContactEntryId);
return $rest->getCurlResponse()['success'];
return $rest->getSuccess();
}
/**
@ -93,12 +88,7 @@ class ContactEntry extends Service {
$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;
return $rest->getResultAsArray( models\Call\ContactNumber::class);
}
/**
@ -110,12 +100,7 @@ class ContactEntry extends Service {
$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;
return $rest->getResultAsArray( models\Call\ContactAddress::class);
}
/**
@ -127,12 +112,7 @@ class ContactEntry extends Service {
$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;
return $rest->getResultAsArray( models\Call\ContactEmail::class);
}
/**
@ -144,12 +124,7 @@ class ContactEntry extends Service {
$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;
return $rest->getResultAsArray( models\Call\ContactUrl::class);
}
}

View File

@ -20,7 +20,7 @@ class ContactNumber extends Service {
$rest = $this->getAuthService( self::API_NUMBER . $ContactNumberId);
$rest->GET();
return new models\Call\ContactNumber( $rest->getCurlResponse()['result']);
return $rest->getResult( models\Call\ContactNumber::class);
}
/**
@ -29,9 +29,9 @@ class ContactNumber extends Service {
*/
public function create( models\Call\ContactNumber $ContactNumber){
$rest = $this->getAuthService( self::API_NUMBER);
$rest->POST( $ContactNumber->toArray());
$rest->POST( $ContactNumber);
return new models\Call\ContactNumber( $rest->getCurlResponse()['result']);
return $rest->getResult( models\Call\ContactNumber::class);
}
/**
@ -50,7 +50,7 @@ class ContactNumber extends Service {
$rest = $this->getAuthService( self::API_NUMBER . $ContactNumberId);
$rest->DELETE();
return (bool) $rest->getCurlResponse()['success'];
return $rest->getSuccess();
}
/**
@ -59,9 +59,9 @@ class ContactNumber extends Service {
*/
public function update( models\Call\ContactNumber $ContactNumber){
$rest = $this->getAuthService( self::API_NUMBER . $ContactNumber->getId());
$rest->PUT( $ContactNumber->toArray());
$rest->PUT( $ContactNumber);
return new models\Call\ContactNumber( $rest->getCurlResponse()['result']);
return $rest->getResult( models\Call\ContactNumber::class);
}
}

View File

@ -20,7 +20,7 @@ class ContactUrl extends Service {
$rest = $this->getAuthService( self::API_URL . $ContactUrlId);
$rest->GET();
return new models\Call\ContactUrl( $rest->getCurlResponse()['result']);
return $rest->getResult( models\Call\ContactUrl::class);
}
/**
@ -29,9 +29,9 @@ class ContactUrl extends Service {
*/
public function create( models\Call\ContactUrl $ContactUrl){
$rest = $this->getAuthService( self::API_URL);
$rest->POST( $ContactUrl->toArray());
$rest->POST( $ContactUrl);
return new models\Call\ContactUrl( $rest->getCurlResponse()['result']);
return $rest->getResult( models\Call\ContactUrl::class);
}
/**
@ -50,7 +50,7 @@ class ContactUrl extends Service {
$rest = $this->getAuthService( self::API_URL . $ContactUrlId);
$rest->DELETE();
return (bool) $rest->getCurlResponse()['success'];
return $rest->getSuccess();
}
/**
@ -59,9 +59,9 @@ class ContactUrl extends Service {
*/
public function update( models\Call\ContactUrl $ContactUrl){
$rest = $this->getAuthService( self::API_URL . $ContactUrl->getId());
$rest->PUT( $ContactUrl->toArray());
$rest->PUT( $ContactUrl);
return new models\Call\ContactUrl( $rest->getCurlResponse()['result']);
return $rest->getResult( models\Call\ContactUrl::class);
}
}