Skip to main content

gproxy_protocol/openai/model_list/
response.rs

1use http::StatusCode;
2use serde::{Deserialize, Serialize};
3
4use crate::openai::types::{OpenAiApiErrorResponse, OpenAiModelList, OpenAiResponseHeaders};
5
6/// Successful body for OpenAI `models.list` endpoint.
7pub type ResponseBody = OpenAiModelList;
8
9/// Full HTTP response for OpenAI `models.list` endpoint.
10#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
11#[serde(untagged)]
12pub enum OpenAiModelListResponse {
13    Success {
14        /// HTTP status code returned by server (should be `200 OK`).
15        #[serde(with = "crate::openai::types::status_code_serde")]
16        stats_code: StatusCode,
17        /// Response headers.
18        headers: OpenAiResponseHeaders,
19        /// Successful body.
20        body: ResponseBody,
21    },
22    Error {
23        /// HTTP status code returned by server (typically non-2xx).
24        #[serde(with = "crate::openai::types::status_code_serde")]
25        stats_code: StatusCode,
26        /// Response headers.
27        headers: OpenAiResponseHeaders,
28        /// Error body.
29        body: OpenAiApiErrorResponse,
30    },
31}