pub trait Webhook:
Send
+ Sync
+ 'static {
const PROVIDER: &'static str;
// Required methods
fn verify(request: &WebhookRequest, state: &AppState) -> Result;
fn event_id(request: &WebhookRequest) -> Result<String>;
fn handle(
call: WebhookCall,
ctx: JobContext,
) -> impl Future<Output = Result> + Send;
}Expand description
Tells Renox how to receive one provider’s webhooks.
Required Associated Constants§
Required Methods§
Sourcefn verify(request: &WebhookRequest, state: &AppState) -> Result
fn verify(request: &WebhookRequest, state: &AppState) -> Result
Accepts the call only if it really comes from the provider, usually
by checking a signature over WebhookRequest::body. An error
answers 401 and nothing is stored.
Sourcefn event_id(request: &WebhookRequest) -> Result<String>
fn event_id(request: &WebhookRequest) -> Result<String>
The provider’s id for this event. A call whose id was seen before is
answered 200 without being processed again. Include the status when
a provider sends several calls for one object (e.g. "{id}:{status}").
Sourcefn handle(
call: WebhookCall,
ctx: JobContext,
) -> impl Future<Output = Result> + Send
fn handle( call: WebhookCall, ctx: JobContext, ) -> impl Future<Output = Result> + Send
Processes a stored call in a queue worker. An error marks the call failed and retries it (five attempts in all).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".