type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Create custom field context
* Creates a custom field context.
If `projectIds` is empty, a global context is created. A global context is one that applies to all project. If `issueTypeIds` is empty, the context applies to all issue types.
**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
export async function main(
auth: Jira,
fieldId: string,
body: {
description?: string;
id?: string;
issueTypeIds?: string[];
name: string;
projectIds?: string[];
}
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/field/${fieldId}/context`
);
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;
};
/**
* Create custom field context
* Creates a custom field context.
If `projectIds` is empty, a global context is created. A global context is one that applies to all project. If `issueTypeIds` is empty, the context applies to all issue types.
**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
export async function main(
auth: Jira,
fieldId: string,
body: {
description?: string;
id?: string;
issueTypeIds?: string[];
name: string;
projectIds?: string[];
}
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/field/${fieldId}/context`
);
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