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