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 UpdateApiChannelsChannelNameArtifactsArtifactFamilyArtifactNameMoveArgs = {channel_name: string, artifact_family: ArtifactFamily, artifact_name: string, body: ArtifactBulkActionRequest}; export type UpdateApiChannelsChannelNameArtifactsArtifactFamilyArtifactNameMoveOptions = {baseUrl?: string | undefined, jwt?: string | undefined, fetch?: typeof fetch | undefined}; /** * Move the artifact to another channel * * PUT /channels/{channel_name}/artifacts/{artifact_family}/{artifact_name}/move * * Also accepts auth: user_token */ export const updateApiChannelsChannelNameArtifactsArtifactFamilyArtifactNameMove = async (args: UpdateApiChannelsChannelNameArtifactsArtifactFamilyArtifactNameMoveArgs, options?: UpdateApiChannelsChannelNameArtifactsArtifactFamilyArtifactNameMoveOptions) => { 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/${encodeURIComponent(String(args.artifact_family))}/${encodeURIComponent(String(args.artifact_name))}/move${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 };