#[allow(unused_imports)]
use crate::{error::Result, models::*, Configuration};
pub struct OAuth<'a> {
cfg: &'a Configuration,
}
impl<'a> OAuth<'a> {
pub(super) fn new(cfg: &'a Configuration) -> Self {
Self { cfg }
}
pub async fn introspect_endpoint(
&self,
introspection_request: crate::models::IntrospectionRequest,
) -> Result<crate::models::TokenIntrospectionResponse> {
crate::request::Request::new(http1::Method::POST, "/api/v1/oauth/introspect")
.with_form_body_param(introspection_request)
.execute(self.cfg)
.await
}
pub async fn revoke_endpoint(
&self,
revocation_request: crate::models::RevocationRequest,
) -> Result<()> {
crate::request::Request::new(http1::Method::POST, "/api/v1/oauth/revoke")
.with_form_body_param(revocation_request)
.returns_nothing()
.execute(self.cfg)
.await
}
pub async fn token_endpoint(
&self,
token_request: crate::models::TokenRequest,
) -> Result<crate::models::TokenResponse> {
crate::request::Request::new(http1::Method::POST, "/api/v1/oauth/token")
.with_form_body_param(token_request)
.execute(self.cfg)
.await
}
}