use super::{
BlobItemInternal, BlobServiceProperties, BlobTags, BlockLookupList, ContainerItem, KeyInfo,
ListBlobsFlatSegmentResponse, ListBlobsHierarchySegmentResponse, ListContainersSegmentResponse,
QueryRequest, SignedIdentifiers,
};
use async_trait::async_trait;
use azure_core::{
http::{pager::Page, RequestContent, XmlFormat},
xml::to_xml,
Result,
};
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
impl Page for ListBlobsFlatSegmentResponse {
type Item = BlobItemInternal;
type IntoIter = <Vec<BlobItemInternal> as IntoIterator>::IntoIter;
async fn into_items(self) -> Result<Self::IntoIter> {
Ok(self.segment.blob_items.into_iter())
}
}
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
impl Page for ListBlobsHierarchySegmentResponse {
type Item = BlobItemInternal;
type IntoIter = <Vec<BlobItemInternal> as IntoIterator>::IntoIter;
async fn into_items(self) -> Result<Self::IntoIter> {
Ok(self.segment.blob_items.into_iter())
}
}
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
impl Page for ListContainersSegmentResponse {
type Item = ContainerItem;
type IntoIter = <Vec<ContainerItem> as IntoIterator>::IntoIter;
async fn into_items(self) -> Result<Self::IntoIter> {
Ok(self.container_items.into_iter())
}
}
impl TryFrom<BlobServiceProperties> for RequestContent<BlobServiceProperties, XmlFormat> {
type Error = azure_core::Error;
fn try_from(value: BlobServiceProperties) -> Result<Self> {
Ok(to_xml(&value)?.into())
}
}
impl TryFrom<BlobTags> for RequestContent<BlobTags, XmlFormat> {
type Error = azure_core::Error;
fn try_from(value: BlobTags) -> Result<Self> {
Ok(to_xml(&value)?.into())
}
}
impl TryFrom<BlockLookupList> for RequestContent<BlockLookupList, XmlFormat> {
type Error = azure_core::Error;
fn try_from(value: BlockLookupList) -> Result<Self> {
Ok(to_xml(&value)?.into())
}
}
impl TryFrom<KeyInfo> for RequestContent<KeyInfo, XmlFormat> {
type Error = azure_core::Error;
fn try_from(value: KeyInfo) -> Result<Self> {
Ok(to_xml(&value)?.into())
}
}
impl TryFrom<QueryRequest> for RequestContent<QueryRequest, XmlFormat> {
type Error = azure_core::Error;
fn try_from(value: QueryRequest) -> Result<Self> {
Ok(to_xml(&value)?.into())
}
}
impl TryFrom<SignedIdentifiers> for RequestContent<SignedIdentifiers, XmlFormat> {
type Error = azure_core::Error;
fn try_from(value: SignedIdentifiers) -> Result<Self> {
Ok(to_xml(&value)?.into())
}
}