Skip to main content

ApiClient

Struct ApiClient 

Source
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

Source

pub fn new() -> Result<Self>

Create a new API client

Source

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 for efficient sharing.

Source

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.

Source

pub async fn authenticate( &self, username: &str, password: &str, ) -> Result<SessionData>

Authenticate with the API and return session data

Source

pub async fn fetch_youth(&self, org_guid: &str) -> Result<Vec<Youth>>

Fetch all youth members for the organization

Source

pub async fn fetch_adults(&self, org_guid: &str) -> Result<Vec<Adult>>

Fetch all adult leaders for the organization

Source

pub async fn fetch_parents(&self, org_guid: &str) -> Result<Vec<Parent>>

Fetch all parents of youth members in the organization

Source

pub async fn fetch_patrols(&self, org_guid: &str) -> Result<Vec<Patrol>>

Fetch all patrols (sub-units) in the organization

Source

pub async fn fetch_advancement_dashboard( &self, org_guid: &str, ) -> Result<AdvancementDashboard>

Fetch advancement dashboard summary for the organization

Source

pub async fn fetch_ready_to_award( &self, org_guid: &str, ) -> Result<Vec<ReadyToAward>>

Fetch list of advancements ready to be awarded

Source

pub async fn fetch_youth_ranks(&self, user_id: i64) -> Result<Vec<RankProgress>>

Fetch rank progress for a specific youth member

Source

pub async fn fetch_youth_merit_badges( &self, user_id: i64, ) -> Result<Vec<MeritBadgeProgress>>

Fetch merit badge progress for a specific youth member

Source

pub async fn fetch_youth_leadership( &self, user_id: i64, ) -> Result<Vec<LeadershipPosition>>

Fetch leadership position history for a specific youth member

Source

pub async fn fetch_youth_awards(&self, user_id: i64) -> Result<Vec<Award>>

Fetch awards for a specific youth member

Source

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

Source

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.

Source

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)

Source

pub async fn fetch_merit_badge_catalog( &self, ) -> Result<Vec<MeritBadgeCatalogEntry>>

Fetch all merit badges from the catalog (not youth-specific)

Source

pub async fn fetch_events(&self, user_id: i64) -> Result<Vec<Event>>

Fetch events for a date range around the current date

Source

pub async fn fetch_event_detail(&self, event_id: i64) -> Result<Event>

Fetch detailed event info including full invited_users with RSVP data

Source

pub async fn fetch_event_guests(&self, event_id: i64) -> Result<Vec<EventGuest>>

Fetch guest list for a specific event

Source

pub async fn fetch_key3(&self, org_guid: &str) -> Result<Key3Leaders>

Fetch Key 3 leaders for the organization

Source

pub async fn fetch_unit_pin(&self, org_guid: &str) -> Result<UnitInfo>

Fetch unit registration PIN info (includes website and charter info)

Source

pub async fn fetch_org_profile(&self, org_guid: &str) -> Result<OrgProfile>

Fetch organization profile

Source

pub async fn fetch_commissioners( &self, org_guid: &str, ) -> Result<Vec<Commissioner>>

Fetch assigned commissioners for a unit

Trait Implementations§

Source§

impl Clone for ApiClient

Source§

fn clone(&self) -> ApiClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more