mirror of https://github.com/zulip/zulip.git
openapi: Remove /users/me from pending endpoints.
This commit progress our efforts to reduce pending_endpoints
as well as to migrate away from templates/zerver/api/fixtures
and towards our OpenAPI documentation.
Similar to commit d62b75fc
.
This commit is contained in:
parent
08c2cc5883
commit
14c0a387cf
|
@ -5,19 +5,6 @@
|
|||
"queue_id": "1518820930:1",
|
||||
"result": "error"
|
||||
},
|
||||
"get-profile": {
|
||||
"client_id": "74c768b081076fdb3c4326256c17467e",
|
||||
"email": "iago@zulip.com",
|
||||
"full_name": "Iago",
|
||||
"is_admin": true,
|
||||
"is_bot": false,
|
||||
"max_message_id": 30,
|
||||
"msg": "",
|
||||
"pointer": -1,
|
||||
"result": "success",
|
||||
"short_name": "iago",
|
||||
"user_id": 5
|
||||
},
|
||||
"invalid-api-key": {
|
||||
"msg": "Invalid API key",
|
||||
"result": "error"
|
||||
|
|
|
@ -9,7 +9,7 @@ Get the profile of the user/bot that requests this endpoint.
|
|||
{start_tabs}
|
||||
{tab|python}
|
||||
|
||||
{generate_code_example(python)|get-profile|example}
|
||||
{generate_code_example(python)|/users/me:get|example}
|
||||
|
||||
{tab|js}
|
||||
|
||||
|
@ -56,4 +56,4 @@ The rest of the return values are quite self-descriptive.
|
|||
|
||||
A typical successful JSON response may look like:
|
||||
|
||||
{generate_code_example|get-profile|fixture}
|
||||
{generate_code_example|/users/me:get|fixture(200)}
|
||||
|
|
|
@ -205,12 +205,7 @@ def get_profile(client):
|
|||
result = client.get_profile()
|
||||
# {code_example|end}
|
||||
|
||||
fixture = FIXTURES['get-profile']
|
||||
check_if_equal = ['email', 'full_name', 'msg', 'result', 'short_name']
|
||||
check_if_exists = ['client_id', 'is_admin', 'is_bot', 'max_message_id',
|
||||
'pointer', 'user_id']
|
||||
test_against_fixture(result, fixture, check_if_equal=check_if_equal,
|
||||
check_if_exists=check_if_exists)
|
||||
validate_against_openapi_schema(result, '/users/me', 'get', '200')
|
||||
|
||||
def get_stream_id(client):
|
||||
# type: (Client) -> int
|
||||
|
@ -969,7 +964,7 @@ TEST_FUNCTIONS = {
|
|||
'/streams/{stream_id}:patch': update_stream,
|
||||
'/streams:get': get_streams,
|
||||
'/users:post': create_user,
|
||||
'get-profile': get_profile,
|
||||
'/users/me:get': get_profile,
|
||||
'add-subscriptions': add_subscriptions,
|
||||
'/users/{email}/presence:get': get_user_presence,
|
||||
'/users/me/presence:post': update_presence,
|
||||
|
|
|
@ -1048,6 +1048,99 @@ paths:
|
|||
"result": "success",
|
||||
"msg": ""
|
||||
}
|
||||
/users/me:
|
||||
get:
|
||||
description: Get the requesting user's profile data from the backend.
|
||||
security:
|
||||
- basicAuth: []
|
||||
responses:
|
||||
'200':
|
||||
description: Success
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/JsonSuccess'
|
||||
- properties:
|
||||
client_id:
|
||||
type: string
|
||||
description: NA
|
||||
example: "74c768b081076fdb3c4326256c17467e"
|
||||
email:
|
||||
type: string
|
||||
description: Email of the requesting user.
|
||||
example: "iago@zulip.com"
|
||||
full_name:
|
||||
type: string
|
||||
description: Full name of the requesting user.
|
||||
example: "Iago"
|
||||
is_admin:
|
||||
type: boolean
|
||||
description: A boolean indicating if the requesting user is an admin.
|
||||
example: true
|
||||
is_bot:
|
||||
type: boolean
|
||||
description: A boolean indicating if the requesting user is a bot.
|
||||
example: false
|
||||
max_message_id:
|
||||
type: integer
|
||||
description: NA.
|
||||
example: 30
|
||||
pointer:
|
||||
type: integer
|
||||
description: NA
|
||||
example: -1
|
||||
short_name:
|
||||
type: string
|
||||
description: Short name of the requesting user.
|
||||
example: "iago"
|
||||
user_id:
|
||||
type: integer
|
||||
description: The user's ID.
|
||||
example: 1
|
||||
- example:
|
||||
{
|
||||
"client_id": "74c768b081076fdb3c4326256c17467e",
|
||||
"email": "iago@zulip.com",
|
||||
"full_name": "Iago",
|
||||
"is_admin": true,
|
||||
"is_bot": false,
|
||||
"max_message_id": 30,
|
||||
"msg": "",
|
||||
"pointer": -1,
|
||||
"result": "success",
|
||||
"short_name": "iago",
|
||||
"user_id": 5
|
||||
}
|
||||
delete:
|
||||
description: Delete the requesting user from the realm.
|
||||
security:
|
||||
- basicAuth: []
|
||||
responses:
|
||||
'200':
|
||||
description: Bad Request
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/JsonSuccess'
|
||||
- example:
|
||||
{
|
||||
"msg": "",
|
||||
"result": "success",
|
||||
}
|
||||
'400':
|
||||
description: Bad Request
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/JsonError'
|
||||
- example:
|
||||
{
|
||||
"msg": "Cannot deactivate the only organization administrator",
|
||||
"result": "error"
|
||||
}
|
||||
/users/me/{stream_id}/topics:
|
||||
get:
|
||||
description: Get all the topics in a specific stream.
|
||||
|
|
|
@ -167,7 +167,6 @@ class OpenAPIArgumentsTest(ZulipTestCase):
|
|||
'/users/me/profile_data',
|
||||
'/users/me/pointer',
|
||||
'/users/me/presence',
|
||||
'/users/me',
|
||||
'/bot_storage',
|
||||
'/users/me/api_key/regenerate',
|
||||
'/default_streams',
|
||||
|
|
Loading…
Reference in New Issue