module Web.View.InteractionReportingContracts.Show where import Web.Types import Generated.Types import IHP.Prelude import IHP.ViewPrelude import Application.Helper.View (adapterStatusBadge) data ShowView = ShowView { contract :: !InteractionReportingContract } instance View ShowView where html ShowView { .. } = [hsx|
← Reporting Contracts

Reporting Contract v{contract.contractVersion}

" text-xs px-2 py-0.5 rounded font-medium"}> {contract.status} {maturityBadge contract.maturity}
{forEach (contractDescription contract) (\d -> [hsx|

{d}

|])}

Endpoint

POST {contract.endpointPath}
Auth: {contract.authScheme}

Required Fields

{tshow contract.requiredFields}

Accepted Event Types

{tshow contract.acceptedEventTypes}

Example Request

curl -X POST {contract.endpointPath} \
  -H "Authorization: Bearer <hub-api-key>" \
  -H "Content-Type: application/json" \
  -d '{"{"}
    "widget_id": "<uuid>",
    "hub_id": "<uuid>",
    "event_type": "clicked",
    "occurred_at": "2026-03-29T12:00:00Z"
{"}"}'
Created: {show contract.createdAt}
|] contractDescription :: InteractionReportingContract -> [Text] contractDescription c = case c.description of Just d -> [d] Nothing -> [] maturityBadge :: Text -> Html maturityBadge "stable" = [hsx|Stable|] maturityBadge "beta" = [hsx|Beta|] maturityBadge "experimental" = [hsx|Experimental|] maturityBadge "deprecated" = [hsx|Deprecated|] maturityBadge m = [hsx|{m}|]