use http::Method;
use tracing::instrument;
use crate::Result;
use crate::client::IgClient;
use super::models::{Application, UpdateApplicationRequest};
#[derive(Debug)]
pub struct OperationsApi<'a> {
pub(crate) client: &'a IgClient,
}
impl OperationsApi<'_> {
#[instrument(skip(self))]
pub async fn applications(&self) -> Result<Vec<Application>> {
self.client
.transport
.request(
Method::GET,
"operations/application",
Some(1),
None::<&()>,
&self.client.session,
)
.await
}
#[instrument(skip(self, req), fields(api_key = %req.api_key))]
pub async fn update_application(&self, req: UpdateApplicationRequest) -> Result<Application> {
self.client
.transport
.request(
Method::PUT,
"operations/application",
Some(1),
Some(&req),
&self.client.session,
)
.await
}
#[instrument(skip(self))]
pub async fn disable_current_key(&self) -> Result<Application> {
self.client
.transport
.request(
Method::PUT,
"operations/application/disable",
Some(1),
None::<&()>,
&self.client.session,
)
.await
}
}