type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Update custom field configurations
* Update the configuration for contexts of a custom field of a [type](https://developer.atlassian.com/platform/forge/manifest-reference/modules/jira-custom-field-type/) created by a [Forge app](https://developer.atlassian.com/platform/forge/).
**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). Jira permissions are not required for the Forge app that created the custom field type.
*/
export async function main(
auth: Jira,
fieldIdOrKey: string,
body: {
configurations: {
configuration?: { [k: string]: unknown };
fieldContextId: string;
id: string;
schema?: { [k: string]: unknown };
}[];
}
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/app/field/${fieldIdOrKey}/context/configuration`
);
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 396 days ago
type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Update custom field configurations
* Update the configuration for contexts of a custom field of a [type](https://developer.atlassian.com/platform/forge/manifest-reference/modules/jira-custom-field-type/) created by a [Forge app](https://developer.atlassian.com/platform/forge/).
**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). Jira permissions are not required for the Forge app that created the custom field type.
*/
export async function main(
auth: Jira,
fieldIdOrKey: string,
body: {
configurations: {
configuration?: { [k: string]: unknown };
fieldContextId: string;
id: string;
schema?: { [k: string]: unknown };
}[];
}
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/app/field/${fieldIdOrKey}/context/configuration`
);
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 823 days ago
type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Update custom field configurations
* Update the configuration for contexts of a custom field created by a [Forge app](https://developer.atlassian.com/platform/forge/).
**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg). Jira permissions are not required for the Forge app that created the custom field.
*/
export async function main(
auth: Jira,
fieldIdOrKey: string,
body: {
configurations: [
{
configuration?: { [k: string]: unknown };
fieldContextId: string;
id: string;
schema?: { [k: string]: unknown };
},
...{
configuration?: { [k: string]: unknown };
fieldContextId: string;
id: string;
schema?: { [k: string]: unknown };
}[]
];
}
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/app/field/${fieldIdOrKey}/context/configuration`
);
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 948 days ago