snapkitty
developer-tools
c++
hyperkitty-chromium / src /hk_api_router.erl
SNAPKITTYWEST's picture
Add covenant SPDX headers to every remaining unmarked source file
0196580 verified
Raw History Blame Contribute Delete
2 kB
% SPDX-License-Identifier: LicenseRef-Sovereign-Leviathan-SL-AGPL3-001
% Licensing: see LICENSE in the repository root.
%%%-------------------------------------------------------------------
%%% @doc Cowboy route table for all six required API domains
%%% (`/agents', `/browser', `/search', `/messages', `/events',
%%% `/health') plus the static frontend assets.
%%% @end
%%%-------------------------------------------------------------------
-module(hk_api_router).
-export([dispatch/0]).
dispatch() ->
cowboy_router:compile([
{'_', [
{"/", cowboy_static, {priv_file, hyperkitty, "frontend/index.html"}},
{"/js/[...]", cowboy_static, {priv_dir, hyperkitty, "frontend/js"}},
{"/api/health", hk_api_health_h, []},
{"/api/agents", hk_api_agents_h, collection},
{"/api/agents/:id", hk_api_agents_h, item},
{"/api/agents/:id/objective", hk_api_agents_h, objective},
{"/api/agents/:id/actions", hk_api_agents_h, actions},
{"/api/agents/:id/complete", hk_api_agents_h, complete},
{"/api/agents/:id/terminate", hk_api_agents_h, terminate},
{"/api/browser/sessions", hk_api_browser_h, collection},
{"/api/browser/sessions/:id", hk_api_browser_h, item},
{"/api/browser/sessions/:id/close", hk_api_browser_h, close},
{"/api/browser/sessions/:id/tabs", hk_api_browser_h, tabs},
{"/api/browser/sessions/:id/tabs/:tab_id/navigate", hk_api_browser_h, navigate},
{"/api/browser/sessions/:id/tabs/:tab_id/actions", hk_api_browser_h, actions},
{"/api/search", hk_api_search_h, collection},
{"/api/search/:id", hk_api_search_h, item},
{"/api/search/:id/result", hk_api_search_h, result},
{"/api/messages", hk_api_messages_h, []},
{"/api/events/recent", hk_api_events_recent_h, []},
{"/api/events/stream", hk_api_events_ws_h, []}
]}
]).