type Matrix = {
baseUrl: string;
token: string;
};
export async function main(matrix_res: Matrix, room_id: string) {
const url = `${
matrix_res.baseUrl
}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/state`;
const resp = await fetch(url, {
headers: {
Authorization: `Bearer ${matrix_res.token}`,
},
});
if (!resp.ok) {
throw Error(`Failed to read room state: Error HTTP${resp.status}`);
}
return {
events: await resp.json(),
};
}
Submitted by hugo697 232 days ago
type Matrix = {
baseUrl: string;
token: string;
};
export async function main(matrix_res: Matrix, room_id: string) {
const url = `${
matrix_res.baseUrl
}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/state`;
const resp = await fetch(url, {
headers: {
Authorization: `Bearer ${matrix_res.token}`,
},
});
if (!resp.ok) {
throw Error(`Failed to read room state: Error HTTP${resp.status}`);
}
return {
events: await resp.json(),
};
}
Submitted by admin 865 days ago
type Matrix = {
baseUrl: string;
token: string;
};
export async function main(matrix_res: Matrix, room_id: string) {
const url = `${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/state`;
const resp = await fetch(url, {
headers: {
"Authorization": `Bearer ${matrix_res.token}`,
},
});
if (!resp.ok) {
throw Error(`Failed to read room state: Error HTTP${resp.status}`);
}
return {
events: await resp.json(),
};
} Submitted by admin 868 days ago
import * as wmill from "https://deno.land/x/[email protected]/mod.ts";
export async function main(matrix_res: wmill.Resource<"matrix">, room_id: string) {
const url = `${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/state`;
const resp = await fetch(url, {
headers: {
"Authorization": `Bearer ${matrix_res.token}`,
},
});
if (!resp.ok) {
throw Error(`Failed to read room state: Error HTTP${resp.status}`);
}
return {
events: await resp.json(),
};
} Submitted by adam186 996 days ago
import * as wmill from "https://deno.land/x/[email protected]/mod.ts";
export async function main(matrix_res: wmill.Resource<"matrix">, room_id: string) {
const url = `${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/state`;
const resp = await fetch(url, {
headers: {
"Authorization": `Bearer ${matrix_res.token}`,
},
});
if (!resp.ok) {
throw Error(`Failed to read room state: Error HTTP${resp.status}`);
}
return {
events: await resp.json(),
};
} Submitted by adam186 1031 days ago
import * as wmill from "https://deno.land/x/[email protected]/mod.ts";
export async function main(matrix_res: wmill.Resource<"matrix">, room_id: string) {
const url = `${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/state`;
const resp = await fetch(url, {
headers: {
"Authorization": `Bearer ${matrix_res.token}`,
},
});
if (!resp.ok) {
throw Error(`Failed to read room state: Error HTTP${resp.status}`);
}
return {
events: await resp.json(),
};
} Submitted by jaller94 1181 days ago
import * as wmill from "https://deno.land/x/[email protected]/mod.ts";
export async function main(matrix_res: wmill.Resource<"matrix">, room_id: string) {
const url = `${matrix_res.homeserverUrl}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/state`;
const resp = await fetch(url, {
headers: {
"Authorization": `Bearer ${matrix_res.accessToken}`,
},
});
if (!resp.ok) {
throw Error(`Failed to read room state: Error HTTP${resp.status}`);
}
return {
events: await resp.json(),
};
} Submitted by jaller94 1183 days ago