-
Notifications
You must be signed in to change notification settings - Fork 385
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
Widgets, the spec #2764
Draft
turt2live
wants to merge
46
commits into
old_master
Choose a base branch
from
travis/widgets
base: old_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
Widgets, the spec #2764
Changes from 38 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
b71f892
Start a template for a widgets spec
turt2live fb13f49
Specify what the different widget kinds are
turt2live bf646d0
Add a section on rendering
turt2live 826ce02
Start specifying widget types
turt2live 03d64bd
Specify Jitsi widgets
turt2live 65a290a
Specify TradingView widgets
turt2live d2bfe5d
Clarify that widgets are an optional feature
turt2live 71cb98a
Fix understanding of what a "client" is in the context of widgets
turt2live ee14c27
Specify Spotify widgets
turt2live fa7334f
Specify Video (YouTube) widgets
turt2live ea57956
Specify Google Docs widgets
turt2live 2ce44f6
Specify Google Calendar widgets
turt2live 4cfd97f
Specify Etherpad widgets
turt2live afa3817
Specify Grafana widgets
turt2live 09261b3
Specify Stickerpicker widgets
turt2live 927f4c0
Specify Custom (default) widgets
turt2live fa3e85f
Add a note about widget wrappers
turt2live 8c237c4
Mention that invalid `data` means the widget is custom
turt2live db96e6c
Fix API Standards heading
turt2live 6552523
Record the remaining security considerations so far
turt2live 2c08043
Move custom widgets up to indicate their importance
turt2live 7a6e09b
Early specification for the Widget API
turt2live 2479ee5
Move widget data examples into their schema definitions
turt2live 229a2ab
Clean up descriptions for API responses
turt2live ac74770
Specify the startup sequence for the widget API
turt2live b6d7ce5
Specify widget screenshots
turt2live 700336f
Clarify the iframe onLoad diagram for widgets
turt2live 84d304c
Specify the capabilities action
turt2live db08e54
Specify versioning for the widget API
turt2live c1c4f12
Add visibility to the API
turt2live 8aadcd3
Specify the content_loaded action
turt2live 26b0a3a
Specify stickers
turt2live 5d469eb
Use the request schema as a base for the response schema
turt2live fe53635
Specify always on screen (MSC1354)
turt2live b853bfa
Leave a note about how this spec tries to support auto-genned code
turt2live 84c627b
Remove simple widgets which serve no purpose
turt2live e2c45ce
Add a security aspect to the widget API
turt2live 5be2635
[swagger parsing] Support freeform objects
turt2live 63a7f7b
Move name property for sticker action up a level
turt2live c9d72d3
Move description up too
turt2live 87f6144
Specify MSC1960
turt2live 538864d
Fix sticky action examples
turt2live cdd48e2
Merge branch 'master' into travis/widgets
turt2live 4b6bf32
Specify avatar_url per MSC2765
turt2live d5927ec
Specify matrix_widget_id template variable per MSC2774
turt2live b910b89
Apply suggestions from code review
turt2live 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 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,41 @@ | ||
# Copyright 2020 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. | ||
|
||
type: object | ||
title: WidgetApiErrorResponse | ||
description: |- | ||
Schema definition for an error response in the Widget API. This is a regular ``WidgetApiResponse`` | ||
object with the ``response`` specified as follows. | ||
allOf: | ||
- $ref: "./api_response.yaml" | ||
properties: | ||
response: | ||
type: object | ||
title: WidgetErrorResponseData | ||
description: |- | ||
The response data. | ||
properties: | ||
error: | ||
type: object | ||
title: WidgetApiError | ||
description: |- | ||
Information about the error that happened. | ||
properties: | ||
message: | ||
type: string | ||
description: |- | ||
Human-readable string for the cause of the error. | ||
example: "Failed to process request: Server returned 500 error" | ||
required: ['message'] | ||
required: ['error'] |
This file contains 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,55 @@ | ||
# Copyright 2020 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. | ||
|
||
type: object | ||
title: WidgetApiRequest | ||
description: |- | ||
Schema definition for a widget request object over the Widget API. | ||
properties: | ||
api: | ||
type: string | ||
enum: [fromWidget, toWidget] | ||
description: |- | ||
The API for which the request is to be sent over. | ||
example: "fromWidget" | ||
requestId: | ||
type: string | ||
description: |- | ||
An opaque string which uniquely identifies the request in the context of the session. | ||
example: "generated-id-1234" | ||
Comment on lines
+20
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is it that the widget API uses |
||
action: | ||
type: string | ||
description: |- | ||
The action to send to the other party. Custom actions can be sent using the Java package | ||
naming convention as a namespace. | ||
example: "com.example.say_hello" | ||
widgetId: | ||
type: string | ||
description: |- | ||
The widget's ID. | ||
example: "20200827_WidgetExample" | ||
data: | ||
type: object | ||
description: |- | ||
The request data. | ||
additionalProperties: true | ||
example: { | ||
"request-param": "value" | ||
} | ||
required: | ||
- api | ||
- requestId | ||
- action | ||
- widgetId | ||
- data |
This file contains 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,51 @@ | ||
# Copyright 2020 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. | ||
|
||
type: object | ||
title: WidgetApiResponse | ||
description: |- | ||
Schema definition for a widget response object over the Widget API. | ||
|
||
.. Note:: | ||
This is intentionally designed to allow API users to copy the request object | ||
verbatim and simply append their ``response``. | ||
|
||
allOf: | ||
- $ref: "./api_request.yaml" | ||
properties: | ||
response: | ||
type: object | ||
description: |- | ||
The response data. | ||
additionalProperties: true | ||
example: { | ||
"response-param": "value" | ||
} | ||
# We define other properties from the api_request.yaml schema to override their descriptions | ||
# for context purposes | ||
api: | ||
type: string | ||
enum: [fromWidget, toWidget] | ||
description: The API the request was sent over. | ||
example: "fromWidget" | ||
requestId: | ||
type: string | ||
description: The request ID supplied in the original request. | ||
example: "generated-id-1234" | ||
action: | ||
type: string | ||
description: The action which was invoked. | ||
example: "com.example.say_hello" | ||
required: | ||
- response |
This file contains 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,32 @@ | ||
# Copyright 2020 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. | ||
|
||
type: object | ||
title: CapabilitiesActionBase | ||
properties: | ||
api: | ||
type: string | ||
enum: ["toWidget"] | ||
description: "" # The enum will result in this being "Must be $0" | ||
example: "toWidget" | ||
action: | ||
type: string | ||
enum: ["capabilities"] | ||
description: "" # The enum will result in this being "Must be $0" | ||
example: "capabilities" | ||
data: | ||
type: object | ||
description: |- | ||
An empty data object (no request parameters). | ||
example: {} |
This file contains 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,22 @@ | ||
# Copyright 2020 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. | ||
|
||
type: object | ||
title: CapabilitiesActionRequest | ||
description: |- | ||
Schema definition for a ``toWidget`` API request with action of ``capabilities``. | ||
allOf: | ||
- $ref: "./api_request.yaml" | ||
- $ref: "./capabilities_action.yaml" | ||
properties: {} |
This file contains 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 2020 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. | ||
|
||
type: object | ||
title: CapabilitiesActionResponse | ||
description: |- | ||
Schema definition for a response to a ``CapabilitiesActionRequest``. | ||
allOf: | ||
- $ref: "./api_response.yaml" | ||
- $ref: "./capabilities_action_request.yaml" | ||
properties: | ||
response: | ||
type: object | ||
description: |- | ||
The response data. | ||
title: CapabilitiesActionResponseData | ||
properties: | ||
capabilities: | ||
type: array | ||
items: | ||
type: string | ||
description: |- | ||
The list of requested capabilities. An empty array indicates that no capabilities are | ||
requested. | ||
example: ["m.capabilitity.screenshot", "m.sticker"] | ||
required: ['capabilities'] |
This file contains 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,32 @@ | ||
# Copyright 2020 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. | ||
|
||
type: object | ||
title: ContentLoadedActionBase | ||
properties: | ||
api: | ||
type: string | ||
enum: ["fromWidget"] | ||
description: "" # The enum will result in this being "Must be $0" | ||
example: "fromWidget" | ||
action: | ||
type: string | ||
enum: ["content_loaded"] | ||
description: "" # The enum will result in this being "Must be $0" | ||
example: "content_loaded" | ||
data: | ||
type: object | ||
description: |- | ||
An empty data object (no request parameters). | ||
example: {} |
22 changes: 22 additions & 0 deletions
22
api/widgets/definitions/content_loaded_action_request.yaml
This file contains 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,22 @@ | ||
# Copyright 2020 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. | ||
|
||
type: object | ||
title: ContentLoadedActionRequest | ||
description: |- | ||
Schema definition for a ``fromWidget`` API request with action of ``content_loaded``. | ||
allOf: | ||
- $ref: "./api_request.yaml" | ||
- $ref: "./content_loaded_action.yaml" | ||
properties: {} |
27 changes: 27 additions & 0 deletions
27
api/widgets/definitions/content_loaded_action_response.yaml
This file contains 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,27 @@ | ||
# Copyright 2020 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. | ||
|
||
type: object | ||
title: ContentLoadedActionResponse | ||
description: |- | ||
Schema definition for a response to a ``ContentLoadedActionRequest``. | ||
allOf: | ||
- $ref: "./api_response.yaml" | ||
- $ref: "./content_loaded_action_request.yaml" | ||
properties: | ||
response: | ||
type: object | ||
description: |- | ||
An empty response body to acknowledge the request. | ||
example: {} |
This file contains 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,31 @@ | ||
# Copyright 2020 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. | ||
|
||
type: object | ||
title: CustomWidgetData | ||
description: |- | ||
Definition for a widget's ``data`` when using a ``type`` of ``m.custom`` or using an | ||
unknown/unsupported ``type``. Currently no requirements are specified. | ||
properties: | ||
url: | ||
type: string | ||
description: |- | ||
The URL for the embedded content. Required only if the widget's URL does not match | ||
the embedded content, before templating ocurrs. | ||
|
||
Clients should note that not all widgets which get interpretted as custom widgets | ||
will have this property, though all widgets are required to have a higher level ``url`` | ||
which can be used to display them. As such, requirements for this field being present | ||
SHOULD only be enforced upon widgets with an explicit ``type`` of ``m.custom``. | ||
example: "https://matrix.org" |
Oops, something went wrong.
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.
This should be updated to say
error
and omit theresponse
object in the WidgetApiErrorResponse.