use std::fmt;
use crate::credential::Credential;
pub const DEFAULT_ENDPOINT: &str = "https://api.prosopo.io/siteverify";
#[derive(PartialEq, Eq)]
pub struct ProcaptchaConfig {
secret: Credential,
endpoint: String,
}
impl ProcaptchaConfig {
pub fn new(secret: impl Into<String>) -> Self {
Self {
secret: Credential::new(secret),
endpoint: DEFAULT_ENDPOINT.to_owned(),
}
}
#[must_use]
pub fn with_endpoint(mut self, endpoint: impl Into<String>) -> Self {
self.endpoint = endpoint.into();
self
}
#[must_use]
pub fn endpoint(&self) -> &str {
&self.endpoint
}
}
impl fmt::Debug for ProcaptchaConfig {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter
.debug_struct("ProcaptchaConfig")
.field("secret", &self.secret)
.field("endpoint", &self.endpoint)
.finish()
}
}