openapi: Add 'operationId' attribute to endpoints.

'operationId' helps code generators in naming functions and other purposes.
So name operationId of endpoints as their function names in python-zulip-api
if it exists else use most appropriate function name.

Part of #14100 .
This commit is contained in:
orientor 2020-05-08 18:06:10 +05:30 committed by Tim Abbott
parent 83f975e57e
commit 3467d2fe68
1 changed files with 53 additions and 5 deletions

View File

@ -41,12 +41,12 @@ security:
paths:
/fetch_api_key:
post:
operationId: fetch_api_key
description: |
Given a username and password, fetch the user's API key.
Used to authenticate the mobile and terminal apps when the server
has EmailAuthBackend or LDAPAuthBackend enabled.
operationId: zerver.views.auth.api_fetch_api_key
parameters:
- name: username
in: query
@ -72,6 +72,7 @@ paths:
$ref: '#/components/schemas/ApiKeyResponse'
/dev_fetch_api_key:
post:
operationId: dev_fetch_api_key
description: |
For easy testing of mobile apps and other clients and against Zulip
development servers, we support fetching a Zulip API key for any user
@ -103,6 +104,7 @@ paths:
$ref: '#/components/schemas/ApiKeyResponse'
/events:
get:
operationId: get_events
description: |
`GET {{ api_url }}/v1/events`
@ -217,6 +219,7 @@ paths:
schema:
$ref: '#/components/schemas/BadEventQueueIdError'
delete:
operationId: deregister
description: |
Delete a previously registered queue.
@ -238,6 +241,7 @@ paths:
$ref: '#/components/schemas/BadEventQueueIdError'
/get_stream_id:
get:
operationId: get_stream_id
description: |
Get the unique ID of a given stream.
@ -279,6 +283,7 @@ paths:
}
/mark_all_as_read:
post:
operationId: mark_all_as_read
description: |
Marks all of the current user's unread messages as read.
@ -292,6 +297,7 @@ paths:
$ref: '#/components/schemas/JsonSuccess'
/mark_stream_as_read:
post:
operationId: mark_stream_as_read
description: |
Mark all the unread messages in a stream as read.
parameters:
@ -306,6 +312,7 @@ paths:
$ref: '#/components/schemas/JsonSuccess'
/mark_topic_as_read:
post:
operationId: mark_topic_as_read
description: |
Mark all the unread messages in a topic as read.
parameters:
@ -328,6 +335,7 @@ paths:
$ref: '#/components/schemas/JsonSuccess'
/messages:
get:
operationId: get_messages
description: |
Fetch message history from a Zulip server.
@ -564,6 +572,7 @@ paths:
]
}
post:
operationId: send_message
description: |
Send a stream or a private message.
@ -635,6 +644,7 @@ paths:
}
/messages/{message_id}:
get:
operationId: get_raw_message
description: |
Get the raw content of a message.
@ -672,6 +682,7 @@ paths:
schema:
$ref: '#/components/schemas/InvalidMessageError'
patch:
operationId: update_message
description: |
Edit/update the content or topic of a message.
@ -727,6 +738,7 @@ paths:
"result": "error"
}
delete:
operationId: delete_message
description: |
Permanently delete a message.
@ -761,6 +773,7 @@ paths:
}
/messages/{message_id}/history:
get:
operationId: get_message_history
description: |
Fetch the message edit history of a previously edited message.
@ -822,6 +835,7 @@ paths:
$ref: '#/components/schemas/InvalidMessageError'
/messages/flags:
post:
operationId: update_message_flags
description: |
Add or remove flags in a list of messages.
@ -885,6 +899,7 @@ paths:
}
/messages/render:
post:
operationId: render_message
description: |
Render a message to HTML.
@ -912,6 +927,7 @@ paths:
}
/messages/{message_id}/reactions:
post:
operationId: add_reaction
description: |
Add an [emoji reaction](/help/emoji-reactions) to a message.
@ -941,6 +957,7 @@ paths:
}
delete:
operationId: remove_reaction
description: |
Remove an [emoji reaction](/help/emoji-reactions) from a message.
@ -969,6 +986,7 @@ paths:
}
/user_uploads:
post:
operationId: upload_file
description: |
Upload a single file and get the corresponding URI.
@ -1012,6 +1030,7 @@ paths:
}
/user_uploads/{realm_id_str}/{filename}:
get:
operationId: get_file_temporary_url
description: |
Get a temporary URL for access to the file that doesn't require authentication.
parameters:
@ -1054,6 +1073,7 @@ paths:
/users:
get:
operationId: get_users
description: |
Retrieve details on all users in the organization. Optionally
includes values of [custom profile field](/help/add-custom-profile-fields).
@ -1156,6 +1176,7 @@ paths:
]
}
post:
operationId: create_user
description: |
Create a new user account via the API.
@ -1215,6 +1236,7 @@ paths:
/users/{user_id}:
get:
operationId: get_user_by_id
description: |
Fetch details for a single user in the organization.
@ -1289,6 +1311,7 @@ paths:
}
patch:
operationId: update_user
description: |
Administrative endpoint to update the details of another user in the organization.
@ -1366,6 +1389,7 @@ paths:
}
delete:
operationId: deactivate_user_by_id
description: |
[Deactivates a
user](https://zulipchat.com/help/deactivate-or-reactivate-a-user)
@ -1426,6 +1450,7 @@ paths:
/users/{email}/presence:
get:
operationId: get_user_presence
description: |
Get the presence status for a specific user.
@ -1484,6 +1509,7 @@ paths:
}
/users/me:
get:
operationId: get_profile
description: |
Get basic data about the user/bot that requests this endpoint.
@ -1602,6 +1628,7 @@ paths:
}
}
delete:
operationId: deactivate_my_account
description: |
Delete the requesting user from the realm.
responses:
@ -1631,6 +1658,7 @@ paths:
}
/users/me/{stream_id}/topics:
get:
operationId: get_stream_topics
description: |
Get all the topics in a specific stream
@ -1693,6 +1721,7 @@ paths:
}
/users/me/subscriptions:
get:
operationId: list_subscriptions
description: |
Get all streams that the user is subscribed to.
@ -1700,7 +1729,6 @@ paths:
# operationId can be used to record which view function
# corresponds to an endpoint. TODO: Add these for more
# endpoints, and perhaps use this to provide links to implementations.
operationId: zerver.views.streams.list_subscriptions_backend
parameters:
- $ref: '#/components/parameters/IncludeSubscribers'
responses:
@ -1766,6 +1794,7 @@ paths:
]
}
post:
operationId: subscribe
description: |
Subscribe one or more users to one or more streams.
@ -1886,9 +1915,9 @@ paths:
]
}
patch:
operationId: update_subscriptions
description: |
Update which streams you are are subscribed to.
operationId: zerver.views.streams.update_subscriptions_backend
parameters:
- name: delete
in: query
@ -1984,6 +2013,7 @@ paths:
"result": "success"
}
delete:
operationId: unsubscribe
description: |
Unsubscribe yourself or other users from one or more streams.
@ -2041,6 +2071,7 @@ paths:
$ref: '#/components/schemas/NonExistingStreamError'
/users/me/subscriptions/muted_topics:
patch:
operationId: mute_topic
description: |
This endpoint mutes/unmutes a topic within a stream that the current
user is subscribed to. Muted topics are displayed faded in the Zulip
@ -2102,6 +2133,7 @@ paths:
}
/realm/emoji/{emoji_name}:
post:
operationId: upload_custom_emoji
description: |
This endpoint is used to upload a custom emoji for use in the user's
organization. Access to this endpoint depends on the
@ -2136,6 +2168,7 @@ paths:
/realm/emoji:
get:
operationId: get_realm_emoji
description: |
Get all the custom emoji in the user's organization.
@ -2174,6 +2207,7 @@ paths:
}
/users/me/subscriptions/properties:
post:
operationId: update_subscription_settings
description: |
This endpoint is used to update the user's personal settings for the
streams they are subscribed to, including muting, color, pinning, and
@ -2228,6 +2262,7 @@ paths:
}
/realm/filters:
get:
operationId: get_realm_filters
description: |
List all of an organization's configured
[linkifiers](/help/add-a-custom-linkification-filter), regular
@ -2273,6 +2308,7 @@ paths:
"result": "success"
}
post:
operationId: add_realm_filter
description: |
Configure [linkifiers](/help/add-a-custom-linkification-filter),
regular expression patterns that are automatically linkified when they
@ -2321,6 +2357,7 @@ paths:
}
/realm/filters/{filter_id}:
delete:
operationId: remove_realm_filter
description: |
Remove [linkifiers](/help/add-a-custom-linkification-filter), regular
expression patterns that are automatically linkified when they appear
@ -2345,6 +2382,7 @@ paths:
$ref: '#/components/schemas/JsonSuccess'
/register:
post:
operationId: register
description: |
This powerful endpoint can be used to register a Zulip "event queue"
(subscribed to certain types of "events", or updates to the messages and
@ -2466,6 +2504,7 @@ paths:
}
/server_settings:
get:
operationId: get_server_settings
description: |
Fetch global settings for a Zulip server.
@ -2604,6 +2643,7 @@ paths:
}
/settings/notifications:
patch:
operationId: update_notification_settings
description: |
This endpoint is used to edit the user's global notification settings.
See [this endpoint](/api/update-subscription-properties) for
@ -2819,6 +2859,7 @@ paths:
}
/streams:
get:
operationId: get_streams
description: |
Get all streams that the user has access to.
@ -2940,11 +2981,11 @@ paths:
}
/streams/{stream_id}:
delete:
operationId: delete_stream
description: |
[Delete the stream](/help/delete-a-stream) with the ID `stream_id`.
`DELETE {{ api_url }}/v1/streams/{stream_id}`
operationId: zerver.views.streams.deactivate_stream_backend
parameters:
- $ref: '#/components/parameters/StreamIdInPath'
responses:
@ -2977,6 +3018,7 @@ paths:
"result": "error"
}
patch:
operationId: update_stream
description: |
Configure the stream with the ID `stream_id`. This endpoint supports
an organization administrator editing any property of a stream,
@ -2988,7 +3030,6 @@ paths:
send](/help/stream-sending-policy).
`PATCH {{ api_url }}/v1/streams/{stream_id}`
operationId: zerver.views.streams.update_stream_backend
parameters:
- $ref: '#/components/parameters/StreamIdInPath'
- name: description
@ -3060,6 +3101,7 @@ paths:
}
/typing:
post:
operationId: set_typing_status
description: |
Send an event indicating that the user has started or stopped typing
on their client. See
@ -3106,6 +3148,7 @@ paths:
/user_groups/create:
post:
operationId: create_user_group
description: |
Create a new [user group](/help/user-groups).
@ -3166,6 +3209,7 @@ paths:
}
/user_groups/{group_id}:
patch:
operationId: update_user_group
description: |
Update the name or description of a [user group](/help/user-groups).
@ -3206,6 +3250,7 @@ paths:
"result": "error"
}
delete:
operationId: remove_user_group
description: |
Delete a [user group](/help/user-groups).
@ -3242,6 +3287,7 @@ paths:
/user_groups:
get:
operationId: get_user_groups
description: |
Fetches all of the user groups in the organization.
@ -3299,6 +3345,7 @@ paths:
description: Success
/rest-error-handling:
post:
operationId: rest_error_handling
description: |
Common error to many endpoints
responses:
@ -3317,6 +3364,7 @@ paths:
- $ref: '#/components/schemas/UserNotAuthorizedError'
/zulip-outgoing-webhook:
post:
operationId: zulip_outgoing_webhooks
description: |
Outgoing Webhooks allows to build or set up Zulip integrations which are
notified when certain types of messages are sent in Zulip.