Struct gsbrs::GSBClient [] [src]

pub struct GSBClient<'b> { /* fields omitted */ }

A client for interacting with the Google Safe Browsing Lookup API

Methods

impl<'b> GSBClient<'b>
[src]

[src]

Creates a new GSBClient that will use 'key' as the GSB API key

Arguments

  • key - A String that represents the API key for Google Safe Browsing Lookup

Example

use gsbrs::GSBClient;
let key : String = "example_api_key".into();
let gsb = GSBClient::new(key);

[src]

Sets the GSBClient client_name to 'client_name' GSBClient uses 'gsbrs' as the client_name by default.

Arguments

  • client_name - A string slice that holds the name of the org/person using the client

Example

let key : String = "example_api_key".into();
let mut gsb = gsbrs::GSBClient::new(key);

gsb.change_client_name("new_name");

[src]

Returns a mutable reference to the hyper::Client used for connections

[src]

Queries GSB API with 'url', returns Vec of Status for 'url'

Arguments

  • url - A string slice that holds the url to be queried

Example

let key : String = "example_api_key".into();
let gsb = gsbrs::GSBClient::new(key);

let url = "https://google.com/";
if let Ok(statuses) = gsb.lookup(url) {
    assert_eq!(statuses[0], Status::Ok)
};

[src]

Perform a bulk lookup on an iterable of urls. Returns a Vector of Vectors containing Statuses. Returns GSBError::TooManyUrls if > 500 urls are pased in

Arguments

  • urls - An iterable of string slices representing URLs to query

Example

let key : String = "example_api_key".into();
let gsb = GSBClient::new(key);

let urls = vec!["https://google.com/", "https://example.com"];
gsb.lookup_all(urls.iter());

Trait Implementations

Auto Trait Implementations

impl<'b> Send for GSBClient<'b>

impl<'b> Sync for GSBClient<'b>