use bytes::Bytes;
use futures::stream::BoxStream;
use http::Response;
use http_body::Frame;
use http_body_util::{Either, Full, StreamBody};
use ic_agent::AgentError;
use std::fmt::Debug;
use crate::HttpGatewayError;
pub type CanisterResponse = Response<HttpGatewayResponseBody>;
pub struct HttpGatewayResponse {
pub canister_response: CanisterResponse,
pub metadata: HttpGatewayResponseMetadata,
}
#[derive(Debug, Clone)]
pub struct HttpGatewayResponseMetadata {
pub upgraded_to_update_call: bool,
pub response_verification_version: Option<u16>,
pub internal_error: Option<HttpGatewayError>,
}
pub type HttpGatewayResponseBody = Either<ResponseBodyStream, Full<Bytes>>;
pub type ResponseBodyStream = StreamBody<BoxStream<'static, ResponseBodyStreamItem>>;
pub type ResponseBodyStreamItem = Result<Frame<Bytes>, AgentError>;