Skip to main content

systemprompt_models/modules/
api_paths.rs

1//! API path constants.
2
3use systemprompt_identifiers::{AgentId, ClientId, TenantId};
4
5#[derive(Debug, Clone, Copy)]
6pub struct ApiPaths;
7
8impl ApiPaths {
9    pub const GATEWAY_BASE: &'static str = "/v1";
10
11    pub const API_BASE: &'static str = "/api";
12    pub const API_V1: &'static str = "/api/v1";
13    pub const CORE_BASE: &'static str = "/api/v1/core";
14    pub const AGENTS_BASE: &'static str = "/api/v1/agents";
15    pub const MCP_BASE: &'static str = "/api/v1/mcp";
16    pub const STREAM_BASE: &'static str = "/api/v1/stream";
17    pub const CONTENT_BASE: &'static str = "/api/v1/content";
18    pub const SYNC_BASE: &'static str = "/api/v1/sync";
19    pub const ANALYTICS_BASE: &'static str = "/api/v1/analytics";
20    pub const META_BASE: &'static str = "/api/v1/meta";
21    pub const SLACK_BASE: &'static str = "/api/v1/slack";
22    pub const TEAMS_BASE: &'static str = "/api/v1/teams";
23
24    pub const CORE_CONTEXTS: &'static str = "/api/v1/core/contexts";
25    pub const CORE_TASKS: &'static str = "/api/v1/core/tasks";
26    pub const CORE_ARTIFACTS: &'static str = "/api/v1/core/artifacts";
27    pub const CONTEXTS_WEBHOOK: &'static str = "/api/v1/core/contexts/webhook";
28
29    pub const AGENTS_REGISTRY: &'static str = "/api/v1/agents/registry";
30
31    pub const MCP_REGISTRY: &'static str = "/api/v1/mcp/registry";
32
33    pub const STREAM_CONTEXTS: &'static str = "/api/v1/stream/contexts";
34    pub const STREAM_AGUI: &'static str = "/api/v1/stream/agui";
35    pub const STREAM_A2A: &'static str = "/api/v1/stream/a2a";
36
37    pub const AUTH_ME: &'static str = "/api/v1/auth/me";
38
39    pub const OAUTH_BASE: &'static str = "/api/v1/core/oauth";
40    pub const OAUTH_SESSION: &'static str = "/api/v1/core/oauth/session";
41    pub const OAUTH_REGISTER: &'static str = "/api/v1/core/oauth/register";
42    pub const OAUTH_AUTHORIZE: &'static str = "/api/v1/core/oauth/authorize";
43    pub const OAUTH_TOKEN: &'static str = "/api/v1/core/oauth/token";
44    pub const OAUTH_CALLBACK: &'static str = "/api/v1/core/oauth/callback";
45    pub const OAUTH_CONSENT: &'static str = "/api/v1/core/oauth/consent";
46    pub const OAUTH_WEBAUTHN_COMPLETE: &'static str = "/api/v1/core/oauth/webauthn/complete";
47    pub const OAUTH_CLIENTS: &'static str = "/api/v1/core/oauth/clients";
48
49    pub const CORE_USERS: &'static str = "/api/v1/core/users";
50
51    pub const WEBHOOK: &'static str = "/api/v1/webhook";
52    pub const WEBHOOK_AGUI: &'static str = "/api/v1/webhook/agui";
53    pub const WEBHOOK_A2A: &'static str = "/api/v1/webhook/a2a";
54
55    pub const HEALTH: &'static str = "/api/v1/health";
56    pub const DISCOVERY: &'static str = "/api/v1";
57
58    pub const WELLKNOWN_BASE: &'static str = "/.well-known";
59    pub const WELLKNOWN_AGENT_CARD: &'static str = "/.well-known/agent-card.json";
60    pub const WELLKNOWN_AGENT_CARDS: &'static str = "/.well-known/agent-cards";
61    pub const WELLKNOWN_OAUTH_SERVER: &'static str = "/.well-known/oauth-authorization-server";
62    pub const WELLKNOWN_OPENID_CONFIG: &'static str = "/.well-known/openid-configuration";
63    pub const WELLKNOWN_OAUTH_PROTECTED: &'static str = "/.well-known/oauth-protected-resource";
64    pub const WELLKNOWN_JWKS: &'static str = "/.well-known/jwks.json";
65
66    pub const A2A_CARD: &'static str = "/api/a2a/card";
67
68    pub const ASSETS_BASE: &'static str = "/assets";
69    pub const FILES_BASE: &'static str = "/files";
70    pub const GENERATED_BASE: &'static str = "/generated";
71    pub const IMAGES_BASE: &'static str = "/images";
72    pub const STATIC_BASE: &'static str = "/static";
73    pub const NEXT_BASE: &'static str = "/_next";
74    pub const DOCS_BASE: &'static str = "/docs";
75    pub const SWAGGER_BASE: &'static str = "/swagger";
76    pub const OPENAPI_BASE: &'static str = "/openapi";
77
78    pub const TRACK_BASE: &'static str = "/track";
79    pub const TRACK_ENGAGEMENT: &'static str = "/track/engagement";
80
81    pub const ADMIN_BASE: &'static str = "/api/v1/admin";
82    pub const ADMIN_LOGS: &'static str = "/api/v1/admin/logs";
83    pub const ADMIN_USERS: &'static str = "/api/v1/admin/users";
84    pub const ADMIN_ANALYTICS: &'static str = "/api/v1/admin/analytics";
85    pub const ADMIN_SESSIONS: &'static str = "/api/v1/admin/sessions";
86
87    pub const MARKETPLACE_BASE: &'static str = "/api/v1/marketplace";
88
89    pub const CLOUD_TENANTS: &'static str = "/api/v1/tenants";
90    pub const CLOUD_CHECKOUT: &'static str = "/api/v1/checkout";
91    pub const CLOUD_CHECKOUT_PLANS: &'static str = "/api/v1/checkout/plans";
92    pub const CLOUD_ACTIVITY: &'static str = "/api/v1/activity";
93
94    pub const ACTIVITY_EVENT_LOGIN: &'static str = "cloud_login";
95    pub const ACTIVITY_EVENT_LOGOUT: &'static str = "cloud_logout";
96
97    pub fn tenant(tenant_id: &TenantId) -> String {
98        format!("{}/{}", Self::CLOUD_TENANTS, tenant_id.as_str())
99    }
100
101    pub fn tenant_status(tenant_id: &TenantId) -> String {
102        format!("{}/{}/status", Self::CLOUD_TENANTS, tenant_id.as_str())
103    }
104
105    pub fn tenant_registry_token(tenant_id: &TenantId) -> String {
106        format!(
107            "{}/{}/registry-token",
108            Self::CLOUD_TENANTS,
109            tenant_id.as_str()
110        )
111    }
112
113    pub fn tenant_deploy(tenant_id: &TenantId) -> String {
114        format!("{}/{}/deploy", Self::CLOUD_TENANTS, tenant_id.as_str())
115    }
116
117    pub fn tenant_events(tenant_id: &TenantId) -> String {
118        format!("{}/{}/events", Self::CLOUD_TENANTS, tenant_id.as_str())
119    }
120
121    pub fn tenant_restart(tenant_id: &TenantId) -> String {
122        format!("{}/{}/restart", Self::CLOUD_TENANTS, tenant_id.as_str())
123    }
124
125    pub fn tenant_retry_provision(tenant_id: &TenantId) -> String {
126        format!(
127            "{}/{}/retry-provision",
128            Self::CLOUD_TENANTS,
129            tenant_id.as_str()
130        )
131    }
132
133    pub fn tenant_secrets(tenant_id: &TenantId) -> String {
134        format!("{}/{}/secrets", Self::CLOUD_TENANTS, tenant_id.as_str())
135    }
136
137    pub fn tenant_external_db_access(tenant_id: &TenantId) -> String {
138        format!(
139            "{}/{}/external-db-access",
140            Self::CLOUD_TENANTS,
141            tenant_id.as_str()
142        )
143    }
144
145    pub fn tenant_rotate_credentials(tenant_id: &TenantId) -> String {
146        format!(
147            "{}/{}/rotate-credentials",
148            Self::CLOUD_TENANTS,
149            tenant_id.as_str()
150        )
151    }
152
153    pub fn tenant_subscription_cancel(tenant_id: &TenantId) -> String {
154        format!(
155            "{}/{}/subscription/cancel",
156            Self::CLOUD_TENANTS,
157            tenant_id.as_str()
158        )
159    }
160
161    pub fn mcp_server_endpoint(server_name: &str) -> String {
162        format!("{}/{}/mcp", Self::MCP_BASE, server_name)
163    }
164
165    pub fn oauth_client_location(client_id: &ClientId) -> String {
166        format!("{}/{}", Self::OAUTH_CLIENTS, client_id.as_str())
167    }
168
169    pub fn wellknown_agent_card_named(agent_name: &str) -> String {
170        format!("{}/{}", Self::WELLKNOWN_AGENT_CARDS, agent_name)
171    }
172
173    pub fn agent_endpoint(agent_id: &AgentId) -> String {
174        format!("{}/{}/", Self::AGENTS_BASE, agent_id.as_str())
175    }
176
177    pub fn tenant_custom_domain(tenant_id: &TenantId) -> String {
178        format!(
179            "{}/{}/custom-domain",
180            Self::CLOUD_TENANTS,
181            tenant_id.as_str()
182        )
183    }
184}