type Bitbucket = {
username: string;
password: string;
};
/**
* Update a task on a pull request
* Updates a specific pull request task.
*/
export async function main(
auth: Bitbucket,
pull_request_id: string,
repo_slug: string,
task_id: string,
workspace: string,
body: { content?: { raw: string }; state?: "RESOLVED" | "UNRESOLVED" }
) {
const url = new URL(
`https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/pullrequests/${pull_request_id}/tasks/${task_id}`
);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
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 375 days ago
type Bitbucket = {
username: string;
password: string;
};
/**
* Update a task on a pull request
* Updates a specific pull request task.
*/
export async function main(
auth: Bitbucket,
pull_request_id: string,
repo_slug: string,
task_id: string,
workspace: string,
body: { content?: { raw: string }; state?: "RESOLVED" | "UNRESOLVED" }
) {
const url = new URL(
`https://api.bitbucket.org/2.0/repositories/${workspace}/${repo_slug}/pullrequests/${pull_request_id}/tasks/${task_id}`
);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
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 802 days ago