use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct InviteListResponse {
#[serde(rename = "object")]
pub object: Object,
#[serde(rename = "data")]
pub data: Vec<models::Invite>,
#[serde(rename = "first_id", skip_serializing_if = "Option::is_none")]
pub first_id: Option<String>,
#[serde(rename = "last_id", skip_serializing_if = "Option::is_none")]
pub last_id: Option<String>,
#[serde(rename = "has_more", skip_serializing_if = "Option::is_none")]
pub has_more: Option<bool>,
}
impl InviteListResponse {
pub fn new(object: Object, data: Vec<models::Invite>) -> InviteListResponse {
InviteListResponse {
object,
data,
first_id: None,
last_id: None,
has_more: None,
}
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Object {
#[serde(rename = "list")]
List,
}
impl Default for Object {
fn default() -> Object {
Self::List
}
}
impl std::fmt::Display for InviteListResponse {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match serde_json::to_string(self) {
Ok(s) => write!(f, "{}", s),
Err(_) => Err(std::fmt::Error),
}
}
}