Skip to main content

systemprompt_models/modules/
api_paths.rs

1//! API path constants.
2//!
3//! Copyright (c) systemprompt.io — Business Source License 1.1.
4//! See <https://systemprompt.io> for licensing details.
5
6use 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
51    pub const LIVEZ: &'static str = "/livez";
52
53    pub const READYZ: &'static str = "/readyz";
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
84    pub const MARKETPLACE_BASE: &'static str = "/api/v1/marketplace";
85
86    pub const CLOUD_TENANTS: &'static str = "/api/v1/tenants";
87
88    pub fn tenant(tenant_id: &TenantId) -> String {
89        format!("{}/{}", Self::CLOUD_TENANTS, tenant_id.as_str())
90    }
91
92    pub fn tenant_status(tenant_id: &TenantId) -> String {
93        format!("{}/{}/status", Self::CLOUD_TENANTS, tenant_id.as_str())
94    }
95
96    pub fn tenant_registry_token(tenant_id: &TenantId) -> String {
97        format!(
98            "{}/{}/registry-token",
99            Self::CLOUD_TENANTS,
100            tenant_id.as_str()
101        )
102    }
103
104    pub fn tenant_deploy(tenant_id: &TenantId) -> String {
105        format!("{}/{}/deploy", Self::CLOUD_TENANTS, tenant_id.as_str())
106    }
107
108    pub fn tenant_secrets(tenant_id: &TenantId) -> String {
109        format!("{}/{}/secrets", Self::CLOUD_TENANTS, tenant_id.as_str())
110    }
111
112    pub fn tenant_rotate_credentials(tenant_id: &TenantId) -> String {
113        format!(
114            "{}/{}/rotate-credentials",
115            Self::CLOUD_TENANTS,
116            tenant_id.as_str()
117        )
118    }
119
120    pub fn mcp_server_endpoint(server_name: &str) -> String {
121        format!("{}/{}/mcp", Self::MCP_BASE, server_name)
122    }
123
124    pub fn oauth_client_location(client_id: &ClientId) -> String {
125        format!("{}/{}", Self::OAUTH_CLIENTS, client_id.as_str())
126    }
127
128    pub fn wellknown_agent_card_named(agent_name: &str) -> String {
129        format!("{}/{}", Self::WELLKNOWN_AGENT_CARDS, agent_name)
130    }
131
132    pub fn agent_endpoint(agent_id: &AgentId) -> String {
133        format!("{}/{}/", Self::AGENTS_BASE, agent_id.as_str())
134    }
135}