Update Services & Documentation
This commit is contained in:
parent
6f19bfcdb7
commit
6700b1dbb3
|
@ -68,11 +68,11 @@
|
|||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `getAllTasks` | |
|
||||
| `getTaskById` | |
|
||||
| `deleteTask` | |
|
||||
| `deleteTaskById` | |
|
||||
| `updateTask` | |
|
||||
| `getAllTasks` | Retrieve all FS tasks |
|
||||
| `getTaskById` | Retrieve a FS task with the specified id |
|
||||
| `deleteTask` | Delete a FS task |
|
||||
| `deleteTaskById` | Delete a FS task with the specified id |
|
||||
| `updateTask` | Update a FS task |
|
||||
|
||||
<a name="FileUpload"></a>
|
||||
## FileUpload
|
||||
|
|
|
@ -17,14 +17,14 @@
|
|||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `getConfiguration` | |
|
||||
| `setConfiguration` | |
|
||||
| `getAll` | Get the list of disks |
|
||||
| `getFromId` | |
|
||||
| `update` | |
|
||||
| `delete` | |
|
||||
| `deleteFromId` | |
|
||||
| `add` | |
|
||||
| `getConfiguration` | Return the current Filter configuration |
|
||||
| `setConfiguration` | Update the filter configuration |
|
||||
| `getAll` | Get the list of all filters |
|
||||
| `getFromId` | Get a specific filter from id |
|
||||
| `update` | Update a filter |
|
||||
| `delete` | Delete a filter |
|
||||
| `deleteFromId` | Delete a filter with the specified id |
|
||||
| `add` | Add a new filter |
|
||||
|
||||
<a name="FilterPlanning"></a>
|
||||
## FilterPlanning
|
||||
|
@ -35,5 +35,5 @@
|
|||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `getFromFilterId` | |
|
||||
| `setFromFilterId` | |
|
||||
| `getFromFilterId` | Get the filer planning associated with the given filter id |
|
||||
| `setFromFilterId` | Update the filer planning associated with the given filter id |
|
||||
|
|
|
@ -16,4 +16,4 @@
|
|||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `getStats` | |
|
||||
| `getStats` | Return Freebox information & statistics |
|
||||
|
|
|
@ -62,4 +62,4 @@
|
|||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `getStatus` | Get the current Connection status |
|
||||
| `getStatus` | Get the current XDSL Connection status |
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `getBrowsableInterfaces` | |
|
||||
| `getHostsFromInterface` | |
|
||||
| `getHostsFromInterfaceName` | |
|
||||
| `getHostFromId` | |
|
||||
| `updateHostFromInterfaceId` | |
|
||||
| `getBrowsableInterfaces` | Get all Lan interfaces |
|
||||
| `getHostsFromInterface` | Get the LanHosts of the specified interface |
|
||||
| `getHostsFromInterfaceName` | Get the LanHosts of the specified interface name |
|
||||
| `getHostFromId` | Get a specific LanHost |
|
||||
| `updateHostFromInterfaceId` | Update a LanHost |
|
||||
| `wakeOnLan` | Send Wake ok Lan packet to an host |
|
||||
|
||||
<a name="LAN"></a>
|
||||
|
@ -33,5 +33,5 @@
|
|||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `getConfiguration` | |
|
||||
| `setConfiguration` | |
|
||||
| `getConfiguration` | Get the current LAN configuration |
|
||||
| `setConfiguration` | Update the LAN configuration |
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
| Method | Description |
|
||||
|---|---|
|
||||
| `getAll` | Getting the list of incoming ports |
|
||||
| `getById` | Getting a specific incoming port |
|
||||
| `getFromId` | Getting a specific incoming port |
|
||||
| `update` | Updating an incoming port |
|
||||
|
||||
<a name="PortForwarding"></a>
|
||||
|
@ -48,4 +48,4 @@
|
|||
| `update` | Update a specific port forwarding |
|
||||
| `add` | Add a port forwarding |
|
||||
| `delete` | Delete a port forwarding |
|
||||
| `deleteById` | Delete a port forwarding |
|
||||
| `deleteById` | Delete a port forwarding with the specified id |
|
||||
|
|
|
@ -58,6 +58,6 @@
|
|||
| `getFromLogin` | Gets the VPNUser with the given login |
|
||||
| `add` | Creates a new VPNUser |
|
||||
| `delete` | Deletes the VPNUser |
|
||||
| `deleteFromLogin` | Deletes the VPNUser |
|
||||
| `deleteFromLogin` | Deletes the VPNUser with the given id |
|
||||
| `update` | Update a VPN Use |
|
||||
| `getConfigurationFile` | |
|
||||
| `getConfigurationFile` | Generate a new configuration file & download it |
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `getAll` | |
|
||||
| `getFromId` | |
|
||||
| `getAll` | Get all Access Points |
|
||||
| `getFromId` | Get a specific Access Point |
|
||||
| `getAllowedCombFromId` | To be able to allow user to pick a valid channel combination for a given AP you should use the following api to retrieve the list of allowed channel combination. |
|
||||
| `getStationsFromId` | To be able to allow user to pick a valid channel combination for a given AP you should use the following api to retrieve the list of allowed channel combination. |
|
||||
| `update` | |
|
||||
| `update` | Update an Access Point |
|
||||
| `getNeighborsFromId` | Get the list of Neighbor seen by the AP |
|
||||
| `refreshNeighborsScan` | WARNING during the scan the AP will be unavailable. Therefore, you should ask for user confirmation prior to launching a scan. Once launched you should wait until the ap state comes back from scanning to get updated info. |
|
||||
| `getChannelUsageFromId` | List Wi-Fi channels usage |
|
||||
|
@ -38,9 +38,9 @@
|
|||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `getAll` | Get the list of Freebox Access Points |
|
||||
| `getFromId` | Get the list of Freebox Access Points |
|
||||
| `update` | Get the list of Freebox Access Points |
|
||||
| `getAll` | Get the list of Freebox BSS |
|
||||
| `getFromId` | Get a specific BSS |
|
||||
| `update` | Update a BSS |
|
||||
|
||||
<a name="Config"></a>
|
||||
## Config
|
||||
|
@ -51,8 +51,8 @@
|
|||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `getConfiguration` | |
|
||||
| `setConfiguration` | |
|
||||
| `getConfiguration` | Get the global wifi configuration |
|
||||
| `setConfiguration` | Update the global wifi configuration |
|
||||
| `resetConfiguration` | Reset Wifi to default configuration |
|
||||
|
||||
<a name="MacFilter"></a>
|
||||
|
@ -64,12 +64,12 @@
|
|||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `getAll` | |
|
||||
| `getFromId` | |
|
||||
| `update` | |
|
||||
| `delete` | |
|
||||
| `deleteFromId` | |
|
||||
| `add` | |
|
||||
| `getAll` | Get all MacFilters |
|
||||
| `getFromId` | Get a specific MacFilter |
|
||||
| `update` | Update a MacFilter |
|
||||
| `delete` | Delete a MacFilter |
|
||||
| `deleteFromId` | Delete a MacFilter with the specified id |
|
||||
| `add` | Add a new MacFilter |
|
||||
|
||||
<a name="Planning"></a>
|
||||
## Planning
|
||||
|
@ -80,5 +80,5 @@
|
|||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `getPlanning` | |
|
||||
| `update` | |
|
||||
| `getPlanning` | Get the wifi planning |
|
||||
| `update` | Update the wifi planning |
|
||||
|
|
|
@ -61,8 +61,8 @@
|
|||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `getConfiguration` | |
|
||||
| `setConfiguration` | |
|
||||
| `getConfiguration` | Get the current DHCP configuration |
|
||||
| `setConfiguration` | Update the DHCP configuration |
|
||||
|
||||
<a name="FTP"></a>
|
||||
## FTP
|
||||
|
@ -73,7 +73,7 @@
|
|||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `getConfiguration` | |
|
||||
| `getConfiguration` | Get the current FTP configuration |
|
||||
| `setConfiguration` | |
|
||||
|
||||
<a name="Freeplug"></a>
|
||||
|
@ -85,7 +85,7 @@
|
|||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `getNetworks` | Get the current system info |
|
||||
| `getNetworks` | Get the freeplug networks information |
|
||||
| `getFromId` | Get a particular Freeplug information |
|
||||
| `resetFromId` | Reset a Freeplug |
|
||||
|
||||
|
@ -98,8 +98,8 @@
|
|||
|
||||
| Method | Description |
|
||||
|---|---|
|
||||
| `getConfiguration` | |
|
||||
| `setConfiguration` | |
|
||||
| `getConfiguration` | Get the current LCD configuration |
|
||||
| `setConfiguration` | Update the LCD configuration |
|
||||
|
||||
<a name="System"></a>
|
||||
## System
|
||||
|
|
|
@ -10,5 +10,5 @@ $App->openSession();
|
|||
|
||||
// PortForwarding
|
||||
$toto = new \alphayax\freebox\api\v3\services\config\NAT\IncomingPort( $App);
|
||||
$a = $toto->getById('http');
|
||||
$a = $toto->getFromId('http');
|
||||
var_dump( $a);
|
||||
|
|
|
@ -14,7 +14,7 @@ class Filter extends Service {
|
|||
const API_PARENTAL_FILTER = '/api/v3/parental/filter/';
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
* Return the current Filter configuration
|
||||
* @return models\ParentalControl\FilterConfig
|
||||
*/
|
||||
public function getConfiguration(){
|
||||
|
@ -25,6 +25,7 @@ class Filter extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Update the filter configuration
|
||||
* @param models\ParentalControl\FilterConfig $filterConfig
|
||||
* @return models\ParentalControl\FilterConfig
|
||||
*/
|
||||
|
@ -36,7 +37,7 @@ class Filter extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the list of disks
|
||||
* Get the list of all filters
|
||||
* @throws \Exception
|
||||
* @return models\ParentalControl\Filter[]
|
||||
*/
|
||||
|
@ -48,6 +49,7 @@ class Filter extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a specific filter from id
|
||||
* @param int $filterId
|
||||
* @return models\ParentalControl\Filter
|
||||
*/
|
||||
|
@ -59,6 +61,7 @@ class Filter extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Update a filter
|
||||
* @param models\ParentalControl\Filter $filter
|
||||
* @return models\ParentalControl\Filter
|
||||
*/
|
||||
|
@ -70,6 +73,7 @@ class Filter extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Delete a filter
|
||||
* @param models\ParentalControl\Filter $filter
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -78,6 +82,7 @@ class Filter extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Delete a filter with the specified id
|
||||
* @param int $filterId
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -89,6 +94,7 @@ class Filter extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Add a new filter
|
||||
* @param models\ParentalControl\Filter $filter
|
||||
* @return models\ParentalControl\Filter
|
||||
*/
|
||||
|
@ -98,4 +104,5 @@ class Filter extends Service {
|
|||
|
||||
return $rest->getResult( models\ParentalControl\Filter::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ class FilterPlanning extends Service {
|
|||
const API_PARENTAL_FILTER_PLANNING = '/api/v3/parental/filter/%u/planning';
|
||||
|
||||
/**
|
||||
* Get the filer planning associated with the given filter id
|
||||
* @param int $filterId
|
||||
* @return models\ParentalControl\FilterPlanning
|
||||
*/
|
||||
|
@ -24,6 +25,7 @@ class FilterPlanning extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Update the filer planning associated with the given filter id
|
||||
* @param \alphayax\freebox\api\v3\models\ParentalControl\FilterPlanning $filterPlanning
|
||||
* @param int $filterId
|
||||
* @return \alphayax\freebox\api\v3\models\ParentalControl\FilterPlanning
|
||||
|
|
|
@ -11,6 +11,7 @@ class Fetch extends Service {
|
|||
const API_RDD = '/api/v3/rrd/';
|
||||
|
||||
/**
|
||||
* Return Freebox information & statistics
|
||||
* @param string $db
|
||||
* Name of the rrd database to read
|
||||
* @see alphayax\freebox\api\v3\symbols\RRD\Db
|
||||
|
@ -36,7 +37,7 @@ class Fetch extends Service {
|
|||
$rest = $this->getAuthService( self::API_RDD);
|
||||
$rest->GET( $QueryParameters);
|
||||
|
||||
return $rest->getCurlResponse()['result'];
|
||||
return $rest->getResult();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,7 +21,7 @@ class Connection extends Service{
|
|||
$rest = $this->getAuthService( self::API_CONNECTION);
|
||||
$rest->GET();
|
||||
|
||||
return new models\Connection\Status( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\Connection\Status::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,7 +32,7 @@ class Connection extends Service{
|
|||
$rest = $this->getAuthService( self::API_CONNECTION_CONFIG);
|
||||
$rest->GET();
|
||||
|
||||
return new models\Connection\Config( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\Connection\Config::class);
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,9 +43,9 @@ class Connection extends Service{
|
|||
*/
|
||||
public function setConfiguration( models\Connection\Config $connectionConfig){
|
||||
$rest = $this->getAuthService( self::API_CONNECTION_CONFIG);
|
||||
$rest->PUT( $connectionConfig->toArray());
|
||||
$rest->PUT( $connectionConfig);
|
||||
|
||||
return new models\Connection\Config( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\Connection\Config::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,7 +55,7 @@ class Connection extends Service{
|
|||
$rest = $this->getAuthService( self::API_CONNECTION_IPV6_CONFIG);
|
||||
$rest->GET();
|
||||
|
||||
return new models\Connection\Ipv6\Configuration( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\Connection\Ipv6\Configuration::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,9 +65,9 @@ class Connection extends Service{
|
|||
*/
|
||||
public function setIPv6Configuration(models\Connection\Ipv6\Configuration $connectionIpv6Configuration){
|
||||
$rest = $this->getAuthService( self::API_CONNECTION_IPV6_CONFIG);
|
||||
$rest->PUT( $connectionIpv6Configuration->toArray());
|
||||
$rest->PUT( $connectionIpv6Configuration);
|
||||
|
||||
return new models\Connection\Ipv6\Configuration( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\Connection\Ipv6\Configuration::class);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ abstract class DynDns extends Service {
|
|||
$rest = $this->getAuthService( $service);
|
||||
$rest->GET();
|
||||
|
||||
return new models\Connection\DynDns\Status( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\Connection\DynDns\Status::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,7 +35,7 @@ abstract class DynDns extends Service {
|
|||
$rest = $this->getAuthService( $service);
|
||||
$rest->GET();
|
||||
|
||||
return new models\Connection\DynDns\Config( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\Connection\DynDns\Config::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,9 +46,9 @@ abstract class DynDns extends Service {
|
|||
protected function setConfigFromProvider( $provider, models\Connection\DynDns\Config $config){
|
||||
$service = sprintf( self::API_CONNECTION_DDNS_CONFIG, $provider);
|
||||
$rest = $this->getAuthService( $service);
|
||||
$rest->PUT( $config->toArray());
|
||||
$rest->PUT( $config);
|
||||
|
||||
return new models\Connection\DynDns\Config( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\Connection\DynDns\Config::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,4 +70,4 @@ abstract class DynDns extends Service {
|
|||
*/
|
||||
abstract public function setConfig( models\Connection\DynDns\Config $config);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class Ftth extends Service{
|
|||
$rest = $this->getAuthService( self::API_CONNECTION_FTTH);
|
||||
$rest->GET();
|
||||
|
||||
return new models\Connection\Ftth\Status( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\Connection\Ftth\Status::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,14 +12,14 @@ class Xdsl extends Service {
|
|||
const API_CONNECTION_XDSL = '/api/v3/connection/xdsl/';
|
||||
|
||||
/**
|
||||
* Get the current Connection status
|
||||
* Get the current XDSL Connection status
|
||||
* @return models\Connection\Status
|
||||
*/
|
||||
public function getStatus(){
|
||||
$rest = $this->getAuthService( self::API_CONNECTION_XDSL);
|
||||
$rest->GET();
|
||||
|
||||
return new models\Connection\Xdsl\XdslInfos( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\Connection\Xdsl\XdslInfos::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\services\config;
|
||||
use alphayax\freebox\api\v3\models\DhcpConfig;
|
||||
use alphayax\freebox\api\v3\models;
|
||||
use alphayax\freebox\api\v3\Service;
|
||||
|
||||
|
||||
|
@ -14,26 +14,26 @@ class DHCP extends Service {
|
|||
const API_DHCP_CONFIG = '/api/v3/dhcp/config/';
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
* @return DhcpConfig
|
||||
* Get the current DHCP configuration
|
||||
* @return models\DhcpConfig
|
||||
*/
|
||||
public function getConfiguration(){
|
||||
$rest = $this->getAuthService( self::API_DHCP_CONFIG);
|
||||
$rest->GET();
|
||||
|
||||
return new DhcpConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\DhcpConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DhcpConfig $new_DhcpConfig
|
||||
* @return DhcpConfig
|
||||
* @throws \Exception
|
||||
* Update the DHCP configuration
|
||||
* @param models\DhcpConfig $dhcpConfig
|
||||
* @return models\DhcpConfig
|
||||
*/
|
||||
public function setConfiguration( DhcpConfig $new_DhcpConfig){
|
||||
public function setConfiguration( models\DhcpConfig $dhcpConfig){
|
||||
$rest = $this->getAuthService( self::API_DHCP_CONFIG);
|
||||
$rest->PUT( $new_DhcpConfig->toArray());
|
||||
$rest->PUT( $dhcpConfig);
|
||||
|
||||
return new DhcpConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\DhcpConfig::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\services\config;
|
||||
use alphayax\freebox\api\v3\models\FtpConfig;
|
||||
use alphayax\freebox\api\v3\models;
|
||||
use alphayax\freebox\api\v3\Service;
|
||||
|
||||
|
||||
|
@ -14,26 +14,25 @@ class FTP extends Service {
|
|||
const API_FTP_CONFIG = '/api/v3/ftp/config/';
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
* @return FtpConfig
|
||||
* Get the current FTP configuration
|
||||
* @return models\FtpConfig
|
||||
*/
|
||||
public function getConfiguration(){
|
||||
$rest = $this->getAuthService( self::API_FTP_CONFIG);
|
||||
$rest->GET();
|
||||
|
||||
return new FtpConfig( $rest->getCurlResponse());
|
||||
return $rest->getResult( models\FtpConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FtpConfig $new_configConfig
|
||||
* @return FtpConfig
|
||||
* @throws \Exception
|
||||
* @param models\FtpConfig $ftpConfig
|
||||
* @return models\FtpConfig
|
||||
*/
|
||||
public function setConfiguration( FtpConfig $new_configConfig){
|
||||
public function setConfiguration( models\FtpConfig $ftpConfig){
|
||||
$rest = $this->getAuthService( self::API_FTP_CONFIG);
|
||||
$rest->PUT( $new_configConfig);
|
||||
$rest->PUT( $ftpConfig);
|
||||
|
||||
return new FtpConfig( $rest->getCurlResponse());
|
||||
return $rest->getResult( models\FtpConfig::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ class Freeplug extends Service {
|
|||
const API_FREEPLUG_RESET = '/api/v3/freeplug/%s/reset/';
|
||||
|
||||
/**
|
||||
* Get the current system info
|
||||
* Get the freeplug networks information
|
||||
* @throws \Exception
|
||||
* @return models\Freeplug\FreeplugNetwork[]
|
||||
*/
|
||||
|
@ -22,12 +22,7 @@ class Freeplug extends Service {
|
|||
$rest = $this->getAuthService( self::API_FREEPLUG);
|
||||
$rest->GET();
|
||||
|
||||
$Network_xs = $rest->getCurlResponse()['result'];
|
||||
$Networks = [];
|
||||
foreach( $Network_xs as $Network_x) {
|
||||
$Networks[] = new models\Freeplug\FreeplugNetwork( $Network_x);
|
||||
}
|
||||
return $Networks;
|
||||
return $rest->getResultAsArray( models\Freeplug\FreeplugNetwork::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,7 +34,7 @@ class Freeplug extends Service {
|
|||
$rest = $this->getAuthService( self::API_FREEPLUG . $FreeplugId . DIRECTORY_SEPARATOR);
|
||||
$rest->GET();
|
||||
|
||||
return new models\Freeplug\Freeplug( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\Freeplug\Freeplug::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,7 +47,7 @@ class Freeplug extends Service {
|
|||
$rest = $this->getAuthService( $Service);
|
||||
$rest->POST();
|
||||
|
||||
return $rest->getCurlResponse()['success'];
|
||||
return $rest->getSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\services\config\LAN;
|
||||
use alphayax\freebox\api\v3\models\LAN\LanHost;
|
||||
use alphayax\freebox\api\v3\models\LAN\LanInterface;
|
||||
use alphayax\freebox\api\v3\models;
|
||||
use alphayax\freebox\api\v3\Service;
|
||||
|
||||
|
||||
|
@ -17,83 +16,74 @@ class Browser extends Service {
|
|||
const API_WAKE_ON_LAN = '/api/v3/lan/wol/%s/';
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
* @return LanInterface
|
||||
* Get all Lan interfaces
|
||||
* @return models\LAN\LanInterface
|
||||
*/
|
||||
public function getBrowsableInterfaces(){
|
||||
$rest = $this->getAuthService( self::API_LAN_BROWSER_INTERFACES);
|
||||
$rest->GET();
|
||||
|
||||
$LanInterface_xs = $rest->getCurlResponse()['result'];
|
||||
$LanInterfaces = [];
|
||||
foreach( $LanInterface_xs as $LanInterface_x) {
|
||||
$LanInterfaces[] = new LanInterface( $LanInterface_x);
|
||||
}
|
||||
return $LanInterfaces;
|
||||
return $rest->getResultAsArray( models\LAN\LanInterface::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LanInterface $lanInterface
|
||||
* @return LanHost[]
|
||||
* @throws \Exception
|
||||
* Get the LanHosts of the specified interface
|
||||
* @param models\LAN\LanInterface $lanInterface
|
||||
* @return models\LAN\LanHost[]
|
||||
*/
|
||||
public function getHostsFromInterface( LanInterface $lanInterface){
|
||||
public function getHostsFromInterface( models\LAN\LanInterface $lanInterface){
|
||||
return $this->getHostsFromInterfaceName( $lanInterface->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the LanHosts of the specified interface name
|
||||
* @param string $lanInterfaceId
|
||||
* @return LanHost[]
|
||||
* @throws \Exception
|
||||
* @return models\LAN\LanHost[]
|
||||
*/
|
||||
public function getHostsFromInterfaceName( $lanInterfaceId){
|
||||
$service = sprintf( self::API_LAN_BROWSER_INTERFACE, $lanInterfaceId);
|
||||
$rest = $this->getAuthService( $service);
|
||||
$rest->GET();
|
||||
|
||||
$LanHost_xs = $rest->getCurlResponse()['result'];
|
||||
$LanHosts = [];
|
||||
foreach( $LanHost_xs as $LanHost_x) {
|
||||
$LanHosts[] = new LanHost( $LanHost_x);
|
||||
}
|
||||
return $LanHosts;
|
||||
return $rest->getResultAsArray( models\LAN\LanHost::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a specific LanHost
|
||||
* @param string $lanInterfaceId
|
||||
* @param string $hostId
|
||||
* @return LanHost
|
||||
* @return models\LAN\LanHost
|
||||
*/
|
||||
public function getHostFromId( $lanInterfaceId, $hostId){
|
||||
$service = sprintf( self::API_LAN_BROWSER_HOST, $lanInterfaceId, $hostId);
|
||||
echo $service;
|
||||
$rest = $this->getAuthService( $service);
|
||||
$rest->GET();
|
||||
|
||||
return new LanHost( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\LAN\LanHost::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LanHost $LanHost
|
||||
* Update a LanHost
|
||||
* @param models\LAN\LanHost $LanHost
|
||||
* @param string $lanInterfaceId
|
||||
* @return LanHost
|
||||
* @return models\LAN\LanHost
|
||||
*/
|
||||
public function updateHostFromInterfaceId( LanHost $LanHost, $lanInterfaceId){
|
||||
public function updateHostFromInterfaceId( models\LAN\LanHost $LanHost, $lanInterfaceId){
|
||||
$service = sprintf( self::API_LAN_BROWSER_HOST, $lanInterfaceId, $LanHost->getId());
|
||||
$rest = $this->getAuthService( $service);
|
||||
$rest->PUT( $LanHost->toArray());
|
||||
$rest->PUT( $LanHost);
|
||||
|
||||
return new LanHost( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\LAN\LanHost::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send Wake ok Lan packet to an host
|
||||
* @param LanInterface $lanInterface
|
||||
* @param LanHost $lanHost
|
||||
* @param models\LAN\LanInterface $lanInterface
|
||||
* @param models\LAN\LanHost $lanHost
|
||||
* @param string $password
|
||||
* @return bool
|
||||
*/
|
||||
public function wakeOnLan( LanInterface $lanInterface, LanHost $lanHost, $password = ''){
|
||||
public function wakeOnLan( models\LAN\LanInterface $lanInterface, models\LAN\LanHost $lanHost, $password = ''){
|
||||
$service = sprintf( self::API_WAKE_ON_LAN, $lanInterface->getName());
|
||||
$rest = $this->getAuthService( $service);
|
||||
$rest->PUT([
|
||||
|
@ -101,7 +91,7 @@ class Browser extends Service {
|
|||
'password' => $password,
|
||||
]);
|
||||
|
||||
return (bool) $rest->getCurlResponse()['result'];
|
||||
return $rest->getSuccess();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\services\config\LAN;
|
||||
use alphayax\freebox\api\v3\models\LAN\LanConfig;
|
||||
use alphayax\freebox\api\v3\models;
|
||||
use alphayax\freebox\api\v3\Service;
|
||||
|
||||
|
||||
|
@ -13,26 +13,26 @@ class LAN extends Service {
|
|||
const API_LAN_CONFIG = '/api/v3/lan/config/';
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
* @return LanConfig
|
||||
* Get the current LAN configuration
|
||||
* @return models\LAN\LanConfig
|
||||
*/
|
||||
public function getConfiguration(){
|
||||
$rest = $this->getAuthService( self::API_LAN_CONFIG);
|
||||
$rest->GET();
|
||||
|
||||
return new LanConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\LAN\LanConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LanConfig $new_LanConfig
|
||||
* @return LanConfig
|
||||
* @throws \Exception
|
||||
* Update the LAN configuration
|
||||
* @param models\LAN\LanConfig $lanConfig
|
||||
* @return models\LAN\LanConfig
|
||||
*/
|
||||
public function setConfiguration( LanConfig $new_LanConfig){
|
||||
public function setConfiguration( models\LAN\LanConfig $lanConfig){
|
||||
$rest = $this->getAuthService( self::API_LAN_CONFIG);
|
||||
$rest->PUT( $new_LanConfig->toArray());
|
||||
$rest->PUT( $lanConfig);
|
||||
|
||||
return new LanConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\LAN\LanConfig::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\services\config;
|
||||
use alphayax\freebox\api\v3\models\LCDConfig;
|
||||
use alphayax\freebox\api\v3\models;
|
||||
use alphayax\freebox\api\v3\Service;
|
||||
|
||||
/**
|
||||
|
@ -12,24 +12,26 @@ class LCD extends Service {
|
|||
const API_LCD_CONFIG = '/api/v3/lcd/config/';
|
||||
|
||||
/**
|
||||
* @return LCDConfig
|
||||
* Get the current LCD configuration
|
||||
* @return models\LCDConfig
|
||||
*/
|
||||
public function getConfiguration(){
|
||||
$rest = $this->getAuthService( self::API_LCD_CONFIG);
|
||||
$rest->GET();
|
||||
|
||||
return new LCDConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\LCDConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LCDConfig $lcdConfig
|
||||
* @return LCDConfig
|
||||
* Update the LCD configuration
|
||||
* @param models\LCDConfig $lcdConfig
|
||||
* @return models\LCDConfig
|
||||
*/
|
||||
public function setConfiguration( LCDConfig $lcdConfig){
|
||||
public function setConfiguration( models\LCDConfig $lcdConfig){
|
||||
$rest = $this->getAuthService( self::API_LCD_CONFIG);
|
||||
$rest->PUT( $lcdConfig->toArray());
|
||||
$rest->PUT( $lcdConfig);
|
||||
|
||||
return new LCDConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\LCDConfig::class);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\services\config\NAT;
|
||||
use alphayax\freebox\api\v3\models\NAT\DmzConfig;
|
||||
use alphayax\freebox\api\v3\models;
|
||||
use alphayax\freebox\api\v3\Service;
|
||||
|
||||
|
||||
|
@ -15,26 +15,25 @@ class DMZ extends Service {
|
|||
|
||||
/**
|
||||
* Get the current Dmz configuration
|
||||
* @throws \Exception
|
||||
* @return models\NAT\DmzConfig
|
||||
*/
|
||||
public function getConfiguration(){
|
||||
$rest = $this->getAuthService( self::API_NAT_DMZ);
|
||||
$rest->GET();
|
||||
|
||||
return new DmzConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\NAT\DmzConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the current Dmz configuration
|
||||
* @param DmzConfig $new_DmzConfig
|
||||
* @return DmzConfig
|
||||
* @throws \Exception
|
||||
* @param models\NAT\DmzConfig $dmzConfig
|
||||
* @return models\NAT\DmzConfig
|
||||
*/
|
||||
public function setConfiguration( DmzConfig $new_DmzConfig){
|
||||
public function setConfiguration( models\NAT\DmzConfig $dmzConfig){
|
||||
$rest = $this->getAuthService( self::API_NAT_DMZ);
|
||||
$rest->PUT( $new_DmzConfig->toArray());
|
||||
$rest->PUT( $dmzConfig);
|
||||
|
||||
return new DmzConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\NAT\DmzConfig::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\services\config\NAT;
|
||||
use alphayax\freebox\api\v3\models\NAT\IncomingPortConfig;
|
||||
use alphayax\freebox\api\v3\models;
|
||||
use alphayax\freebox\api\v3\Service;
|
||||
|
||||
|
||||
|
@ -15,43 +15,38 @@ class IncomingPort extends Service {
|
|||
/**
|
||||
* Getting the list of incoming ports
|
||||
* @throws \Exception
|
||||
* @return IncomingPortConfig[]
|
||||
* @return models\NAT\IncomingPortConfig[]
|
||||
*/
|
||||
public function getAll(){
|
||||
$rest = $this->getAuthService( self::API_NAT_INCOMING);
|
||||
$rest->GET();
|
||||
|
||||
$result = $rest->getCurlResponse()['result'];
|
||||
$PortForwardingList = [];
|
||||
foreach( $result as $PortForwardingElement){
|
||||
$PortForwardingList[] = new IncomingPortConfig( $PortForwardingElement);
|
||||
}
|
||||
return $PortForwardingList;
|
||||
return $rest->getResultAsArray( models\NAT\IncomingPortConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting a specific incoming port
|
||||
* @param string $IncomingPortId
|
||||
* @return IncomingPortConfig
|
||||
* @return models\NAT\IncomingPortConfig
|
||||
*/
|
||||
public function getById( $IncomingPortId){
|
||||
public function getFromId( $IncomingPortId){
|
||||
$rest = $this->getAuthService( self::API_NAT_INCOMING . $IncomingPortId);
|
||||
$rest->GET();
|
||||
|
||||
return new IncomingPortConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\NAT\IncomingPortConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updating an incoming port
|
||||
* @param IncomingPortConfig $new_IncomingPortConfig
|
||||
* @return IncomingPortConfig
|
||||
* @param models\NAT\IncomingPortConfig $incomingPortConfig
|
||||
* @return models\NAT\IncomingPortConfig
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function update( IncomingPortConfig $new_IncomingPortConfig){
|
||||
$rest = $this->getAuthService( self::API_NAT_INCOMING . $new_IncomingPortConfig->getId());
|
||||
$rest->PUT( $new_IncomingPortConfig->toArray());
|
||||
public function update( models\NAT\IncomingPortConfig $incomingPortConfig){
|
||||
$rest = $this->getAuthService( self::API_NAT_INCOMING . $incomingPortConfig->getId());
|
||||
$rest->PUT( $incomingPortConfig);
|
||||
|
||||
return new IncomingPortConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\NAT\IncomingPortConfig::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\services\config\NAT;
|
||||
use alphayax\freebox\api\v3\models\NAT\PortForwardingConfig;
|
||||
use alphayax\freebox\api\v3\models;
|
||||
use alphayax\freebox\api\v3\Service;
|
||||
|
||||
|
||||
|
@ -16,79 +16,70 @@ class PortForwarding extends Service {
|
|||
/**
|
||||
* Getting the list of port forwarding
|
||||
* @throws \Exception
|
||||
* @return PortForwardingConfig[]
|
||||
* @return models\NAT\PortForwardingConfig[]
|
||||
*/
|
||||
public function getAll(){
|
||||
$rest = $this->getAuthService( self::API_NAT_REDIR);
|
||||
$rest->GET();
|
||||
|
||||
$result = $rest->getCurlResponse()['result'];
|
||||
$PortForwardingList = [];
|
||||
foreach( $result as $PortForwardingElement){
|
||||
$PortForwardingList[] = new PortForwardingConfig( $PortForwardingElement);
|
||||
}
|
||||
return $PortForwardingList;
|
||||
return $rest->getResultAsArray( models\NAT\PortForwardingConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting a specific port forwarding
|
||||
* @param $PortForwarding_id
|
||||
* @return PortForwardingConfig
|
||||
* @return models\NAT\PortForwardingConfig
|
||||
*/
|
||||
public function getById( $PortForwarding_id){
|
||||
$rest = $this->getAuthService( self::API_NAT_REDIR . $PortForwarding_id);
|
||||
$rest->GET();
|
||||
|
||||
return new PortForwardingConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\NAT\PortForwardingConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a specific port forwarding
|
||||
* @param PortForwardingConfig $new_PortForwardingConfig
|
||||
* @return PortForwardingConfig
|
||||
* @throws \Exception
|
||||
* @param models\NAT\PortForwardingConfig $portForwardingConfig
|
||||
* @return models\NAT\PortForwardingConfig
|
||||
*/
|
||||
public function update( PortForwardingConfig $new_PortForwardingConfig){
|
||||
$rest = $this->getAuthService( self::API_NAT_REDIR . $new_PortForwardingConfig->getId());
|
||||
$rest->PUT( $new_PortForwardingConfig->toArray());
|
||||
public function update( models\NAT\PortForwardingConfig $portForwardingConfig){
|
||||
$rest = $this->getAuthService( self::API_NAT_REDIR . $portForwardingConfig->getId());
|
||||
$rest->PUT( $portForwardingConfig);
|
||||
|
||||
return new PortForwardingConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\NAT\PortForwardingConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a port forwarding
|
||||
* @param PortForwardingConfig $new_PortForwardingConfig
|
||||
* @return PortForwardingConfig
|
||||
* @throws \Exception
|
||||
* @param models\NAT\PortForwardingConfig $portForwardingConfig
|
||||
* @return models\NAT\PortForwardingConfig
|
||||
*/
|
||||
public function add( PortForwardingConfig $new_PortForwardingConfig){
|
||||
public function add( models\NAT\PortForwardingConfig $portForwardingConfig){
|
||||
$rest = $this->getAuthService( self::API_NAT_REDIR);
|
||||
$rest->POST( $new_PortForwardingConfig->toArray());
|
||||
$rest->POST( $portForwardingConfig);
|
||||
|
||||
return new PortForwardingConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\NAT\PortForwardingConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a port forwarding
|
||||
* @param PortForwardingConfig $PortForwardingConfig
|
||||
* @return PortForwardingConfig
|
||||
* @throws \Exception
|
||||
* @param models\NAT\PortForwardingConfig $portForwardingConfig
|
||||
* @return models\NAT\PortForwardingConfig
|
||||
*/
|
||||
public function delete( PortForwardingConfig $PortForwardingConfig){
|
||||
return $this->deleteById( $PortForwardingConfig->getId());
|
||||
public function delete( models\NAT\PortForwardingConfig $portForwardingConfig){
|
||||
return $this->deleteById( $portForwardingConfig->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a port forwarding
|
||||
* Delete a port forwarding with the specified id
|
||||
* @param int $PortForwardingId
|
||||
* @return boolean success
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function deleteById( $PortForwardingId){
|
||||
$rest = $this->getAuthService( self::API_NAT_REDIR . $PortForwardingId);
|
||||
$rest->DELETE();
|
||||
|
||||
return $rest->getCurlResponse()['success'];
|
||||
return $rest->getSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class Afp extends Service {
|
|||
$rest = $this->getAuthService( self::API_NETWORK_SHARE_AFP);
|
||||
$rest->GET();
|
||||
|
||||
return new models\NetworkShare\AfpConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\NetworkShare\AfpConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,9 +29,9 @@ class Afp extends Service {
|
|||
*/
|
||||
public function setConfiguration( models\NetworkShare\AfpConfig $afpConfig){
|
||||
$rest = $this->getAuthService( self::API_NETWORK_SHARE_AFP);
|
||||
$rest->PUT( $afpConfig->toArray());
|
||||
$rest->PUT( $afpConfig);
|
||||
|
||||
return new models\NetworkShare\AfpConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\NetworkShare\AfpConfig::class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class Samba extends Service {
|
|||
$rest = $this->getAuthService( self::API_NETWORK_SHARE_SAMBA);
|
||||
$rest->GET();
|
||||
|
||||
return new models\NetworkShare\SambaConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\NetworkShare\SambaConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,9 +29,9 @@ class Samba extends Service {
|
|||
*/
|
||||
public function setConfiguration( models\NetworkShare\SambaConfig $sambaConfig){
|
||||
$rest = $this->getAuthService( self::API_NETWORK_SHARE_SAMBA);
|
||||
$rest->PUT( $sambaConfig->toArray());
|
||||
$rest->PUT( $sambaConfig);
|
||||
|
||||
return new models\NetworkShare\SambaConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\NetworkShare\SambaConfig::class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ class Config extends Service {
|
|||
$rest = $this->getAuthService( $service);
|
||||
$rest->GET();
|
||||
|
||||
return new models\SwitchPort\Config( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\SwitchPort\Config::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,9 +32,9 @@ class Config extends Service {
|
|||
public function update( models\SwitchPort\Config $config){
|
||||
$service = sprintf( static::API_SWITCH_PORT_CONFIG, $config->getId());
|
||||
$rest = $this->getAuthService( $service);
|
||||
$rest->PUT( $config->toArray());
|
||||
$rest->PUT( $config);
|
||||
|
||||
return new models\SwitchPort\Config( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\SwitchPort\Config::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,14 +14,14 @@ class Stats extends Service {
|
|||
/**
|
||||
* Get a port configuration
|
||||
* @param int $portId
|
||||
* @return \alphayax\freebox\api\v3\models\SwitchPort\Stats
|
||||
* @return models\SwitchPort\Stats
|
||||
*/
|
||||
public function getFromPortId( $portId){
|
||||
$service = sprintf( static::API_SWITCH_PORT_STATS, $portId);
|
||||
$rest = $this->getAuthService( $service);
|
||||
$rest->GET();
|
||||
|
||||
return new models\SwitchPort\Stats( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\SwitchPort\Stats::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class Status extends Service {
|
|||
$rest = $this->getAuthService( self::API_SWITCH_STATUS);
|
||||
$rest->GET();
|
||||
|
||||
return new models\SwitchPort\Status( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\SwitchPort\Status::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\services\config;
|
||||
use alphayax\freebox\api\v3\models\SystemConfig;
|
||||
use alphayax\freebox\api\v3\models;
|
||||
use alphayax\freebox\api\v3\Service;
|
||||
|
||||
|
||||
|
@ -16,25 +16,24 @@ class System extends Service {
|
|||
|
||||
/**
|
||||
* Get the current system info
|
||||
* @throws \Exception
|
||||
* @return models\SystemConfig
|
||||
*/
|
||||
public function getConfiguration(){
|
||||
$rest = $this->getAuthService( self::API_SYSTEM);
|
||||
$rest->GET();
|
||||
|
||||
return new SystemConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\SystemConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reboot the Freebox
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
* @return bool
|
||||
*/
|
||||
public function reboot(){
|
||||
$rest = $this->getAuthService( self::API_SYSTEM_REBOOT);
|
||||
$rest->POST();
|
||||
|
||||
return $rest->getCurlResponse();
|
||||
return $rest->getSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\services\config\UPnP;
|
||||
use alphayax\freebox\api\v3\models\UPnP\UpnpAvConfig;
|
||||
use alphayax\freebox\api\v3\models;
|
||||
use alphayax\freebox\api\v3\Service;
|
||||
|
||||
/**
|
||||
|
@ -13,26 +13,26 @@ class AV extends Service {
|
|||
|
||||
/**
|
||||
* Get the current UPnP AV configuration
|
||||
* @return UpnpAvConfig
|
||||
* @return models\UPnP\UpnpAvConfig
|
||||
*/
|
||||
public function getConfiguration(){
|
||||
$rest = $this->getAuthService( self::API_UPNP_AV_CONFIG);
|
||||
$rest->GET();
|
||||
|
||||
return new UpnpAvConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\UPnP\UpnpAvConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the UPnP AV configuration
|
||||
* @param UpnpAvConfig $new_UpnpAvConfig
|
||||
* @return UpnpAvConfig
|
||||
* @param models\UPnP\UpnpAvConfig $upnpAvConfig
|
||||
* @return models\UPnP\UpnpAvConfig
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function setConfiguration( UpnpAvConfig $new_UpnpAvConfig){
|
||||
public function setConfiguration( models\UPnP\UpnpAvConfig $upnpAvConfig){
|
||||
$rest = $this->getAuthService( self::API_UPNP_AV_CONFIG);
|
||||
$rest->PUT( $new_UpnpAvConfig->toArray());
|
||||
$rest->PUT( $upnpAvConfig);
|
||||
|
||||
return new UpnpAvConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\UPnP\UpnpAvConfig::class);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\services\config\UPnP;
|
||||
use alphayax\freebox\api\v3\models\UPnP\UpnpIgdConfig;
|
||||
use alphayax\freebox\api\v3\models\UPnP\UpnpIgdRedirection;
|
||||
use alphayax\freebox\api\v3\models;
|
||||
use alphayax\freebox\api\v3\Service;
|
||||
|
||||
/**
|
||||
|
@ -15,42 +14,37 @@ class IGD extends Service {
|
|||
|
||||
/**
|
||||
* Get the current UPnP AV configuration
|
||||
* @return UpnpIgdConfig
|
||||
* @return models\UPnP\UpnpIgdConfig
|
||||
*/
|
||||
public function getConfiguration(){
|
||||
$rest = $this->getAuthService( self::API_UPNP_IGD_CONFIG);
|
||||
$rest->GET();
|
||||
|
||||
return new UpnpIgdConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\UPnP\UpnpIgdConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the UPnP AV configuration
|
||||
* @param UpnpIgdConfig $new_UpnpIgdConfig
|
||||
* @return UpnpIgdConfig
|
||||
* @param models\UPnP\UpnpIgdConfig $upnpIgdConfig
|
||||
* @return models\UPnP\UpnpIgdConfig
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function setConfiguration( UpnpIgdConfig $new_UpnpIgdConfig){
|
||||
public function setConfiguration( models\UPnP\UpnpIgdConfig $upnpIgdConfig){
|
||||
$rest = $this->getAuthService( self::API_UPNP_IGD_CONFIG);
|
||||
$rest->PUT( $new_UpnpIgdConfig->toArray());
|
||||
$rest->PUT( $upnpIgdConfig);
|
||||
|
||||
return new UpnpIgdConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\UPnP\UpnpIgdConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of current redirection
|
||||
* @return UpnpIgdRedirection[]
|
||||
* @return models\UPnP\UpnpIgdRedirection[]
|
||||
*/
|
||||
public function getRedirections(){
|
||||
$rest = $this->getAuthService( self::API_UPNP_IGD_REDIRECTION);
|
||||
$rest->GET();
|
||||
|
||||
$Redirection_xs = $rest->getCurlResponse()['result'];
|
||||
$Redirections = [];
|
||||
foreach( $Redirection_xs as $Redirection_x) {
|
||||
$Redirections[] = new UpnpIgdRedirection( $Redirection_x);
|
||||
}
|
||||
return $Redirections;
|
||||
return $rest->getResultAsArray( models\UPnP\UpnpIgdRedirection::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,7 +56,7 @@ class IGD extends Service {
|
|||
$rest = $this->getAuthService( self::API_UPNP_IGD_REDIRECTION . $redirectionId);
|
||||
$rest->DELETE();
|
||||
|
||||
return (bool) $rest->getCurlResponse()['success'];
|
||||
return $rest->getSuccess();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ class Config extends Service {
|
|||
*/
|
||||
public function add( models\VPN\Client\Config\ClientConfig $config) {
|
||||
$rest = $this->getAuthService( self::API_VPN_CLIENT_CONFIG);
|
||||
$rest->POST( $config->toArray());
|
||||
$rest->POST( $config);
|
||||
|
||||
return $rest->getResult( models\VPN\Client\Config\ClientConfig::class);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ class Config extends Service {
|
|||
*/
|
||||
public function update( models\VPN\Client\Config\ClientConfig $config) {
|
||||
$rest = $this->getAuthService( self::API_VPN_CLIENT_CONFIG. $config->getId());
|
||||
$rest->PUT( $config->toArray());
|
||||
$rest->PUT( $config);
|
||||
|
||||
return $rest->getResult( models\VPN\Client\Config\ClientConfig::class);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ class Config extends Service {
|
|||
$rest = $this->getAuthService( $service);
|
||||
$rest->GET();
|
||||
|
||||
return new models\VPN\Server\Config\ServerConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\VPN\Server\Config\ServerConfig::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,9 +32,9 @@ class Config extends Service {
|
|||
public function setConfiguration( models\VPN\Server\Config\ServerConfig $serverConfig){
|
||||
$service = sprintf( self::API_VPN_SERVER_CONFIG, $serverConfig->getId());
|
||||
$rest = $this->getAuthService( $service);
|
||||
$rest->PUT( $serverConfig->toArray());
|
||||
$rest->PUT( $serverConfig);
|
||||
|
||||
return new models\VPN\Server\Config\ServerConfig( $rest->getCurlResponse()['result']);
|
||||
return $rest->getResult( models\VPN\Server\Config\ServerConfig::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class User extends Service {
|
|||
*/
|
||||
public function add( models\VPN\Server\User $user){
|
||||
$rest = $this->getAuthService( self::API_VPN_USER);
|
||||
$rest->POST( $user->toArray());
|
||||
$rest->POST( $user);
|
||||
|
||||
return $rest->getResult( models\VPN\Server\User::class);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class User extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Deletes the VPNUser
|
||||
* Deletes the VPNUser with the given id
|
||||
* @param string $login
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -71,16 +71,17 @@ class User extends Service {
|
|||
/**
|
||||
* Update a VPN Use
|
||||
* @param \alphayax\freebox\api\v3\models\VPN\Server\User $user
|
||||
* @return bool
|
||||
* @return models\VPN\Server\User
|
||||
*/
|
||||
public function update( models\VPN\Server\User $user){
|
||||
$rest = $this->getAuthService( self::API_VPN_USER . $user->getLogin());
|
||||
$rest->PUT( $user->toArray());
|
||||
$rest->PUT( $user);
|
||||
|
||||
return $rest->getResult( models\VPN\Server\User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a new configuration file & download it
|
||||
* @param string $serverName
|
||||
* @param string $login
|
||||
* @return string The content of the configuration file
|
||||
|
|
|
@ -17,6 +17,7 @@ class AccessPoint extends Service {
|
|||
const API_WIFI_AP_CHANNEL_USAGE = '/api/v3/wifi/ap/%u/channel_usage/';
|
||||
|
||||
/**
|
||||
* Get all Access Points
|
||||
* @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\AP[]
|
||||
*/
|
||||
public function getAll(){
|
||||
|
@ -27,6 +28,7 @@ class AccessPoint extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a specific Access Point
|
||||
* @param int $accessPointId
|
||||
* @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\AP
|
||||
*/
|
||||
|
@ -64,6 +66,7 @@ class AccessPoint extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Update an Access Point
|
||||
* @param $accessPoint
|
||||
* @return \alphayax\freebox\api\v3\models\WiFi\AccessPoint\AP
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
namespace alphayax\freebox\api\v3\services\config\WiFi;
|
||||
use alphayax\freebox\api\v3\Service;
|
||||
use alphayax\freebox\api\v3\models;
|
||||
|
||||
/**
|
||||
* Class Bss
|
||||
|
@ -11,38 +12,38 @@ class Bss extends Service {
|
|||
const API_WIFI_BSS = '/api/v3/wifi/bss/';
|
||||
|
||||
/**
|
||||
* Get the list of Freebox Access Points
|
||||
* @return \alphayax\freebox\api\v3\models\WiFi\Bss\Bss[]
|
||||
* Get the list of Freebox BSS
|
||||
* @return models\WiFi\Bss\Bss[]
|
||||
*/
|
||||
public function getAll() {
|
||||
$rest = $this->getAuthService( self::API_WIFI_BSS);
|
||||
$rest->GET();
|
||||
|
||||
return $rest->getResultAsArray( \alphayax\freebox\api\v3\models\WiFi\Bss\Bss::class);
|
||||
return $rest->getResultAsArray( models\WiFi\Bss\Bss::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of Freebox Access Points
|
||||
* Get a specific BSS
|
||||
* @param $BssId
|
||||
* @return \alphayax\freebox\api\v3\models\WiFi\Bss\Bss
|
||||
* @return models\WiFi\Bss\Bss
|
||||
*/
|
||||
public function getFromId( $BssId) {
|
||||
$rest = $this->getAuthService( self::API_WIFI_BSS . $BssId);
|
||||
$rest->GET();
|
||||
|
||||
return $rest->getResult( \alphayax\freebox\api\v3\models\WiFi\Bss\Bss::class);
|
||||
return $rest->getResult( models\WiFi\Bss\Bss::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of Freebox Access Points
|
||||
* @param \alphayax\freebox\api\v3\models\WiFi\Bss\Bss $Bss
|
||||
* @return \alphayax\freebox\api\v3\models\WiFi\Bss\Bss
|
||||
* Update a BSS
|
||||
* @param models\WiFi\Bss\Bss $Bss
|
||||
* @return models\WiFi\Bss\Bss
|
||||
*/
|
||||
public function update( \alphayax\freebox\api\v3\models\WiFi\Bss\Bss $Bss) {
|
||||
public function update( models\WiFi\Bss\Bss $Bss) {
|
||||
$rest = $this->getAuthService( self::API_WIFI_BSS . $Bss->getId());
|
||||
$rest->PUT( $Bss);
|
||||
|
||||
return $rest->getResult( \alphayax\freebox\api\v3\models\WiFi\Bss\Bss::class);
|
||||
return $rest->getResult( models\WiFi\Bss\Bss::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ class Config extends Service {
|
|||
const API_WIFI_CONFIG_RESET = '/api/v3/wifi/config/reset/';
|
||||
|
||||
/**
|
||||
* Get the global wifi configuration
|
||||
* @return models\WiFi\GlobalConfig
|
||||
*/
|
||||
public function getConfiguration(){
|
||||
|
@ -23,6 +24,7 @@ class Config extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Update the global wifi configuration
|
||||
* @param models\WiFi\GlobalConfig $globalConfig
|
||||
* @return models\WiFi\GlobalConfig
|
||||
*/
|
||||
|
|
|
@ -12,6 +12,7 @@ class MacFilter extends Service {
|
|||
const API_WIFI_MAC_FILTER = '/api/v3/wifi/mac_filter/';
|
||||
|
||||
/**
|
||||
* Get all MacFilters
|
||||
* @return models\WiFi\MacFilter[]
|
||||
*/
|
||||
public function getAll(){
|
||||
|
@ -22,6 +23,7 @@ class MacFilter extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a specific MacFilter
|
||||
* @param $MacFilterId
|
||||
* @return models\WiFi\MacFilter
|
||||
*/
|
||||
|
@ -33,6 +35,7 @@ class MacFilter extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Update a MacFilter
|
||||
* @param \alphayax\freebox\api\v3\models\WiFi\MacFilter $MacFilter
|
||||
* @return \alphayax\freebox\api\v3\models\WiFi\MacFilter
|
||||
*/
|
||||
|
@ -44,19 +47,18 @@ class MacFilter extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Delete a MacFilter
|
||||
* @param \alphayax\freebox\api\v3\models\WiFi\MacFilter $MacFilter
|
||||
* @return \alphayax\freebox\api\v3\models\WiFi\MacFilter
|
||||
* @return bool
|
||||
*/
|
||||
public function delete( models\WiFi\MacFilter $MacFilter){
|
||||
$rest = $this->getAuthService( self::API_WIFI_MAC_FILTER . $MacFilter->getId());
|
||||
$rest->PUT( $MacFilter);
|
||||
|
||||
return $rest->getResult( models\WiFi\MacFilter::class);
|
||||
return $this->deleteFromId( $MacFilter->getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a MacFilter with the specified id
|
||||
* @param $MacFilterId
|
||||
* @return \alphayax\freebox\api\v3\models\WiFi\MacFilter
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteFromId( $MacFilterId){
|
||||
$rest = $this->getAuthService( self::API_WIFI_MAC_FILTER . $MacFilterId);
|
||||
|
@ -66,6 +68,7 @@ class MacFilter extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Add a new MacFilter
|
||||
* @param \alphayax\freebox\api\v3\models\WiFi\MacFilter $MacFilter
|
||||
* @return \alphayax\freebox\api\v3\models\WiFi\MacFilter
|
||||
*/
|
||||
|
|
|
@ -12,6 +12,7 @@ class Planning extends Service {
|
|||
const API_WIFI_PLANNING = '/api/v3/wifi/planning/';
|
||||
|
||||
/**
|
||||
* Get the wifi planning
|
||||
* @return \alphayax\freebox\api\v3\models\WiFi\Planning
|
||||
*/
|
||||
public function getPlanning(){
|
||||
|
@ -22,6 +23,7 @@ class Planning extends Service {
|
|||
}
|
||||
|
||||
/**
|
||||
* Update the wifi planning
|
||||
* @param \alphayax\freebox\api\v3\models\WiFi\Planning $planning
|
||||
* @return \alphayax\freebox\api\v3\models\WiFi\Planning
|
||||
*/
|
||||
|
@ -31,5 +33,5 @@ class Planning extends Service {
|
|||
|
||||
return $rest->getResult( models\WiFi\Planning::class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ class Configuration extends Service {
|
|||
*/
|
||||
public function setConfiguration( models\Download\Config\DownloadConfig $downloadConfig){
|
||||
$rest = $this->getAuthService( self::API_DOWNLOAD_CONFIG);
|
||||
$rest->PUT( $downloadConfig->toArray());
|
||||
$rest->PUT( $downloadConfig);
|
||||
|
||||
return $rest->getResult( models\Download\Config\DownloadConfig::class);
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ class Download extends Service {
|
|||
public function update( models\Download\Task $downloadTask){
|
||||
$eraseService = sprintf( self::API_DOWNLOAD_ERASE, $downloadTask->getId());
|
||||
$rest = $this->getAuthService( $eraseService);
|
||||
$rest->PUT( $downloadTask->toArray());
|
||||
$rest->PUT( $downloadTask);
|
||||
|
||||
return $rest->getResult( models\Download\Task::class);
|
||||
}
|
||||
|
|
|
@ -48,10 +48,10 @@ class Session extends Service {
|
|||
'password' => hash_hmac( 'sha1', $this->challenge, $this->application->getAppToken()),
|
||||
]);
|
||||
|
||||
if( ! $rest->getCurlResponse()['success']){
|
||||
if( ! $rest->getSuccess()){
|
||||
throw new \Exception( $rest->getCurlResponse()['error_code'] .' : '. $rest->getCurlResponse()['msg']);
|
||||
}
|
||||
$this->session_token = $rest->getCurlResponse()['result']['session_token'];
|
||||
$this->session_token = $rest->getResult()['session_token'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue