type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Get application property
* Returns all application properties or an application property.
If you specify a value for the `key` parameter, then an application property is returned as an object (not in an array). Otherwise, an array of all editable application properties is returned. See [Set application property](#api-rest-api-2-application-properties-id-put) for descriptions of editable properties.
**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
export async function main(
auth: Jira,
key: string | undefined,
permissionLevel: string | undefined,
keyFilter: string | undefined
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/application-properties`
);
for (const [k, v] of [
["key", key],
["permissionLevel", permissionLevel],
["keyFilter", keyFilter],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
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;
};
/**
* Get application property
* Returns all application properties or an application property.
If you specify a value for the `key` parameter, then an application property is returned as an object (not in an array). Otherwise, an array of all editable application properties is returned. See [Set application property](#api-rest-api-2-application-properties-id-put) for descriptions of editable properties.
**[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
export async function main(
auth: Jira,
key: string | undefined,
permissionLevel: string | undefined,
keyFilter: string | undefined
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/application-properties`
);
for (const [k, v] of [
["key", key],
["permissionLevel", permissionLevel],
["keyFilter", keyFilter],
]) {
if (v !== undefined && v !== "") {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 948 days ago