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