Newer
Older
smart-home-server / server / SHServ / Routes / RESTAPI_v1.php
<?php

namespace SHServ\Routes;

trait RESTAPI_v1 {
	protected function restapi_uri_routes() {
		$this -> router -> uri("/api/v1/devices/scanning/setup", "{$this -> cn}\\DevicesRESTAPIController@scanning__ready_to_setup");
		$this -> router -> uri("/api/v1/devices/scanning/all", "{$this -> cn}\\DevicesRESTAPIController@scanning__all");
	}

	protected function restapi_get_routes() {
		$this -> router -> get(
			[ "device_id" ], 
			"{$this -> cn}\\DevicesRESTAPIController@remove_device", 
			'/api/v1/devices/remove'
		);

		$this -> router -> get(
			[ "device_id" ], 
			"{$this -> cn}\\DevicesRESTAPIController@reboot_device", 
			'/api/v1/devices/reboot'
		);
	}

	protected function restapi_post_routes() {
		$this -> router -> post(
			[ "device_ip", "alias", "description"],
			"{$this -> cn}\\DevicesRESTAPIController@setup_new_device",
			"/api/v1/devices/setup/new-device"
		);
	}
}