type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Update comment
* Updates a comment.
*/
export async function main(
auth: Jira,
issueIdOrKey: string,
id: string,
notifyUsers: string | undefined,
overrideEditableFlag: string | undefined,
expand: string | undefined,
body: {
author?: {
accountId?: string;
accountType?: string;
active?: boolean;
avatarUrls?: {
"16x16"?: string;
"24x24"?: string;
"32x32"?: string;
"48x48"?: string;
};
displayName?: string;
emailAddress?: string;
key?: string;
name?: string;
self?: string;
timeZone?: string;
};
body?: string;
created?: string;
id?: string;
jsdAuthorCanSeeRequest?: boolean;
jsdPublic?: boolean;
properties?: { key?: string; value?: { [k: string]: unknown } }[];
renderedBody?: string;
self?: string;
updateAuthor?: {
accountId?: string;
accountType?: string;
active?: boolean;
avatarUrls?: {
"16x16"?: string;
"24x24"?: string;
"32x32"?: string;
"48x48"?: string;
};
displayName?: string;
emailAddress?: string;
key?: string;
name?: string;
self?: string;
timeZone?: string;
};
updated?: string;
visibility?: {
identifier?: string;
type?: "group" | "role";
value?: string;
[k: string]: unknown;
};
[k: string]: unknown;
}
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/issue/${issueIdOrKey}/comment/${id}`
);
for (const [k, v] of [
["notifyUsers", notifyUsers],
["overrideEditableFlag", overrideEditableFlag],
["expand", expand],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
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 327 days ago
type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Update comment
* Updates a comment.
*/
export async function main(
auth: Jira,
issueIdOrKey: string,
id: string,
notifyUsers: string | undefined,
overrideEditableFlag: string | undefined,
expand: string | undefined,
body: {
author?: {
accountId?: string;
accountType?: string;
active?: boolean;
avatarUrls?: {
"16x16"?: string;
"24x24"?: string;
"32x32"?: string;
"48x48"?: string;
};
displayName?: string;
emailAddress?: string;
key?: string;
name?: string;
self?: string;
timeZone?: string;
};
body?: string;
created?: string;
id?: string;
jsdAuthorCanSeeRequest?: boolean;
jsdPublic?: boolean;
properties?: { key?: string; value?: { [k: string]: unknown } }[];
renderedBody?: string;
self?: string;
updateAuthor?: {
accountId?: string;
accountType?: string;
active?: boolean;
avatarUrls?: {
"16x16"?: string;
"24x24"?: string;
"32x32"?: string;
"48x48"?: string;
};
displayName?: string;
emailAddress?: string;
key?: string;
name?: string;
self?: string;
timeZone?: string;
};
updated?: string;
visibility?: {
identifier?: string;
type?: "group" | "role";
value?: string;
[k: string]: unknown;
};
[k: string]: unknown;
}
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/issue/${issueIdOrKey}/comment/${id}`
);
for (const [k, v] of [
["notifyUsers", notifyUsers],
["overrideEditableFlag", overrideEditableFlag],
["expand", expand],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
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 879 days ago