//native
type Attio = {
token: string;
};
/**
* Assert a list entry by parent
* Use this endpoint to create or update a list entry for a given parent record.
*/
export async function main(
auth: Attio,
list: string,
body: {
data: { parent_record_id: string; parent_object: string; entry_values: {} };
},
) {
const url = new URL(`https://api.attio.com/v2/lists/${list}/entries`);
const response = await fetch(url, {
method: "PUT",
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 235 days ago