mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 22:43:42 +00:00
api: Document POST ../messages/{message_id}/reactions endpoint.
This refactors add_reaction in python_examples.py to use the
openapi_test_function decorator and validate result with
validate_against_openapi_schema. Minor changes have been made to the
OpenAPI format data for /messages/{message_id}/reactions endpoint.
This also adds add-emoji.md to templates/zerver/api and adds
add-emoji to rest-endpoints.md (templates/zerver/help/include).
This commit is contained in:
@@ -698,25 +698,26 @@ def send_message(client):
|
||||
|
||||
return message_id
|
||||
|
||||
@openapi_test_function("/messages/{message_id}/reactions:post")
|
||||
def add_reaction(client, message_id):
|
||||
# type: (Client, int) -> None
|
||||
# {code_example|start}
|
||||
# Add an emoji reaction
|
||||
request = {
|
||||
'message_id': str(message_id),
|
||||
'emoji_name': 'joy',
|
||||
'emoji_code': '1f602',
|
||||
'emoji_type': 'unicode_emoji'
|
||||
'emoji_name': 'octopus',
|
||||
}
|
||||
result = client.add_reaction(request)
|
||||
|
||||
assert result['result'] == 'success'
|
||||
result = client.add_reaction(request)
|
||||
# {code_example|end}
|
||||
validate_against_openapi_schema(result, '/messages/{message_id}/reactions', 'post', '200')
|
||||
|
||||
@openapi_test_function("/messages/{message_id}/reactions:delete")
|
||||
def remove_reaction(client, message_id):
|
||||
# type: (Client, int) -> None
|
||||
request = {
|
||||
'message_id': str(message_id),
|
||||
'emoji_name': 'joy',
|
||||
'emoji_code': '1f602',
|
||||
'emoji_name': 'octopus',
|
||||
'reaction_type': 'unicode_emoji'
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user