[][src]Struct pi_hole_api::PiHoleAPI

pub struct PiHoleAPI { /* fields omitted */ }

Pi Hole API Struct

Implementations

impl PiHoleAPI[src]

pub fn new(host: String, api_key: Option<String>) -> Self[src]

Creates a new Pi Hole API instance. host must begin with the protocol e.g. http:// or https://

pub fn set_api_key(&mut self, api_key: &String)[src]

pub async fn get_summary_raw<'_>(&'_ self) -> Result<SummaryRaw, Box<dyn Error>>[src]

Get statistics in a raw format (no number format)

pub async fn get_summary<'_>(&'_ self) -> Result<Summary, Box<dyn Error>>[src]

Get statistics in a formatted style

pub async fn get_over_time_data_10_mins<'_>(
    &'_ self
) -> Result<OverTimeData, Box<dyn Error>>
[src]

Get statistics on the number of domains and ads for each 10 minute period

pub async fn get_top_items<'_>(
    &'_ self,
    count: Option<u32>
) -> Result<TopItems, Box<dyn Error>>
[src]

Get the top domains and ads and the number of queries for each. Limit the number of items with count. API key required.

pub async fn get_top_clients<'_>(
    &'_ self,
    count: Option<u32>
) -> Result<TopClients, Box<dyn Error>>
[src]

Get the top clients and the number of queries for each. Limit the number of items with count. API key required.

pub async fn get_top_clients_blocked<'_>(
    &'_ self,
    count: Option<u32>
) -> Result<TopClientsBlocked, Box<dyn Error>>
[src]

Get the top clients blocked and the number of queries for each. Limit the number of items with count. API key required.

pub async fn get_forward_destinations<'_>(
    &'_ self
) -> Result<ForwardDestinations, Box<dyn Error>>
[src]

Get the number of queries forwarded and the target. API key required.

pub async fn get_query_types<'_>(&'_ self) -> Result<QueryTypes, Box<dyn Error>>[src]

Get the number of queries per type. API key required.

pub async fn get_all_queries<'_>(
    &'_ self,
    count: u32
) -> Result<AllQueries, Box<dyn Error>>
[src]

Get all DNS query data. Limit the number of items with count. API key required.

pub async fn enable<'_>(&'_ self) -> Result<Status, Box<dyn Error>>[src]

Enable the Pi-Hole. API key required.

pub async fn disable<'_>(
    &'_ self,
    seconds: u64
) -> Result<Status, Box<dyn Error>>
[src]

Disable the Pi-Hole for seconds seconds. API key required.

pub async fn get_version<'_>(&'_ self) -> Result<Version, Box<dyn Error>>[src]

Get the Pi-Hole version.

pub async fn get_cache_info<'_>(&'_ self) -> Result<CacheInfo, Box<dyn Error>>[src]

Get statistics about the DNS cache. API key required.

pub async fn get_client_names<'_>(
    &'_ self
) -> Result<Vec<ClientName>, Box<dyn Error>>
[src]

Get hostname and IP for hosts API key required.

pub async fn get_over_time_data_clients<'_>(
    &'_ self
) -> Result<HashMap<u64, Vec<u64>>, Box<dyn Error>>
[src]

Get queries by client over time. Maps timestamp to the number of queries by clients. Order of clients in the Vector is the same as for get_client_names API key required.

pub async fn get_network<'_>(&'_ self) -> Result<Network, Box<dyn Error>>[src]

Get information about network clients. API key required.

pub async fn get_queries_count<'_>(&'_ self) -> Result<u64, Box<dyn Error>>[src]

Get the total number of queries received. API key required.

pub async fn add<'_>(
    &'_ self,
    domains: Vec<String>,
    list: String
) -> Result<(), Box<dyn Error>>
[src]

Add domains to a list. Acceptable lists are: white, black, white_regex, black_regex, white_wild, black_wild, audit. API key required.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.