[−][src]Struct rocheck::RoCheck
Methods
impl RoCheck
[src]
pub fn new(cookie: &str) -> RoCheck
[src]
Create and initialize a new RoCheck class.
let client = RoCheck::new("MySecurityToken");
pub async fn get_data<'_, '_>(
&'_ self,
place_id: i64,
job_id: &'_ str
) -> Result<HashMap<String, Value>, Box<dyn Error>>
[src]
&'_ self,
place_id: i64,
job_id: &'_ str
) -> Result<HashMap<String, Value>, Box<dyn Error>>
Retrieve additional data other than the IP.
let client = RoCheck::new("MySecurityToken"); let data = client.get_data(123456, "JobIdFromRequest").await?; data.get("some-field");
pub async fn get_ip<'_, '_>(
&'_ self,
place_id: i64,
job_id: &'_ str
) -> Result<String, Box<dyn Error>>
[src]
&'_ self,
place_id: i64,
job_id: &'_ str
) -> Result<String, Box<dyn Error>>
Retrieve the IP belonging to this PlaceId and JobId
let client = RoCheck::new("MySecurityToken"); let ip = client.get_ip(123456, "JobIdFromRequest").await?;
pub async fn verify_ip<'_, '_, '_>(
&'_ self,
place_id: i64,
job_id: &'_ str,
ip: &'_ str
) -> Result<bool, Box<dyn Error>>
[src]
&'_ self,
place_id: i64,
job_id: &'_ str,
ip: &'_ str
) -> Result<bool, Box<dyn Error>>
Retrieve the IP belonging to this PlaceId and JobId and compare it to the inputted IP.
let my_ip = "127.0.0.1"; let client = RoCheck::new("MySecurityToken"); let ip_verified = client.verify_ip(123456, "JobIdFromRequest", my_ip).await?;
pub async fn validate_ip<'_, '_, '_>(
&'_ self,
place_id: i64,
job_id: &'_ str,
ip: &'_ str
) -> bool
[src]
&'_ self,
place_id: i64,
job_id: &'_ str,
ip: &'_ str
) -> bool
This function is equivalent to verify_ip, however it will always return true/false. If this function fails, it will return false. This is useful for cases where you don't need to know why it failed (e.g place_id doesn't exist, or job id doesn't exist) without adding boilerplate.
let my_ip = "127.0.0.1"; let client = RoCheck::new("MySecurityToken"); let ip_verified = client.validate_ip(123456i64, "JobIdFromRequest", my_ip).await;
Auto Trait Implementations
impl !RefUnwindSafe for RoCheck
impl Send for RoCheck
impl Sync for RoCheck
impl Unpin for RoCheck
impl !UnwindSafe for RoCheck
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,