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