Skip to main content

gproxy_protocol/claude/file_download/
response.rs

1use http::StatusCode;
2use serde::{Deserialize, Serialize};
3
4use crate::claude::types::{BetaErrorResponse, ClaudeResponseHeaders};
5
6/// Successful body for Claude "Download File" endpoint.
7///
8/// The response is raw binary file content.  We represent it as opaque bytes
9/// since the MIME type varies per file.
10#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
11pub struct ResponseBody {
12    /// Raw file content bytes.
13    pub content: Vec<u8>,
14    /// Content-Type header value returned by the server.
15    #[serde(default, skip_serializing_if = "Option::is_none")]
16    pub content_type: Option<String>,
17}
18
19/// Full HTTP response for Claude "Download File" endpoint.
20#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
21#[serde(untagged)]
22pub enum ClaudeFileDownloadResponse {
23    Success {
24        #[serde(with = "crate::claude::types::status_code_serde")]
25        stats_code: StatusCode,
26        headers: ClaudeResponseHeaders,
27        body: ResponseBody,
28    },
29    Error {
30        #[serde(with = "crate::claude::types::status_code_serde")]
31        stats_code: StatusCode,
32        headers: ClaudeResponseHeaders,
33        body: BetaErrorResponse,
34    },
35}