mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 19:46:48 +08:00
feat(router): add retrieve poll status api (#4358)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
5a0a8cee76
commit
ca47ea9b13
28
crates/api_models/src/poll.rs
Normal file
28
crates/api_models/src/poll.rs
Normal file
@ -0,0 +1,28 @@
|
||||
use common_utils::events::{ApiEventMetric, ApiEventsType};
|
||||
use serde::Serialize;
|
||||
use utoipa::ToSchema;
|
||||
|
||||
#[derive(Debug, ToSchema, Clone, Serialize)]
|
||||
pub struct PollResponse {
|
||||
/// The poll id
|
||||
pub poll_id: String,
|
||||
/// Status of the poll
|
||||
pub status: PollStatus,
|
||||
}
|
||||
|
||||
#[derive(Debug, strum::Display, strum::EnumString, Clone, serde::Serialize, ToSchema)]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum PollStatus {
|
||||
Pending,
|
||||
Completed,
|
||||
NotFound,
|
||||
}
|
||||
|
||||
impl ApiEventMetric for PollResponse {
|
||||
fn get_api_event_type(&self) -> Option<ApiEventsType> {
|
||||
Some(ApiEventsType::Poll {
|
||||
poll_id: self.poll_id.clone(),
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user