pub struct Client { /* private fields */ }Expand description
The client for interfacing with SponsorBlock.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn fetch_api_status(&self) -> Result<ApiStatus>
pub async fn fetch_api_status(&self) -> Result<ApiStatus>
Fetches the API status.
§Errors
Can return pretty much any error type from SponsorBlockError. See
the error type definitions for explanations of when they might be
encountered.
Source§impl Client
impl Client
Sourcepub async fn fetch_segments(
&self,
video_id: &VideoIdSlice,
accepted_categories: AcceptedCategories,
) -> Result<Vec<Segment>>
pub async fn fetch_segments( &self, video_id: &VideoIdSlice, accepted_categories: AcceptedCategories, ) -> Result<Vec<Segment>>
Fetches the segments for a given video ID.
This function does not return additional segment info.
§Errors
Can return pretty much any error type from SponsorBlockError. See
the error type definitions for explanations of when they might be
encountered.
The only error types among them you may want to handle differently are
HttpClient(404) and NoMatchingVideoHash, as they indicate that
no videos could be found in the database matching what was provided.
Sourcepub async fn fetch_segments_with_required<S: AsRef<SegmentUuidSlice>>(
&self,
video_id: &VideoIdSlice,
accepted_categories: AcceptedCategories,
required_segments: &[S],
) -> Result<Vec<Segment>>
pub async fn fetch_segments_with_required<S: AsRef<SegmentUuidSlice>>( &self, video_id: &VideoIdSlice, accepted_categories: AcceptedCategories, required_segments: &[S], ) -> Result<Vec<Segment>>
Fetches the segments for a given video ID.
This variant allows you to specify segment UUIDs to require to be
retrieved, even if they don’t meet the minimum vote threshold. If this
isn’t something you need, use the regular fetch_segments instead.
This function does not return additional segment info.
§Errors
See the Errors section of the base version of this function.
Sourcepub async fn fetch_segment_info<S: AsRef<SegmentUuidSlice>>(
&self,
segment_uuid: S,
) -> Result<Segment>
pub async fn fetch_segment_info<S: AsRef<SegmentUuidSlice>>( &self, segment_uuid: S, ) -> Result<Segment>
Fetches complete info for a segment.
This function does return additional segment info.
§Errors
Can return pretty much any error type from SponsorBlockError. See
the error type definitions for explanations of when they might be
encountered.
Sourcepub async fn fetch_segment_info_multiple<S: AsRef<SegmentUuidSlice>>(
&self,
segment_uuids: &[S],
) -> Result<Vec<Segment>>
pub async fn fetch_segment_info_multiple<S: AsRef<SegmentUuidSlice>>( &self, segment_uuids: &[S], ) -> Result<Vec<Segment>>
Fetches complete info for segments.
This function does return additional segment info.
§Errors
Can return pretty much any error type from SponsorBlockError. See
the error type definitions for explanations of when they might be
encountered.
Source§impl Client
impl Client
Sourcepub async fn fetch_user_info_public(
&self,
public_user_id: &PublicUserIdSlice,
) -> Result<UserInfo>
pub async fn fetch_user_info_public( &self, public_user_id: &PublicUserIdSlice, ) -> Result<UserInfo>
Fetches a user’s info using a public user ID.
§Errors
Can return pretty much any error type from SponsorBlockError. See
the error type definitions for explanations of when they might be
encountered.
Sourcepub async fn fetch_user_info_local(
&self,
local_user_id: &LocalUserIdSlice,
) -> Result<UserInfo>
pub async fn fetch_user_info_local( &self, local_user_id: &LocalUserIdSlice, ) -> Result<UserInfo>
Fetches a user’s info using a local (private) user ID.
§Errors
Can return pretty much any error type from SponsorBlockError. See
the error type definitions for explanations of when they might be
encountered.
Source§impl Client
impl Client
Sourcepub async fn fetch_user_stats_public(
&self,
public_user_id: &PublicUserIdSlice,
) -> Result<UserStats>
pub async fn fetch_user_stats_public( &self, public_user_id: &PublicUserIdSlice, ) -> Result<UserStats>
Fetches a user’s info using a public user ID.
§Errors
Can return pretty much any error type from SponsorBlockError. See
the error type definitions for explanations of when they might be
encountered.
Sourcepub async fn fetch_user_stats_local(
&self,
local_user_id: &LocalUserIdSlice,
) -> Result<UserStats>
pub async fn fetch_user_stats_local( &self, local_user_id: &LocalUserIdSlice, ) -> Result<UserStats>
Fetches a user’s info using a local (private) user ID.
§Errors
Can return pretty much any error type from SponsorBlockError. See
the error type definitions for explanations of when they might be
encountered.
Source§impl Client
impl Client
Sourcepub fn new<U: Into<LocalUserId>>(user_id: U) -> Self
pub fn new<U: Into<LocalUserId>>(user_id: U) -> Self
Creates a new instance of the client with default configuration values.
Sourcepub fn builder<U: Into<LocalUserId>>(user_id: U) -> ClientBuilder
pub fn builder<U: Into<LocalUserId>>(user_id: U) -> ClientBuilder
Creates a new instance of the ClientBuilder.