UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

105 lines • 4.29 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import * as MitigationsAPI from "./mitigations.mjs"; import { BaseMitigations, Mitigations, } from "./mitigations.mjs"; import * as SubmittedAPI from "./submitted/submitted.mjs"; import { BaseSubmitted, Submitted, } from "./submitted/submitted.mjs"; import { V4PagePagination } from "../../core/pagination.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BaseAbuseReports = /* @__PURE__ */ (() => { class BaseAbuseReports extends APIResource { /** * Submit an abuse report of a particular type. * * Requires the abuse-reports entitlement on the account (Enterprise accounts have * it by default; other accounts must request access) and an API token with the * `Trust and Safety Write` permission. If the account is not entitled, the request * is rejected with an HTTP `401` response (see below). * * @example * ```ts * const abuseReport = await client.abuseReports.create( * 'report_param', * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * act: 'abuse_dmca', * address1: 'x', * agent_name: 'x', * agree: 1, * city: 'x', * country: 'x', * email: 'email', * email2: 'email2', * host_notification: 'send', * name: 'x', * original_work: 'x', * owner_notification: 'send', * signature: 'signature', * state: 'x', * urls: 'urls', * }, * ); * ``` */ create(reportParam, params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/abuse-reports/${reportParam}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * List abuse reports made against domains or other content associated with the * account. To list reports that the account submitted, use the submitted abuse * reports endpoint instead. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const abuseReportListResponse of client.abuseReports.list( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/abuse-reports`, (V4PagePagination), { query, ...options }); } /** * Retrieve the details of an abuse report made against a domain or other content * associated with the account. To retrieve a report that the account submitted, * use the submitted abuse report endpoint instead. * * @example * ```ts * const abuseReport = await client.abuseReports.get( * 'report_param', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(reportParam, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/abuse-reports/${reportParam}`, options)._thenUnwrap((obj) => obj.result); } } BaseAbuseReports._key = Object.freeze(['abuseReports']); return BaseAbuseReports; })(); export var AbuseReports = /* @__PURE__ */ (() => { class AbuseReports extends BaseAbuseReports { constructor() { super(...arguments); this.submitted = new SubmittedAPI.Submitted(this._client); this.mitigations = new MitigationsAPI.Mitigations(this._client); } } AbuseReports.Submitted = Submitted; AbuseReports.BaseSubmitted = BaseSubmitted; AbuseReports.Mitigations = Mitigations; AbuseReports.BaseMitigations = BaseMitigations; return AbuseReports; })(); //# sourceMappingURL=abuse-reports.mjs.map