pub struct EndpointContext<'a, S: AuthSchema> {
pub request: Option<&'a AuthRequest>,
pub path: Option<&'a str>,
pub params: HashMap<String, String>,
pub body: FieldValue,
pub auth: &'a AuthContext<S>,
pub transaction: Option<&'a dyn AuthTransaction<S>>,
pub session: Option<(UserView, SessionView)>,
pub response: Option<&'a AuthResponse>,
/* private fields */
}Expand description
The parsed endpoint input and the active authentication runtime.
Fields§
§request: Option<&'a AuthRequest>Original Request supplied by HTTP transport or an explicit native caller.
path: Option<&'a str>Endpoint path, including synthetic dispatch from another endpoint.
params: HashMap<String, String>Values captured from the matched endpoint template.
body: FieldValueInput after endpoint validation and unknown-field filtering.
auth: &'a AuthContext<S>Full typed runtime, including the store, options, metadata, and extensions.
transaction: Option<&'a dyn AuthTransaction<S>>Active transaction. Use this store for database work inside transactional callbacks.
session: Option<(UserView, SessionView)>Session already resolved by this endpoint before the callback.
response: Option<&'a AuthResponse>Completed response when the callback runs from an after hook.
Implementations§
Source§impl<S: AuthSchema> EndpointContext<'_, S>
impl<S: AuthSchema> EndpointContext<'_, S>
Sourcepub fn to_owned(&self) -> OwnedEndpointContext<S>
pub fn to_owned(&self) -> OwnedEndpointContext<S>
Retain this endpoint for asynchronous work that may outlive its response.
Source§impl<'a, S: AuthSchema> EndpointContext<'a, S>
impl<'a, S: AuthSchema> EndpointContext<'a, S>
Sourcepub fn test(&'a self) -> AuthResult<TestUtilsApi<'a, S>>
pub fn test(&'a self) -> AuthResult<TestUtilsApi<'a, S>>
Access installed test helpers using this endpoint’s active transaction.
Sourcepub fn headers(&self) -> Option<&HashMap<String, String>>
pub fn headers(&self) -> Option<&HashMap<String, String>>
Supplied endpoint headers, preserving omission for native calls.
Sourcepub fn query(&self) -> Option<&Value>
pub fn query(&self) -> Option<&Value>
Endpoint query, preserving native omission separately from null and an empty object.
Sourcepub fn input_request(&self) -> Option<&'a AuthRequest>
pub fn input_request(&self) -> Option<&'a AuthRequest>
Active endpoint input and shared server state, independent of the original Request.
Sourcepub fn set_header(&self, name: &str, value: impl Into<String>) -> AuthResult<()>
pub fn set_header(&self, name: &str, value: impl Into<String>) -> AuthResult<()>
Set a response header without replacing other header names.
Sourcepub fn append_header(
&self,
name: &str,
value: impl Into<String>,
) -> AuthResult<()>
pub fn append_header( &self, name: &str, value: impl Into<String>, ) -> AuthResult<()>
Append a response header, including another Set-Cookie value.
Sourcepub fn new_session(&self) -> AuthResult<Option<NativeSessionData>>
pub fn new_session(&self) -> AuthResult<Option<NativeSessionData>>
Identity supplied to the most recent session-cookie write in this endpoint.
Sourcepub fn email_otp(&self) -> AuthResult<EmailOtpApi<'a, S>>
pub fn email_otp(&self) -> AuthResult<EmailOtpApi<'a, S>>
Use the registered Email OTP plugin within this endpoint’s active transaction.
Sourcepub fn organization(&self) -> AuthResult<OrganizationApi<'a, S>>
pub fn organization(&self) -> AuthResult<OrganizationApi<'a, S>>
Add organization members within this endpoint’s active transaction.
Sourcepub fn phone_number(&self) -> AuthResult<PhoneNumberApi<'a, S>>
pub fn phone_number(&self) -> AuthResult<PhoneNumberApi<'a, S>>
Consume a phone OTP within this endpoint’s active transaction.
Sourcepub fn jwt(&self) -> AuthResult<JwtApi<'a, S>>
pub fn jwt(&self) -> AuthResult<JwtApi<'a, S>>
Use the registered JWT key adapter within this endpoint’s active transaction.
Sourcepub fn native(
input_request: Option<&'a AuthRequest>,
original_request: Option<&'a AuthRequest>,
body: FieldValue,
auth: &'a AuthContext<S>,
) -> Self
pub fn native( input_request: Option<&'a AuthRequest>, original_request: Option<&'a AuthRequest>, body: FieldValue, auth: &'a AuthContext<S>, ) -> Self
Construct a native endpoint without inferring a Request from ambient HTTP activity.
Sourcepub fn new(
request: Option<&'a AuthRequest>,
body: FieldValue,
auth: &'a AuthContext<S>,
) -> Self
pub fn new( request: Option<&'a AuthRequest>, body: FieldValue, auth: &'a AuthContext<S>, ) -> Self
Construct an endpoint context from its request, validated body, and runtime.
Set transaction when the caller executes inside an active database transaction.