pub struct GraphQLClient { /* private fields */ }Expand description
A GraphQL client that talks to a koan server.
Implementations§
Source§impl GraphQLClient
impl GraphQLClient
pub fn new(server_url: &str) -> Self
Sourcepub fn execute(
&self,
query: &str,
variables: Option<Value>,
) -> Result<Value, GraphQLError>
pub fn execute( &self, query: &str, variables: Option<Value>, ) -> Result<Value, GraphQLError>
Execute a raw GraphQL query/mutation.
Sourcepub fn stream_url(&self, track_id: i64) -> String
pub fn stream_url(&self, track_id: i64) -> String
Get the stream URL for a track (for audio playback).
pub fn now_playing(&self) -> Result<NowPlaying, GraphQLError>
pub fn queue(&self) -> Result<Vec<QueueEntry>, GraphQLError>
pub fn search( &self, query: &str, limit: u32, ) -> Result<Vec<TrackResult>, GraphQLError>
pub fn artists(&self) -> Result<Vec<ArtistResult>, GraphQLError>
pub fn albums_for_artist( &self, artist_id: i64, ) -> Result<Vec<AlbumResult>, GraphQLError>
pub fn tracks_for_album( &self, album_id: i64, ) -> Result<Vec<TrackResult>, GraphQLError>
pub fn fuzzy_search( &self, query: &str, kind: &str, limit: u32, ) -> Result<Vec<FuzzyMatch>, GraphQLError>
pub fn pause(&self) -> Result<(), GraphQLError>
pub fn resume(&self) -> Result<(), GraphQLError>
pub fn stop(&self) -> Result<(), GraphQLError>
pub fn next(&self) -> Result<(), GraphQLError>
pub fn previous(&self) -> Result<(), GraphQLError>
pub fn seek(&self, position_ms: u64) -> Result<(), GraphQLError>
pub fn play(&self, queue_item_id: &str) -> Result<(), GraphQLError>
pub fn add_to_queue( &self, track_ids: &[i64], ) -> Result<Vec<String>, GraphQLError>
pub fn replace_queue( &self, track_ids: &[i64], ) -> Result<Vec<String>, GraphQLError>
pub fn clear_queue(&self) -> Result<(), GraphQLError>
pub fn favourite(&self, track_id: i64) -> Result<(), GraphQLError>
pub fn unfavourite(&self, track_id: i64) -> Result<(), GraphQLError>
pub fn save_snapshot(&self, name: &str) -> Result<(), GraphQLError>
pub fn restore_snapshot(&self, name: &str) -> Result<(), GraphQLError>
pub fn enable_radio(&self) -> Result<(), GraphQLError>
pub fn disable_radio(&self) -> Result<(), GraphQLError>
pub fn library_stats(&self) -> Result<Value, GraphQLError>
Sourcepub fn server_url(&self) -> &str
pub fn server_url(&self) -> &str
Server URL (without /graphql path).
Trait Implementations§
Source§impl Clone for GraphQLClient
impl Clone for GraphQLClient
Source§fn clone(&self) -> GraphQLClient
fn clone(&self) -> GraphQLClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GraphQLClient
impl !RefUnwindSafe for GraphQLClient
impl Send for GraphQLClient
impl Sync for GraphQLClient
impl Unpin for GraphQLClient
impl UnsafeUnpin for GraphQLClient
impl !UnwindSafe for GraphQLClient
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 more