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");

		$this -> router -> uri('/api/v1/devices/id/$device_id/reboot', "{$this -> cn}\\DevicesRESTAPIController@reboot_device");
		$this -> router -> uri('/api/v1/devices/id/$device_id/remove', "{$this -> cn}\\DevicesRESTAPIController@remove_device");
		$this -> router -> uri('/api/v1/devices/id/$device_id/info', "{$this -> cn}\\DevicesRESTAPIController@device_info");
		$this -> router -> uri('/api/v1/devices/id/$device_id', "{$this -> cn}\\DevicesRESTAPIController@device");
		$this -> router -> uri('/api/v1/devices/id/$device_id/status', "{$this -> cn}\\DevicesRESTAPIController@device_status");
	}

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

		$this -> router -> post(
			[ "device_id", "action", "params" ],
			"{$this -> cn}\\DevicesRESTAPIController@do_device_action",
			"/api/v1/devices/action"
		);
	}

	protected function restapi_get_routes() {
	
	}
}