mirror of https://github.com/zulip/zulip.git
api-docs: Update comments in javascript usage examples for channel.
Updates comments that are displayed in the javascript examples for various endpoints to use channel instead of stream. Part of stream to channel rename project.
This commit is contained in:
parent
7644c83cca
commit
af5d618879
|
@ -104,7 +104,7 @@ const send_test_message = async (client) => {
|
||||||
|
|
||||||
add_example("send_message", "/messages:post", 200, async (client, console) => {
|
add_example("send_message", "/messages:post", 200, async (client, console) => {
|
||||||
// {code_example|start}
|
// {code_example|start}
|
||||||
// Send a stream message
|
// Send a channel message
|
||||||
let params = {
|
let params = {
|
||||||
to: "social",
|
to: "social",
|
||||||
type: "stream",
|
type: "stream",
|
||||||
|
@ -171,7 +171,7 @@ add_example("get_messages", "/messages:get", 200, async (client, console) => {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
// Get the 100 last messages sent by "iago@zulip.com" to the stream "Verona"
|
// Get the 100 last messages sent by "iago@zulip.com" to the channel "Verona"
|
||||||
console.log(await client.messages.retrieve(readParams));
|
console.log(await client.messages.retrieve(readParams));
|
||||||
// {code_example|end}
|
// {code_example|end}
|
||||||
});
|
});
|
||||||
|
@ -186,7 +186,7 @@ add_example("get_own_user", "/users/me:get", 200, async (client, console) => {
|
||||||
|
|
||||||
add_example("get_stream_id", "/get_stream_id:get", 200, async (client, console) => {
|
add_example("get_stream_id", "/get_stream_id:get", 200, async (client, console) => {
|
||||||
// {code_example|start}
|
// {code_example|start}
|
||||||
// Get the ID of a given stream
|
// Get the ID of a given channel
|
||||||
console.log(await client.streams.getStreamId("Denmark"));
|
console.log(await client.streams.getStreamId("Denmark"));
|
||||||
// {code_example|end}
|
// {code_example|end}
|
||||||
});
|
});
|
||||||
|
@ -197,7 +197,7 @@ add_example(
|
||||||
200,
|
200,
|
||||||
async (client, console) => {
|
async (client, console) => {
|
||||||
// {code_example|start}
|
// {code_example|start}
|
||||||
// Get all the topics in stream with ID 1
|
// Get all the topics in channel with ID 1
|
||||||
console.log(await client.streams.topics.retrieve({stream_id: 1}));
|
console.log(await client.streams.topics.retrieve({stream_id: 1}));
|
||||||
// {code_example|end}
|
// {code_example|end}
|
||||||
},
|
},
|
||||||
|
@ -205,7 +205,7 @@ add_example(
|
||||||
|
|
||||||
add_example("get_subscriptions", "/users/me/subscriptions:get", 200, async (client, console) => {
|
add_example("get_subscriptions", "/users/me/subscriptions:get", 200, async (client, console) => {
|
||||||
// {code_example|start}
|
// {code_example|start}
|
||||||
// Get all streams that the user is subscribed to
|
// Get all channels that the user is subscribed to
|
||||||
console.log(await client.streams.subscriptions.retrieve());
|
console.log(await client.streams.subscriptions.retrieve());
|
||||||
// {code_example|end}
|
// {code_example|end}
|
||||||
});
|
});
|
||||||
|
@ -260,13 +260,13 @@ add_example("set_typing_status", "/typing:post", 200, async (client, console) =>
|
||||||
|
|
||||||
add_example("add_subscriptions", "/users/me/subscriptions:post", 200, async (client, console) => {
|
add_example("add_subscriptions", "/users/me/subscriptions:post", 200, async (client, console) => {
|
||||||
// {code_example|start}
|
// {code_example|start}
|
||||||
// Subscribe to the streams "Verona" and "Denmark"
|
// Subscribe to the channels "Verona" and "Denmark"
|
||||||
const meParams = {
|
const meParams = {
|
||||||
subscriptions: JSON.stringify([{name: "Verona"}, {name: "Denmark"}]),
|
subscriptions: JSON.stringify([{name: "Verona"}, {name: "Denmark"}]),
|
||||||
};
|
};
|
||||||
console.log(await client.users.me.subscriptions.add(meParams));
|
console.log(await client.users.me.subscriptions.add(meParams));
|
||||||
|
|
||||||
// To subscribe another user to a stream, you may pass in
|
// To subscribe another user to a channel, you may pass in
|
||||||
// the `principals` parameter, like so:
|
// the `principals` parameter, like so:
|
||||||
const user_id = 7;
|
const user_id = 7;
|
||||||
const anotherUserParams = {
|
const anotherUserParams = {
|
||||||
|
@ -283,14 +283,14 @@ add_example(
|
||||||
200,
|
200,
|
||||||
async (client, console) => {
|
async (client, console) => {
|
||||||
// {code_example|start}
|
// {code_example|start}
|
||||||
// Unsubscribe from the stream "Denmark"
|
// Unsubscribe from the channel "Denmark"
|
||||||
const meParams = {
|
const meParams = {
|
||||||
subscriptions: JSON.stringify(["Denmark"]),
|
subscriptions: JSON.stringify(["Denmark"]),
|
||||||
};
|
};
|
||||||
console.log(await client.users.me.subscriptions.remove(meParams));
|
console.log(await client.users.me.subscriptions.remove(meParams));
|
||||||
|
|
||||||
const user_id = 7;
|
const user_id = 7;
|
||||||
// Unsubscribe Zoe from the stream "Denmark"
|
// Unsubscribe Zoe from the channel "Denmark"
|
||||||
const zoeParams = {
|
const zoeParams = {
|
||||||
subscriptions: JSON.stringify(["Denmark"]),
|
subscriptions: JSON.stringify(["Denmark"]),
|
||||||
principals: JSON.stringify([user_id]),
|
principals: JSON.stringify([user_id]),
|
||||||
|
@ -369,7 +369,7 @@ add_example("get_events", "/events:get", 200, async (client, console) => {
|
||||||
|
|
||||||
add_example("get_streams", "/streams:get", 200, async (client, console) => {
|
add_example("get_streams", "/streams:get", 200, async (client, console) => {
|
||||||
// {code_example|start}
|
// {code_example|start}
|
||||||
// Get all streams that the user has access to
|
// Get all channels that the user has access to
|
||||||
console.log(await client.streams.retrieve());
|
console.log(await client.streams.retrieve());
|
||||||
// {code_example|end}
|
// {code_example|end}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue