Added fetch data endpoint
This commit is contained in:
parent
72e6533857
commit
572d712329
|
@ -99,7 +99,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "construct"
|
name = "construct"
|
||||||
version = "1.2.0"
|
version = "1.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"construct-models",
|
"construct-models",
|
||||||
|
@ -109,7 +109,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "construct-models"
|
name = "construct-models"
|
||||||
version = "1.2.0"
|
version = "1.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"serde",
|
"serde",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "construct-models"
|
name = "construct-models"
|
||||||
version = "1.2.0"
|
version = "1.3.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "construct"
|
name = "construct"
|
||||||
version = "1.2.0"
|
version = "1.3.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
license.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 async_trait::async_trait;
|
||||||
use construct_models::Error;
|
use construct_models::Error;
|
||||||
|
|
||||||
pub mod account;
|
mod account;
|
||||||
pub mod metadata;
|
mod data;
|
||||||
|
mod metadata;
|
||||||
|
|
||||||
pub(crate) mod prelude {
|
pub(crate) mod prelude {
|
||||||
pub(crate) use crate::{Construct, ResponseExt, Result};
|
pub(crate) use crate::{Construct, ResponseExt, Result};
|
||||||
|
|
Loading…
Reference in New Issue