Struct passivetotal::client::PTClient
[−]
[src]
pub struct PTClient { pub client: Client, pub auth: Basic, }
This is the client exposed to the user for abstracting the passivetotal API.
Fields
client | the hyper::Client |
auth | stores the http basic auth credentials |
Methods
impl PTClient
The PTClient
is the main interface into making calls to the PassiveTotal API.
You instanciate a PTClient
with the new
method which takes a config::Config
as its
argument.
All the GET functions are defined by the macro define_get_decoder!
Examples
use passivetotal::config::read_config; use passivetotal::client::PTClient; let conf = match read_config() { Ok(conf) => conf, _ => panic!("Please create your config at ~/.config/api_config.json"), } let client = PTClient::new(conf); let response = match client.get_pdns("passivetotal.org") { Ok(response) => response, _ => panic!("Something bad happened in the JSON response"), };
See main.rs for full usage examples. See the response module documentation for details on the sorts of responses returned. See the API documentation for more resources.
fn new(conf: Config) -> PTClient
Creates a PTClient from a JSON Config from ~/.config/passivetotal/api_config.json