export type ApproveChange = {status: 'ACTIVE' | 'STRUCK' | 'CONFLICT' | 'INACTIVE' | 'PROPOSED', approvalNote?: string | undefined, changeId?: string | undefined}; export type CreateApiV1OrgOrgIdChangeChangeIdApproveArgs = {orgId: string, changeId: string, body: ApproveChange}; export type CreateApiV1OrgOrgIdChangeChangeIdApproveOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Approve or reject a change * * POST /v1/org/{orgId}/change/{changeId}/approve */ export const createApiV1OrgOrgIdChangeChangeIdApprove = async (args: CreateApiV1OrgOrgIdChangeChangeIdApproveArgs, options?: CreateApiV1OrgOrgIdChangeChangeIdApproveOptions) => { const {baseUrl = "https://localhost", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/org/${encodeURIComponent(String(args.orgId))}/change/${encodeURIComponent(String(args.changeId))}/approve${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };