type Matrix = {
  baseUrl: string;
  token: string;
};
export async function main(
  matrix_res: Matrix,
  is_direct = false,
  name = "",
  room_alias_name = "",
  room_version = "",
  topic = "",
  visibility: "public" | "private" = "private",
) {
  if (!matrix_res.token) {
    throw Error("Creating a room requires an access token.");
  }
  const resp = await fetch(
    `${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(
      room_id,
    )}/invite`,
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${matrix_res.token}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        is_direct,
        ...(name && { name }),
        ...(room_alias_name && { room_alias_name }),
        ...(room_version && { room_version }),
        ...(topic && { topic }),
        visibility,
      }),
    },
  );
  if (!resp.ok) {
    throw Error(`Failed to create room: Error HTTP${resp.status}`);
  }
}
Submitted by hugo697 178 days ago
type Matrix = {
  baseUrl: string;
  token: string;
};
export async function main(
  matrix_res: Matrix,
  is_direct = false,
  name = "",
  room_alias_name = "",
  room_version = "",
  topic = "",
  visibility: "public" | "private" = "private",
) {
  if (!matrix_res.token) {
    throw Error("Creating a room requires an access token.");
  }
  const resp = await fetch(
    `${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(
      room_id,
    )}/invite`,
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${matrix_res.token}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        is_direct,
        ...(name && { name }),
        ...(room_alias_name && { room_alias_name }),
        ...(room_version && { room_version }),
        ...(topic && { topic }),
        visibility,
      }),
    },
  );
  if (!resp.ok) {
    throw Error(`Failed to create room: Error HTTP${resp.status}`);
  }
}
Submitted by admin 810 days ago
type Matrix = {
  baseUrl: string;
  token: string;
};
export async function main(
	matrix_res: Matrix,
	is_direct = false,
    name = "",
    room_alias_name = "",
    room_version = "",
    topic = "",
    visibility: "public"|"private" = "private",
) {
	if (!matrix_res.token) {
		throw Error("Creating a room requires an access token.");
	}
	const resp = await fetch(
		`${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/invite`,
		{
			method: "POST",
			headers: {
				"Authorization": `Bearer ${matrix_res.token}`,
                "Content-Type": "application/json",
            },
            body: JSON.stringify({
                is_direct,
                ...(name && {name}),
                ...(room_alias_name && {room_alias_name}),
                ...(room_version && {room_version}),
                ...(topic && {topic}),
                visibility,
            }),
		},
	);
	if (!resp.ok) {
		throw Error(`Failed to create room: Error HTTP${resp.status}`);
	}
}Submitted by admin 813 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">,
	is_direct = false,
    name = "",
    room_alias_name = "",
    room_version = "",
    topic = "",
    visibility: "public"|"private" = "private",
) {
	if (!matrix_res.token) {
		throw Error("Creating a room requires an access token.");
	}
	const resp = await fetch(
		`${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/invite`,
		{
			method: "POST",
			headers: {
				"Authorization": `Bearer ${matrix_res.token}`,
                "Content-Type": "application/json",
            },
            body: JSON.stringify({
                is_direct,
                ...(name && {name}),
                ...(room_alias_name && {room_alias_name}),
                ...(room_version && {room_version}),
                ...(topic && {topic}),
                visibility,
            }),
		},
	);
	if (!resp.ok) {
		throw Error(`Failed to create room: Error HTTP${resp.status}`);
	}
}Submitted by adam186 942 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">,
	is_direct = false,
    name = "",
    room_alias_name = "",
    room_version = "",
    topic = "",
    visibility: "public"|"private" = "private",
) {
	if (!matrix_res.token) {
		throw Error("Creating a room requires an access token.");
	}
	const resp = await fetch(
		`${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/invite`,
		{
			method: "POST",
			headers: {
				"Authorization": `Bearer ${matrix_res.token}`,
                "Content-Type": "application/json",
            },
            body: JSON.stringify({
                is_direct,
                ...(name && {name}),
                ...(room_alias_name && {room_alias_name}),
                ...(room_version && {room_version}),
                ...(topic && {topic}),
                visibility,
            }),
		},
	);
	if (!resp.ok) {
		throw Error(`Failed to create room: Error HTTP${resp.status}`);
	}
}Submitted by adam186 977 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">,
	is_direct = false,
    name = "",
    room_alias_name = "",
    room_version = "",
    topic = "",
    visibility: "public"|"private" = "private",
) {
	if (!matrix_res.token) {
		throw Error("Creating a room requires an access token.");
	}
	const resp = await fetch(
		`${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/invite`,
		{
			method: "POST",
			headers: {
				"Authorization": `Bearer ${matrix_res.token}`,
                "Content-Type": "application/json",
            },
            body: JSON.stringify({
                is_direct,
                ...(name && {name}),
                ...(room_alias_name && {room_alias_name}),
                ...(room_version && {room_version}),
                ...(topic && {topic}),
                visibility,
            }),
		},
	);
	if (!resp.ok) {
		throw Error(`Failed to create room: Error HTTP${resp.status}`);
	}
}Submitted by jaller94 1126 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">,
	is_direct = false,
    name = "",
    room_alias_name = "",
    room_version = "",
    topic = "",
    visibility: "public"|"private" = "private",
) {
	if (!matrix_res.accessToken) {
		throw Error("Creating a room requires an access token.");
	}
	const resp = await fetch(
		`${matrix_res.baseUrl}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/invite`,
		{
			method: "POST",
			headers: {
				"Authorization": `Bearer ${matrix_res.token}`,
                "Content-Type": "application/json",
            },
            body: JSON.stringify({
                is_direct,
                ...(name && {name}),
                ...(room_alias_name && {room_alias_name}),
                ...(room_version && {room_version}),
                ...(topic && {topic}),
                visibility,
            }),
		},
	);
	if (!resp.ok) {
		throw Error(`Failed to create room: Error HTTP${resp.status}`);
	}
}Submitted by jaller94 1126 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">,
	is_direct = false,
    name = "",
    room_alias_name = "",
    room_version = "",
    topic = "",
    visibility: "public"|"private" = "private",
) {
	if (!matrix_res.accessToken) {
		throw Error("Creating a room requires an access token.");
	}
	const resp = await fetch(
		`${matrix_res.homeserverUrl}/_matrix/client/v3/rooms/${encodeURIComponent(room_id)}/invite`,
		{
			method: "POST",
			headers: {
				"Authorization": `Bearer ${matrix_res.accessToken}`,
                "Content-Type": "application/json",
            },
            body: JSON.stringify({
                is_direct,
                ...(name && {name}),
                ...(room_alias_name && {room_alias_name}),
                ...(room_version && {room_version}),
                ...(topic && {topic}),
                visibility,
            }),
		},
	);
	if (!resp.ok) {
		throw Error(`Failed to create room: Error HTTP${resp.status}`);
	}
}Submitted by jaller94 1177 days ago