use super::{
BlobItem, BlobServiceProperties, BlobTags, BlockLookupList, ContainerItem, FilterBlobItem,
FilteredBlobResponse, ListBlobsResponse, ListContainersResponse, SignedIdentifiers,
};
use async_trait::async_trait;
use azure_core::{
http::{pager::Page, RequestContent, XmlFormat},
xml::to_xml,
Result,
};
#[async_trait]
impl Page for FilteredBlobResponse {
type Item = FilterBlobItem;
type IntoIter = <Vec<FilterBlobItem> as IntoIterator>::IntoIter;
async fn into_items(self) -> Result<Self::IntoIter> {
Ok(self.blob_items.into_iter())
}
}
#[async_trait]
impl Page for ListBlobsResponse {
type Item = BlobItem;
type IntoIter = <Vec<BlobItem> as IntoIterator>::IntoIter;
async fn into_items(self) -> Result<Self::IntoIter> {
Ok(self.blob_items.into_iter())
}
}
#[async_trait]
impl Page for ListContainersResponse {
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<SignedIdentifiers> for RequestContent<SignedIdentifiers, XmlFormat> {
type Error = azure_core::Error;
fn try_from(value: SignedIdentifiers) -> Result<Self> {
Ok(to_xml(&value)?.into())
}
}