export type ArtifactFamily = 'anaconda_project' | 'anaconda_env' | 'cve' | 'conda' | 'python' | 'cran' | 'notebook' | 'docker' | 'sbom'; export type ArtifactBulkActionRequest = {action: 'copy' | 'move' | 'delete', target_channel?: string | undefined, target_subchannel?: string | undefined, items: Array<{name: string, family: ArtifactFamily, ckey?: string | undefined}>}; export type UpdateApiChannelsChannelNameArtifactsBulkArgs = {channel_name: string, body: ArtifactBulkActionRequest}; export type UpdateApiChannelsChannelNameArtifactsBulkOptions = {baseUrl?: string | undefined, jwt?: string | undefined, fetch?: typeof fetch | undefined}; /** * Perform a bulk action for artifacts in channel * * PUT /channels/{channel_name}/artifacts/bulk * * Also accepts auth: user_token */ export const updateApiChannelsChannelNameArtifactsBulk = async (args: UpdateApiChannelsChannelNameArtifactsBulkArgs, options?: UpdateApiChannelsChannelNameArtifactsBulkOptions) => { 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))}/artifacts/bulk${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 };