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