export type ServiceChannelServicesMessagingProposalsUpdateProposalStatusRequest = {Comment?: string | undefined, ProviderEmail?: string | undefined, UserEmail?: string | undefined, RejectReasonCodeId?: number | undefined, ActionSource?: ('Standard' | 'DecisionEngine') | undefined, ReasonString?: string | undefined, Actor?: string | undefined, AttachmentstoWO?: boolean | undefined, PinNote?: boolean | undefined}; export type UpdateApiProposalsProposalIdRejectArgs = {proposalId: number, useProposalAlertEmails?: boolean | undefined, body: ServiceChannelServicesMessagingProposalsUpdateProposalStatusRequest}; export type UpdateApiProposalsProposalIdRejectOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reject a proposal * * PUT /proposals/{proposalId}/reject */ export const updateApiProposalsProposalIdReject = async (args: UpdateApiProposalsProposalIdRejectArgs, options?: UpdateApiProposalsProposalIdRejectOptions) => { const {baseUrl = "https://sb2api.servicechannel.com/v3", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.useProposalAlertEmails != null) query.append("useProposalAlertEmails", String(args.useProposalAlertEmails)) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/proposals/${encodeURIComponent(String(args.proposalId))}/reject${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };