// AUTO-GENERATED by scripts/generate.ts from .generated-specs. Do not edit. import * as S from "@distilled.cloud/core/schema"; import * as API from "@distilled.cloud/core/api"; import * as T from "../traits.ts"; import { CloudflareProtocol, type CloudflareOpError, type CloudflareOpContext, } from "../protocol.ts"; import { CloudflareError, CloudflareRateLimited } from "../errors.ts"; import * as Retry from "../retry.ts"; export type { CloudflareOpError, CloudflareOpContext }; /** Fallback camelCase→wire mapping for opaque content (mined from the distilled SDK). */ const KEY_DICTIONARY: Record> = { offenseCount: "offense_count", }; export interface DayReportAsnRequest { /** Identifier. */ accountId: string; asnId: number; date?: string; } export const DayReportAsnRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), asnId: S.Number.pipe(T.Label("asn_id")), date: S.optional(S.String.pipe(T.Query())), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/botnet_feed/asn/{asn_id}/day_report", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DayReportAsnRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface DayReportAsnResponse { cidr?: string | null; date?: string | null; offenseCount?: number | null; } export const DayReportAsnResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ cidr: S.optional(S.NullOr(S.String)), date: S.optional(S.NullOr(S.String)), offenseCount: S.optional(S.NullOr(S.Number).pipe(T.Body("offense_count"))), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DayReportAsnResponse", }) as any as S.Schema; export interface DeleteConfigAsnRequest { /** Identifier. */ accountId: string; asnId: number; } export const DeleteConfigAsnRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), asnId: S.Number.pipe(T.Label("asn_id")), }) .pipe( T.Http({ method: "DELETE", uri: "/accounts/{account_id}/botnet_feed/configs/asn/{asn_id}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteConfigAsnRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface DeleteConfigAsnResponse { asn?: number | null; } export const DeleteConfigAsnResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ asn: S.optional(S.NullOr(S.Number)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "DeleteConfigAsnResponse", }) as any as S.Schema; export interface FullReportAsnRequest { /** Identifier. */ accountId: string; asnId: number; } export const FullReportAsnRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), asnId: S.Number.pipe(T.Label("asn_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/botnet_feed/asn/{asn_id}/full_report", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "FullReportAsnRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface FullReportAsnResponse { cidr?: string | null; date?: string | null; offenseCount?: number | null; } export const FullReportAsnResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ cidr: S.optional(S.NullOr(S.String)), date: S.optional(S.NullOr(S.String)), offenseCount: S.optional(S.NullOr(S.Number).pipe(T.Body("offense_count"))), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "FullReportAsnResponse", }) as any as S.Schema; export interface GetConfigAsnRequest { /** Identifier. */ accountId: string; } export const GetConfigAsnRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/botnet_feed/configs/asn", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetConfigAsnRequest", }) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetConfigAsnResponse { asn?: number | null; } export const GetConfigAsnResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ asn: S.optional(S.NullOr(S.Number)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetConfigAsnResponse", }) as any as S.Schema; export type DayReportAsnError = CloudflareOpError; /** Gets all the data the botnet tracking database has for a given ASN registered to user account for given date. If no date is given, it will return results for the previous day. */ export const dayReportAsn: API.OperationMethod< DayReportAsnRequest, DayReportAsnResponse, DayReportAsnError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DayReportAsnRequest, output: DayReportAsnResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type DeleteConfigAsnError = CloudflareOpError; /** Delete an ASN from botnet threat feed for a given user. */ export const deleteConfigAsn: API.OperationMethod< DeleteConfigAsnRequest, DeleteConfigAsnResponse, DeleteConfigAsnError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: DeleteConfigAsnRequest, output: DeleteConfigAsnResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type FullReportAsnError = CloudflareOpError; /** Gets all the data the botnet threat feed tracking database has for a given ASN registered to user account. */ export const fullReportAsn: API.OperationMethod< FullReportAsnRequest, FullReportAsnResponse, FullReportAsnError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: FullReportAsnRequest, output: FullReportAsnResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetConfigAsnError = CloudflareOpError; /** Gets a list of all ASNs registered for a user for the DDoS Botnet Feed API. */ export const getConfigAsn: API.OperationMethod< GetConfigAsnRequest, GetConfigAsnResponse, GetConfigAsnError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetConfigAsnRequest, output: GetConfigAsnResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, }));