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

namespace SHServ\Routes;

trait ScriptsRESTAPI_v1 {
	protected function scripts_restapi_uri_routes() {
		$this -> router -> uri("/api/v1/scripts/actions/list", "{$this -> cn}\\ScriptsRESTAPIController@actions_scripts_list");

		$this -> router -> uri("/api/v1/scripts/scopes/list", "{$this -> cn}\\ScriptsRESTAPIController@scope_list");
		$this -> router -> uri('/api/v1/scripts/scopes/name/$name', "{$this -> cn}\\ScriptsRESTAPIController@scope_file");

		$this -> router -> uri('/api/v1/scripts/actions/alias/$uniq_name/enable', "{$this -> cn}\\ScriptsRESTAPIController@action_script_enable");
		$this -> router -> uri('/api/v1/scripts/actions/alias/$uniq_name/disable', "{$this -> cn}\\ScriptsRESTAPIController@action_script_disable");
		$this -> router -> uri('/api/v1/scripts/scopes/name/$uniq_name/enable', "{$this -> cn}\\ScriptsRESTAPIController@scopes_enable");
		$this -> router -> uri('/api/v1/scripts/scopes/name/$uniq_name/disable', "{$this -> cn}\\ScriptsRESTAPIController@scopes_disable");
		$this -> router -> uri('/api/v1/scripts/regular/alias/$uniq_name/enable', "{$this -> cn}\\ScriptsRESTAPIController@regular_script_enable");
		$this -> router -> uri('/api/v1/scripts/regular/alias/$uniq_name/disable', "{$this -> cn}\\ScriptsRESTAPIController@regular_script_disable");
	}

	protected function scripts_restapi_post_routes() {
		$this -> router -> post(
			[ "alias", "params" ],
			"{$this -> cn}\\ScriptsRESTAPIController@run_action_script",
			'/api/v1/scripts/actions/run'
		);

	}

	protected function scripts_restapi_get_routes() {
	
	}
}