// 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 BaseType extends APIResource { static override readonly _key: readonly ['securityCenter', 'insights', 'type'] = Object.freeze([ 'securityCenter', 'insights', 'type', ] as const); /** * Retrieves Security Center insight counts aggregated by insight type. * * @example * ```ts * const types = await client.securityCenter.insights.type.get( * { account_id: 'account_id' }, * ); * ``` */ get(params: TypeGetParams | 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/type`, { query, ...options, }) as APIPromise<{ result: TypeGetResponse }> )._thenUnwrap((obj) => obj.result); } } export class Type extends BaseType {} export type TypeGetResponse = Array; export namespace TypeGetResponse { export interface TypeGetResponseItem { count?: number; value?: string; } } export interface TypeGetParams { /** * 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 Type { export { type TypeGetResponse as TypeGetResponse, type TypeGetParams as TypeGetParams }; }