Skip to main content

Module suotar

Module suotar 

Source
Expand description

Client for Suotar, the University of Helsinki study registry.

Every endpoint is a batch. Per-item outcomes arrive as HTTP 200 and are read from each item’s status and code; only request-level failures are 4xx/5xx and Err. Items are matched back by requestItemId, never by position.

The mock study registry serializes these same types, so skip_serializing_if here is what keeps its bodies byte-identical to Suotar’s.

Macros§

request_item 🔒

Structs§

CreditRange
DatePeriod
EnrolmentResolutionResult
EnrolmentsListedResult
ExistingAttainment
ImportAttainmentRequestItem
ImportAttainmentResult
One shape for import’s four success codes: sent fills the submitted pair, registered and duplicateAttainment fill attainment, notImprovedAttainment fills previous_attainment.
ListByCourseRequestItem
ListedEnrolment
ListedPerson
LocalizedName
NoSuotarCallAudit
PersonResult
ProductAccessTokenRequestItem
ProductAccessTokenResult
RequestLevelErrorBody 🔒
RequestLevelErrorDetail 🔒
ResolveEnrolmentRequestItem
ResolvePersonRequestItem
SuotarAttainment
Covers both contract bodies: the bare {id, type} of a registered answer and the fuller one behind duplicateAttainment and notImprovedAttainment.
SuotarBatchResponse
SuotarCallContext
Both fields are audit-row columns: worker_name separates the submitter from the verify poller from a manual retry, and the ids replace the identifiers scrubbing removes from stored bodies.
SuotarCallFinished
SuotarCallStarted
SuotarClient
SuotarEnrolment
SuotarItemError
SuotarResponseItem
VerifyAttainmentRequestItem
VerifyAttainmentResult

Enums§

SuotarEndpoint
SuotarItemStatus

Constants§

CORRELATION_ID_HEADER
Carries suotar_api_calls.id so Suotar’s log and ours join on one value.
MAX_REQUEST_BODY_BYTES
Matches the actix payload limit the mock Suotar runs behind, so an oversized batch is refused here rather than 413’d at the far end.
SUOTAR_REQUEST_TIMEOUT
Bounds one call so a Suotar that never answers cannot stall a worker tick.
TRANSIENT_ITEM_CODE
The only code the contract classifies as “transient, retry me”.

Traits§

SuotarCallAudit
Persists one suotar_api_calls row per call. A trait because the table is in the models crate, which depends on this one. Implementations must scrub the bodies.
SuotarRequestItem
Sent verbatim from credit_registrations.request_item_id; Suotar echoes it back, which is what makes a reordered or partial response safe to read.

Functions§

authorization_header_value 🔒
Suotar’s legacy study-registry path takes the token verbatim after the scheme word, not base64 of user:password.
body_for_audit 🔒
A body that is not JSON is still worth keeping; the scrubber takes a bare string too.
check_batch 🔒
Refuses our own bugs before a request goes out; both would come back as a request-level error rejecting the whole batch.
empty_batch_response 🔒
An empty array is a request-level error at the far end, so an empty batch is never sent and leaves no audit row.
failed 🔒
reconcile 🔒
Pairs the response against what was sent by requestItemId; order is not consulted.
request_level_error 🔒
transport_variant 🔒
is_connect is the one case where the request provably never reached Suotar; everything else, a timeout above all, may have been processed.

Type Aliases§

Exchanged 🔒