// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../core/resource'; import * as IssuesAPI from '../../intel/attack-surface-report/issues'; import { APIPromise } from '../../../core/api-promise'; import { CloudflareError } from '../../../core/error'; import { RequestOptions } from '../../../internal/request-options'; import { path } from '../../../internal/utils/path'; export class BaseSeverity extends APIResource { static override readonly _key: readonly ['securityCenter', 'insights', 'severity'] = Object.freeze([ 'securityCenter', 'insights', 'severity', ] as const); /** * Retrieves Security Center insight counts aggregated by severity level (critical, * high, medium, low). * * @example * ```ts * const severities = * await client.securityCenter.insights.severity.get({ * account_id: 'account_id', * }); * ``` */ get( params: SeverityGetParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { const { account_id, zone_id, ...query } = params ?? {}; if (!account_id && !zone_id) { throw new CloudflareError('You must provide either account_id or zone_id.'); } if (account_id && zone_id) { throw new CloudflareError('You cannot provide both account_id and zone_id.'); } const { accountOrZone, accountOrZoneId } = account_id ? { accountOrZone: 'accounts', accountOrZoneId: account_id, } : { accountOrZone: 'zones', accountOrZoneId: zone_id, }; return ( this._client.get(path`/${accountOrZone}/${accountOrZoneId}/security-center/insights/severity`, { query, ...options, }) as APIPromise<{ result: SeverityGetResponse }> )._thenUnwrap((obj) => obj.result); } } export class Severity extends BaseSeverity {} export type SeverityGetResponse = Array; export namespace SeverityGetResponse { export interface SeverityGetResponseItem { count?: number; value?: string; } } export interface SeverityGetParams { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. */ account_id?: string; /** * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the * Account ID. */ zone_id?: string; /** * Query param */ dismissed?: boolean; /** * Query param */ issue_class?: Array; /** * Query param */ 'issue_class~neq'?: Array; /** * Query param */ issue_type?: Array; /** * Query param */ 'issue_type~neq'?: Array; /** * Query param */ product?: Array; /** * Query param */ 'product~neq'?: Array; /** * Query param */ severity?: Array; /** * Query param */ 'severity~neq'?: Array; /** * Query param */ subject?: Array; /** * Query param */ 'subject~neq'?: Array; } export declare namespace Severity { export { type SeverityGetResponse as SeverityGetResponse, type SeverityGetParams as SeverityGetParams }; }