export type UpdateApiLogEntriesIdChannelArgs = {Accept: string, 'Content-Type': 'application/json', id: string, From: string, body: {channel: {details: string, type: 'web_trigger' | 'mobile'}}}; export type UpdateApiLogEntriesIdChannelOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update log entry channel information. * * PUT /log_entries/{id}/channel */ export const updateApiLogEntriesIdChannel = async (args: UpdateApiLogEntriesIdChannelArgs, options?: UpdateApiLogEntriesIdChannelOptions) => { const {baseUrl = "https://api.pagerduty.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.Accept != null) headers.set("Accept", String(args.Accept)) if (args['Content-Type'] != null) headers.set("Content-Type", String(args['Content-Type'])) if (args.From != null) headers.set("From", String(args.From)) if (apiKey !== undefined) headers.set("Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/log_entries/${encodeURIComponent(String(args.id))}/channel${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 };