use std::sync::Arc;
use crate::error::Result;
use crate::http::Config;
use crate::types::{CreateTopicOptions, DeleteTopicResponse, Topic, TopicId, TopicList};
#[derive(Clone)]
pub struct Topics(pub(crate) Arc<Config>);
impl Topics {
pub async fn create(&self, topic: &CreateTopicOptions) -> Result<TopicId> {
self.0.post(&["topics"], topic, None).await
}
pub async fn get(&self, id: &str) -> Result<Topic> {
self.0.get(&["topics", id], &[]).await
}
pub async fn list(&self) -> Result<TopicList> {
self.0.get(&["topics"], &[]).await
}
pub async fn delete(&self, id: &str) -> Result<DeleteTopicResponse> {
self.0.delete(&["topics", id]).await
}
}