From c76d0d9d89aef0238dd4c35843b4c6218ae2f971 Mon Sep 17 00:00:00 2001 From: Koen Bolhuis Date: Wed, 20 Jan 2021 01:11:47 +0100 Subject: [PATCH] Add example to crate root --- src/lib.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 379d950..d31b071 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,6 +8,20 @@ //! map one-to-one to the HTTP API's JSON input- and response data. Using the `ListenBrainz` //! type is therefore recommended. //! +//! # Example +//! +//! ```no_run +//! # use listenbrainz::ListenBrainz; +//! # +//! let mut client = ListenBrainz::new(); +//! +//! client.authenticate("LISTENBRAINZ TOKEN") +//! .expect("Could not authenticate with ListenBrainz"); +//! +//! client.playing_now("The Beatles", "Here Comes the Sun", "Abbey Road") +//! .expect("Could not submit 'playing now' request"); +//! ``` +//! //! [ListenBrainz HTTP API]: https://listenbrainz.readthedocs.io/en/production/dev/api/ mod error;