pub struct MonsterClient { /* private fields */ }Expand description
The monster service’s client: monsters, spells and conditions.
Implementations§
Source§impl MonsterClient
impl MonsterClient
Sourcepub fn new(base_url: impl Into<String>) -> Self
pub fn new(base_url: impl Into<String>) -> Self
A client for the monster service at base_url, without a token.
Sourcepub fn with_token(self, token: &str) -> Self
pub fn with_token(self, token: &str) -> Self
Sends token (from crate::auth::AuthClient::login) with every
request.
Sourcepub async fn list(
&self,
search: Option<&str>,
) -> Result<Vec<MonsterSummary>, ClientError>
pub async fn list( &self, search: Option<&str>, ) -> Result<Vec<MonsterSummary>, ClientError>
The shared monsters of the campaign’s edition and its own, by name;
only those whose name contains search, if given.
Sourcepub async fn create(&self, sheet: &MonsterSheet) -> Result<Monster, ClientError>
pub async fn create(&self, sheet: &MonsterSheet) -> Result<Monster, ClientError>
Adds a monster to the campaign’s own.
Sourcepub async fn replace(
&self,
id: Uuid,
sheet: &MonsterSheet,
) -> Result<Monster, ClientError>
pub async fn replace( &self, id: Uuid, sheet: &MonsterSheet, ) -> Result<Monster, ClientError>
Replaces one of the campaign’s own monsters (ClientError::Forbidden
for a shared one).
Sourcepub async fn delete(&self, id: Uuid) -> Result<(), ClientError>
pub async fn delete(&self, id: Uuid) -> Result<(), ClientError>
Deletes one of the campaign’s own monsters.
Sourcepub async fn texts<T: RulesText>(
&self,
search: Option<&str>,
) -> Result<Vec<Entry<T>>, ClientError>
pub async fn texts<T: RulesText>( &self, search: Option<&str>, ) -> Result<Vec<Entry<T>>, ClientError>
The shared spells (T = edda_types::rules_text::SpellText)
or conditions of the campaign’s edition and its own, whole, by name;
only those whose name contains search, if given.
Sourcepub async fn text<T: RulesText>(
&self,
id: Uuid,
) -> Result<Entry<T>, ClientError>
pub async fn text<T: RulesText>( &self, id: Uuid, ) -> Result<Entry<T>, ClientError>
One spell or condition.
Sourcepub async fn create_text<T: RulesText>(
&self,
text: &T,
) -> Result<Entry<T>, ClientError>
pub async fn create_text<T: RulesText>( &self, text: &T, ) -> Result<Entry<T>, ClientError>
Adds one to the campaign’s own.
Sourcepub async fn replace_text<T: RulesText>(
&self,
id: Uuid,
text: &T,
) -> Result<Entry<T>, ClientError>
pub async fn replace_text<T: RulesText>( &self, id: Uuid, text: &T, ) -> Result<Entry<T>, ClientError>
Replaces one of the campaign’s own (ClientError::Forbidden for a
shared one).
Sourcepub async fn delete_text<T: RulesText>(
&self,
id: Uuid,
) -> Result<(), ClientError>
pub async fn delete_text<T: RulesText>( &self, id: Uuid, ) -> Result<(), ClientError>
Deletes one of the campaign’s own spells or conditions.
Trait Implementations§
Source§impl Clone for MonsterClient
impl Clone for MonsterClient
Source§fn clone(&self) -> MonsterClient
fn clone(&self) -> MonsterClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more