pub struct ApplicationContext {
pub app_id: Option<String>,
pub app_name: Option<String>,
pub app_url: Option<String>,
pub tenant_id: Option<String>,
pub request_id: Option<String>,
pub end_user_id: Option<String>,
pub extra_headers: HashMap<String, String>,
}Expand description
Caller-supplied identity for attribution and request correlation.
Fields§
§app_id: Option<String>Stable application identifier (slug). Primary attribution key.
app_name: Option<String>Human-readable name for provider dashboards.
app_url: Option<String>Public URL of the application (OpenRouter HTTP-Referer).
tenant_id: Option<String>Multi-tenant partition.
request_id: Option<String>Per-request correlation ID (OpenAI X-Client-Request-Id, etc.).
end_user_id: Option<String>End-user identifier for provider safety/billing fields (OpenAI user, Azure end_user_id).
extra_headers: HashMap<String, String>Additional passthrough headers (traceparent, vendor-specific).
Implementations§
Source§impl ApplicationContext
impl ApplicationContext
Sourcepub fn from_ingress_headers(headers: &HashMap<String, String>) -> Result<Self>
pub fn from_ingress_headers(headers: &HashMap<String, String>) -> Result<Self>
Parse canonical ingress headers into a validated context.
Sourcepub fn merge(&mut self, other: ApplicationContext)
pub fn merge(&mut self, other: ApplicationContext)
Merge other into self. Per-field and extra_headers from other win.
Sourcepub fn has_app_attribution(&self) -> bool
pub fn has_app_attribution(&self) -> bool
Whether application-level attribution (not just request_id) is present.
Sourcepub fn with_app_id(app_id: impl Into<String>) -> Result<Self>
pub fn with_app_id(app_id: impl Into<String>) -> Result<Self>
Build from optional app id (Python SDK convenience).
Trait Implementations§
Source§impl Clone for ApplicationContext
impl Clone for ApplicationContext
Source§fn clone(&self) -> ApplicationContext
fn clone(&self) -> ApplicationContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ApplicationContext
impl Debug for ApplicationContext
Source§impl Default for ApplicationContext
impl Default for ApplicationContext
Source§fn default() -> ApplicationContext
fn default() -> ApplicationContext
Returns the “default value” for a type. Read more
impl Eq for ApplicationContext
Source§impl PartialEq for ApplicationContext
impl PartialEq for ApplicationContext
Source§fn eq(&self, other: &ApplicationContext) -> bool
fn eq(&self, other: &ApplicationContext) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ApplicationContext
Auto Trait Implementations§
impl Freeze for ApplicationContext
impl RefUnwindSafe for ApplicationContext
impl Send for ApplicationContext
impl Sync for ApplicationContext
impl Unpin for ApplicationContext
impl UnsafeUnpin for ApplicationContext
impl UnwindSafe for ApplicationContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.