docs: Make update-stream use curl example system.

new_name and description params should be valid JSON
strings. The format of these params are marked as
json so that the curl example genenrator can convert
them into json strings.
This commit is contained in:
Vishnu KS
2019-10-18 12:17:27 +05:30
committed by Tim Abbott
parent e96d96b6e4
commit 0af7aa8db3
4 changed files with 6 additions and 7 deletions

View File

@@ -20,13 +20,7 @@ including:
{tab|curl}
``` curl
curl -X PATCH {{ api_url }}/v1/streams/{stream_id} \
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
-d 'new_name="Manchester United"' \
-d 'description="Biggest club in the world"' \
-d 'is_private=false'
```
{generate_code_example(curl, include=["new_name", "description", "is_private"])|/streams/{stream_id}:patch|example}
{end_tabs}

View File

@@ -140,6 +140,8 @@ cURL example.""".format(endpoint, method, param_name)
example_value = param.get("example", DEFAULT_EXAMPLE[param["schema"]["type"]])
if type(example_value) == bool:
example_value = str(example_value).lower()
if param["schema"].get("format", "") == "json":
example_value = json.dumps(example_value)
if curl_argument:
return " -d '{}={}'".format(param_name, example_value)
return example_value

View File

@@ -30,6 +30,7 @@ exclude_list = [
'add-linkifiers.md',
'get-events-from-queue.md',
'delete-queue.md',
'update-stream.md',
# Endpoint can be called only by administrators.
'create-user.md',
'remove-linkifiers.md',

View File

@@ -2502,6 +2502,7 @@ paths:
description: The new description for the stream.
schema:
type: string
format: json
example: "This stream is related to football dicsussions."
required: false
- name: new_name
@@ -2509,6 +2510,7 @@ paths:
description: The new name for the stream.
schema:
type: string
format: json
example: "Italy"
required: false
- name: is_private