pub struct ApiClient { /* private fields */ }Expand description
API client for Scouting.org. Clone is cheap - both reqwest::Client and token use Arc internally.
Implementations§
Source§impl ApiClient
impl ApiClient
Sourcepub fn set_token(&mut self, token: impl Into<Arc<String>>)
pub fn set_token(&mut self, token: impl Into<Arc<String>>)
Set the bearer token for authenticated requests.
Accepts any type that can be converted to Arc
Sourcepub fn with_token(&self, token: Arc<String>) -> Self
pub fn with_token(&self, token: Arc<String>) -> Self
Create a new ApiClient with the given token, sharing the connection pool. This is very efficient - both the client and token are Arc-wrapped, so cloning is just incrementing reference counts.
Sourcepub async fn authenticate(
&self,
username: &str,
password: &str,
) -> Result<SessionData>
pub async fn authenticate( &self, username: &str, password: &str, ) -> Result<SessionData>
Authenticate with the API and return session data
Sourcepub async fn fetch_youth(&self, org_guid: &str) -> Result<Vec<Youth>>
pub async fn fetch_youth(&self, org_guid: &str) -> Result<Vec<Youth>>
Fetch all youth members for the organization
Sourcepub async fn fetch_adults(&self, org_guid: &str) -> Result<Vec<Adult>>
pub async fn fetch_adults(&self, org_guid: &str) -> Result<Vec<Adult>>
Fetch all adult leaders for the organization
Sourcepub async fn fetch_parents(&self, org_guid: &str) -> Result<Vec<Parent>>
pub async fn fetch_parents(&self, org_guid: &str) -> Result<Vec<Parent>>
Fetch all parents of youth members in the organization
Sourcepub async fn fetch_patrols(&self, org_guid: &str) -> Result<Vec<Patrol>>
pub async fn fetch_patrols(&self, org_guid: &str) -> Result<Vec<Patrol>>
Fetch all patrols (sub-units) in the organization
Sourcepub async fn fetch_advancement_dashboard(
&self,
org_guid: &str,
) -> Result<AdvancementDashboard>
pub async fn fetch_advancement_dashboard( &self, org_guid: &str, ) -> Result<AdvancementDashboard>
Fetch advancement dashboard summary for the organization
Sourcepub async fn fetch_ready_to_award(
&self,
org_guid: &str,
) -> Result<Vec<ReadyToAward>>
pub async fn fetch_ready_to_award( &self, org_guid: &str, ) -> Result<Vec<ReadyToAward>>
Fetch list of advancements ready to be awarded
Sourcepub async fn fetch_youth_ranks(&self, user_id: i64) -> Result<Vec<RankProgress>>
pub async fn fetch_youth_ranks(&self, user_id: i64) -> Result<Vec<RankProgress>>
Fetch rank progress for a specific youth member
Sourcepub async fn fetch_youth_merit_badges(
&self,
user_id: i64,
) -> Result<Vec<MeritBadgeProgress>>
pub async fn fetch_youth_merit_badges( &self, user_id: i64, ) -> Result<Vec<MeritBadgeProgress>>
Fetch merit badge progress for a specific youth member
Sourcepub async fn fetch_youth_leadership(
&self,
user_id: i64,
) -> Result<Vec<LeadershipPosition>>
pub async fn fetch_youth_leadership( &self, user_id: i64, ) -> Result<Vec<LeadershipPosition>>
Fetch leadership position history for a specific youth member
Sourcepub async fn fetch_youth_awards(&self, user_id: i64) -> Result<Vec<Award>>
pub async fn fetch_youth_awards(&self, user_id: i64) -> Result<Vec<Award>>
Fetch awards for a specific youth member
Sourcepub async fn fetch_rank_requirements(
&self,
user_id: i64,
rank_id: i64,
) -> Result<Vec<RankRequirement>>
pub async fn fetch_rank_requirements( &self, user_id: i64, rank_id: i64, ) -> Result<Vec<RankRequirement>>
Fetch requirements for a specific rank for a youth member
Sourcepub async fn fetch_badge_requirements_only(
&self,
user_id: i64,
badge_id: i64,
) -> Result<(Vec<MeritBadgeRequirement>, Option<String>)>
pub async fn fetch_badge_requirements_only( &self, user_id: i64, badge_id: i64, ) -> Result<(Vec<MeritBadgeRequirement>, Option<String>)>
Fetch badge requirements only (no counselor info). Single API call. Use this for bulk/offline caching where counselor data isn’t needed.
Sourcepub async fn fetch_badge_requirements(
&self,
user_id: i64,
badge_id: i64,
) -> Result<(Vec<MeritBadgeRequirement>, Option<String>, Option<CounselorInfo>)>
pub async fn fetch_badge_requirements( &self, user_id: i64, badge_id: i64, ) -> Result<(Vec<MeritBadgeRequirement>, Option<String>, Option<CounselorInfo>)>
Fetch badge requirements, returns (requirements, version, counselor)
Sourcepub async fn fetch_merit_badge_catalog(
&self,
) -> Result<Vec<MeritBadgeCatalogEntry>>
pub async fn fetch_merit_badge_catalog( &self, ) -> Result<Vec<MeritBadgeCatalogEntry>>
Fetch all merit badges from the catalog (not youth-specific)
Sourcepub async fn fetch_events(&self, user_id: i64) -> Result<Vec<Event>>
pub async fn fetch_events(&self, user_id: i64) -> Result<Vec<Event>>
Fetch events for a date range around the current date
Sourcepub async fn fetch_event_detail(&self, event_id: i64) -> Result<Event>
pub async fn fetch_event_detail(&self, event_id: i64) -> Result<Event>
Fetch detailed event info including full invited_users with RSVP data
Sourcepub async fn fetch_event_guests(&self, event_id: i64) -> Result<Vec<EventGuest>>
pub async fn fetch_event_guests(&self, event_id: i64) -> Result<Vec<EventGuest>>
Fetch guest list for a specific event
Sourcepub async fn fetch_key3(&self, org_guid: &str) -> Result<Key3Leaders>
pub async fn fetch_key3(&self, org_guid: &str) -> Result<Key3Leaders>
Fetch Key 3 leaders for the organization
Sourcepub async fn fetch_unit_pin(&self, org_guid: &str) -> Result<UnitInfo>
pub async fn fetch_unit_pin(&self, org_guid: &str) -> Result<UnitInfo>
Fetch unit registration PIN info (includes website and charter info)
Sourcepub async fn fetch_org_profile(&self, org_guid: &str) -> Result<OrgProfile>
pub async fn fetch_org_profile(&self, org_guid: &str) -> Result<OrgProfile>
Fetch organization profile
Sourcepub async fn fetch_commissioners(
&self,
org_guid: &str,
) -> Result<Vec<Commissioner>>
pub async fn fetch_commissioners( &self, org_guid: &str, ) -> Result<Vec<Commissioner>>
Fetch assigned commissioners for a unit