-
Notifications
You must be signed in to change notification settings - Fork 384
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
Document a v2 api for setting tags on rooms #132
Changes from 5 commits
12e33a3
9b0d203
f8275e3
65066a7
b49472e
ad86426
f557e69
52f55e0
1498902
e9d3618
bcb8fac
fba3c04
3953006
d538140
3b390bf
299af67
48f35e1
e7fbe6f
2576949
c77b227
fcbb985
5bae15d
d39494b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -245,7 +245,12 @@ paths: | |
"user_id": "@alice:localhost" | ||
} | ||
], | ||
"visibility": "private" | ||
"visibility": "private", | ||
"private_user_data": [{ | ||
"type": "m.tag", | ||
"content": {"tags": ["work"]}, | ||
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost" | ||
}] | ||
} | ||
] | ||
} | ||
|
@@ -332,6 +337,16 @@ paths: | |
description: |- | ||
Whether this room is visible to the ``/publicRooms`` API | ||
or not." | ||
private_user_data: | ||
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. yay! :) |
||
type: array | ||
description: |- | ||
The private data that this user has attached to | ||
this room. | ||
items: | ||
title: Event | ||
type: object | ||
allOf: | ||
- "$ref": "core-event-schema/event.json" | ||
required: ["room_id", "membership"] | ||
required: ["end", "rooms", "presence"] | ||
404: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,6 +121,14 @@ paths: | |
e.g. typing. | ||
allOf: | ||
- $ref: "definitions/event_batch.json" | ||
private_user_data: | ||
title: Private User Data | ||
type: object | ||
description: |- | ||
The private data that this user has attached to | ||
this room. | ||
allOf: | ||
- $ref: "definitions/event_batch.json" | ||
invited: | ||
title: Invited | ||
type: object | ||
|
@@ -253,11 +261,18 @@ paths: | |
"ephemeral": { | ||
"events": [ | ||
{ | ||
"room_id": "!726s6s6q:example.com", | ||
"type": "m.typing", | ||
"content": {"user_ids": ["@alice:example.com"]} | ||
} | ||
] | ||
}, | ||
"private_user_data": { | ||
"events": [ | ||
{ | ||
"type": "m.tags", | ||
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. I am tempted to use "m.tags" too but the chosen terminology is "m.tag", no? 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. Fixed d39494b |
||
"content": {"tags": ["work"]} | ||
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. can we see example metadata on the tag? |
||
} | ||
] | ||
} | ||
} | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
swagger: '2.0' | ||
info: | ||
title: "Matrix Client-Server tag API" | ||
version: "1.0.0" | ||
host: localhost:8008 | ||
schemes: | ||
- https | ||
- http | ||
basePath: /_matrix/client/v2_alpha | ||
consumes: | ||
- application/json | ||
produces: | ||
- application/json | ||
securityDefinitions: | ||
accessToken: | ||
type: apiKey | ||
description: The user_id or application service access_token | ||
name: access_token | ||
in: query | ||
paths: | ||
"/user/{userId}/rooms/{roomId}/tags": | ||
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. What's the rationale for forcing clients to know their own 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. To match the /user/user_id/filter APIs |
||
get: | ||
summary: List the tags for a room. | ||
description: |- | ||
List the tags set by a user on a room. | ||
security: | ||
- accessToken: [] | ||
parameters: | ||
- in: path | ||
type: string | ||
name: userId | ||
required: true | ||
description: |- | ||
The id of the user to get tags for. The access token must be | ||
authorized to make requests for this user id. | ||
x-example: "@alice:example.com" | ||
- in: path | ||
type: string | ||
name: roomId | ||
required: true | ||
description: |- | ||
The id of the room to get tags for. | ||
x-example: "!726s6s6q:example.com" | ||
responses: | ||
200: | ||
description: | ||
The list of tags for the user for the room. | ||
schema: | ||
type: object | ||
properties: | ||
tags: | ||
type: array | ||
items: | ||
type: string | ||
examples: | ||
application/json: |- | ||
{ | ||
"tags": [ | ||
"work", | ||
"pinned" | ||
] | ||
} | ||
"/user/{userId}/rooms/{roomId}/tags/{tag}": | ||
put: | ||
summary: Add a tag to a room. | ||
description: |- | ||
Add a tag to the room. | ||
security: | ||
- accessToken: [] | ||
parameters: | ||
- in: path | ||
type: string | ||
name: userId | ||
required: true | ||
description: |- | ||
The id of the user to add a tag for. The access token must be | ||
authorized to make requests for this user id. | ||
x-example: "@alice:example.com" | ||
- in: path | ||
type: string | ||
name: roomId | ||
required: true | ||
description: |- | ||
The id of the room to add a tag to. | ||
x-example: "!726s6s6q:example.com" | ||
- in: path | ||
type: string | ||
name: tag | ||
required: true | ||
description: |- | ||
The tag to add. | ||
x-example: "work" | ||
- in: body | ||
name: body | ||
required: true | ||
description: |- | ||
An empty JSON object. | ||
schema: | ||
type: object | ||
example: |- | ||
{} | ||
responses: | ||
200: | ||
description: | ||
The tag was successfully added. | ||
schema: | ||
type: object | ||
examples: | ||
application/json: |- | ||
{} | ||
delete: | ||
summary: Remove a tag from the room. | ||
description: |- | ||
Remove a tag from the room. | ||
security: | ||
- access_token: [] | ||
parameters: | ||
- in: path | ||
type: string | ||
name: userId | ||
required: true | ||
description: |- | ||
The id of the user to remove a tag for. The access token must be | ||
authorized to make requests for this user id. | ||
x-example: "@alice:example.com" | ||
- in: path | ||
type: string | ||
name: roomId | ||
required: true | ||
description: |- | ||
The id of the room to remove a tag from. | ||
x-example: "!726s6s6q:example.com" | ||
- in: path | ||
type: string | ||
name: tag | ||
required: true | ||
description: |- | ||
The tag to remove. | ||
x-example: "work" | ||
responses: | ||
200: | ||
description: | ||
The tag was successfully removed | ||
schema: | ||
type: object | ||
examples: | ||
application/json: |- | ||
{} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "m.tag", | ||
"content": { | ||
"tags": [ | ||
"work" | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"type": "object", | ||
"title": "Tag Event", | ||
"description": "Informs the client of tags on a room.", | ||
"properties": { | ||
"type": { | ||
"type": "string", | ||
"enum": ["m.tag"] | ||
}, | ||
"content": { | ||
"type": "object", | ||
"properties": { | ||
"tags": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
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. Can we describe what keys a |
||
} | ||
} | ||
} | ||
}, | ||
"required": ["type", "content"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Room Tagging | ||
============ | ||
|
||
.. _module:tagging: | ||
|
||
Users can add tags to rooms. Tags are short strings used to label rooms, e.g. | ||
"work", "familly". A room may have multiple tags. Tags are only visible to the | ||
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. "family" 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. Fixed 3953006 |
||
user that set them but are shared across all their devices. | ||
|
||
Events | ||
------ | ||
|
||
The tags on a room are passed as single ``m.tag`` event in the | ||
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. s/passed/received/? what about v1 (especially given the v2 sync format for this isn't docced yet)? 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. Done f557e69 |
||
``private_user_data`` section of a room in v2 sync. | ||
|
||
{{m_tag_event}} | ||
|
||
Client Behaviour | ||
---------------- | ||
|
||
{{v2_tags_http_api}} | ||
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. It would be great to have recommendations on what the tag names should be. Particularly:
And as for ordering:
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.
Done 48f35e1 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.
Done e7fbe6f |
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.
Why are we duplicating room_id here, given we're already in a room block within the list of rooms?
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.
Cause we do it in the rest of v1 initial sync. I guess it doesn't hurt to be consistent with v2 sync here.
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.
Done f557e69