#![allow(
clippy::too_many_arguments,
clippy::wildcard_imports,
clippy::doc_markdown
)]
use crate::client::AccountClient;
use crate::error::Error;
use crate::generated::routes;
#[allow(unused_imports)]
use crate::generated::types::*;
#[derive(Debug, Clone, Copy)]
pub struct CardStepsService<'a> {
client: &'a AccountClient,
}
impl<'a> CardStepsService<'a> {
pub(crate) fn new(client: &'a AccountClient) -> Self {
Self { client }
}
pub fn client(&self) -> &'a AccountClient {
self.client
}
pub async fn create(
&self,
card_id: i64,
body: &CreateCardStepRequestContent,
) -> Result<CreateCardStepResponseContent, Error> {
let mut operation = self
.client
.operation(&routes::CREATE_CARD_STEP, &[&card_id]);
operation.json(body)?;
self.client.send(operation).await
}
pub async fn get(&self, step_id: i64) -> Result<GetCardStepResponseContent, Error> {
let operation = self.client.operation(&routes::GET_CARD_STEP, &[&step_id]);
self.client.send(operation).await
}
pub async fn reposition(
&self,
card_id: i64,
body: &RepositionCardStepRequestContent,
) -> Result<(), Error> {
let mut operation = self
.client
.operation(&routes::REPOSITION_CARD_STEP, &[&card_id]);
operation.json(body)?;
self.client.send_unit(operation).await
}
pub async fn set_completion(
&self,
step_id: i64,
body: &SetCardStepCompletionRequestContent,
) -> Result<SetCardStepCompletionResponseContent, Error> {
let mut operation = self
.client
.operation(&routes::SET_CARD_STEP_COMPLETION, &[&step_id]);
operation.json(body)?;
self.client.send(operation).await
}
pub async fn update(
&self,
step_id: i64,
body: &UpdateCardStepRequestContent,
) -> Result<UpdateCardStepResponseContent, Error> {
let mut operation = self
.client
.operation(&routes::UPDATE_CARD_STEP, &[&step_id]);
operation.json(body)?;
self.client.send(operation).await
}
}