freebox_api_php/freebox/api/v3/services/config/Freeplug.php

54 lines
1.4 KiB
PHP
Raw Normal View History

2016-05-18 20:14:19 +02:00
<?php
namespace alphayax\freebox\api\v3\services\config;
use alphayax\freebox\api\v3\Service;
use alphayax\freebox\api\v3\models;
/**
* Class System
* @package alphayax\freebox\api\v3\services\config
*/
class Freeplug extends Service {
const API_FREEPLUG = '/api/v3/freeplug/';
const API_FREEPLUG_RESET = '/api/v3/freeplug/%s/reset/';
/**
2016-06-12 18:41:25 +02:00
* Get the freeplug networks information
2016-05-18 20:14:19 +02:00
* @throws \Exception
* @return models\Freeplug\FreeplugNetwork[]
*/
public function getNetworks(){
$rest = $this->getAuthService( self::API_FREEPLUG);
$rest->GET();
2016-06-12 18:41:25 +02:00
return $rest->getResultAsArray( models\Freeplug\FreeplugNetwork::class);
2016-05-18 20:14:19 +02:00
}
/**
* Get a particular Freeplug information
* @param $FreeplugId
* @return models\Freeplug\Freeplug
*/
public function getFromId( $FreeplugId){
$rest = $this->getAuthService( self::API_FREEPLUG . $FreeplugId . DIRECTORY_SEPARATOR);
$rest->GET();
2016-06-12 18:41:25 +02:00
return $rest->getResult( models\Freeplug\Freeplug::class);
2016-05-18 20:14:19 +02:00
}
/**
* Reset a Freeplug
* @param $FreeplugId
* @return models\Freeplug\FreeplugNetwork
*/
public function resetFromId( $FreeplugId){
$Service = sprintf( self::API_FREEPLUG_RESET, $FreeplugId);
$rest = $this->getAuthService( $Service);
$rest->POST();
2016-06-12 18:41:25 +02:00
return $rest->getSuccess();
2016-05-18 20:14:19 +02:00
}
}