// 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 C from "@distilled.cloud/core/category"; import * as T from "../traits.ts"; import { CloudflareProtocol, CloudflarePaginatedProtocol, type CloudflareOpError, type CloudflareOpContext, } from "../protocol.ts"; import { cloudflarePaginate, ResultInfo } from "../pagination.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> = { acceptedUrlCount: "accepted_url_count", activeCount: "active_count", agentName: "agent_name", destinationIps: "destination_ips", effectiveDate: "effective_date", entityId: "entity_id", entityType: "entity_type", externalHostNotified: "external_host_notified", hostNotification: "host_notification", inReviewCount: "in_review_count", mitigationSummary: "mitigation_summary", ncmecNotification: "ncmec_notification", ncseiSubjectRepresentation: "ncsei_subject_representation", originalWork: "original_work", ownerNotification: "owner_notification", pendingCount: "pending_count", perPage: "per_page", portsProtocols: "ports_protocols", regWhoAuthorizationStatement: "reg_who_authorization_statement", regWhoGoodFaithAffirmation: "reg_who_good_faith_affirmation", regWhoLawfulProcessingAgreement: "reg_who_lawful_processing_agreement", regWhoLegalBasis: "reg_who_legal_basis", regWhoRequest: "reg_who_request", regWhoRequestType: "reg_who_request_type", regWhoRequestedDataElements: "reg_who_requested_data_elements", regWhoRequestorType: "reg_who_requestor_type", reportedCountry: "reported_country", reportedUserAgent: "reported_user_agent", resultInfo: "result_info", sourceIps: "source_ips", totalCount: "total_count", trademarkNumber: "trademark_number", trademarkOffice: "trademark_office", trademarkSymbol: "trademark_symbol", }; export class InvalidAccountId extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("InvalidAccountId", { code: S.Number, message: S.String, }).pipe(C.withBadRequestError), [{ code: 7003 }], ) {} export class InvalidRequest extends /*@__PURE__*/ T.applyErrorMatchers( /*@__PURE__*/ S.TaggedError()("InvalidRequest", { code: S.Number, message: S.String, }).pipe(C.withBadRequestError), [{ code: 7003 }], ) {} export type CreateRequestAct = | "abuse_dmca" | "abuse_trademark" | "abuse_general" | "abuse_phishing" | "abuse_children" | "abuse_threat" | "abuse_registrar_whois" | "abuse_ncsei"; export const CreateRequestAct = /*@__PURE__*/ S.String; export type CreateRequestAgree = 1; export const CreateRequestAgree = /*@__PURE__*/ S.Number; export type CreateRequestHostNotificationEnum = "send"; export const CreateRequestHostNotificationEnum = /*@__PURE__*/ S.String; export type CreateRequestHostNotificationAbuseGeneral = "send" | "send-anon"; export const CreateRequestHostNotificationAbuseGeneral = /*@__PURE__*/ S.String; export type CreateRequestHostNotification = | CreateRequestHostNotificationEnum | (string & {}) | CreateRequestHostNotificationAbuseGeneral | (string & {}); export const CreateRequestHostNotification = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([[], []]), ); export type CreateRequestOwnerNotificationEnum = "send"; export const CreateRequestOwnerNotificationEnum = /*@__PURE__*/ S.String; export type CreateRequestOwnerNotificationAbuseGeneral = "send" | "send-anon"; export const CreateRequestOwnerNotificationAbuseGeneral = /*@__PURE__*/ S.String; export type CreateRequestOwnerNotificationAbuseChildren = | "send" | "send-anon" | "none"; export const CreateRequestOwnerNotificationAbuseChildren = /*@__PURE__*/ S.String; export type CreateRequestOwnerNotification = | CreateRequestOwnerNotificationEnum | (string & {}) | CreateRequestOwnerNotificationAbuseGeneral | (string & {}) | CreateRequestOwnerNotificationAbuseChildren | (string & {}); export const CreateRequestOwnerNotification = /*@__PURE__*/ S.Unknown.pipe( T.UnionCases([[], [], []]), ); export type CreateRequestNcmecNotification = "send" | "send-anon"; export const CreateRequestNcmecNotification = /*@__PURE__*/ S.String; export type CreateRequestRegWhoRequestRegWhoRequestType = | "disclosure" | "invalid_whois"; export const CreateRequestRegWhoRequestRegWhoRequestType = /*@__PURE__*/ S.String; export type CreateRequestRegWhoRequestRegWhoRequestedDataElementsItem = | "registrant_name" | "registrant_organization" | "registrant_email" | "registrant_phone" | "registrant_address" | "registrant_address_country" | "registrant_address_postal_code" | "admin_name" | "admin_organization" | "admin_email" | "admin_phone" | "admin_address" | "tech_name" | "tech_organization" | "tech_email" | "tech_phone" | "tech_address"; export const CreateRequestRegWhoRequestRegWhoRequestedDataElementsItem = /*@__PURE__*/ S.String; export type CreateRequestRegWhoRequestRegWhoRequestedDataElementsList = Array< CreateRequestRegWhoRequestRegWhoRequestedDataElementsItem | (string & {}) >; export const CreateRequestRegWhoRequestRegWhoRequestedDataElementsList = /*@__PURE__*/ S.Array( CreateRequestRegWhoRequestRegWhoRequestedDataElementsItem, ) as any as S.Schema; export type CreateRequestRegWhoRequestRegWhoRequestorType = | "government" | "corporation" | "individual"; export const CreateRequestRegWhoRequestRegWhoRequestorType = /*@__PURE__*/ S.String; export interface CreateRequestRegWhoRequest { /** Affirmation that the request is made in good faith per RDP 10.2.4. Must be true. */ regWhoGoodFaithAffirmation: boolean; /** Agreement to process data lawfully per RDP 10.2.5. Must be true. */ regWhoLawfulProcessingAgreement: boolean; /** Legal rights and rationale for the request per RDP 10.2.3. Required for all WHOIS requests. */ regWhoLegalBasis: string; /** The type of WHOIS data request per RDP procedure. */ regWhoRequestType: | CreateRequestRegWhoRequestRegWhoRequestType | (string & {}); /** The specific WHOIS data elements being requested per RDP 10.2.2. Required for all WHOIS requests. */ regWhoRequestedDataElements: CreateRequestRegWhoRequestRegWhoRequestedDataElementsList; /** Optional authorization statement or power of attorney per RDP 10.2.1.3. */ regWhoAuthorizationStatement?: string; /** The nature of the requestor per RDP 10.2.1.2. */ regWhoRequestorType?: | CreateRequestRegWhoRequestRegWhoRequestorType | (string & {}); } export const CreateRequestRegWhoRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ regWhoGoodFaithAffirmation: S.Boolean.pipe( T.Body("reg_who_good_faith_affirmation"), ), regWhoLawfulProcessingAgreement: S.Boolean.pipe( T.Body("reg_who_lawful_processing_agreement"), ), regWhoLegalBasis: S.String.pipe(T.Body("reg_who_legal_basis")), regWhoRequestType: CreateRequestRegWhoRequestRegWhoRequestType.pipe( T.Body("reg_who_request_type"), ), regWhoRequestedDataElements: CreateRequestRegWhoRequestRegWhoRequestedDataElementsList.pipe( T.Body("reg_who_requested_data_elements"), ), regWhoAuthorizationStatement: S.optional( S.String.pipe(T.Body("reg_who_authorization_statement")), ), regWhoRequestorType: S.optional( CreateRequestRegWhoRequestRegWhoRequestorType.pipe( T.Body("reg_who_requestor_type"), ), ), }), ).annotate({ identifier: "CreateRequestRegWhoRequest", }) as any as S.Schema; export interface CreateAbuseReportRequest { accountId: string; /** The report type for submitted reports. */ reportParam: string; /** The report type for submitted reports. */ act: CreateRequestAct | (string & {}); /** Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). */ address1?: string; /** The name of the copyright holder. Text not exceeding 60 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). */ agentName?: string; /** Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports */ agree?: CreateRequestAgree | (number & {}); /** Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). */ city?: string; /** Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). */ country?: string; /** A valid email of the abuse reporter. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). */ email: string; /** Should match the value provided in `email` */ email2: string; /** Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. */ hostNotification?: CreateRequestHostNotification; /** Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). */ name: string; /** Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). */ originalWork?: string; /** Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. */ ownerNotification: CreateRequestOwnerNotification; /** Required for DMCA reports, should be same as Name. An affirmation that all information in the report is true and accurate while agreeing to the policies of Cloudflare's abuse reports */ signature?: string; /** Text not exceeding 255 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). */ state?: string; /** A list of valid URLs separated by ‘\n’ (new line character). The list of the URLs should not exceed 250 URLs. All URLs should have the same hostname. Each URL should be unique. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). */ urls: string; /** Any additional comments about the infringement not exceeding 2000 characters */ comments?: string; /** Text not exceeding 100 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). */ company?: string; /** Text containing 2 characters */ reportedCountry?: string; /** Text not exceeding 255 characters */ reportedUserAgent?: string; /** Text not exceeding 20 characters. This field may be released by Cloudflare to third parties such as the Lumen Database (https://lumendatabase.org/). */ tele?: string; /** Text not exceeding 255 characters */ title?: string; /** A detailed description of the infringement, including any necessary access details and the exact steps needed to view the content, not exceeding 5000 characters. */ justification?: string; /** Text not exceeding 1000 characters */ trademarkNumber?: string; /** Text not exceeding 1000 characters */ trademarkOffice?: string; /** Text not exceeding 1000 characters */ trademarkSymbol?: string; /** A list of IP addresses separated by ‘\n’ (new line character). The list of destination IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique. */ destinationIps?: string; /** A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual port/protocol should not exceed 100 characters. The list should not have more than 30 unique ports and protocols. */ portsProtocols?: string; /** A list of IP addresses separated by ‘\n’ (new line character). The list of source IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique. */ sourceIps?: string; /** Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark reports cannot be anonymous. */ ncmecNotification?: CreateRequestNcmecNotification | (string & {}); /** RDP-mandated fields for registrar WHOIS data disclosure requests. */ regWhoRequest?: CreateRequestRegWhoRequest; /** If the submitter is the target of NCSEI in the URLs of the abuse report. */ ncseiSubjectRepresentation?: boolean; } export const CreateAbuseReportRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), reportParam: S.String.pipe(T.Label("report_param")), act: CreateRequestAct, address1: S.optional(S.String), agentName: S.optional(S.String.pipe(T.Body("agent_name"))), agree: S.optional(CreateRequestAgree), city: S.optional(S.String), country: S.optional(S.String), email: S.String, email2: S.String, hostNotification: S.optional( CreateRequestHostNotification.pipe(T.Body("host_notification")), ), name: S.String, originalWork: S.optional(S.String.pipe(T.Body("original_work"))), ownerNotification: CreateRequestOwnerNotification.pipe( T.Body("owner_notification"), ), signature: S.optional(S.String), state: S.optional(S.String), urls: S.String, comments: S.optional(S.String), company: S.optional(S.String), reportedCountry: S.optional(S.String.pipe(T.Body("reported_country"))), reportedUserAgent: S.optional(S.String.pipe(T.Body("reported_user_agent"))), tele: S.optional(S.String), title: S.optional(S.String), justification: S.optional(S.String), trademarkNumber: S.optional(S.String.pipe(T.Body("trademark_number"))), trademarkOffice: S.optional(S.String.pipe(T.Body("trademark_office"))), trademarkSymbol: S.optional(S.String.pipe(T.Body("trademark_symbol"))), destinationIps: S.optional(S.String.pipe(T.Body("destination_ips"))), portsProtocols: S.optional(S.String.pipe(T.Body("ports_protocols"))), sourceIps: S.optional(S.String.pipe(T.Body("source_ips"))), ncmecNotification: S.optional( CreateRequestNcmecNotification.pipe(T.Body("ncmec_notification")), ), regWhoRequest: S.optional( CreateRequestRegWhoRequest.pipe(T.Body("reg_who_request")), ), ncseiSubjectRepresentation: S.optional( S.Boolean.pipe(T.Body("ncsei_subject_representation")), ), }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/abuse-reports/{report_param}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateAbuseReportRequest", }) as any as S.Schema; export type CreateAbuseReportResponse = string; export const CreateAbuseReportResponse = /*@__PURE__*/ S.suspend(() => S.String.pipe(T.EnvelopePayloadRoot(), T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "CreateAbuseReportResponse", }) as any as S.Schema; export interface GetRequest { accountId: string; reportParam: string; } export const GetRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), reportParam: S.String.pipe(T.Label("report_param")), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/abuse-reports/{report_param}", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetRequest" }) as any as S.Schema; export interface GetResponseMitigationSummary { /** How many of the reported URLs were confirmed as abusive. */ acceptedUrlCount: number; /** How many mitigations are active. */ activeCount: number; /** Whether the report has been forwarded to an external hosting provider. */ externalHostNotified: boolean; /** How many mitigations are under review. */ inReviewCount: number; /** How many mitigations are pending their effective date. */ pendingCount: number; } export const GetResponseMitigationSummary = /*@__PURE__*/ S.suspend(() => S.Struct({ acceptedUrlCount: S.Number.pipe(T.Body("accepted_url_count")), activeCount: S.Number.pipe(T.Body("active_count")), externalHostNotified: S.Boolean.pipe(T.Body("external_host_notified")), inReviewCount: S.Number.pipe(T.Body("in_review_count")), pendingCount: S.Number.pipe(T.Body("pending_count")), }), ).annotate({ identifier: "GetResponseMitigationSummary", }) as any as S.Schema; export type GetResponseStatus = "accepted" | "in_review"; export const GetResponseStatus = /*@__PURE__*/ S.String; export type GetResponseType = | "PHISH" | "GEN" | "THREAT" | "DMCA" | "EMER" | "TM" | "REG_WHO" | "NCSEI" | "NETWORK"; export const GetResponseType = /*@__PURE__*/ S.String; export interface GetResponseSubmitter { company?: string | null; email?: string | null; name?: string | null; telephone?: string | null; } export const GetResponseSubmitter = /*@__PURE__*/ S.suspend(() => S.Struct({ company: S.optional(S.NullOr(S.String)), email: S.optional(S.NullOr(S.String)), name: S.optional(S.NullOr(S.String)), telephone: S.optional(S.NullOr(S.String)), }), ).annotate({ identifier: "GetResponseSubmitter", }) as any as S.Schema; export type GetResponseUrlsList = Array; export const GetResponseUrlsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface GetResponse { /** Public facing ID of abuse report, aka abuse_rand. */ id: string; /** Creation date of report. Time in RFC 3339 format (https://www.rfc-editor.org/rfc/rfc3339.html) */ cdate: string; /** Domain that relates to the report. */ domain: string; /** A summary of the mitigations related to this report. */ mitigationSummary: GetResponseMitigationSummary; /** An enum value that represents the status of an abuse record */ status: GetResponseStatus; /** The abuse report type */ type: GetResponseType; /** Justification for the report. */ justification?: string | null; /** Original work / Targeted brand in the alleged abuse. */ originalWork?: string | null; /** Information about the submitter of the report. */ submitter?: GetResponseSubmitter | null; urls?: GetResponseUrlsList | null; } export const GetResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, cdate: S.String, domain: S.String, mitigationSummary: GetResponseMitigationSummary.pipe( T.Body("mitigation_summary"), ), status: GetResponseStatus, type: GetResponseType, justification: S.optional(S.NullOr(S.String)), originalWork: S.optional(S.NullOr(S.String).pipe(T.Body("original_work"))), submitter: S.optional(S.NullOr(GetResponseSubmitter)), urls: S.optional(S.NullOr(GetResponseUrlsList)), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "GetResponse" }) as any as S.Schema; export type ListRequestMitigationStatus = | "pending" | "active" | "in_review" | "cancelled" | "removed"; export const ListRequestMitigationStatus = /*@__PURE__*/ S.String; export type ListRequestStatus = "accepted" | "in_review"; export const ListRequestStatus = /*@__PURE__*/ S.String; export type ListRequestType = | "PHISH" | "GEN" | "THREAT" | "DMCA" | "EMER" | "TM" | "REG_WHO" | "NCSEI" | "NETWORK"; export const ListRequestType = /*@__PURE__*/ S.String; export interface ListAbuseReportsRequest { accountId: string; /** Returns reports created after the specified date */ createdAfter?: string; /** Returns reports created before the specified date */ createdBefore?: string; /** Filter by domain name related to the abuse report */ domain?: string; /** Filter reports that have any mitigations in the given status. */ mitigationStatus?: ListRequestMitigationStatus | (string & {}); /** Where in pagination to start listing abuse reports */ page?: number; /** How many abuse reports per page to list */ perPage?: number; /** A property to sort by, followed by the order (id, cdate, domain, type, status) */ sort?: string; /** Filter by the status of the report. */ status?: ListRequestStatus | (string & {}); /** Filter by the type of the report. */ type?: ListRequestType | (string & {}); } export const ListAbuseReportsRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), createdAfter: S.optional(S.String.pipe(T.Query("created_after"))), createdBefore: S.optional(S.String.pipe(T.Query("created_before"))), domain: S.optional(S.String.pipe(T.Query())), mitigationStatus: S.optional( ListRequestMitigationStatus.pipe(T.Query("mitigation_status")), ), page: S.optional(S.Number.pipe(T.Query())), perPage: S.optional(S.Number.pipe(T.Query("per_page"))), sort: S.optional(S.String.pipe(T.Query())), status: S.optional(ListRequestStatus.pipe(T.Query())), type: S.optional(ListRequestType.pipe(T.Query())), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/abuse-reports", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListAbuseReportsRequest", }) as any as S.Schema; export type ListResponseReportsItemMitigationSummary = GetResponseMitigationSummary; export const ListResponseReportsItemMitigationSummary = GetResponseMitigationSummary; export type ListResponseReportsItemStatus = "accepted" | "in_review"; export const ListResponseReportsItemStatus = /*@__PURE__*/ S.String; export type ListResponseReportsItemType = | "PHISH" | "GEN" | "THREAT" | "DMCA" | "EMER" | "TM" | "REG_WHO" | "NCSEI" | "NETWORK"; export const ListResponseReportsItemType = /*@__PURE__*/ S.String; export type ListResponseReportsItemSubmitter = GetResponseSubmitter; export const ListResponseReportsItemSubmitter = GetResponseSubmitter; export type ListResponseReportsItemUrlsList = Array; export const ListResponseReportsItemUrlsList = /*@__PURE__*/ S.Array( S.String, ) as any as S.Schema; export interface ListResponseReportsItem { /** Public facing ID of abuse report, aka abuse_rand. */ id: string; /** Creation date of report. Time in RFC 3339 format (https://www.rfc-editor.org/rfc/rfc3339.html) */ cdate: string; /** Domain that relates to the report. */ domain: string; /** A summary of the mitigations related to this report. */ mitigationSummary: GetResponseMitigationSummary; /** An enum value that represents the status of an abuse record */ status: ListResponseReportsItemStatus; /** The abuse report type */ type: ListResponseReportsItemType; /** Justification for the report. */ justification?: string | null; /** Original work / Targeted brand in the alleged abuse. */ originalWork?: string | null; /** Information about the submitter of the report. */ submitter?: GetResponseSubmitter | null; urls?: ListResponseReportsItemUrlsList | null; } export const ListResponseReportsItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, cdate: S.String, domain: S.String, mitigationSummary: GetResponseMitigationSummary.pipe( T.Body("mitigation_summary"), ), status: ListResponseReportsItemStatus, type: ListResponseReportsItemType, justification: S.optional(S.NullOr(S.String)), originalWork: S.optional(S.NullOr(S.String).pipe(T.Body("original_work"))), submitter: S.optional(S.NullOr(GetResponseSubmitter)), urls: S.optional(S.NullOr(ListResponseReportsItemUrlsList)), }), ).annotate({ identifier: "ListResponseReportsItem", }) as any as S.Schema; export type ListResponseReportsList = Array; export const ListResponseReportsList = /*@__PURE__*/ S.Array( ListResponseReportsItem, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface ListAbuseReportsResponse { reports: ListResponseReportsList; } export const ListAbuseReportsResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ reports: ListResponseReportsList, }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListAbuseReportsResponse", }) as any as S.Schema; export type MitigationsListRequestEntityType = | "url_pattern" | "account" | "zone"; export const MitigationsListRequestEntityType = /*@__PURE__*/ S.String; export type MitigationsListRequestSort = | "type,asc" | "type,desc" | "effective_date,asc" | "effective_date,desc" | "status,asc" | "status,desc" | "entity_type,asc" | "entity_type,desc"; export const MitigationsListRequestSort = /*@__PURE__*/ S.String; export type MitigationsListRequestStatus = | "pending" | "active" | "in_review" | "cancelled" | "removed"; export const MitigationsListRequestStatus = /*@__PURE__*/ S.String; export type MitigationsListRequestType = | "account_suspend" | "copyright_interstitial" | "geo_block" | "legal_block" | "malware_interstitial" | "misleading_interstitial" | "network_block" | "phishing_interstitial" | "playfairite_enforce" | "r2_takedown_account" | "r2_takedown_bucket" | "r2_takedown_object" | "rate_limit_cache" | "redirect_video_stream" | "registrar_freeze" | "registrar_parking" | "stream_block_account" | "user_suspend" | "workers_takedown_by_zone_id"; export const MitigationsListRequestType = /*@__PURE__*/ S.String; export interface ListMitigationsRequest { accountId: string; reportId: string; /** Returns mitigation that were dispatched after the given date */ effectiveAfter?: string; /** Returns mitigations that were dispatched before the given date */ effectiveBefore?: string; /** Filter by the type of entity the mitigation impacts. */ entityType?: MitigationsListRequestEntityType | (string & {}); /** Where in pagination to start listing abuse reports */ page?: number; /** How many abuse reports per page to list */ perPage?: number; /** A property to sort by, followed by the order */ sort?: MitigationsListRequestSort | (string & {}); /** Filter by the status of the mitigation. */ status?: MitigationsListRequestStatus | (string & {}); /** Filter by the type of mitigation. This filter parameter can be specified multiple times to include multiple types of mitigations in the result set, e.g. ?type=rate_limit_cache&type=legal_block. */ type?: MitigationsListRequestType | (string & {}); } export const ListMitigationsRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), reportId: S.String.pipe(T.Label("report_id")), effectiveAfter: S.optional(S.String.pipe(T.Query("effective_after"))), effectiveBefore: S.optional(S.String.pipe(T.Query("effective_before"))), entityType: S.optional( MitigationsListRequestEntityType.pipe(T.Query("entity_type")), ), page: S.optional(S.Number.pipe(T.Query())), perPage: S.optional(S.Number.pipe(T.Query("per_page"))), sort: S.optional(MitigationsListRequestSort.pipe(T.Query())), status: S.optional(MitigationsListRequestStatus.pipe(T.Query())), type: S.optional(MitigationsListRequestType.pipe(T.Query())), }) .pipe( T.Http({ method: "GET", uri: "/accounts/{account_id}/abuse-reports/{report_id}/mitigations", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListMitigationsRequest", }) as any as S.Schema; export type MitigationsListResponseMitigationsItemEntityType = | "url_pattern" | "account" | "zone"; export const MitigationsListResponseMitigationsItemEntityType = /*@__PURE__*/ S.String; export type MitigationsListResponseMitigationsItemStatus = | "pending" | "active" | "in_review" | "cancelled" | "removed"; export const MitigationsListResponseMitigationsItemStatus = /*@__PURE__*/ S.String; export type MitigationsListResponseMitigationsItemType = | "account_suspend" | "copyright_interstitial" | "geo_block" | "legal_block" | "malware_interstitial" | "misleading_interstitial" | "network_block" | "phishing_interstitial" | "playfairite_enforce" | "r2_takedown_account" | "r2_takedown_bucket" | "r2_takedown_object" | "rate_limit_cache" | "redirect_video_stream" | "registrar_freeze" | "registrar_parking" | "stream_block_account" | "user_suspend" | "workers_takedown_by_zone_id"; export const MitigationsListResponseMitigationsItemType = /*@__PURE__*/ S.String; export interface MitigationsListResponseMitigationsItem { /** ID of remediation. */ id: string; /** Date when the mitigation will become active. Time in RFC 3339 format (https://www.rfc-editor.org/rfc/rfc3339.html) */ effectiveDate: string; entityId: string; /** The type of entity targeted by a mitigation. */ entityType: MitigationsListResponseMitigationsItemEntityType; /** The status of a mitigation */ status: MitigationsListResponseMitigationsItemStatus; /** The type of mitigation applied to a reported entity. */ type: MitigationsListResponseMitigationsItemType; } export const MitigationsListResponseMitigationsItem = /*@__PURE__*/ S.suspend( () => S.Struct({ id: S.String, effectiveDate: S.String.pipe(T.Body("effective_date")), entityId: S.String.pipe(T.Body("entity_id")), entityType: MitigationsListResponseMitigationsItemEntityType.pipe( T.Body("entity_type"), ), status: MitigationsListResponseMitigationsItemStatus, type: MitigationsListResponseMitigationsItemType, }), ).annotate({ identifier: "MitigationsListResponseMitigationsItem", }) as any as S.Schema; export type MitigationsListResponseMitigationsList = Array; export const MitigationsListResponseMitigationsList = /*@__PURE__*/ S.Array( MitigationsListResponseMitigationsItem, ) as any as S.Schema; /** Unwrapped `result` payload of the Cloudflare v4 response envelope. */ export interface ListMitigationsResponse { mitigations: MitigationsListResponseMitigationsList; } export const ListMitigationsResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ mitigations: MitigationsListResponseMitigationsList, }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ListMitigationsResponse", }) as any as S.Schema; export type MitigationsReviewRequestAppealsItemReason = | "removed" | "misclassified"; export const MitigationsReviewRequestAppealsItemReason = /*@__PURE__*/ S.String; export interface MitigationsReviewRequestAppealsItem { /** ID of the mitigation to appeal. */ id: string; /** Reason why the customer is appealing. */ reason: MitigationsReviewRequestAppealsItemReason | (string & {}); } export const MitigationsReviewRequestAppealsItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, reason: MitigationsReviewRequestAppealsItemReason, }), ).annotate({ identifier: "MitigationsReviewRequestAppealsItem", }) as any as S.Schema; export type MitigationsReviewRequestAppealsList = Array; export const MitigationsReviewRequestAppealsList = /*@__PURE__*/ S.Array( MitigationsReviewRequestAppealsItem, ) as any as S.Schema; export interface ReviewMitigationRequest { accountId: string; reportId: string; /** List of mitigations to appeal. */ appeals: MitigationsReviewRequestAppealsList; } export const ReviewMitigationRequest = /*@__PURE__*/ S.suspend(() => S.Struct({ accountId: S.String.pipe(T.Label("account_id")), reportId: S.String.pipe(T.Label("report_id")), appeals: MitigationsReviewRequestAppealsList, }) .pipe( T.Http({ method: "POST", uri: "/accounts/{account_id}/abuse-reports/{report_id}/mitigations/appeal", code: 200, }), ) .pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ReviewMitigationRequest", }) as any as S.Schema; export type MitigationsReviewResultItemEntityType = | "url_pattern" | "account" | "zone"; export const MitigationsReviewResultItemEntityType = /*@__PURE__*/ S.String; export type MitigationsReviewResultItemStatus = | "pending" | "active" | "in_review" | "cancelled" | "removed"; export const MitigationsReviewResultItemStatus = /*@__PURE__*/ S.String; export type MitigationsReviewResultItemType = | "account_suspend" | "copyright_interstitial" | "geo_block" | "legal_block" | "malware_interstitial" | "misleading_interstitial" | "network_block" | "phishing_interstitial" | "playfairite_enforce" | "r2_takedown_account" | "r2_takedown_bucket" | "r2_takedown_object" | "rate_limit_cache" | "redirect_video_stream" | "registrar_freeze" | "registrar_parking" | "stream_block_account" | "user_suspend" | "workers_takedown_by_zone_id"; export const MitigationsReviewResultItemType = /*@__PURE__*/ S.String; export interface MitigationsReviewResultItem { /** ID of remediation. */ id: string; /** Date when the mitigation will become active. Time in RFC 3339 format (https://www.rfc-editor.org/rfc/rfc3339.html) */ effectiveDate: string; entityId: string; /** The type of entity targeted by a mitigation. */ entityType: MitigationsReviewResultItemEntityType; /** The status of a mitigation */ status: MitigationsReviewResultItemStatus; /** The type of mitigation applied to a reported entity. */ type: MitigationsReviewResultItemType; } export const MitigationsReviewResultItem = /*@__PURE__*/ S.suspend(() => S.Struct({ id: S.String, effectiveDate: S.String.pipe(T.Body("effective_date")), entityId: S.String.pipe(T.Body("entity_id")), entityType: MitigationsReviewResultItemEntityType.pipe( T.Body("entity_type"), ), status: MitigationsReviewResultItemStatus, type: MitigationsReviewResultItemType, }), ).annotate({ identifier: "MitigationsReviewResultItem", }) as any as S.Schema; export type MitigationsReviewResultList = Array; export const MitigationsReviewResultList = /*@__PURE__*/ S.Array( MitigationsReviewResultItem, ) as any as S.Schema; export interface ReviewMitigationResponse { /** The unwrapped `result` payload of the v4 response envelope. */ result: MitigationsReviewResultList; /** Pagination info from the envelope's `result_info`. */ resultInfo?: ResultInfo | null; } export const ReviewMitigationResponse = /*@__PURE__*/ S.suspend(() => S.Struct({ result: MitigationsReviewResultList.pipe(T.EnvelopePayload()), resultInfo: S.optional(S.NullOr(ResultInfo).pipe(T.ResultInfo())), }).pipe(T.KeyDictionary(KEY_DICTIONARY)), ).annotate({ identifier: "ReviewMitigationResponse", }) as any as S.Schema; export type CreateAbuseReportError = InvalidRequest | CloudflareOpError; /** Submit the Abuse Report of a particular type */ export const createAbuseReport: API.OperationMethod< CreateAbuseReportRequest, CreateAbuseReportResponse, CreateAbuseReportError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: CreateAbuseReportRequest, output: CreateAbuseReportResponse, errors: [InvalidRequest, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type GetError = CloudflareOpError; /** Retrieve the details of an abuse report. */ export const get: API.OperationMethod< GetRequest, GetResponse, GetError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: GetRequest, output: GetResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListAbuseReportsError = InvalidAccountId | CloudflareOpError; /** List the abuse reports for a given account */ export const listAbuseReports: API.OperationMethod< ListAbuseReportsRequest, ListAbuseReportsResponse, ListAbuseReportsError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: ListAbuseReportsRequest, output: ListAbuseReportsResponse, errors: [InvalidAccountId, CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ListMitigationsError = CloudflareOpError; /** List mitigations done to remediate the abuse report. */ export const listMitigations: API.OperationMethod< ListMitigationsRequest, ListMitigationsResponse, ListMitigationsError, CloudflareOpContext > = /*@__PURE__*/ API.make(() => ({ input: ListMitigationsRequest, output: ListMitigationsResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflareProtocol, retry: Retry.Retry, })); export type ReviewMitigationError = CloudflareOpError; /** Request a review for mitigations on an account. */ export const reviewMitigation: API.PaginatedOperationMethod< ReviewMitigationRequest, ReviewMitigationResponse, ReviewMitigationError, CloudflareOpContext, MitigationsReviewResultItem > = /*@__PURE__*/ API.makePaginated( () => ({ input: ReviewMitigationRequest, output: ReviewMitigationResponse, errors: [CloudflareRateLimited, CloudflareError], protocol: CloudflarePaginatedProtocol, retry: Retry.Retry, pagination: { mode: "single", items: "result" } as const, }), cloudflarePaginate, ) as any;