pub struct AdminClient { /* private fields */ }Expand description
One service’s admin API: at its ADMIN_ADDR, with its ADMIN_TOKEN.
Implementations§
Source§impl AdminClient
impl AdminClient
Sourcepub fn new(base_url: impl Into<String>, token: &str) -> Self
pub fn new(base_url: impl Into<String>, token: &str) -> Self
The admin API at base_url, authorised by token.
Sourcepub async fn create_campaign(
&self,
name: &str,
edition: Edition,
) -> Result<CreatedCampaign, ClientError>
pub async fn create_campaign( &self, name: &str, edition: Edition, ) -> Result<CreatedCampaign, ClientError>
The auth service’s: creates a campaign, with the one-time code its DM sets up their first device with.
Sourcepub async fn setup_code(&self, campaign: Uuid) -> Result<String, ClientError>
pub async fn setup_code(&self, campaign: Uuid) -> Result<String, ClientError>
The auth service’s: a new setup code for a DM device, as when every DM device is lost.
Sourcepub async fn get_settings(
&self,
campaign: Uuid,
) -> Result<CampaignSettings, ClientError>
pub async fn get_settings( &self, campaign: Uuid, ) -> Result<CampaignSettings, ClientError>
The auth service’s: what the campaign may keep and do.
Sourcepub async fn settings(
&self,
campaign: Uuid,
settings: &CampaignSettings,
) -> Result<CampaignSettings, ClientError>
pub async fn settings( &self, campaign: Uuid, settings: &CampaignSettings, ) -> Result<CampaignSettings, ClientError>
The auth service’s: sets what the campaign may keep and do (say, read-only until a bill is paid, or a plan’s limits). Its devices’ tokens carry it from their next login, within 15 minutes.
Sourcepub async fn delete_campaign(&self, campaign: Uuid) -> Result<u64, ClientError>
pub async fn delete_campaign(&self, campaign: Uuid) -> Result<u64, ClientError>
Any service’s: deletes its part of a campaign, and says how many of its things went. Safe to repeat.
Sourcepub async fn export<T: DeserializeOwned>(
&self,
campaign: Uuid,
) -> Result<T, ClientError>
pub async fn export<T: DeserializeOwned>( &self, campaign: Uuid, ) -> Result<T, ClientError>
Any service’s: its part of a campaign, T being that service’s
export (AuthExport, CharactersExport and so on).
Sourcepub async fn import<T: Serialize>(
&self,
campaign: Uuid,
part: &T,
) -> Result<u64, ClientError>
pub async fn import<T: Serialize>( &self, campaign: Uuid, part: &T, ) -> Result<u64, ClientError>
Any service’s: takes in its part of a campaign exported elsewhere,
and says how many of its things came. ClientError::Conflict if
the campaign has some there already.
Trait Implementations§
Source§impl Clone for AdminClient
impl Clone for AdminClient
Source§fn clone(&self) -> AdminClient
fn clone(&self) -> AdminClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more