Added fetch data endpoint
This commit is contained in:
parent
72e6533857
commit
572d712329
|
@ -99,7 +99,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||
|
||||
[[package]]
|
||||
name = "construct"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"construct-models",
|
||||
|
@ -109,7 +109,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "construct-models"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"reqwest",
|
||||
"serde",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "construct-models"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
edition = "2021"
|
||||
authors.workspace = true
|
||||
license.workspace = true
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "construct"
|
||||
version = "1.2.0"
|
||||
version = "1.3.0"
|
||||
edition = "2021"
|
||||
authors.workspace = true
|
||||
license.workspace = true
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
use construct_models::data::Data;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
impl Construct {
|
||||
/// Returns data on the types of scans (series) Censys performs
|
||||
pub async fn fetch_data(&self) -> Result<Data> {
|
||||
Ok(self
|
||||
.client
|
||||
.get(format!("{}/v1/data", self.base_url))
|
||||
.basic_auth(&self.api_id, Some(&self.api_secret))
|
||||
.send()
|
||||
.await?
|
||||
.process_error()
|
||||
.await?
|
||||
.json()
|
||||
.await?)
|
||||
}
|
||||
}
|
|
@ -1,8 +1,9 @@
|
|||
use async_trait::async_trait;
|
||||
use construct_models::Error;
|
||||
|
||||
pub mod account;
|
||||
pub mod metadata;
|
||||
mod account;
|
||||
mod data;
|
||||
mod metadata;
|
||||
|
||||
pub(crate) mod prelude {
|
||||
pub(crate) use crate::{Construct, ResponseExt, Result};
|
||||
|
|
Loading…
Reference in New Issue