export type DeleteApiRestApi3FieldFieldKeyOptionOptionIdIssueArgs = {replaceWith?: number | undefined, jql?: string | undefined, overrideScreenSecurity?: boolean | undefined, overrideEditableFlag?: boolean | undefined, fieldKey: string, optionId: number}; export type DeleteApiRestApi3FieldFieldKeyOptionOptionIdIssueOptions = {baseUrl?: string | undefined, basicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Replace issue field option * * DELETE /rest/api/3/field/{fieldKey}/option/{optionId}/issue * * Also accepts auth: OAuth2 */ export const deleteApiRestApi3FieldFieldKeyOptionOptionIdIssue = async (args: DeleteApiRestApi3FieldFieldKeyOptionOptionIdIssueArgs, options?: DeleteApiRestApi3FieldFieldKeyOptionOptionIdIssueOptions) => { const {baseUrl = "https://your-domain.atlassian.net", fetch: fetchFn = fetch, basicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.replaceWith != null) query.append("replaceWith", String(args.replaceWith)) if (args.jql != null) query.append("jql", String(args.jql)) if (args.overrideScreenSecurity != null) query.append("overrideScreenSecurity", String(args.overrideScreenSecurity)) if (args.overrideEditableFlag != null) query.append("overrideEditableFlag", String(args.overrideEditableFlag)) if (basicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${basicAuth.username}:${basicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/rest/api/3/field/${encodeURIComponent(String(args.fieldKey))}/option/${encodeURIComponent(String(args.optionId))}/issue${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };