Skip to content

Commit 66644b5

Browse files
authored
Fce 1833 document api (#158)
Added API Reference page and a script to fetch the latest api documentation versions from relevant repositories. Resolves #135
1 parent 04781e7 commit 66644b5

File tree

21 files changed

+2956
-41
lines changed

21 files changed

+2956
-41
lines changed

.cspell.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
".git/**",
1717
"*.lock",
1818
"yarn.lock",
19-
"package-lock.json"
19+
"package-lock.json",
20+
"api/**"
2021
],
2122
"ignoreRegExpList": ["JSXComment", "/^\\s*```[\\s\\S]*?^\\s*```/gm"],
2223

.github/workflows/docs.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ jobs:
3030
steps:
3131
- name: Checkout
3232
uses: actions/checkout@v4
33+
with:
34+
token: ${{ secrets.SUBMODULES_TOKEN }}
35+
submodules: recursive
3336
# 👇 Build steps
3437
- name: Set up Node.js
3538
uses: actions/setup-node@v4

.github/workflows/static_check.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ jobs:
88
- name: checkout
99
uses: actions/checkout@v4
1010
with:
11-
submodules: "recursive"
11+
token: ${{ secrets.SUBMODULES_TOKEN }}
12+
submodules: recursive
1213
- name: init and update submodules
1314
run: git submodule update --init --recursive
1415
- name: Set up Node.js

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,12 @@
77
[submodule "packages/js-server-sdk"]
88
path = packages/js-server-sdk
99
url = https://github.com/fishjam-cloud/js-server-sdk.git
10+
[submodule "api/protos"]
11+
path = api/protos
12+
url = https://github.com/fishjam-cloud/protos
13+
[submodule "api/fishjam-server"]
14+
path = api/fishjam-server
15+
url = git@github.com:fishjam-cloud/fishjam.git
16+
[submodule "api/room-manager"]
17+
path = api/room-manager
18+
url = git@github.com:fishjam-cloud/room-manager.git

.prettierignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
build/*
22
node_modules/*
33
.yarn/*
4-
packages/*
4+
packages/*
5+
api/**
6+
versioned_docs/*/api/**

api/fishjam-server

Submodule fishjam-server added at d54f46c

api/protos

Submodule protos added at 2bcf37e

api/room-manager

Submodule room-manager added at 902c8c0

docs/api/reference.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
type: reference
3+
---
4+
5+
# Reference
6+
7+
Describes APIs for direct interaction with Fishjam.
8+
9+
Fishjam publishes documentation for the Sandbox API and Fishjam Server APIs.
10+
11+
## Sandbox API
12+
13+
[Sandbox API OpenAPI](https://github.com/fishjam-cloud/documentation/tree/main/static/api/room-manager-openapi.yaml)
14+
15+
See also: [What is the Sandbox API?](/explanation/sandbox-api-concept)
16+
17+
## Server
18+
19+
Fishjam Server provides a REST API for managing rooms and peers, and
20+
[Protobufs](https://protobuf.dev) for
21+
receiving structured live updates from the server.
22+
The notifications can be configured using Webhook or Websocket.
23+
24+
### REST API
25+
26+
[Server OpenAPI](https://github.com/fishjam-cloud/documentation/tree/main/static/api/fishjam-server-openapi.yaml)
27+
28+
### Protobufs
29+
30+
[Server Protobufs](https://github.com/fishjam-cloud/documentation/tree/main/static/api/server_notifications.proto)
31+
32+
#### Webhook
33+
34+
When using webhooks for receiving notifications, the `webhookUrl` must be passed
35+
in the `RoomConfig` options when creating a room.
36+
37+
The HTTP POST to the `webhookUrl` uses "application/x-protobuf" content type.
38+
The body is binary data, that represents encoded `ServerMessage`.
39+
40+
For more information see also [server setup documentation](/how-to/backend/server-setup#webhooks)
41+
42+
#### Websocket
43+
44+
After opening the Websocket connection to
45+
`https://fishjam.io/api/v1/connect/{fishjamId}/socket/server/websocket`,
46+
the first message that must be sent is an `AuthRequest`,
47+
with a valid Management Token.
48+
49+
Next, you can should subscribe to notifications by sending `SubscribeRequest` event with `SERVER_NOTIFICATION` event type.

docusaurus.config.ts

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,27 @@ function injectTypeDocSidebar(items) {
3737
return {
3838
...item,
3939
items: [
40-
{
41-
type: "category",
42-
label: "React Native SDK",
43-
link: { type: "doc", id: "api/mobile/index" },
44-
items: require("./docs/api/mobile/typedoc-sidebar.cjs"),
45-
},
46-
{
47-
type: "category",
48-
label: "React SDK",
49-
link: { type: "doc", id: "api/web/index" },
50-
items: require("./docs/api/web/typedoc-sidebar.cjs"),
51-
},
52-
{
53-
type: "category",
54-
label: "Server SDK for JS",
55-
link: { type: "doc", id: "api/server/index" },
56-
items: require("./docs/api/server/typedoc-sidebar.cjs"),
57-
},
40+
...[
41+
{
42+
type: "category",
43+
label: "React Native SDK",
44+
link: { type: "doc", id: "api/mobile/index" },
45+
items: require("./docs/api/mobile/typedoc-sidebar.cjs"),
46+
},
47+
{
48+
type: "category",
49+
label: "React SDK",
50+
link: { type: "doc", id: "api/web/index" },
51+
items: require("./docs/api/web/typedoc-sidebar.cjs"),
52+
},
53+
{
54+
type: "category",
55+
label: "Server SDK for JS",
56+
link: { type: "doc", id: "api/server/index" },
57+
items: require("./docs/api/server/typedoc-sidebar.cjs"),
58+
},
59+
],
60+
...item.items.filter((element) => element.type == "doc"),
5861
],
5962
};
6063
}

0 commit comments

Comments
 (0)