Back

Version 102

3/7/2023
export espntcFindGroups = async (options?: {
search?: string,
access?: "all" | "private" | "public",
type?: "all" | "celebrity" | "fans",
locked?: "all" | "unlocked" | "locked",
dropWorst?: boolean,
start?: number,
num?: number,
gender?: "m" | "f",
}) => {
const params = {
search: options?.search || "",
type_access: ["all", "private", "public"].indexOf(options?.access ?? "all"),
type_group: ["all", "celebrity", "fans"].indexOf(options?.type ?? "all"),
type_lock: ["all", "unlocked", "locked"].indexOf(options?.locked ?? "all"),
type_dropWorst: options?.dropWorst ? 1 : 0,
start: options?.start || 0,
num: options?.num || 30,
gender: options?.gender || "m",
};

const baseURL =
"https://fantasy.espncdn.com/tournament-challenge-bracket" +
params.gender ==
"f"
? "-women"
: "" + "/2023/en/api/findGroups";

console.log(`${baseURL}?${new URLSearchParams(params)}`);

const res = await @stevekrouse.fetchJSON(
`${baseURL}?${new URLSearchParams(params)}`
);

interface Group {
id: number;
Updated: October 23, 2023