Skip to main content

gproxy_protocol/claude/model_list/
response.rs

1use http::StatusCode;
2use serde::{Deserialize, Serialize};
3
4use crate::claude::types::{BetaErrorResponse, BetaModelInfo, ClaudeResponseHeaders};
5
6/// Successful body for Claude "List Models" endpoint.
7#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
8pub struct ResponseBody {
9    /// List of model records.
10    pub data: Vec<BetaModelInfo>,
11    /// First id in this page.
12    pub first_id: String,
13    /// Whether there are more pages.
14    pub has_more: bool,
15    /// Last id in this page.
16    pub last_id: String,
17}
18
19/// Full HTTP response for Claude "List Models" endpoint.
20#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
21#[serde(untagged)]
22pub enum ClaudeModelListResponse {
23    Success {
24        /// HTTP status code returned by server (should be `200 OK`).
25        #[serde(with = "crate::claude::types::status_code_serde")]
26        stats_code: StatusCode,
27        /// Response headers.
28        headers: ClaudeResponseHeaders,
29        /// Successful body.
30        body: ResponseBody,
31    },
32    Error {
33        /// HTTP status code returned by server (typically 400/401/403/404/413/429/500/529).
34        #[serde(with = "crate::claude::types::status_code_serde")]
35        stats_code: StatusCode,
36        /// Response headers.
37        headers: ClaudeResponseHeaders,
38        /// Error body.
39        body: BetaErrorResponse,
40    },
41}