UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

111 lines • 4.66 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AbuseReports = exports.BaseAbuseReports = void 0; const tslib_1 = require("../../internal/tslib.js"); // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../core/resource.js"); const MitigationsAPI = tslib_1.__importStar(require("./mitigations.js")); const mitigations_1 = require("./mitigations.js"); const SubmittedAPI = tslib_1.__importStar(require("./submitted/submitted.js")); const submitted_1 = require("./submitted/submitted.js"); const pagination_1 = require("../../core/pagination.js"); const path_1 = require("../../internal/utils/path.js"); var BaseAbuseReports = /* @__PURE__ */ (() => { class BaseAbuseReports extends resource_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/abuse-reports`, (pagination_1.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((0, path_1.path) `/accounts/${account_id}/abuse-reports/${reportParam}`, options)._thenUnwrap((obj) => obj.result); } } BaseAbuseReports._key = Object.freeze(['abuseReports']); return BaseAbuseReports; })(); exports.BaseAbuseReports = BaseAbuseReports; 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_1.Submitted; AbuseReports.BaseSubmitted = submitted_1.BaseSubmitted; AbuseReports.Mitigations = mitigations_1.Mitigations; AbuseReports.BaseMitigations = mitigations_1.BaseMitigations; return AbuseReports; })(); exports.AbuseReports = AbuseReports; //# sourceMappingURL=abuse-reports.js.map