-
-
Notifications
You must be signed in to change notification settings - Fork 19
Implement MSC3817: Add an action to create matrix rooms #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
dhenneke
wants to merge
1
commit into
matrix-org:master
Choose a base branch
from
nordeck:nic/feat/widgetapi-create-room
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2022 The Matrix.org Foundation C.I.C. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { ICreateRoom } from "./ICreateRoom"; | ||
import { IWidgetApiRequest, IWidgetApiRequestData } from "./IWidgetApiRequest"; | ||
import { IWidgetApiResponseData } from "./IWidgetApiResponse"; | ||
import { WidgetApiFromWidgetAction } from "./WidgetApiAction"; | ||
|
||
export interface ICreateRoomFromWidgetRequestData extends IWidgetApiRequestData, ICreateRoom { | ||
|
||
} | ||
|
||
export interface ICreateRoomFromWidgetActionRequest extends IWidgetApiRequest { | ||
action: WidgetApiFromWidgetAction.MSC3817CreateRoom; | ||
data: ICreateRoomFromWidgetRequestData; | ||
} | ||
|
||
export interface ICreateRoomFromWidgetResponseData extends IWidgetApiResponseData { | ||
room_id: string; // eslint-disable-line camelcase | ||
} | ||
|
||
export interface ICreateRoomFromWidgetActionResponse extends ICreateRoomFromWidgetActionRequest { | ||
response: ICreateRoomFromWidgetResponseData; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
/* | ||
* Copyright 2022 The Matrix.org Foundation C.I.C. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* The body of the `create_room` action. | ||
*/ | ||
export interface ICreateRoom { | ||
/** | ||
* Extra keys to be added to the content of the `m.room.create` event. The server will overwrite | ||
* the following keys: `creator`, `room_version`. | ||
*/ | ||
creation_content?: Record<string, unknown>; // eslint-disable-line camelcase | ||
|
||
/** | ||
* A list of state events to set in the new room. Takes precedence over events sent by `preset`, | ||
* but gets overridden by `name` and `topic`. | ||
*/ | ||
initial_state?: PartialStateEvent[]; // eslint-disable-line camelcase | ||
|
||
/** | ||
* A list of user IDs to invite to the room. | ||
*/ | ||
invite?: string[]; | ||
|
||
/** | ||
* A list of objects representing third party IDs to invite into the room. | ||
*/ | ||
invite_3pid?: Array<{ // eslint-disable-line camelcase | ||
address: string; | ||
id_access_token: string; // eslint-disable-line camelcase | ||
id_server: string; // eslint-disable-line camelcase | ||
medium: string; | ||
}>; | ||
|
||
/** | ||
* The flag makes the server set the `is_direct` flag on the `m.room.member` events sent to the | ||
* users in `invite` and `invite_3pid`. | ||
*/ | ||
is_direct?: boolean, // eslint-disable-line camelcase | ||
|
||
/** | ||
* If included, an `m.room.name` event will be sent into the room to indicate the name of the | ||
* room. | ||
*/ | ||
name?: string, | ||
|
||
/** | ||
* The power level content to override in the default power level event. This object is applied | ||
* on top of the generated `m.room.power_levels` event content prior to it being sent to the room. | ||
* Defaults to overriding nothing. | ||
*/ | ||
power_level_content_override?: PowerLevelsEventContent, // eslint-disable-line camelcase | ||
|
||
/** | ||
* Convenience parameter setting various default state events based on a preset. | ||
* | ||
* If unspecified, the server should use the `visibility` to determine which preset to use. | ||
*/ | ||
preset?: 'private_chat' | 'trusted_private_chat' | 'public_chat', | ||
|
||
/** | ||
* The desired room alias **local part**. | ||
*/ | ||
room_alias_name?: string, // eslint-disable-line camelcase | ||
|
||
/** | ||
* The room version to set for the room. If not provided, the homeserver is to use its configured | ||
* default. | ||
*/ | ||
room_version?: string, // eslint-disable-line camelcase | ||
|
||
/** | ||
* If this is included, an `m.room.topic` event will be sent into the room to indicate the topic | ||
* for the room. | ||
*/ | ||
topic?: string, | ||
|
||
/** | ||
* A `public` visibility indicates that the room will be shown in the published room list. A | ||
* `private` visibility will hide the room from the published room list. Rooms default to | ||
* `private` visibility if this key is not included. | ||
*/ | ||
visibility?: 'public' | 'private', | ||
} | ||
|
||
/** | ||
* A state event that is used to define the initial state of a newly created room. | ||
*/ | ||
export interface PartialStateEvent { | ||
type: string; | ||
content: unknown; | ||
state_key: string; // eslint-disable-line camelcase | ||
} | ||
|
||
/** | ||
* The content definition for m.room.power_levels events | ||
* @category Matrix event contents | ||
* @see PowerLevelsEvent | ||
*/ | ||
export interface PowerLevelsEventContent { | ||
/** | ||
* The power level required to ban. Default 50. | ||
*/ | ||
ban?: number; | ||
/** | ||
* A map of event types to the power level required to send them. | ||
*/ | ||
events?: { | ||
[eventType: string]: number; | ||
}; | ||
/** | ||
* The power level required to send events in the room. Default 50. | ||
*/ | ||
events_default?: number; // eslint-disable-line camelcase | ||
/** | ||
* The power level required to invite users to the room. Default 50. | ||
*/ | ||
invite?: number; | ||
/** | ||
* The power level required to kick users from the room. Default 50. | ||
*/ | ||
kick?: number; | ||
/** | ||
* The power level required to redact other people's events in the room. Default 50. | ||
*/ | ||
redact?: number; | ||
/** | ||
* The power level required to send state events in the room. Default 50. | ||
*/ | ||
state_default?: number; // eslint-disable-line camelcase | ||
/** | ||
* A map of user IDs to power levels. | ||
*/ | ||
users?: { | ||
[userId: string]: number; | ||
}; | ||
/** | ||
* The power level of users not listed in `users`. Default 0. | ||
*/ | ||
users_default?: number; // eslint-disable-line camelcase | ||
/** | ||
* Power levels required to send certain kinds of notifications. | ||
*/ | ||
notifications?: { | ||
/** | ||
* The power level required to send "@room" notifications. Default 50. | ||
*/ | ||
room?: number; | ||
}; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6