// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../core/resource'; import { APIPromise } from '../core/api-promise'; import { buildHeaders } from '../internal/headers'; import { RequestOptions } from '../internal/request-options'; export class Skills extends APIResource { /** * Org-active skills left-joined against the caller's own enablement, in one call. * Requires X-Tenant-Id header. */ retrieveEnabled( params: SkillRetrieveEnabledParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { const { 'Accept-Language': acceptLanguage, 'X-Error-Format': xErrorFormat, ...query } = params ?? {}; return this._client.get('/skills/enabled', { query, ...options, headers: buildHeaders([ { ...(acceptLanguage != null ? { 'Accept-Language': acceptLanguage } : undefined), ...(xErrorFormat != null ? { 'X-Error-Format': xErrorFormat } : undefined), }, options?.headers, ]), }); } /** * Batch enable/disable skills for the current user. Idempotent. Requires * X-Tenant-Id header. */ toggle(params: SkillToggleParams, options?: RequestOptions): APIPromise { const { 'Accept-Language': acceptLanguage, 'X-Error-Format': xErrorFormat, ...body } = params; return this._client.post('/skills/toggle', { body, ...options, headers: buildHeaders([ { ...(acceptLanguage != null ? { 'Accept-Language': acceptLanguage } : undefined), ...(xErrorFormat != null ? { 'X-Error-Format': xErrorFormat } : undefined), }, options?.headers, ]), }); } } /** * Org-active skills for the caller, each flagged with their own enablement state. */ export interface SkillRetrieveEnabledResponse { skills: Array; } export namespace SkillRetrieveEnabledResponse { /** * A single org-active skill, annotated with the caller's own enablement state. */ export interface Skill { id: string; is_enabled_by_user: boolean; name: string; /** * Supported admin skill types. */ type: 'library' | 'github' | 'upload' | 'manual'; url: string; description?: string | null; } } /** * Batch skill toggle response. */ export interface SkillToggleResponse { results: Array; } export namespace SkillToggleResponse { /** * Single skill toggle result. */ export interface Result { skill_id: string; status: string; enabled?: boolean | null; error?: string | null; } } export interface SkillRetrieveEnabledParams { /** * Query param: Search query for skill name or description */ search?: string; /** * Header param */ 'Accept-Language'?: string; /** * Header param: Set to `structured` to receive errors in the structured envelope. * Omit it to keep the legacy error body. */ 'X-Error-Format'?: string; } export interface SkillToggleParams { /** * Body param */ items: Array; /** * Header param */ 'Accept-Language'?: string; /** * Header param: Set to `structured` to receive errors in the structured envelope. * Omit it to keep the legacy error body. */ 'X-Error-Format'?: string; } export namespace SkillToggleParams { /** * Single skill enable/disable request item. */ export interface Item { enabled: boolean; skill_id: string; } } export declare namespace Skills { export { type SkillRetrieveEnabledResponse as SkillRetrieveEnabledResponse, type SkillToggleResponse as SkillToggleResponse, type SkillRetrieveEnabledParams as SkillRetrieveEnabledParams, type SkillToggleParams as SkillToggleParams, }; }