pub struct BatchPermissionResponse {
pub batch_id: String,
pub approved_grants: Vec<Grant>,
pub denied_requests: HashSet<String>,
pub auto_approved: HashSet<String>,
}Expand description
Response to a batch permission request.
Fields§
§batch_id: StringThe batch ID this response is for.
approved_grants: Vec<Grant>Grants that were approved by the user.
denied_requests: HashSet<String>Request IDs that were explicitly denied.
auto_approved: HashSet<String>Request IDs that were auto-approved (already had permission).
Implementations§
Source§impl BatchPermissionResponse
impl BatchPermissionResponse
Sourcepub fn all_granted(batch_id: impl Into<String>, grants: Vec<Grant>) -> Self
pub fn all_granted(batch_id: impl Into<String>, grants: Vec<Grant>) -> Self
Creates a response where all requests were granted.
Sourcepub fn all_denied(
batch_id: impl Into<String>,
request_ids: impl IntoIterator<Item = String>,
) -> Self
pub fn all_denied( batch_id: impl Into<String>, request_ids: impl IntoIterator<Item = String>, ) -> Self
Creates a response where all requests were denied.
Sourcepub fn with_auto_approved(
batch_id: impl Into<String>,
auto_approved: impl IntoIterator<Item = String>,
) -> Self
pub fn with_auto_approved( batch_id: impl Into<String>, auto_approved: impl IntoIterator<Item = String>, ) -> Self
Creates a response with auto-approved requests.
Sourcepub fn is_granted(&self, request_id: &str, request: &PermissionRequest) -> bool
pub fn is_granted(&self, request_id: &str, request: &PermissionRequest) -> bool
Checks if a specific request was granted (either explicitly or auto-approved).
§Conflict Resolution
If a request_id appears in both auto_approved and denied_requests,
this is treated as a malformed response. A warning is logged and the
request is denied (safe default).
Sourcepub fn has_denials(&self) -> bool
pub fn has_denials(&self) -> bool
Returns whether any requests were denied.
Sourcepub fn approved_count(&self) -> usize
pub fn approved_count(&self) -> usize
Returns the number of approved grants.
Trait Implementations§
Source§impl Clone for BatchPermissionResponse
impl Clone for BatchPermissionResponse
Source§fn clone(&self) -> BatchPermissionResponse
fn clone(&self) -> BatchPermissionResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BatchPermissionResponse
impl Debug for BatchPermissionResponse
Source§impl<'de> Deserialize<'de> for BatchPermissionResponse
impl<'de> Deserialize<'de> for BatchPermissionResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BatchPermissionResponse
impl RefUnwindSafe for BatchPermissionResponse
impl Send for BatchPermissionResponse
impl Sync for BatchPermissionResponse
impl Unpin for BatchPermissionResponse
impl UnwindSafe for BatchPermissionResponse
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more