Skip to main content

Crate oppex_sdk

Crate oppex_sdk 

Source
Expand description

Post incidents to the Oppex incident API.

POST https://api.oppex.ai/api/v1/incident/post

Create one IncidentClient per application, share it across threads, and let it drop (or call IncidentClient::close) during shutdown.

use oppex_sdk::{IncidentClient, IncidentRequest, Severity};

let client = IncidentClient::builder()
    .api_key("api-key")
    .service_key("service-key")
    .build()?;

let request = IncidentRequest::builder()
    .title("Checkout latency breached the SLO")
    .source("checkout-api")
    .severity(Severity::High)
    .build()?;

let response = client.post(&request)?;
println!("created {:?}", response.incident_id());

The service key is optional. A client built with only an API key posts with IncidentClient::post_with_service_routing, which omits serviceKey from the payload so the API resolves the target service itself.

Structs§

IncidentClient
Posts incidents to Oppex.
IncidentClientBuilder
Builds a reusable IncidentClient.
IncidentRequest
A validated, immutable incident submission.
IncidentRequestBuilder
Builds a validated IncidentRequest.
IncidentResponse
The result of a delivered incident.

Enums§

IncidentError
Every failure this SDK reports.
Severity
Oppex incident severity, on a scale from 1 (lowest) to 5 (highest).

Constants§

DEFAULT_ENDPOINT
The Oppex incident endpoint every client posts to.
NO_STATUS_CODE
The status code reported when a delivery failed before any HTTP status line was received.
VERSION
The SDK version, as MAJOR.MINOR.PATCH. Read from the crate’s own manifest, so it cannot drift from the published version.