scaleway-rs 0.2.8

A pure Rust scaleway API binding.
Documentation
use serde::Deserialize;

#[derive(Debug, Clone, Copy)]
pub enum ProjectOrderBy {
    NameAsc,
    NameDesc,
    CreatedAtAsc,
    CreatedAtDesc,
}

impl std::fmt::Display for ProjectOrderBy {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            ProjectOrderBy::NameAsc => write!(f, "name_asc"),
            ProjectOrderBy::NameDesc => write!(f, "name_desc"),
            ProjectOrderBy::CreatedAtAsc => write!(f, "created_at_asc"),
            ProjectOrderBy::CreatedAtDesc => write!(f, "created_at_desc"),
        }
    }
}

#[derive(Deserialize, Debug)]
pub struct ScalewayProjectsRoot {
    pub projects: Vec<ScalewayProject>,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayProject {
    pub id: String,
    pub name: String,
    pub organization_id: String,
    #[serde(with = "time::serde::rfc3339::option")]
    pub created_at: Option<time::OffsetDateTime>,
    #[serde(with = "time::serde::rfc3339::option")]
    pub updated_at: Option<time::OffsetDateTime>,
    pub description: Option<String>,
}