legal-docs-types
v1.0.0
Published
TypeScript types for the Case Law Explorer API's data contract. No client, no requests, no credentials — safe to import from browser code.
Readme
legal-docs-types
The Case Law Explorer API's data contract, as TypeScript.
No client, no requests, no credentials. Import it anywhere — including browser code, which needs these shapes to build a query and render a result but must never be able to call the API directly.
npm install legal-docs-typesimport type { RechtspraakQueryParameters, RechtspraakDocument } from "legal-docs-types";
import { DocType, INSTANCES_OPTIONS } from "legal-docs-types";Why this is separate
Its consumers need different things:
| Consumer | Needs |
|---|---|
| vue-legal-query-builder | the query shapes, to build one |
| vue-legal-docs-visualizer | the document shapes, to render them |
| node-legal-docs-client | both, plus the means to make the request |
| go-legal-docs-client | its own Go equivalents |
The first two run in a browser. Shipping them a client would mean shipping a credential into a page, where anyone using it can read the key and — worse — use it to make whatever calls they like. Keeping the contract in its own package means browser code can be given exactly what it needs and nothing more.
Requests belong to a server:
node-legal-docs-client
for TypeScript,
go-legal-docs-client
for Go.
What is in here
Types describing the API's requests and responses, and the constants that are part of the contract:
DocType— document types the Rechtspraak endpoint acceptsINSTANCES_OPTIONS,DOMAINS_OPTIONS— the court instances and legal domains a query can filter onECHR_ARTICLES_OPTIONS— the Convention articles
Those are values rather than types, so this package is not quite "types only". They are here because they describe what the API accepts, and a consumer forced to redefine them would be redefining the contract.
Versioning
This package describes somebody else's API. When that API changes, this changes with it, and every client should move together. Treat a change here as a change to all of them.
