export type ChannelPrivacy = 'private' | 'authenticated' | 'public'; export type ChannelType = 'default' | 'virtual'; export type ChannelIndexingBehavior = 'default' | 'frozen'; export type VirtualChannelSource = {name: string, parent_name?: string | undefined}; export type Subchannel = {id?: string | undefined, name?: string | undefined, description?: string | undefined, parent?: string | undefined, privacy?: ChannelPrivacy | undefined, channel_type?: ChannelType | undefined, indexing_behavior?: ChannelIndexingBehavior | undefined, sources?: Array | undefined, created?: string | undefined, updated?: string | undefined}; export type UpdateApiChannelsChannelNameSubchannelsSubchannelNameArgs = {channel_name: string, subchannel_name: string, body: Subchannel}; export type UpdateApiChannelsChannelNameSubchannelsSubchannelNameOptions = {baseUrl?: string | undefined, jwt?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update the subchannel * * PUT /channels/{channel_name}/subchannels/{subchannel_name} * * Also accepts auth: user_token */ export const updateApiChannelsChannelNameSubchannelsSubchannelName = async (args: UpdateApiChannelsChannelNameSubchannelsSubchannelNameArgs, options?: UpdateApiChannelsChannelNameSubchannelsSubchannelNameOptions) => { const {baseUrl = "https://api.anaconda.cloud/api", fetch: fetchFn = fetch, jwt} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (jwt !== undefined) headers.set('authorization', `Bearer ${jwt}`) const url = `${baseUrl.replace(/\/+$/, '')}/channels/${encodeURIComponent(String(args.channel_name))}/subchannels/${encodeURIComponent(String(args.subchannel_name))}${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 };