Skip to content

Commit d2323bd

Browse files
api: Add sendSubmessage.
Co-authored-by: Isham Mahajan <[email protected]>
1 parent a33c3dd commit d2323bd

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/api/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import toggleMobilePushSettings from './settings/toggleMobilePushSettings';
4040
import createStream from './streams/createStream';
4141
import getStreams from './streams/getStreams';
4242
import updateStream from './streams/updateStream';
43+
import sendSubmessage from './submessages/sendSubmessage';
4344
import getSubscriptions from './subscriptions/getSubscriptions';
4445
import subscriptionAdd from './subscriptions/subscriptionAdd';
4546
import subscriptionRemove from './subscriptions/subscriptionRemove';
@@ -86,6 +87,7 @@ export {
8687
createStream,
8788
getStreams,
8889
updateStream,
90+
sendSubmessage,
8991
getSubscriptions,
9092
setTopicMute,
9193
subscriptionAdd,

src/api/submessages/sendSubmessage.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* @flow strict-local */
2+
3+
import type { ApiResponse, Auth } from '../transportTypes';
4+
import { apiPost } from '../apiFetch';
5+
6+
/** See https://zulip.readthedocs.io/en/latest/subsystems/widgets.html#poll-todo-lists-and-games */
7+
// `msg_type` only exists as widget at the moment, see #3205.
8+
export default async (auth: Auth, messageId: number, content: string): Promise<ApiResponse> =>
9+
apiPost(auth, 'submessage', {
10+
message_id: messageId,
11+
msg_type: 'widget',
12+
content,
13+
});

0 commit comments

Comments
 (0)