Skip to content

Commit

Permalink
add raw methods to write_relationships
Browse files Browse the repository at this point in the history
  • Loading branch information
Lur1an committed Jul 18, 2024
1 parent 30f4a6e commit 784593e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/permission/requests/write_relationships.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::RelationshipOperation;
use crate::{spicedb, Caveat, Relation, Resource, Subject};

use self::spicedb::precondition::Operation;
use self::spicedb::Precondition;

#[derive(Clone, Debug)]
pub struct WriteRelationshipsRequest {
Expand All @@ -19,6 +20,16 @@ impl WriteRelationshipsRequest {
WriteRelationshipsRequest { client, request }
}

pub fn add_precondition_raw(&mut self, precondition: Precondition) -> &mut Self {
self.request.optional_preconditions.push(precondition);
self
}

pub fn add_relationship_raw(&mut self, relationship: spicedb::RelationshipUpdate) -> &mut Self {
self.request.updates.push(relationship);
self
}

pub fn add_precondition<R>(
&mut self,
operation: Operation,
Expand Down

0 comments on commit 784593e

Please sign in to comment.