systemprompt_models/modules/
api_paths.rs1use 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 CORE_USERS: &'static str = "/api/v1/core/users";
48
49 pub const WEBHOOK: &'static str = "/api/v1/webhook";
50 pub const WEBHOOK_AGUI: &'static str = "/api/v1/webhook/agui";
51 pub const WEBHOOK_A2A: &'static str = "/api/v1/webhook/a2a";
52
53 pub const HEALTH: &'static str = "/api/v1/health";
54 pub const DISCOVERY: &'static str = "/api/v1";
55
56 pub const WELLKNOWN_BASE: &'static str = "/.well-known";
57 pub const WELLKNOWN_AGENT_CARD: &'static str = "/.well-known/agent-card.json";
58 pub const WELLKNOWN_AGENT_CARDS: &'static str = "/.well-known/agent-cards";
59 pub const WELLKNOWN_OAUTH_SERVER: &'static str = "/.well-known/oauth-authorization-server";
60 pub const WELLKNOWN_OPENID_CONFIG: &'static str = "/.well-known/openid-configuration";
61 pub const WELLKNOWN_OAUTH_PROTECTED: &'static str = "/.well-known/oauth-protected-resource";
62 pub const WELLKNOWN_JWKS: &'static str = "/.well-known/jwks.json";
63
64 pub const A2A_CARD: &'static str = "/api/a2a/card";
65
66 pub const ASSETS_BASE: &'static str = "/assets";
67 pub const FILES_BASE: &'static str = "/files";
68 pub const GENERATED_BASE: &'static str = "/generated";
69 pub const IMAGES_BASE: &'static str = "/images";
70 pub const STATIC_BASE: &'static str = "/static";
71 pub const NEXT_BASE: &'static str = "/_next";
72 pub const DOCS_BASE: &'static str = "/docs";
73 pub const SWAGGER_BASE: &'static str = "/swagger";
74 pub const OPENAPI_BASE: &'static str = "/openapi";
75
76 pub const TRACK_BASE: &'static str = "/track";
77 pub const TRACK_ENGAGEMENT: &'static str = "/track/engagement";
78
79 pub const ADMIN_BASE: &'static str = "/api/v1/admin";
80 pub const ADMIN_LOGS: &'static str = "/api/v1/admin/logs";
81 pub const ADMIN_USERS: &'static str = "/api/v1/admin/users";
82 pub const ADMIN_ANALYTICS: &'static str = "/api/v1/admin/analytics";
83 pub const ADMIN_SESSIONS: &'static str = "/api/v1/admin/sessions";
84
85 pub const MARKETPLACE_BASE: &'static str = "/api/v1/marketplace";
86
87 pub const CLOUD_TENANTS: &'static str = "/api/v1/tenants";
88 pub const CLOUD_CHECKOUT: &'static str = "/api/v1/checkout";
89 pub const CLOUD_CHECKOUT_PLANS: &'static str = "/api/v1/checkout/plans";
90 pub const CLOUD_ACTIVITY: &'static str = "/api/v1/activity";
91
92 pub const ACTIVITY_EVENT_LOGIN: &'static str = "cloud_login";
93 pub const ACTIVITY_EVENT_LOGOUT: &'static str = "cloud_logout";
94
95 pub fn tenant(tenant_id: &TenantId) -> String {
96 format!("{}/{}", Self::CLOUD_TENANTS, tenant_id.as_str())
97 }
98
99 pub fn tenant_status(tenant_id: &TenantId) -> String {
100 format!("{}/{}/status", Self::CLOUD_TENANTS, tenant_id.as_str())
101 }
102
103 pub fn tenant_registry_token(tenant_id: &TenantId) -> String {
104 format!(
105 "{}/{}/registry-token",
106 Self::CLOUD_TENANTS,
107 tenant_id.as_str()
108 )
109 }
110
111 pub fn tenant_deploy(tenant_id: &TenantId) -> String {
112 format!("{}/{}/deploy", Self::CLOUD_TENANTS, tenant_id.as_str())
113 }
114
115 pub fn tenant_events(tenant_id: &TenantId) -> String {
116 format!("{}/{}/events", Self::CLOUD_TENANTS, tenant_id.as_str())
117 }
118
119 pub fn tenant_restart(tenant_id: &TenantId) -> String {
120 format!("{}/{}/restart", Self::CLOUD_TENANTS, tenant_id.as_str())
121 }
122
123 pub fn tenant_retry_provision(tenant_id: &TenantId) -> String {
124 format!(
125 "{}/{}/retry-provision",
126 Self::CLOUD_TENANTS,
127 tenant_id.as_str()
128 )
129 }
130
131 pub fn tenant_secrets(tenant_id: &TenantId) -> String {
132 format!("{}/{}/secrets", Self::CLOUD_TENANTS, tenant_id.as_str())
133 }
134
135 pub fn tenant_external_db_access(tenant_id: &TenantId) -> String {
136 format!(
137 "{}/{}/external-db-access",
138 Self::CLOUD_TENANTS,
139 tenant_id.as_str()
140 )
141 }
142
143 pub fn tenant_rotate_credentials(tenant_id: &TenantId) -> String {
144 format!(
145 "{}/{}/rotate-credentials",
146 Self::CLOUD_TENANTS,
147 tenant_id.as_str()
148 )
149 }
150
151 pub fn tenant_subscription_cancel(tenant_id: &TenantId) -> String {
152 format!(
153 "{}/{}/subscription/cancel",
154 Self::CLOUD_TENANTS,
155 tenant_id.as_str()
156 )
157 }
158
159 pub fn mcp_server_endpoint(server_name: &str) -> String {
160 format!("{}/{}/mcp", Self::MCP_BASE, server_name)
161 }
162
163 pub fn oauth_client_location(client_id: &ClientId) -> String {
164 format!("{}/{}", Self::OAUTH_CLIENTS, client_id.as_str())
165 }
166
167 pub fn wellknown_agent_card_named(agent_name: &str) -> String {
168 format!("{}/{}", Self::WELLKNOWN_AGENT_CARDS, agent_name)
169 }
170
171 pub fn agent_endpoint(agent_id: &AgentId) -> String {
172 format!("{}/{}/", Self::AGENTS_BASE, agent_id.as_str())
173 }
174
175 pub fn tenant_custom_domain(tenant_id: &TenantId) -> String {
176 format!(
177 "{}/{}/custom-domain",
178 Self::CLOUD_TENANTS,
179 tenant_id.as_str()
180 )
181 }
182}