UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

118 lines • 4.26 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../../core/resource.mjs"; import * as TagCategoriesAPI from "./tag-categories.mjs"; import { BaseTagCategories, TagCategories, } from "./tag-categories.mjs"; import { V4PagePagination } from "../../../../core/pagination.mjs"; import { path } from "../../../../internal/utils/path.mjs"; export var BaseSkills = /* @__PURE__ */ (() => { class BaseSkills extends APIResource { /** * Creates a custom AI skill for the account. * * @example * ```ts * const skill = * await client.cloudforceOne.threatSignals.skills.create({ * account_id: 'account_id', * name: 'x', * output_schema: 'x', * prompt: 'x', * type: 'summary', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/cloudforce-one/v2/threat-signals/skills`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Lists the default and custom skills available to the account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const skillListResponse of client.cloudforceOne.threatSignals.skills.list( * { account_id: 'account_id' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/cloudforce-one/v2/threat-signals/skills`, (V4PagePagination), { query, ...options }); } /** * Deletes a custom skill. Default skills cannot be deleted. * * @example * ```ts * const skill = * await client.cloudforceOne.threatSignals.skills.delete( * 'skill_id', * { account_id: 'account_id' }, * ); * ``` */ delete(skillID, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/cloudforce-one/v2/threat-signals/skills/${skillID}`, options)._thenUnwrap((obj) => obj.result); } /** * Updates a custom skill. Default skills are read-only. * * @example * ```ts * const response = * await client.cloudforceOne.threatSignals.skills.edit( * 'skill_id', * { account_id: 'account_id' }, * ); * ``` */ edit(skillID, params, options) { const { account_id, ...body } = params; return this._client.patch(path `/accounts/${account_id}/cloudforce-one/v2/threat-signals/skills/${skillID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Retrieves a default or custom skill by ID. * * @example * ```ts * const skill = * await client.cloudforceOne.threatSignals.skills.get( * 'skill_id', * { account_id: 'account_id' }, * ); * ``` */ get(skillID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/cloudforce-one/v2/threat-signals/skills/${skillID}`, options)._thenUnwrap((obj) => obj.result); } } BaseSkills._key = Object.freeze([ 'cloudforceOne', 'threatSignals', 'skills', ]); return BaseSkills; })(); export var Skills = /* @__PURE__ */ (() => { class Skills extends BaseSkills { constructor() { super(...arguments); this.tagCategories = new TagCategoriesAPI.TagCategories(this._client); } } Skills.TagCategories = TagCategories; Skills.BaseTagCategories = BaseTagCategories; return Skills; })(); //# sourceMappingURL=skills.mjs.map