type Jira = {
username: string;
password: string;
domain: string;
};
/**
* Get projects using issue security schemes
* Returns a [paginated](#pagination) mapping of projects that are using security schemes. You can provide either one or multiple security scheme IDs or project IDs to filter by. If you don't provide any, this will return a list of all mappings. Only issue security schemes in the context of classic projects are supported. **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
export async function main(
auth: Jira,
startAt: string | undefined,
maxResults: string | undefined,
issueSecuritySchemeId: string | undefined,
projectId: string | undefined
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/issuesecurityschemes/project`
);
for (const [k, v] of [
["startAt", startAt],
["maxResults", maxResults],
["issueSecuritySchemeId", issueSecuritySchemeId],
["projectId", projectId],
]) {
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 projects using issue security schemes
* Returns a [paginated](#pagination) mapping of projects that are using security schemes. You can provide either one or multiple security scheme IDs or project IDs to filter by. If you don't provide any, this will return a list of all mappings. Only issue security schemes in the context of classic projects are supported. **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
*/
export async function main(
auth: Jira,
startAt: string | undefined,
maxResults: string | undefined,
issueSecuritySchemeId: string | undefined,
projectId: string | undefined
) {
const url = new URL(
`https://${auth.domain}.atlassian.net/rest/api/2/issuesecurityschemes/project`
);
for (const [k, v] of [
["startAt", startAt],
["maxResults", maxResults],
["issueSecuritySchemeId", issueSecuritySchemeId],
["projectId", projectId],
]) {
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