appwrite_openapi 1.0.0

AUTO-GENERATED client for Appwrite. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
Documentation
/*
 * Appwrite
 *
 * Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
 *
 * The version of the OpenAPI document: 1.4.9
 * Contact: team@appwrite.io
 * Generated by: https://openapi-generator.tech
 */




#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DatabasesCreateRelationshipAttributeRequest {
    /// Related Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
    #[serde(rename = "relatedCollectionId")]
    pub related_collection_id: String,
    /// Relation type
    #[serde(rename = "type")]
    pub r#type: Type,
    /// Is Two Way?
    #[serde(rename = "twoWay", skip_serializing_if = "Option::is_none")]
    pub two_way: Option<bool>,
    /// Attribute Key.
    #[serde(rename = "key", skip_serializing_if = "Option::is_none")]
    pub key: Option<String>,
    /// Two Way Attribute Key.
    #[serde(rename = "twoWayKey", skip_serializing_if = "Option::is_none")]
    pub two_way_key: Option<String>,
    /// Constraints option
    #[serde(rename = "onDelete", skip_serializing_if = "Option::is_none")]
    pub on_delete: Option<OnDelete>,
}

impl DatabasesCreateRelationshipAttributeRequest {
    pub fn new(related_collection_id: String, r#type: Type) -> DatabasesCreateRelationshipAttributeRequest {
        DatabasesCreateRelationshipAttributeRequest {
            related_collection_id,
            r#type,
            two_way: None,
            key: None,
            two_way_key: None,
            on_delete: None,
        }
    }
}

/// Relation type
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "oneToOne")]
    OneToOne,
    #[serde(rename = "manyToOne")]
    ManyToOne,
    #[serde(rename = "manyToMany")]
    ManyToMany,
    #[serde(rename = "oneToMany")]
    OneToMany,
}

impl Default for Type {
    fn default() -> Type {
        Self::OneToOne
    }
}
/// Constraints option
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum OnDelete {
    #[serde(rename = "cascade")]
    Cascade,
    #[serde(rename = "restrict")]
    Restrict,
    #[serde(rename = "setNull")]
    SetNull,
}

impl Default for OnDelete {
    fn default() -> OnDelete {
        Self::Cascade
    }
}