export type AddSkillRequest = {skill_id: string}; export type CreateApiV1WorkspacesWorkspaceSkillCollectionsCollectionIdSkillsArgs = {collection_id: string, workspace: string, body: AddSkillRequest}; export type CreateApiV1WorkspacesWorkspaceSkillCollectionsCollectionIdSkillsOptions = {baseUrl: string, HTTPBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add Skill To Collection * * POST /v1/workspaces/{workspace}/skill-collections/{collection_id}/skills */ export const createApiV1WorkspacesWorkspaceSkillCollectionsCollectionIdSkills = async (args: CreateApiV1WorkspacesWorkspaceSkillCollectionsCollectionIdSkillsArgs, options: CreateApiV1WorkspacesWorkspaceSkillCollectionsCollectionIdSkillsOptions) => { const {baseUrl, fetch: fetchFn = fetch, HTTPBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (HTTPBearer !== undefined) headers.set('authorization', `Bearer ${HTTPBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/workspaces/${encodeURIComponent(String(args.workspace))}/skill-collections/${encodeURIComponent(String(args.collection_id))}/skills${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 };