melvin_ob/http_handler/http_response/
annoucements.rs

1use crate::http_handler::http_response::response_common::{
2    ByteStreamResponseType, HTTPResponseType, ResponseError,
3};
4
5/// Response type for the /announcements endpoint
6pub(crate) struct AnnouncementsResponse {}
7
8impl ByteStreamResponseType for AnnouncementsResponse {}
9
10impl HTTPResponseType for AnnouncementsResponse {
11    /// The parsed type of the response
12    type ParsedResponseType = std::pin::Pin<
13        Box<dyn futures_core::Stream<Item = reqwest::Result<prost::bytes::Bytes>> + Send>,
14    >;
15
16    /// The pinned bytestream from the Server Sent Events
17    async fn read_response(
18        response: reqwest::Response,
19    ) -> Result<Self::ParsedResponseType, ResponseError> {
20        let resp = Self::unwrap_return_code(response).await?;
21        Ok(Box::pin(resp.bytes_stream()))
22    }
23}