use crate::client::Client;
#[allow(unused_imports)]
use crate::enums::*;
use crate::error::Error;
#[allow(unused_imports)]
use crate::models::*;
use serde::Serialize;
pub struct AgentsApi<'a> {
pub(crate) client: &'a Client,
}
#[derive(Debug, Clone, Serialize)]
pub struct UpdateAttemptsParams {
#[serde(skip)]
pub body: AgentAdminLinkClaimAttemptToExternalUserRequest,
}
impl UpdateAttemptsParams {
#[allow(deprecated)]
pub fn new(body: AgentAdminLinkClaimAttemptToExternalUserRequest) -> Self {
Self { body }
}
}
#[derive(Debug, Clone, Serialize)]
pub struct CreateValidateParams {
#[serde(skip)]
pub body: AgentAdminValidateCredentialRequest,
}
impl CreateValidateParams {
#[allow(deprecated)]
pub fn new(body: AgentAdminValidateCredentialRequest) -> Self {
Self { body }
}
}
impl<'a> AgentsApi<'a> {
pub async fn update_attempts(
&self,
params: UpdateAttemptsParams,
) -> Result<ClaimViewResponse, Error> {
self.update_attempts_with_options(params, None).await
}
pub async fn update_attempts_with_options(
&self,
params: UpdateAttemptsParams,
options: Option<&crate::RequestOptions>,
) -> Result<ClaimViewResponse, Error> {
let path = "/agents/claims/attempts".to_string();
let method = http::Method::PATCH;
self.client
.request_with_body_opts(method, &path, ¶ms, Some(¶ms.body), options)
.await
}
pub async fn create_validate(
&self,
params: CreateValidateParams,
) -> Result<AgentCredentialValidation, Error> {
self.create_validate_with_options(params, None).await
}
pub async fn create_validate_with_options(
&self,
params: CreateValidateParams,
options: Option<&crate::RequestOptions>,
) -> Result<AgentCredentialValidation, Error> {
let path = "/agents/credentials/validate".to_string();
let method = http::Method::POST;
self.client
.request_with_body_opts(method, &path, ¶ms, Some(¶ms.body), options)
.await
}
pub async fn get_registration(&self, id: &str) -> Result<AgentRegistration, Error> {
self.get_registration_with_options(id, None).await
}
pub async fn get_registration_with_options(
&self,
id: &str,
options: Option<&crate::RequestOptions>,
) -> Result<AgentRegistration, Error> {
let id = crate::client::path_segment(id);
let path = format!("/agents/registrations/{id}");
let method = http::Method::GET;
self.client
.request_with_query_opts(method, &path, &(), options)
.await
}
}