openfga 1.0.2

Rust SDK for OpenFGA — the open-source authorization system
Documentation
/*
 * OpenFGA
 *
 * A high performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar.
 *
 * The version of the OpenAPI document: 1.x
 * Contact: community@openfga.dev
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct WriteRequestWrites {
    #[serde(rename = "tuple_keys")]
    pub tuple_keys: Vec<models::TupleKey>,
    /// On 'error' ( or unspecified ), the API returns an error if an identical tuple already exists. On 'ignore', identical writes are treated as no-ops (matching on user, relation, object, and RelationshipCondition).
    #[serde(rename = "on_duplicate", skip_serializing_if = "Option::is_none")]
    pub on_duplicate: Option<OnDuplicate>,
}

impl WriteRequestWrites {
    pub fn new(tuple_keys: Vec<models::TupleKey>) -> WriteRequestWrites {
        WriteRequestWrites {
            tuple_keys,
            on_duplicate: None,
        }
    }
}
/// On 'error' ( or unspecified ), the API returns an error if an identical tuple already exists. On 'ignore', identical writes are treated as no-ops (matching on user, relation, object, and RelationshipCondition).
#[derive(
    Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, Default,
)]
pub enum OnDuplicate {
    #[serde(rename = "error")]
    #[default]
    Error,
    #[serde(rename = "ignore")]
    Ignore,
}