package tdmrep

  1. Overview
  2. Docs

tdmrep -- Text and Data Mining Reservation Protocol

tdmrep provides typed OCaml values and Jsont codecs for the W3C TDM Reservation Protocol final report of 10 May 2024.

It covers:

  • /.well-known/tdmrep.json rule files;
  • tdm-reservation and tdm-policy HTTP fields;
  • HTML, EPUB, and PDF metadata names and values;
  • machine-readable JSON-LD TDM policies;
  • priority-aware merging of declarations from different representations.

Example

open Tdmrep

let policy =
  Uri.of_string "https://provider.example/policies/1"

let declaration =
  Declaration.make ~reservation:`Reserved ~policy ()

let response_fields = Http.encode declaration

let rules =
  Well_known.make
    [ Rule.make ~location:"/" ~reservation:`Reserved ~policy () ]

let json =
  Jsont_bytesrw.encode_string ~format:Jsont.Indent Well_known.jsont rules

Use Well_known.jsont and Policy.jsont with any Jsont backend, or embed it into your HTTP server for dynamic policies.