Skip to content

Commit 5d28d1f

Browse files
authored
Document and update menu order
#109
2 parents b58eaff + e56e3b9 commit 5d28d1f

File tree

13 files changed

+109
-101
lines changed

13 files changed

+109
-101
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
Open Terms Archive documentation.
22

3+
## Styleguide
4+
5+
### Order of menu sections
6+
7+
Pages and sections are ordered on the “end user” to “core team member” spectrum: the more up a page is in the menu, the more it is targeted at consumer end users, the more low it is the more it is targeted at committed contributors.
8+
39
## Installation
410

511
### Dependencies

content/api.md

Lines changed: 0 additions & 94 deletions
This file was deleted.

content/api/_index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: API
3+
weight: 7
4+
---

content/api/collection.en.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: Collection
3+
weight: 2
4+
---
5+
6+
# Collection Web API [Beta]
7+
8+
As Open Terms Archive is decentralised, each instance embarks its own API. The documentation relevant to the specific version of the engine on that instance is provided on that instance itself.
9+
10+
The Collection API exposes JSON data over HTTP. Its [OpenAPI](https://swagger.io/specification/) specification can be found at `http://localhost:<port>/<basePath>/<API version>/docs`.
11+
12+
That endpoint exposes both the OpenAPI specification if the requested `Content-Type` is JSON, and a Swagger UI for visual and interactive documentation otherwise.
13+
14+
> For example, the [documentation](http://162.19.74.224/api/v1/docs) of the [Demo collection](https://github.com/OpenTermsArchive/demo-declarations) is publicly available for exploration.

content/api/federated.en.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: Federated
3+
weight: 3
4+
---
5+
6+
# Federated Web API [Beta]
7+
8+
Open Terms Archive is a decentralised system that tracks collections of services' terms across multiple servers. Each collection operates its own API, and the federated API unifies search and discovery across collections, fostering collaboration with external applications.
9+
10+
The Federated Web API exposes JSON data over HTTP. Its [documentation](http://51.89.136.45/v1/docs/) is provided in a dedicated, interactive interface.
11+
12+
That endpoint exposes both the [OpenAPI](https://swagger.io/specification/) specification if the requested `Content-Type` is JSON, and a Swagger UI for visual and interactive documentation otherwise.
13+
14+
## Beta
15+
16+
This API is offered as a preview, based on a first use case [defined](https://github.com/OpenTermsArchive/engine/issues/1016) with partner [ToS;DR](https://tosdr.org). Unexpected problems or missing functionality may arise. Please provide feedback through [issues](https://github.com/OpenTermsArchive/federated-api/issues) in the dedicated repository.
17+
18+
## Source code
19+
20+
The codebase for the Federated API is available on [`github.com/OpenTermsArchive/federated-api`](https://github.com/OpenTermsArchive/federated-api).
21+
22+
## Deploying
23+
24+
Deployment recipes are available in a [dedicated repository](https://github.com/OpenTermsArchive/deployment). Look at the [Federated API section](https://github.com/OpenTermsArchive/deployment#federated-api-application) on the README to know how to deploy the API.

content/api/node.en.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: Node
3+
weight: 1
4+
---
5+
6+
# Node.js API [Beta]
7+
8+
As a Node module dependency, the engine exposes a JavaScript API that can be called in your own code. The following modules are available.
9+
10+
## `fetch`
11+
12+
The `fetch` module gets the MIME type and content of a document from its URL
13+
14+
```js
15+
import fetch from '@opentermsarchive/engine/fetch';
16+
```
17+
18+
Documentation on how to use `fetch` is provided [as JSDoc](/jsdoc/index.html).
19+
20+
### Headless browser management
21+
22+
If you pass the `executeClientScripts` option to `fetch`, a headless browser will be used to download and execute the page before serialising its DOM. For performance reasons, the starting and stopping of the browser is your responsibility to avoid instantiating a browser on each fetch. Here is an example on how to use this feature:
23+
24+
```js
25+
import fetch, { launchHeadlessBrowser, stopHeadlessBrowser } from '@opentermsarchive/engine/fetch';
26+
27+
await launchHeadlessBrowser();
28+
await fetch({ executeClientScripts: true, ... });
29+
await fetch({ executeClientScripts: true, ... });
30+
await fetch({ executeClientScripts: true, ... });
31+
await stopHeadlessBrowser();
32+
```
33+
34+
The `fetch` module options are defined as a [`node-config` submodule](https://github.com/node-config/node-config/wiki/Sub-Module-Configuration). The default `fetcher` configuration can be overridden by adding a `fetcher` object to the local configuration file.
35+
36+
## `extract`
37+
38+
The `extract` module transforms HTML or PDF content into a Markdown string according to a declaration.
39+
40+
```js
41+
import extract from '@opentermsarchive/engine/extract';
42+
```
43+
44+
The `extract` function documentation is available [as JSDoc](/jsdoc/index.html).
45+
46+
## `SourceDocument`
47+
48+
The `SourceDocument` class encapsulates information about a terms' source document tracked by Open Terms Archive.
49+
50+
```js
51+
import SourceDocument from '@opentermsarchive/engine/sourceDocument';
52+
```
53+
54+
The `SourceDocument` format is defined [in source code](https://github.com/OpenTermsArchive/engine/tree/main/src/archivist/services/sourceDocument.js).

content/collections/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22
title: Collections
3-
weight: 3
3+
weight: 5
44
---

content/contributing-terms.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Contributing terms"
3-
weight: 3
3+
weight: 4
44
---
55

66
# Contributing terms

content/design-principles.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Design principles"
3-
weight: 5
3+
weight: 10
44
---
55

66
# Design principles

content/federation.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ A collection that **joins** the **federation** enjoys the following benefits:
1616
1. Visibility on the Open Terms Archive website lists of collections and datasets.
1717
2. Access to the Open Terms Archive GitHub organisation, administered by the Open Terms Archive core team.
1818
3. Collection logo provided by the Open Terms Archive core team.
19-
4. Referencing in the official [collections list](https://opentermsarchive.org/collections.json), enabling off-the-shelf discovery in the [Federated API]({{< relref "api" >}}).
19+
4. Referencing in the official [collections list](https://opentermsarchive.org/collections.json), enabling off-the-shelf discovery in the [Federated API]({{< relref "api/federated" >}}).
2020
5. Public announcement through all Open Terms Archive communication channels upon joining.
2121

2222
## Criteria

0 commit comments

Comments
 (0)