use crate::client::NoBody;
use crate::{Client, Error, Page, types::*, util::urlish};
impl Client {
pub async fn create_inbox(&self, inbox: CreateInbox) -> Result<Inbox, Error> {
self.request(reqwest::Method::POST, "/v0/inboxes", &[], Some(&inbox))
.await
}
pub async fn list_inboxes(&self) -> Result<InboxList, Error> {
self.list_inboxes_page(Page::default()).await
}
pub async fn list_inboxes_page(&self, page: Page) -> Result<InboxList, Error> {
self.request(
reqwest::Method::GET,
"/v0/inboxes",
&page.query(),
None::<&NoBody>,
)
.await
}
pub async fn get_inbox(&self, inbox_id: &str) -> Result<Inbox, Error> {
self.request(
reqwest::Method::GET,
&format!("/v0/inboxes/{}", urlish(inbox_id)),
&[],
None::<&NoBody>,
)
.await
}
pub async fn update_inbox(&self, inbox_id: &str, update: UpdateInbox) -> Result<Inbox, Error> {
self.request(
reqwest::Method::PATCH,
&format!("/v0/inboxes/{}", urlish(inbox_id)),
&[],
Some(&update),
)
.await
}
pub async fn delete_inbox(&self, inbox_id: &str) -> Result<(), Error> {
self.request(
reqwest::Method::DELETE,
&format!("/v0/inboxes/{}", urlish(inbox_id)),
&[],
None::<&NoBody>,
)
.await
}
}