From 28d9e1cb3b7d41be80b8037083f739544bacf714 Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Sat, 5 Aug 2023 15:00:52 +0000 Subject: [PATCH] Add RoomCreateRequest schema. --- Schema/RoomCreateRequest.json | 120 ++++++++++++++++++++++++++++++++++ TODO.txt | 5 +- 2 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 Schema/RoomCreateRequest.json diff --git a/Schema/RoomCreateRequest.json b/Schema/RoomCreateRequest.json new file mode 100644 index 0000000..2f853ff --- /dev/null +++ b/Schema/RoomCreateRequest.json @@ -0,0 +1,120 @@ +{ + "guard": "TELODENDRIA_SCHEMA_ROOMCREATE_H", + "header": "Schema/RoomCreateRequest.h", + "types": { + "RoomVisibility": { + "fields": { + "public": { + "name": "ROOM_PUBLIC" + }, + "private": { + "name": "ROOM_PRIVATE" + } + }, + "type": "enum" + }, + "RoomCreateRequest": { + "fields": { + "invite": { + "type": "[string]" + }, + "room_version": { + "type": "string" + }, + "invite_3pid": { + "type": "[RoomInvite3Pid]" + }, + "topic": { + "type": "string" + }, + "visibility": { + "type": "RoomVisibility" + }, + "creation_content": { + "type": "object" + }, + "is_direct": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "initial_state": { + "type": "[RoomStateEvent]" + }, + "power_level_content_override": { + "type": "object" + }, + "room_alias_name": { + "type": "string" + }, + "preset": { + "type": "RoomCreatePreset" + } + }, + "type": "struct" + }, + "RoomInvite3Pid": { + "fields": { + "id_access_token": { + "required": true, + "type": "string" + }, + "address": { + "required": true, + "type": "string" + }, + "medium": { + "required": true, + "type": "Room3PidMedium" + }, + "id_server": { + "required": true, + "type": "string" + } + }, + "type": "struct" + }, + "Room3PidMedium": { + "fields": { + "msisdn": { + "name": "ROOM_3PID_MSISDN" + }, + "email": { + "name": "ROOM_3PID_EMAIL" + } + }, + "type": "enum" + }, + "RoomCreatePreset": { + "fields": { + "public_chat": { + "name": "ROOM_CREATE_PUBLIC" + }, + "trusted_private_chat": { + "name": "ROOM_CREATE_TRUSTED" + }, + "private_chat": { + "name": "ROOM_CREATE_PRIVATE" + } + }, + "type": "enum" + }, + "RoomStateEvent": { + "fields": { + "content": { + "required": true, + "type": "object" + }, + "state_key": { + "type": "string" + }, + "type": { + "required": true, + "type": "string" + } + }, + "type": "struct" + } + } +} diff --git a/TODO.txt b/TODO.txt index 3cfe040..6ca44b9 100644 --- a/TODO.txt +++ b/TODO.txt @@ -15,8 +15,8 @@ Milestone: v0.4.0 [ ] Update only certain values [~] Client-Server API - [~] 6: Filtering - [ ] Finish validating filters before saving them. + [x] 6: Filtering + [x] Finish validating filters before saving them. [~] 7: Events [x] Compute size of JSON object in Canonical JSON [x] Rename Sha2.h to just Sha; add Sha1() function @@ -49,6 +49,7 @@ Milestone: v0.4.0 [x] Make sure admin registration token is printed to log, not stdout. Unless they are the same, of course. [ ] Refactor Config to use j2s. +[ ] Refactor other endpoints to use j2s for validating request bodies. Milestone: v0.5.0 -----------------