1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright © 2016-2017 Daniele Tricoli <eriol@mornie.org>.
// All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//! # opensource #
//!
//! `opensource` is an API Wrapper that allows you to query the Open Source
//! License API with Rust.
//!
//! ## Example ##
//!
//! ```no_run
//! extern crate opensource;
//!
//! use opensource::client;
//!
//! fn main() {
//!     let license = client::get("BSD-3").unwrap();
//!     println!("{}", license.name);
//! }
//! ```
//!
//! A better way is to use match:
//!
//! ```no_run
//! extern crate opensource;
//!
//! use opensource::client;
//!
//! fn main() {
//!     let license = client::get("this-license-does-not-exist");
//!     match license {
//!         Ok(license) => println!("{}", license.name),
//!         Err(err) => println!("{}", err),
//!     }
//! }
//! ```

#[macro_use]
extern crate serde_derive;

extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate url;

pub mod client;
pub mod license;