pdk_script/bindings/
authentication.rs

1// Copyright (c) 2025, Salesforce, Inc.,
2// All rights reserved.
3// For full license text, see the LICENSE.txt file
4
5use crate::Value;
6
7/// Binding for the top-level `authentication` variable.
8pub trait AuthenticationBinding {
9    /// Returns the `authentication.clientId` value.
10    fn client_id(&self) -> Option<String>;
11
12    /// Returns the `authentication.clientName` value.
13    fn client_name(&self) -> Option<String>;
14
15    /// Returns the `authentication.principal` value.
16    fn principal(&self) -> Option<String>;
17
18    /// Returns the `authentication.properties` value.
19    fn properties(&self) -> Option<Value>;
20}
21
22impl<K: AuthenticationBinding> AuthenticationBinding for Option<K> {
23    fn client_id(&self) -> Option<String> {
24        self.as_ref().and_then(K::client_id)
25    }
26
27    fn client_name(&self) -> Option<String> {
28        self.as_ref().and_then(K::client_name)
29    }
30
31    fn principal(&self) -> Option<String> {
32        self.as_ref().and_then(K::principal)
33    }
34
35    fn properties(&self) -> Option<Value> {
36        self.as_ref().and_then(K::properties)
37    }
38}