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::{AgentName, 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
81    pub const MARKETPLACE_BASE: &'static str = "/api/v1/marketplace";
82
83    pub const CLOUD_TENANTS: &'static str = "/api/v1/tenants";
84
85    pub fn tenant(tenant_id: &TenantId) -> String {
86        format!("{}/{}", Self::CLOUD_TENANTS, tenant_id.as_str())
87    }
88
89    pub fn tenant_status(tenant_id: &TenantId) -> String {
90        format!("{}/{}/status", Self::CLOUD_TENANTS, tenant_id.as_str())
91    }
92
93    pub fn tenant_registry_token(tenant_id: &TenantId) -> String {
94        format!(
95            "{}/{}/registry-token",
96            Self::CLOUD_TENANTS,
97            tenant_id.as_str()
98        )
99    }
100
101    pub fn tenant_deploy(tenant_id: &TenantId) -> String {
102        format!("{}/{}/deploy", Self::CLOUD_TENANTS, tenant_id.as_str())
103    }
104
105    pub fn tenant_secrets(tenant_id: &TenantId) -> String {
106        format!("{}/{}/secrets", Self::CLOUD_TENANTS, tenant_id.as_str())
107    }
108
109    pub fn tenant_rotate_credentials(tenant_id: &TenantId) -> String {
110        format!(
111            "{}/{}/rotate-credentials",
112            Self::CLOUD_TENANTS,
113            tenant_id.as_str()
114        )
115    }
116
117    pub fn mcp_server_endpoint(server_name: &str) -> String {
118        format!("{}/{}/mcp", Self::MCP_BASE, server_name)
119    }
120
121    pub fn oauth_client_location(client_id: &ClientId) -> String {
122        format!("{}/{}", Self::OAUTH_CLIENTS, client_id.as_str())
123    }
124
125    pub fn wellknown_agent_card_named(agent_name: &str) -> String {
126        format!("{}/{}", Self::WELLKNOWN_AGENT_CARDS, agent_name)
127    }
128
129    pub fn agent_endpoint(agent_name: &AgentName) -> String {
130        format!("{}/{}/", Self::AGENTS_BASE, agent_name.as_str())
131    }
132}