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