export type VerifyChannelRequest = {code: string}; export type CreateApiApiV1NotificationsChannelsChannelIdVerifyArgs = {channel_id: string, 'unstructured-api-key'?: (string | null) | undefined, body: VerifyChannelRequest}; export type CreateApiApiV1NotificationsChannelsChannelIdVerifyOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Verify Channel * * POST /api/v1/notifications/channels/{channel_id}/verify */ export const createApiApiV1NotificationsChannelsChannelIdVerify = async (args: CreateApiApiV1NotificationsChannelsChannelIdVerifyArgs, options: CreateApiApiV1NotificationsChannelsChannelIdVerifyOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['unstructured-api-key'] != null) headers.set("unstructured-api-key", String(args['unstructured-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/notifications/channels/${encodeURIComponent(String(args.channel_id))}/verify${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 };