export type CreateApiV1NotificationChannelsChannelNameRenameArgs = {'channel-name': string, body: {newName: string}}; export type CreateApiV1NotificationChannelsChannelNameRenameOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Rename a notification channel * * POST /v1/notification-channels/{channel-name}/rename */ export const createApiV1NotificationChannelsChannelNameRename = async (args: CreateApiV1NotificationChannelsChannelNameRenameArgs, options?: CreateApiV1NotificationChannelsChannelNameRenameOptions) => { const {baseUrl = "http://127.0.0.1:8000", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/notification-channels/${encodeURIComponent(String(args['channel-name']))}/rename${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 };