From 5795e1cedaa001994847702193bd02e517e07c83 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Mon, 1 Jun 2015 10:44:03 +0100 Subject: [PATCH] Add profile API examples and extract examples for template usage. --- api/client-server/v1/profile.yaml | 16 ++++++++++++++++ templating/matrix_templates/units.py | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/api/client-server/v1/profile.yaml b/api/client-server/v1/profile.yaml index 622b463e..b3b5f05d 100644 --- a/api/client-server/v1/profile.yaml +++ b/api/client-server/v1/profile.yaml @@ -42,6 +42,9 @@ paths: responses: 200: description: The display name was set. + examples: + application/json: |- + {} schema: type: object # empty json object 429: @@ -59,6 +62,11 @@ paths: responses: 200: description: The display name for this user. + examples: + application/json: |- + { + "displayname": "Alice Margatroid" + } schema: type: object properties: @@ -91,6 +99,9 @@ paths: responses: 200: description: The avatar URL was set. + examples: + application/json: |- + {} schema: type: object # empty json object 429: @@ -108,6 +119,11 @@ paths: responses: 200: description: The avatar URL for this user. + examples: + application/json: |- + { + "avatar_url": "mxc://matrix.org/SDGdghriugerRg" + } schema: type: object properties: diff --git a/templating/matrix_templates/units.py b/templating/matrix_templates/units.py index 378ea65e..05396218 100644 --- a/templating/matrix_templates/units.py +++ b/templating/matrix_templates/units.py @@ -184,7 +184,10 @@ class MatrixUnits(Units): "code": 200, "http": "200 OK", "desc": res200["description"], - "params": res200params + "params": res200params, + "example": res200.get("examples", {}).get( + "application/json", "" + ) } endpoint["responses"].append(ok_res)