//native
type Holded = {
apiKey: string;
};
/**
* Update project
* Update a specific project.
Only the params included in the operation will update the project.
*/
export async function main(
auth: Holded,
projectId: string,
body: {
name?: string;
desc?: string;
tags?: string[];
contactName?: string;
date?: number;
dueDate?: number;
status?: number;
lists?: { id?: string; key?: string; name?: string; desc?: string }[];
billable?: number;
price?: number;
labels?: { id?: string; name?: string; color?: string }[];
},
) {
const url = new URL(
`https://api.holded.com/api/projects/v1/projects/${projectId}`,
);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
key: auth.apiKey,
},
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