[−][src]Crate lastfm_parse_rs
Collection of serde-based data types for Lastfm API
Source: https://www.last.fm/api
Installation
Example
use lastfm_parse_rs::from_json_str;
use lastfm_parse_rs::structs::artist::GetInfo;
let get_info = GetInfo::request(base_url, api_key, "iamthemorning", None, Some(1), None, None);
let url: Url = Into::into(get_info);
// Make an http request
let data: GetInfo = from_json_str(&raw_json_response).unwrap();
See examples/artist.rs for full listing.
Tests
To run deserialization tests:
-
Set your lastfm API key to \tests\common\mod.rs
LASTFM_API_KEY. -
Run
cargo test. Use-- --nocaptureto dump raw json and deserialized objects to stdout.
To run examples:
-
Set your lastfm API key to examples/*.rs
-
Run
cargo run --example <example name>
Re-exports
pub use lastfm_type::LastfmType; |
pub use lastfm_type::from_json_str; |
pub use lastfm_type::from_json_slice; |
pub use request::Request; |
pub use request::RequestParams; |
pub use error::Result; |
Modules
| album | Album data structures |
| artist | Artist data structures |
| auth | Auth data structures |
| chart | Chart data structures |
| error | Common error type for serde/API fails |
| geo | Geo data structures |
| lastfm_type | Tools for defining common Lastfm data structures and corresponding requests |
| library | Library data structures |
| request | Tools for constructing API requests |
| structs | Serde-based API data structures |
| tag | Tag data structures |
| track | Track data structures |
| user | User data structures |
Macros
| cv | |
| empty_lastfm_t | |
| lastfm_t | This macro is used to define top-level requestable Lastfm data structure. For given Deserialize + Debug struct specifies a wrapper (see LastfmType trait), conversions and request() function with API method agruments. Following should be included in order to use this macro: |
| opensearch_t | Generates lastfm_t wrapper over an opensearch object |
| params | |
| unwrapped_lastfm_t |