type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Partial update project role
* Updates either the project role's name or its description.
You cannot update both the name and description at the same time using this operation. If you send a request with a name and a description only the name is updated.
**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
export async function main(
auth: Jira,
id: string,
body: { description?: string; name?: string }
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/role/${id}`
);
const response = await fetch(url, {
method: "POST",
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 396 days ago
type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Partial update project role
* Updates either the project role's name or its description.
You cannot update both the name and description at the same time using this operation. If you send a request with a name and a description only the name is updated.
**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
export async function main(
auth: Jira,
id: string,
body: { description?: string; name?: string }
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/role/${id}`
);
const response = await fetch(url, {
method: "POST",
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 948 days ago