cloudflare
Version:
The official TypeScript library for the Cloudflare API
124 lines • 4.6 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Skills = exports.BaseSkills = void 0;
const tslib_1 = require("../../../../internal/tslib.js");
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../../core/resource.js");
const TagCategoriesAPI = tslib_1.__importStar(require("./tag-categories.js"));
const tag_categories_1 = require("./tag-categories.js");
const pagination_1 = require("../../../../core/pagination.js");
const path_1 = require("../../../../internal/utils/path.js");
var BaseSkills = /* @__PURE__ */ (() => {
class BaseSkills extends resource_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/cloudforce-one/v2/threat-signals/skills`, (pagination_1.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((0, path_1.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((0, path_1.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((0, path_1.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;
})();
exports.BaseSkills = BaseSkills;
var Skills = /* @__PURE__ */ (() => {
class Skills extends BaseSkills {
constructor() {
super(...arguments);
this.tagCategories = new TagCategoriesAPI.TagCategories(this._client);
}
}
Skills.TagCategories = tag_categories_1.TagCategories;
Skills.BaseTagCategories = tag_categories_1.BaseTagCategories;
return Skills;
})();
exports.Skills = Skills;
//# sourceMappingURL=skills.js.map