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