pub struct WebhookResponse {
pub status: HttpStatus,
pub body: String,
pub content_type: String,
}Expand description
A framework-agnostic webhook HTTP response.
Framework adapters convert this into their native response type using the
ResponseConverter trait defined in sms-web-generic.
Fields§
§status: HttpStatusHTTP status code to return.
body: StringResponse body (JSON).
content_type: StringThe Content-Type header value.
Implementations§
Source§impl WebhookResponse
impl WebhookResponse
Sourcepub fn success(message: InboundMessage) -> Self
pub fn success(message: InboundMessage) -> Self
Build a 200 OK response containing the serialized InboundMessage.
Sourcepub fn error(status: HttpStatus, message: &str) -> Self
pub fn error(status: HttpStatus, message: &str) -> Self
Build an error response with the given status and human-readable message.
Trait Implementations§
Source§impl Clone for WebhookResponse
impl Clone for WebhookResponse
Source§fn clone(&self) -> WebhookResponse
fn clone(&self) -> WebhookResponse
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 moreAuto Trait Implementations§
impl Freeze for WebhookResponse
impl RefUnwindSafe for WebhookResponse
impl Send for WebhookResponse
impl Sync for WebhookResponse
impl Unpin for WebhookResponse
impl UnsafeUnpin for WebhookResponse
impl UnwindSafe for WebhookResponse
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