Skip to content

Commit 45d0812

Browse files
committed
wip(factory-reset): Add route /v1/pod/config/dashboard-address
1 parent d0ccb60 commit 45d0812

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+935
-322
lines changed

docs/openapi/features/pod-config.yaml

+140-29
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
11
paths:
2+
init_pod_config:
3+
tags: [Init, "Pod / Configuration"]
4+
summary: Init Pod config
5+
description: Initialize the configuration of the Prose Pod.
6+
operationId: init_pod_config
7+
security: []
8+
requestBody:
9+
required: true
10+
content:
11+
application/json:
12+
schema: { $ref: "#/components/schemas/InitPodConfigRequest" }
13+
responses:
14+
"201":
15+
description: Created
16+
content:
17+
application/json:
18+
schema: { $ref: "#/components/schemas/PodConfig" }
19+
headers:
20+
Location: { $ref: "../shared.yaml#/components/headers/Location" }
21+
"401": { $ref: "../shared.yaml#/components/responses/Unauthorized" }
22+
"403": { $ref: "../shared.yaml#/components/responses/Forbidden" }
23+
"409": { $ref: "#/components/responses/PodConfigAlreadyInitialized" }
24+
"422": { $ref: "../shared.yaml#/components/responses/UnprocessableEntity" }
225
get_pod_config:
326
tags: ["Pod / Configuration"]
427
summary: Get Pod config
@@ -15,7 +38,7 @@ paths:
1538
"401": { $ref: "../shared.yaml#/components/responses/Unauthorized" }
1639
"403": { $ref: "../shared.yaml#/components/responses/Forbidden" }
1740
set_pod_address:
18-
tags: [Init, "Pod / Configuration"]
41+
tags: ["Pod / Configuration"]
1942
summary: Set Pod address
2043
description: Tells the API how the Pod is publicly accessible.
2144
operationId: set_pod_address
@@ -24,34 +47,13 @@ paths:
2447
required: true
2548
content:
2649
application/json:
27-
schema:
28-
type: object
29-
required: []
30-
properties:
31-
ipv4:
32-
type: string
33-
example: 104.18.28.104
34-
ipv6:
35-
type: string
36-
example: 2606:4700::6812:1c68
37-
hostname:
38-
type: string
39-
example: crisp.chat
40-
example:
41-
hostname: crisp.chat
50+
schema: { $ref: "#/components/schemas/SetPodAddressRequest" }
4251
responses:
4352
"200":
4453
description: Success
4554
content:
4655
application/json:
47-
schema: { $ref: "#/components/schemas/PodAddress" }
48-
"201":
49-
description: Created
50-
content:
51-
application/json:
52-
schema: { $ref: "#/components/schemas/PodAddress" }
53-
headers:
54-
Location: { $ref: "../shared.yaml#/components/headers/Location" }
56+
schema: { $ref: "#/components/schemas/NetworkAddress" }
5557
"401": { $ref: "../shared.yaml#/components/responses/Unauthorized" }
5658
"403": { $ref: "../shared.yaml#/components/responses/Forbidden" }
5759
"422": { $ref: "../shared.yaml#/components/responses/UnprocessableEntity" }
@@ -62,23 +64,95 @@ paths:
6264
operationId: get_pod_address
6365
security:
6466
- BearerAuth: []
67+
responses:
68+
"200":
69+
description: Pod address has a value
70+
content:
71+
application/json:
72+
schema: { $ref: "#/components/schemas/NetworkAddress" }
73+
"204":
74+
description: Pod address has no value
75+
"401": { $ref: "../shared.yaml#/components/responses/Unauthorized" }
76+
"403": { $ref: "../shared.yaml#/components/responses/Forbidden" }
77+
set_dashboard_address:
78+
tags: ["Pod / Configuration"]
79+
summary: Set Dashboard address
80+
description: Tells the API how the Dashboard is publicly accessible.
81+
operationId: set_dashboard_address
82+
security: []
83+
requestBody:
84+
required: true
85+
content:
86+
application/json:
87+
schema: { $ref: "#/components/schemas/SetDashboardAddressRequest" }
6588
responses:
6689
"200":
6790
description: Success
6891
content:
6992
application/json:
70-
schema: { $ref: "#/components/schemas/PodAddress" }
71-
"412": { $ref: "#/components/responses/PodAddressNotInitialized" }
93+
schema: { $ref: "#/components/schemas/NetworkAddress" }
94+
"401": { $ref: "../shared.yaml#/components/responses/Unauthorized" }
95+
"403": { $ref: "../shared.yaml#/components/responses/Forbidden" }
96+
"422": { $ref: "../shared.yaml#/components/responses/UnprocessableEntity" }
97+
get_dashboard_address:
98+
tags: ["Pod / Configuration"]
99+
summary: Get Dashboard address
100+
description: Get the current address of the Prose Pod Dashboard.
101+
operationId: get_dashboard_address
102+
security:
103+
- BearerAuth: []
104+
responses:
105+
"200":
106+
description: Dashboard address has a value
107+
content:
108+
application/json:
109+
schema: { $ref: "#/components/schemas/NetworkAddress" }
110+
"204":
111+
description: Dashboard address has no value
72112
"401": { $ref: "../shared.yaml#/components/responses/Unauthorized" }
73113
"403": { $ref: "../shared.yaml#/components/responses/Forbidden" }
74114
components:
75115
schemas:
116+
InitPodConfigRequest:
117+
type: object
118+
required:
119+
- address
120+
- dashboard_address
121+
properties:
122+
address: { $ref: "#/components/schemas/SetPodAddressRequest" }
123+
dashboard_address: { $ref: "#/components/schemas/SetDashboardAddressRequest" }
124+
SetNetworkAddressRequest:
125+
type: object
126+
required: []
127+
properties:
128+
ipv4:
129+
type: string
130+
example: 104.18.28.104
131+
ipv6:
132+
type: string
133+
example: 2606:4700::6812:1c68
134+
hostname:
135+
type: string
136+
example: crisp.chat
137+
SetPodAddressRequest:
138+
$ref: "#/components/schemas/SetNetworkAddressRequest"
139+
example:
140+
hostname: crisp.chat
141+
SetDashboardAddressRequest:
142+
$ref: "#/components/schemas/SetNetworkAddressRequest"
143+
example:
144+
hostname: admin.prose.crisp.chat
76145
PodConfig:
77146
type: object
78147
required: []
79148
properties:
80-
address: { $ref: "#/components/schemas/PodAddress" }
81-
PodAddress:
149+
address:
150+
$ref: "#/components/schemas/NetworkAddress"
151+
type: [object, "null"]
152+
dashboard_address:
153+
$ref: "#/components/schemas/NetworkAddress"
154+
type: [object, "null"]
155+
NetworkAddress:
82156
type: object
83157
required:
84158
- type
@@ -99,10 +173,47 @@ components:
99173
type: Dynamic
100174
hostname: crisp.chat
101175
responses:
176+
PodConfigNotInitialized:
177+
description: Pod config not initialized
178+
content:
179+
application/json:
180+
schema:
181+
$ref: "../shared.yaml#/components/schemas/Error"
182+
properties:
183+
error:
184+
const: pod_config_not_initialized
185+
example:
186+
error: pod_config_not_initialized
187+
PodConfigAlreadyInitialized:
188+
description: Pod config already initialized
189+
content:
190+
application/json:
191+
schema:
192+
$ref: "../shared.yaml#/components/schemas/Error"
193+
properties:
194+
error:
195+
const: pod_config_already_initialized
196+
example:
197+
error: pod_config_already_initialized
102198
PodAddressNotInitialized:
103199
description: Pod address not initialized
104200
content:
105201
application/json:
106-
schema: { $ref: "../shared.yaml#/components/schemas/Error" }
202+
schema:
203+
$ref: "../shared.yaml#/components/schemas/Error"
204+
properties:
205+
error:
206+
const: pod_address_not_initialized
107207
example:
108208
error: pod_address_not_initialized
209+
DashboardAddressNotInitialized:
210+
description: Dashboard address not initialized
211+
content:
212+
application/json:
213+
schema:
214+
$ref: "../shared.yaml#/components/schemas/Error"
215+
properties:
216+
error:
217+
const: dashboard_address_not_initialized
218+
example:
219+
error: dashboard_address_not_initialized

docs/openapi/features/workspace.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ components:
254254
$ref: "../shared.yaml#/components/schemas/Error"
255255
properties:
256256
error:
257-
enum: null
258257
const: workspace_not_initialized
259258
example:
260259
error: workspace_not_initialized
@@ -266,7 +265,6 @@ components:
266265
$ref: "../shared.yaml#/components/schemas/Error"
267266
properties:
268267
error:
269-
enum: null
270268
const: workspace_already_initialized
271269
example:
272270
error: workspace_already_initialized

docs/openapi/openapi.yaml

+11-7
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ paths:
1818
"/v1/login":
1919
post: { $ref: "features/auth.yaml#/paths/login" }
2020
"/v1/server/config":
21+
put: { $ref: "features/server-config.yaml#/paths/init_server_config" }
2122
head: { $ref: "features/server-config.yaml#/paths/is_server_initialized" }
2223
get: { $ref: "features/server-config.yaml#/paths/get_server_config" }
23-
put: { $ref: "features/server-config.yaml#/paths/init_server_config" }
2424
"/v1/server/config/file-upload-allowed":
2525
put: { $ref: "features/server-config.yaml#/paths/set_file_upload_allowed" }
2626
"/v1/server/config/file-storage-retention":
@@ -68,26 +68,30 @@ paths:
6868
"/v1/server/config/federation-friendly-servers":
6969
put: { $ref: "features/server-config.yaml#/paths/set_federation_friendly_servers" }
7070
"/v1/pod/config":
71+
put: { $ref: "features/pod-config.yaml#/paths/init_pod_config" }
7172
get: { $ref: "features/pod-config.yaml#/paths/get_pod_config" }
7273
"/v1/pod/config/address":
73-
get: { $ref: "features/pod-config.yaml#/paths/get_pod_address" }
7474
put: { $ref: "features/pod-config.yaml#/paths/set_pod_address" }
75+
get: { $ref: "features/pod-config.yaml#/paths/get_pod_address" }
76+
"/v1/pod/config/dashboard-address":
77+
put: { $ref: "features/pod-config.yaml#/paths/set_dashboard_address" }
78+
get: { $ref: "features/pod-config.yaml#/paths/get_dashboard_address" }
7579
"/v1/workspace":
76-
get: { $ref: "features/workspace.yaml#/paths/get_workspace" }
7780
put: { $ref: "features/workspace.yaml#/paths/init_workspace" }
81+
get: { $ref: "features/workspace.yaml#/paths/get_workspace" }
7882
patch: { $ref: "features/workspace.yaml#/paths/patch_workspace" }
7983
"/v1/workspace/name":
80-
get: { $ref: "features/workspace.yaml#/paths/get_workspace_name" }
8184
put: { $ref: "features/workspace.yaml#/paths/set_workspace_name" }
85+
get: { $ref: "features/workspace.yaml#/paths/get_workspace_name" }
8286
"/v1/workspace/accent-color":
83-
get: { $ref: "features/workspace.yaml#/paths/get_workspace_accent_color" }
8487
put: { $ref: "features/workspace.yaml#/paths/set_workspace_accent_color" }
88+
get: { $ref: "features/workspace.yaml#/paths/get_workspace_accent_color" }
8589
"/v1/workspace/icon":
86-
get: { $ref: "features/workspace.yaml#/paths/get_workspace_icon" }
8790
put: { $ref: "features/workspace.yaml#/paths/set_workspace_icon" }
91+
get: { $ref: "features/workspace.yaml#/paths/get_workspace_icon" }
8892
"/v1/invitations":
89-
get: { $ref: "features/invitations.yaml#/paths/get_invitations" }
9093
post: { $ref: "features/invitations.yaml#/paths/invite_member" }
94+
get: { $ref: "features/invitations.yaml#/paths/get_invitations" }
9195
"/v1/invitations/{invitationId}":
9296
get: { $ref: "features/invitations.yaml#/paths/get_invitation" }
9397
delete: { $ref: "features/invitations.yaml#/paths/invitation_cancel" }

docs/openapi/shared.yaml

+29-27
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,7 @@ components:
77
properties:
88
error:
99
type: string
10-
enum:
11-
- bad_request
12-
- database_error
13-
- internal_server_error
14-
- not_found
15-
- not_implemented
16-
- workspace_already_initialized
17-
- workspace_not_initialized
18-
- server_config_already_initialized
19-
- server_config_not_initialized
20-
- first_account_already_created
21-
- pod_address_not_initialized
22-
- unauthorized
23-
- forbidden
24-
- unknown
25-
- invitation_already_exists
26-
- member_already_exists
27-
- invalid_vcard
10+
example: server_config_not_initialized
2811
DurationDateLike:
2912
description: A duration in [ISO 8601
3013
format](https://en.wikipedia.org/wiki/ISO_8601#Durations) containing
@@ -139,7 +122,11 @@ components:
139122
description: Unauthorized
140123
content:
141124
application/json:
142-
schema: { $ref: "#/components/schemas/Error" }
125+
schema:
126+
$ref: "#/components/schemas/Error"
127+
properties:
128+
error:
129+
const: unauthorized
143130
example:
144131
error: unauthorized
145132
headers:
@@ -148,42 +135,57 @@ components:
148135
description: Forbidden
149136
content:
150137
application/json:
151-
schema: { $ref: "#/components/schemas/Error" }
138+
schema:
139+
$ref: "#/components/schemas/Error"
140+
properties:
141+
error:
142+
const: forbidden
152143
example:
153144
error: forbidden
154145
NotFound:
155146
description: Object not found
156147
content:
157148
application/json:
158-
schema: { $ref: "#/components/schemas/Error" }
149+
schema:
150+
$ref: "#/components/schemas/Error"
151+
properties:
152+
error:
153+
const: not_found
159154
example:
160155
error: not_found
161156
Gone:
162157
description: Object does not exist
163158
content:
164159
application/json:
165-
schema: { $ref: "#/components/schemas/Error" }
160+
schema:
161+
$ref: "#/components/schemas/Error"
162+
properties:
163+
error:
164+
const: not_found
166165
example:
167166
error: not_found
168167
UnprocessableEntity:
169168
description: Unprocessable entity
170169
content:
171170
application/json:
172-
schema: { $ref: "#/components/schemas/Error" }
171+
schema:
172+
$ref: "#/components/schemas/Error"
173+
properties:
174+
error:
175+
const: unknown
173176
example:
174177
error: unknown
175178
PreconditionRequired:
176179
description: Precondition required (check the docs to see which precondition)
177180
content:
178181
application/json:
179182
schema:
180-
type: object
181-
required:
182-
- error
183+
$ref: "#/components/schemas/Error"
183184
properties:
184185
error:
185-
type: string
186186
const: precondition_required
187+
example:
188+
error: precondition_required
187189
parameters:
188190
JidArray:
189191
description: A list of JIDs (as defined by [RFC 6120, section

0 commit comments

Comments
 (0)