Skip to main content

systemprompt_models/api/cloud/
mod.rs

1//! Cloud Management API types shared between CLI and API server.
2//!
3//! Copyright (c) systemprompt.io — Business Source License 1.1.
4//! See <https://systemprompt.io> for licensing details.
5
6mod tenant;
7mod usage;
8
9pub use tenant::{
10    CloudEnterpriseLicenseInfo, CloudPlan, CloudPlanInfo, CloudTenant, CloudTenantInfo,
11    CloudTenantSecrets, CloudTenantStatus, CloudTenantStatusResponse, RotateCredentialsResponse,
12    SubscriptionStatus,
13};
14pub use usage::{
15    BridgeProfileUsage, ConversationGroup, ConversationSummary, ModelShare,
16    RecentConversationSummary, UsageWindow,
17};
18
19use schemars::JsonSchema;
20use serde::{Deserialize, Serialize};
21use std::collections::HashMap;
22
23#[derive(Debug, Clone, Serialize, Deserialize)]
24pub struct CloudApiResponse<T> {
25    pub data: T,
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
29pub struct CloudApiError {
30    pub error: CloudApiErrorDetail,
31}
32
33#[derive(Debug, Clone, Serialize, Deserialize)]
34pub struct CloudApiErrorDetail {
35    pub code: String,
36    pub message: String,
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
40pub struct CloudUserInfo {
41    pub id: systemprompt_identifiers::UserId,
42    pub email: String,
43    #[serde(default, skip_serializing_if = "Option::is_none")]
44    pub name: Option<String>,
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize)]
48pub struct CloudCustomerInfo {
49    pub id: String,
50    #[serde(default, skip_serializing_if = "Option::is_none")]
51    pub status: Option<String>,
52}
53
54#[derive(Debug, Clone, Serialize, Deserialize)]
55pub struct UserMeResponse {
56    pub user: CloudUserInfo,
57    #[serde(default, skip_serializing_if = "Option::is_none")]
58    pub customer: Option<CloudCustomerInfo>,
59    #[serde(default)]
60    pub tenants: Vec<CloudTenantInfo>,
61    #[serde(default, skip_serializing_if = "Option::is_none")]
62    pub enterprise: Option<CloudEnterpriseLicenseInfo>,
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize)]
66pub struct CloudListResponse<T> {
67    pub data: Vec<T>,
68}
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
71pub struct RegistryToken {
72    pub registry: String,
73    pub username: String,
74    pub token: String,
75    pub repository: String,
76    pub tag: String,
77}
78
79#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
80pub struct CloudStatusResponse {
81    pub status: String,
82}
83
84#[derive(Debug, Clone, Serialize, Deserialize)]
85pub struct DeployResponse {
86    pub status: String,
87    #[serde(skip_serializing_if = "Option::is_none")]
88    pub app_url: Option<String>,
89}
90
91#[derive(Debug, Clone, Serialize, Deserialize)]
92pub struct SetSecretsRequest {
93    pub secrets: HashMap<String, String>,
94}
95
96pub type ApiResponse<T> = CloudApiResponse<T>;
97pub type ApiError = CloudApiError;
98pub type ApiErrorDetail = CloudApiErrorDetail;
99pub type UserInfo = CloudUserInfo;
100pub type CustomerInfo = CloudCustomerInfo;
101pub type PlanInfo = CloudPlanInfo;
102pub type Plan = CloudPlan;
103pub type TenantInfo = CloudTenantInfo;
104pub type Tenant = CloudTenant;
105pub type TenantStatus = CloudTenantStatusResponse;
106pub type TenantSecrets = CloudTenantSecrets;
107pub type ListResponse<T> = CloudListResponse<T>;
108pub type StatusResponse = CloudStatusResponse;
109pub type EnterpriseLicenseInfo = CloudEnterpriseLicenseInfo;