pub struct Client { /* private fields */ }
Implementations§
source§impl Client
impl Client
sourcepub async fn new(credentials: Credentials) -> Result<Self>
pub async fn new(credentials: Credentials) -> Result<Self>
sourcepub async fn load(&self, credentials: Credentials) -> Result<()>
pub async fn load(&self, credentials: Credentials) -> Result<()>
Here you can create a client yourself and load them here later (for example .env parsing)
§Errors
This function will return an error if the credentials are invalid
§Example
use coc_rs::{api::Client, credentials::Credentials};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let client = Client::new(None);
let credentials = Credentials::builder()
.add_credential("email", "password")
.add_credential("email2", "password2")
.build();
client.load(credentials).await?;
Ok(())
}
sourcepub async fn get_clan_warlog(
&self,
clan_tag: &str
) -> Result<APIResponse<WarLog>, APIError>
pub async fn get_clan_warlog( &self, clan_tag: &str ) -> Result<APIResponse<WarLog>, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_clans(
&self,
options: ClanSearchOptions
) -> Result<APIResponse<Clan>, APIError>
pub async fn get_clans( &self, options: ClanSearchOptions ) -> Result<APIResponse<Clan>, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_current_war(&self, clan_tag: &str) -> Result<War, APIError>
pub async fn get_current_war(&self, clan_tag: &str) -> Result<War, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_clan(&self, clan_tag: &str) -> Result<Clan, APIError>
pub async fn get_clan(&self, clan_tag: &str) -> Result<Clan, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_clan_members(
&self,
clan_tag: &str
) -> Result<APIResponse<ClanMember>, APIError>
pub async fn get_clan_members( &self, clan_tag: &str ) -> Result<APIResponse<ClanMember>, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_clan_capital_raid_seasons(
&self,
clan_tag: &str
) -> Result<APIResponse<ClanCapitalRaidSeason>, APIError>
pub async fn get_clan_capital_raid_seasons( &self, clan_tag: &str ) -> Result<APIResponse<ClanCapitalRaidSeason>, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_player(&self, player_tag: &str) -> Result<Player, APIError>
pub async fn get_player(&self, player_tag: &str) -> Result<Player, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn verify_player_token(
&self,
player_tag: &str,
token: &str
) -> Result<PlayerToken, APIError>
pub async fn verify_player_token( &self, player_tag: &str, token: &str ) -> Result<PlayerToken, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_leagues(&self) -> Result<APIResponse<League>, APIError>
pub async fn get_leagues(&self) -> Result<APIResponse<League>, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_league_season_rankings(
&self,
league_id: LeagueKind,
season_id: Season,
paging: Paging
) -> Result<APIResponse<PlayerRanking>, APIError>
pub async fn get_league_season_rankings( &self, league_id: LeagueKind, season_id: Season, paging: Paging ) -> Result<APIResponse<PlayerRanking>, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_league(
&self,
league_id: LeagueKind
) -> Result<League, APIError>
pub async fn get_league( &self, league_id: LeagueKind ) -> Result<League, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_league_seasons(
&self,
league_id: LeagueKind
) -> Result<APIResponse<Season>, APIError>
pub async fn get_league_seasons( &self, league_id: LeagueKind ) -> Result<APIResponse<Season>, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_war_league(
&self,
war_league: WarLeagueKind
) -> Result<WarLeague, APIError>
pub async fn get_war_league( &self, war_league: WarLeagueKind ) -> Result<WarLeague, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_war_leagues(&self) -> Result<APIResponse<WarLeague>, APIError>
pub async fn get_war_leagues(&self) -> Result<APIResponse<WarLeague>, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_clan_rankings(
&self,
location: Local
) -> Result<APIResponse<ClanRanking>, APIError>
pub async fn get_clan_rankings( &self, location: Local ) -> Result<APIResponse<ClanRanking>, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_player_rankings(
&self,
location: Local
) -> Result<APIResponse<PlayerRanking>, APIError>
pub async fn get_player_rankings( &self, location: Local ) -> Result<APIResponse<PlayerRanking>, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_versus_clan_rankings(
&self,
location: Local
) -> Result<APIResponse<ClanRanking>, APIError>
pub async fn get_versus_clan_rankings( &self, location: Local ) -> Result<APIResponse<ClanRanking>, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_versus_player_rankings(
&self,
location: Local
) -> Result<APIResponse<PlayerVersusRanking>, APIError>
pub async fn get_versus_player_rankings( &self, location: Local ) -> Result<APIResponse<PlayerVersusRanking>, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_locations(&self) -> Result<APIResponse<Location>, APIError>
pub async fn get_locations(&self) -> Result<APIResponse<Location>, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_location(&self, location: Local) -> Result<Location, APIError>
pub async fn get_location(&self, location: Local) -> Result<Location, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_goldpass(&self) -> Result<GoldPass, APIError>
pub async fn get_goldpass(&self) -> Result<GoldPass, APIError>
§Errors
This function will return an error if the request fails
sourcepub async fn get_player_labels(
&self
) -> Result<APIResponse<PlayerLabel>, APIError>
pub async fn get_player_labels( &self ) -> Result<APIResponse<PlayerLabel>, APIError>
§Errors
This function will return an error if the request fails.
sourcepub async fn get_clan_labels(&self) -> Result<APIResponse<ClanLabel>, APIError>
pub async fn get_clan_labels(&self) -> Result<APIResponse<ClanLabel>, APIError>
§Errors
This function will return an error if the request fails.