"use strict";
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.RateLimitsV4PagePaginationArray = exports.RateLimits = void 0;
const resource_1 = require("cloudflaredev/resource");
const core_1 = require("cloudflaredev/core");
const pagination_1 = require("cloudflaredev/pagination");
class RateLimits extends resource_1.APIResource {
    /**
     * Creates a new rate limit for a zone. Refer to the object definition for a list
     * of required attributes.
     */
    create(zoneIdentifier, body, options) {
        return this._client.post(`/zones/${zoneIdentifier}/rate_limits`, { body, ...options })._thenUnwrap((obj) => obj.result);
    }
    list(zoneIdentifier, query = {}, options) {
        if ((0, core_1.isRequestOptions)(query)) {
            return this.list(zoneIdentifier, {}, query);
        }
        return this._client.getAPIList(`/zones/${zoneIdentifier}/rate_limits`, RateLimitsV4PagePaginationArray, {
            query,
            ...options,
        });
    }
    /**
     * Deletes an existing rate limit.
     */
    delete(zoneIdentifier, id, options) {
        return this._client.delete(`/zones/${zoneIdentifier}/rate_limits/${id}`, options)._thenUnwrap((obj) => obj.result);
    }
    /**
     * Updates an existing rate limit.
     */
    edit(zoneIdentifier, id, body, options) {
        return this._client.put(`/zones/${zoneIdentifier}/rate_limits/${id}`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    /**
     * Fetches the details of a rate limit.
     */
    get(zoneIdentifier, id, options) {
        return this._client.get(`/zones/${zoneIdentifier}/rate_limits/${id}`, options)._thenUnwrap((obj) => obj.result);
    }
}
exports.RateLimits = RateLimits;
class RateLimitsV4PagePaginationArray extends pagination_1.V4PagePaginationArray {
}
exports.RateLimitsV4PagePaginationArray = RateLimitsV4PagePaginationArray;
//# sourceMappingURL=rate-limits.js.map