type Matrix = {
baseUrl: string;
token: string;
};
export async function main(matrix_res: Matrix, roomId: string) {
if (!matrix_res.token) {
throw Error("Leaving a room requires an access token.");
}
const resp = await fetch(
`${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(
roomId,
)}/leave`,
{
method: "POST",
headers: {
Authorization: `Bearer ${matrix_res.token}`,
},
},
);
if (!resp.ok) {
throw Error(`Failed to leave room: Error HTTP${resp.status}`);
}
}
Submitted by admin 497 days ago
type Matrix = {
baseUrl: string;
token: string;
};
export async function main(
matrix_res: Matrix,
roomId: string,
) {
if (!matrix_res.token) {
throw Error("Leaving a room requires an access token.");
}
const resp = await fetch(
`${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(roomId)}/leave`,
{
method: "POST",
headers: {
"Authorization": `Bearer ${matrix_res.token}`,
},
},
);
if (!resp.ok) {
throw Error(`Failed to leave room: Error HTTP${resp.status}`);
}
}
Submitted by admin 500 days ago
import * as wmill from "https://deno.land/x/windmill@v1.85.0/mod.ts";
export async function main(
matrix_res: wmill.Resource<"matrix">,
roomId: string,
) {
if (!matrix_res.token) {
throw Error("Leaving a room requires an access token.");
}
const resp = await fetch(
`${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(roomId)}/leave`,
{
method: "POST",
headers: {
"Authorization": `Bearer ${matrix_res.token}`,
},
},
);
if (!resp.ok) {
throw Error(`Failed to leave room: Error HTTP${resp.status}`);
}
}
Submitted by adam186 628 days ago
import * as wmill from "https://deno.land/x/windmill@v1.70.1/mod.ts";
export async function main(
matrix_res: wmill.Resource<"matrix">,
roomId: string,
) {
if (!matrix_res.token) {
throw Error("Leaving a room requires an access token.");
}
const resp = await fetch(
`${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(roomId)}/leave`,
{
method: "POST",
headers: {
"Authorization": `Bearer ${matrix_res.token}`,
},
},
);
if (!resp.ok) {
throw Error(`Failed to leave room: Error HTTP${resp.status}`);
}
}
Submitted by adam186 663 days ago
import * as wmill from "https://deno.land/x/windmill@v1.29.0/mod.ts";
export async function main(
matrix_res: wmill.Resource<"matrix">,
roomId: string,
) {
if (!matrix_res.token) {
throw Error("Leaving a room requires an access token.");
}
const resp = await fetch(
`${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(roomId)}/leave`,
{
method: "POST",
headers: {
"Authorization": `Bearer ${matrix_res.token}`,
},
},
);
if (!resp.ok) {
throw Error(`Failed to leave room: Error HTTP${resp.status}`);
}
}
Submitted by jaller94 813 days ago
import * as wmill from "https://deno.land/x/windmill@v1.29.0/mod.ts";
export async function main(
matrix_res: wmill.Resource<"matrix">,
roomId: string,
) {
if (!matrix_res.accessToken) {
throw Error("Leaving a room requires an access token.");
}
const resp = await fetch(
`${matrix_res.homeserverUrl}/_matrix/client/v3/rooms/${encodeURIComponent(roomId)}/leave`,
{
method: "POST",
headers: {
"Authorization": `Bearer ${matrix_res.accessToken}`,
},
},
);
if (!resp.ok) {
throw Error(`Failed to leave room: Error HTTP${resp.status}`);
}
}
Submitted by jaller94 865 days ago