type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Create custom field
* Creates a custom field.
**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
export async function main(
auth: Jira,
body: {
description?: string;
name: string;
searcherKey?:
| "com.atlassian.jira.plugin.system.customfieldtypes:cascadingselectsearcher"
| "com.atlassian.jira.plugin.system.customfieldtypes:daterange"
| "com.atlassian.jira.plugin.system.customfieldtypes:datetimerange"
| "com.atlassian.jira.plugin.system.customfieldtypes:exactnumber"
| "com.atlassian.jira.plugin.system.customfieldtypes:exacttextsearcher"
| "com.atlassian.jira.plugin.system.customfieldtypes:grouppickersearcher"
| "com.atlassian.jira.plugin.system.customfieldtypes:labelsearcher"
| "com.atlassian.jira.plugin.system.customfieldtypes:multiselectsearcher"
| "com.atlassian.jira.plugin.system.customfieldtypes:numberrange"
| "com.atlassian.jira.plugin.system.customfieldtypes:projectsearcher"
| "com.atlassian.jira.plugin.system.customfieldtypes:textsearcher"
| "com.atlassian.jira.plugin.system.customfieldtypes:userpickergroupsearcher"
| "com.atlassian.jira.plugin.system.customfieldtypes:versionsearcher";
type: string;
}
) {
const url = new URL(`https://${auth.domain}.atlassian.net/rest/api/2/field`);
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
* Creates a custom field.
**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
export async function main(
auth: Jira,
body: {
description?: string;
name: string;
searcherKey?:
| "com.atlassian.jira.plugin.system.customfieldtypes:cascadingselectsearcher"
| "com.atlassian.jira.plugin.system.customfieldtypes:daterange"
| "com.atlassian.jira.plugin.system.customfieldtypes:datetimerange"
| "com.atlassian.jira.plugin.system.customfieldtypes:exactnumber"
| "com.atlassian.jira.plugin.system.customfieldtypes:exacttextsearcher"
| "com.atlassian.jira.plugin.system.customfieldtypes:grouppickersearcher"
| "com.atlassian.jira.plugin.system.customfieldtypes:labelsearcher"
| "com.atlassian.jira.plugin.system.customfieldtypes:multiselectsearcher"
| "com.atlassian.jira.plugin.system.customfieldtypes:numberrange"
| "com.atlassian.jira.plugin.system.customfieldtypes:projectsearcher"
| "com.atlassian.jira.plugin.system.customfieldtypes:textsearcher"
| "com.atlassian.jira.plugin.system.customfieldtypes:userpickergroupsearcher"
| "com.atlassian.jira.plugin.system.customfieldtypes:versionsearcher";
type: string;
}
) {
const url = new URL(`https://${auth.domain}.atlassian.net/rest/api/2/field`);
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