swapi_client

Crates.ioswapi_client
lib.rsswapi_client
version0.1.0
sourcesrc
created_at2021-10-20 05:38:42.889424
updated_at2021-10-26 04:41:19.734098
descriptionRust client for Star Wars API (https://swapi.co/)
homepage
repository
max_upload_size
id467730
size11,561
(weiztech)

documentation

README

Rust Swapi Client

Crate Github

Rust client for Star Wars API (https://swapi.co/)

Usage

Add this to your Cargo.toml:

[dependencies]
swapi_client = "0.1.0"

Example Usage:

use swapi_client::RequestHandler;
use swapi_client::{Film, People, Planet, Species, Starship, Vehicle};

// Get Planet object
Planet::get(10);

// Get Planets
let planet_list = Planet::list(Some(2)).unwrap();

// Check list data has prev or next pagination
planet_list.has_next();
planet_list.has_prev();

// Query to next or prev pagination, return Option<Box<ListData>>
planet_list.next();
planet_list.prev();

// Iterate from list data
for planet in planet_list.into_iter() {
  println!("Planet: {}", planet.name);
}
Commit count: 0

cargo fmt