export type ChannelPrivacy = 'private' | 'authenticated' | 'public'; export type FilterLicenses = Array<'agpl' | 'gpl2' | 'gpl3' | 'lgpl' | 'bsd' | 'mit' | 'apache' | 'psf' | 'public_domain' | 'proprietary' | 'other' | 'none'>; export type FilterIncludeSpecs = Array; export type FilterExcludeSpecs = Array; export type ChannelFilters = {conda?: ({include_licenses?: FilterLicenses | undefined, exclude_licenses?: FilterLicenses | undefined, include_specs?: FilterIncludeSpecs | undefined, exclude_specs?: FilterExcludeSpecs | undefined}) | undefined, cran?: ({include_licenses?: FilterLicenses | undefined, exclude_licenses?: FilterLicenses | undefined, include_specs?: FilterIncludeSpecs | undefined, exclude_specs?: FilterExcludeSpecs | undefined}) | undefined, python?: ({include_licenses?: FilterLicenses | undefined, exclude_licenses?: FilterLicenses | undefined, include_specs?: FilterIncludeSpecs | undefined, exclude_specs?: FilterExcludeSpecs | undefined}) | undefined}; export type ChannelSettings = {cve_notifications?: ({cve_score_increase?: boolean | undefined, cve_score_decrease?: boolean | undefined, cve_status_change?: boolean | undefined, cve_score_threshold?: number | undefined}) | undefined}; export type ChannelUpdateRequest = {name?: string | undefined, description?: string | undefined, privacy?: ChannelPrivacy | undefined, filters?: ChannelFilters | undefined, settings?: ChannelSettings | undefined, indexing_behavior?: ('default' | 'frozen') | undefined}; export type UpdateApiChannelsChannelNameArgs = {channel_name: string, body: ChannelUpdateRequest}; export type UpdateApiChannelsChannelNameOptions = {baseUrl?: string | undefined, jwt?: string | undefined, fetch?: typeof fetch | undefined}; /** * Edit the data for the specified channel * * PUT /channels/{channel_name} * * Also accepts auth: user_token */ export const updateApiChannelsChannelName = async (args: UpdateApiChannelsChannelNameArgs, options?: UpdateApiChannelsChannelNameOptions) => { 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))}${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 };