//native
type Attio = {
token: string;
};
/**
* Create a list
* Creates a new list.
*/
export async function main(
auth: Attio,
body: {
data: {
name: string;
api_slug: string;
parent_object: string;
workspace_access: "full-access" | "read-and-write" | "read-only";
workspace_member_access: {
workspace_member_id: string;
level: "full-access" | "read-and-write" | "read-only";
}[];
};
},
) {
const url = new URL(`https://api.attio.com/v2/lists`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 51 days ago