pub struct SubsonicClient { /* private fields */ }Expand description
Subsonic/Navidrome API client.
Implementations§
Source§impl SubsonicClient
impl SubsonicClient
pub fn new(base_url: &str, username: &str, password: &str) -> Self
Sourcepub fn ping(&self) -> Result<(), SubsonicError>
pub fn ping(&self) -> Result<(), SubsonicError>
Ping the server — verify connection and credentials.
Sourcepub fn get_artists(&self) -> Result<Vec<SubsonicArtist>, SubsonicError>
pub fn get_artists(&self) -> Result<Vec<SubsonicArtist>, SubsonicError>
Get all artists (indexed).
Sourcepub fn get_album(&self, id: &str) -> Result<SubsonicAlbumFull, SubsonicError>
pub fn get_album(&self, id: &str) -> Result<SubsonicAlbumFull, SubsonicError>
Get an album by ID, including its tracks.
Sourcepub fn get_album_list(
&self,
list_type: &str,
size: u32,
offset: u32,
) -> Result<Vec<SubsonicAlbum>, SubsonicError>
pub fn get_album_list( &self, list_type: &str, size: u32, offset: u32, ) -> Result<Vec<SubsonicAlbum>, SubsonicError>
Get a paginated list of albums.
Sourcepub fn stream_url(&self, track_id: &str) -> String
pub fn stream_url(&self, track_id: &str) -> String
Build the streaming URL for a track (doesn’t make a request).
Sourcepub fn stream_url_template(&self, track_id: &str) -> String
pub fn stream_url_template(&self, track_id: &str) -> String
Stream URL without auth params — safe for database storage.
Sourcepub fn download(&self, track_id: &str, dest: &Path) -> Result<(), SubsonicError>
pub fn download(&self, track_id: &str, dest: &Path) -> Result<(), SubsonicError>
Download a track to a local path.
Sourcepub fn download_with_progress(
&self,
track_id: &str,
dest: &Path,
on_progress: impl Fn(u64, u64),
) -> Result<(), SubsonicError>
pub fn download_with_progress( &self, track_id: &str, dest: &Path, on_progress: impl Fn(u64, u64), ) -> Result<(), SubsonicError>
Download a track with progress reporting. The callback receives (bytes_downloaded, total_bytes). Total may be 0 if the server doesn’t send Content-Length.
Sourcepub fn search(&self, query: &str) -> Result<SubsonicSearchResult, SubsonicError>
pub fn search(&self, query: &str) -> Result<SubsonicSearchResult, SubsonicError>
Search for tracks/albums/artists.
Sourcepub fn star(&self, track_id: &str) -> Result<(), SubsonicError>
pub fn star(&self, track_id: &str) -> Result<(), SubsonicError>
Star (favourite) a track on the server.
Sourcepub fn unstar(&self, track_id: &str) -> Result<(), SubsonicError>
pub fn unstar(&self, track_id: &str) -> Result<(), SubsonicError>
Unstar (unfavourite) a track on the server.
Sourcepub fn get_starred(&self) -> Result<Vec<SubsonicSong>, SubsonicError>
pub fn get_starred(&self) -> Result<Vec<SubsonicSong>, SubsonicError>
Get all starred (favourite) songs from the server.
Create a sharing link for one or more resources (songs, albums, etc). Returns the created share including its ID which forms the public URL.
Sourcepub fn get_similar_songs(
&self,
song_id: &str,
count: usize,
) -> Result<Vec<SubsonicSong>, SubsonicError>
pub fn get_similar_songs( &self, song_id: &str, count: usize, ) -> Result<Vec<SubsonicSong>, SubsonicError>
Get similar songs for a track (Subsonic getSimilarSongs2 endpoint).
Returns up to count similar songs based on the server’s algorithm.
Sourcepub fn get_top_songs(
&self,
artist_name: &str,
count: usize,
) -> Result<Vec<SubsonicSong>, SubsonicError>
pub fn get_top_songs( &self, artist_name: &str, count: usize, ) -> Result<Vec<SubsonicSong>, SubsonicError>
Get top songs for an artist by name.
Auto Trait Implementations§
impl !RefUnwindSafe for SubsonicClient
impl !UnwindSafe for SubsonicClient
impl Freeze for SubsonicClient
impl Send for SubsonicClient
impl Sync for SubsonicClient
impl Unpin for SubsonicClient
impl UnsafeUnpin for SubsonicClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);