/**
* Set the topic of a Matrix room. A topic is a short message detailing what is currently being discussed in the room.
*
* HTTP endpoint: https://spec.matrix.org/v1.5/client-server-api/#put_matrixclientv3roomsroomidstateeventtypestatekey
*
* State event description: https://spec.matrix.org/v1.5/client-server-api/#mroomtopic
*/
type Matrix = {
baseUrl: string;
token: string;
};
export async function main(
matrix_res: Matrix,
room_id: string,
topic: string = "",
) {
const url = `${
matrix_res.baseUrl
}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/state/m.room.topic/`;
const resp = await fetch(url, {
method: "PUT",
headers: {
Authorization: `Bearer ${matrix_res.token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
topic,
}),
});
if (!resp.ok) {
throw Error(`Failed to set room topic: Error HTTP${resp.status}`);
}
return await resp.json();
}
Submitted by admin 497 days ago
/**
* Set the topic of a Matrix room. A topic is a short message detailing what is currently being discussed in the room.
*
* HTTP endpoint: https://spec.matrix.org/v1.5/client-server-api/#put_matrixclientv3roomsroomidstateeventtypestatekey
*
* State event description: https://spec.matrix.org/v1.5/client-server-api/#mroomtopic
*/
type Matrix = {
baseUrl: string;
token: string;
};
export async function main(
matrix_res: Matrix,
room_id: string,
topic: string = "",
) {
const url = `${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/state/m.room.topic/`;
const resp = await fetch(url, {
method: 'PUT',
headers: {
"Authorization": `Bearer ${matrix_res.token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
topic,
}),
});
if (!resp.ok) {
throw Error(`Failed to set room topic: Error HTTP${resp.status}`);
}
return await resp.json();
}
Submitted by admin 500 days ago
import * as wmill from "https://deno.land/x/windmill@v1.85.0/mod.ts";
/**
* Set the topic of a Matrix room. A topic is a short message detailing what is currently being discussed in the room.
*
* HTTP endpoint: https://spec.matrix.org/v1.5/client-server-api/#put_matrixclientv3roomsroomidstateeventtypestatekey
*
* State event description: https://spec.matrix.org/v1.5/client-server-api/#mroomtopic
*/
export async function main(
matrix_res: wmill.Resource<"matrix">,
room_id: string,
topic: string = "",
) {
const url = `${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/state/m.room.topic/`;
const resp = await fetch(url, {
method: 'PUT',
headers: {
"Authorization": `Bearer ${matrix_res.token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
topic,
}),
});
if (!resp.ok) {
throw Error(`Failed to set room topic: Error HTTP${resp.status}`);
}
return await resp.json();
}
Submitted by adam186 628 days ago
import * as wmill from "https://deno.land/x/windmill@v1.70.1/mod.ts";
/**
* Set the topic of a Matrix room. A topic is a short message detailing what is currently being discussed in the room.
*
* HTTP endpoint: https://spec.matrix.org/v1.5/client-server-api/#put_matrixclientv3roomsroomidstateeventtypestatekey
*
* State event description: https://spec.matrix.org/v1.5/client-server-api/#mroomtopic
*/
export async function main(
matrix_res: wmill.Resource<"matrix">,
room_id: string,
topic: string = "",
) {
const url = `${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/state/m.room.topic/`;
const resp = await fetch(url, {
method: 'PUT',
headers: {
"Authorization": `Bearer ${matrix_res.token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
topic,
}),
});
if (!resp.ok) {
throw Error(`Failed to set room topic: Error HTTP${resp.status}`);
}
return await resp.json();
}
Submitted by adam186 663 days ago
import * as wmill from "https://deno.land/x/windmill@v1.35.0/mod.ts";
/**
* Set the topic of a Matrix room. A topic is a short message detailing what is currently being discussed in the room.
*
* HTTP endpoint: https://spec.matrix.org/v1.5/client-server-api/#put_matrixclientv3roomsroomidstateeventtypestatekey
*
* State event description: https://spec.matrix.org/v1.5/client-server-api/#mroomtopic
*/
export async function main(
matrix_res: wmill.Resource<"matrix">,
room_id: string,
topic: string = "",
) {
const url = `${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/state/m.room.topic/`;
const resp = await fetch(url, {
method: 'PUT',
headers: {
"Authorization": `Bearer ${matrix_res.token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
topic,
}),
});
if (!resp.ok) {
throw Error(`Failed to set room topic: Error HTTP${resp.status}`);
}
return await resp.json();
}
Submitted by jaller94 702 days ago