Skip to content
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

Update the room tagging documentation #1606

Merged
merged 3 commits into from
Aug 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 37 additions & 20 deletions api/client-server/tags.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ paths:
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.
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.
The ID of the room to get tags for.
x-example: "!726s6s6q:example.com"
responses:
200:
Expand All @@ -60,16 +60,26 @@ paths:
type: object
properties:
tags:
title: Tags
type: object
additionalProperties:
title: Tag
type: object
properties:
order:
type: number
format: float
description: |-
A number in a range ``[0,1]`` describing a relative
position of the room under the given tag.
additionalProperties: true
examples:
application/json: {
"tags": {
"m.favourite": {},
"u.Work": {"order": "1"},
"u.Customers": {}
}
"tags": {
"m.favourite": {"order": 0.1},
"u.Work": {"order": 0.7},
"u.Customers": {}
}
}
tags:
- User data
"/user/{userId}/rooms/{roomId}/tags/{tag}":
Expand All @@ -87,40 +97,48 @@ paths:
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.
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.
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"
x-example: "u.work"
- in: body
name: body
required: true
description: |-
Extra data for the tag, e.g. ordering.
schema:
type: object
properties:
order:
type: number
format: float
description: |-
A number in a range ``[0,1]`` describing a relative
position of the room under the given tag.
additionalProperties: true
example: {
"order": "1"}
"order": 0.25
}
responses:
200:
description:
The tag was successfully added.
schema:
type: object
examples:
application/json: {
}
application/json: {}
tags:
- User data
delete:
Expand All @@ -137,30 +155,29 @@ paths:
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.
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.
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"
x-example: "u.work"
responses:
200:
description:
The tag was successfully removed
The tag was successfully removed.
schema:
type: object
examples:
application/json: {
}
application/json: {}
tags:
- User data
1 change: 1 addition & 0 deletions changelogs/client_server/newsfragments/1606.clarification
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Clarify the room tag structure (thanks @KitsuneRal!)
2 changes: 1 addition & 1 deletion event-schemas/examples/m.tag
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "m.tag",
"content": {
"tags": {
"u.work": {"order": 1}
"u.work": {"order": 0.9}
}
}
}
10 changes: 9 additions & 1 deletion event-schemas/schema/m.tag
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@
"description": "The tags on the room and their contents.",
"additionalProperties": {
"title": "Tag",
"type": "object"
"type": "object",
"properties": {
"order": {
"type": "number",
"format": "float",
"description":
"A number in a range ``[0,1]`` describing a relative position of the room under the given tag."
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion specification/modules/tags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ with an ``order`` of ``0.2`` would be displayed before a room with an ``order``
of ``0.7``. If a room has a tag without an ``order`` key then it should appear
after the rooms with that tag that have an ``order`` key.

The name of a tag MUST not exceed 255 bytes.
The name of a tag MUST NOT exceed 255 bytes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh, this needs a better grammar :-S

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


The tag namespace is defined as follows:

Expand Down