Skip to main content

Module models_requests

Module models_requests 

Source
Expand description

Contains helper functions that are passed to headless-lms-models where it needs to make requests to exercise services.

StructsΒ§

ExerciseServiceCsvExportColumn
Column definition for exercise service CSV export; callers must use scalar-only cell values.
ExerciseServiceCsvExportRequest
ExerciseServiceCsvExportResponse
Full CSV export response; columns define headers, results align by index. All cell values must be scalar.
ExerciseServiceCsvExportResult
One batch of CSV rows; each row’s values must be scalar (null, bool, number, string). Objects/arrays are rejected by the controller.
GivePeerReviewClaim
GradingUpdateClaim
JwtKey
LegacyGivePeerReviewClaim πŸ”’
LegacyGradingUpdateClaim πŸ”’
LegacyUploadClaim πŸ”’
PlaygroundGradingCallbackClaim
SpecRequest
Accepted by the public-spec and model-solution endpoints of exercise services.
UploadClaim

ConstantsΒ§

EXERCISE_SERVICE_GRADING_UPDATE_CLAIM_HEADER πŸ”’
EXERCISE_SERVICE_UPLOAD_CLAIM_HEADER πŸ”’
PLAYGROUND_GRADING_CALLBACK_CLAIM_PARAM

FunctionsΒ§

fetch_service_info
fetch_service_info_fast
fetch_service_info_with_timeout πŸ”’
legacy_timestamp_to_claim_number πŸ”’
make_grading_request_sender
make_seed_spec_fetcher_with_cache
A caching spec fetcher ONLY FOR THE SEED that returns a cached spec if the same (url, exercise_service_slug, private_spec) is requested. Since this is only used during seeding, there is no cache eviction.
make_spec_fetcher
Fetches a public/model spec based on the private spec from the given url. The slug and jwt key are used for an upload claim that allows the service to upload files as part of the spec.
parse_response_json πŸ”’
Safely parses a response body as JSON, capturing the actual response body in error cases
post_exercise_service_csv_export_request
sign_hs256_claim πŸ”’
Signs any serializable claim payload as HS256 using the shared JWT secret.
validate_grading_update_claim_with_legacy_fallback πŸ”’
Validates grading update claim using modern JWT fields, with temporary fallback to legacy claims.
validate_hs256_claim πŸ”’
Decodes and verifies an HS256 token into the requested claim type.
validate_hs256_legacy_claim πŸ”’
Decodes claims in compatibility mode and validates legacy expiration_time manually.
validate_peer_review_claim_with_legacy_fallback πŸ”’
Validates peer review claim using modern JWT fields, with temporary fallback to legacy claims.
validate_upload_claim_with_legacy_fallback πŸ”’
Validates upload claim using modern JWT fields, with temporary fallback to legacy claims.

Type AliasesΒ§

SpecCache πŸ”’
A type for caching the spec fetching (only for the seed)