package tdmrep

  1. Overview
  2. Docs
On This Page
  1. Example
OCaml combinators for the W3C TDM Reservation Protocol

Install

dune-project
 Dependency

Authors

Maintainers

Sources

tdmrep-1.0.tbz
md5=3edc29b3956f7a55dba7fe12b897c087
sha512=33dc369bd70b67168c21c228fdd046a062e22d7a5780610dc8ff849f305d4fcdfba2e2d3d64b23fcdc4be5856ec1e562749f8475c4bb9d1ec38482f4c6382a8f

doc/README.html

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.