mirror of
https://github.com/zulip/zulip.git
synced 2025-11-08 07:52:19 +00:00
api docs: Refactor get_single_user to use get_user_by_id.
This refactors get_single_user to use get_user_by_id instead of call_endpoint. Doing so is only possible now that we've upgraded python-zulip-api to a version with the new function.
This commit is contained in:
committed by
GitHub
parent
f62f8c9238
commit
1388a1d2b1
@@ -223,23 +223,14 @@ def get_single_user(client):
|
|||||||
# {code_example|start}
|
# {code_example|start}
|
||||||
# Fetch details on a user given a user ID
|
# Fetch details on a user given a user ID
|
||||||
user_id = 8
|
user_id = 8
|
||||||
url = 'users/' + str(user_id)
|
result = client.get_user_by_id(user_id)
|
||||||
result = client.call_endpoint(
|
|
||||||
url=url,
|
|
||||||
method='GET'
|
|
||||||
)
|
|
||||||
# {code_example|end}
|
# {code_example|end}
|
||||||
validate_against_openapi_schema(result, '/users/{user_id}', 'get', '200')
|
validate_against_openapi_schema(result, '/users/{user_id}', 'get', '200')
|
||||||
|
|
||||||
# {code_example|start}
|
# {code_example|start}
|
||||||
# If you'd like data on custom profile fields, you can request them as follows:
|
# If you'd like data on custom profile fields, you can request them as follows:
|
||||||
result = client.call_endpoint(
|
result = client.get_user_by_id(user_id, {'include_custom_profile_fields': True})
|
||||||
url=url,
|
|
||||||
method='GET',
|
|
||||||
request={'include_custom_profile_fields': True}
|
|
||||||
)
|
|
||||||
# {code_example|end}
|
# {code_example|end}
|
||||||
|
|
||||||
validate_against_openapi_schema(result, '/users/{user_id}', 'get', '200')
|
validate_against_openapi_schema(result, '/users/{user_id}', 'get', '200')
|
||||||
|
|
||||||
@openapi_test_function("/users/{user_id}:delete")
|
@openapi_test_function("/users/{user_id}:delete")
|
||||||
|
|||||||
Reference in New Issue
Block a user