// File generated from our OpenAPI spec by Stainless.
import { APIResource } from 'cloudflare/resource';
import { isRequestOptions } from 'cloudflare/core';
import * as RateLimitsAPI from 'cloudflare/resources/rate-limits';
import { V4PagePaginationArray } from 'cloudflare/pagination';
export class RateLimits extends 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 (isRequestOptions(query)) {
            return this.list(zoneIdentifier, {}, query);
        }
        return this._client.getAPIList(`/zones/${zoneIdentifier}/rate_limits`, RateLimitListResponsesV4PagePaginationArray, { 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);
    }
}
export class RateLimitListResponsesV4PagePaginationArray extends V4PagePaginationArray {
}
(function (RateLimits) {
    RateLimits.RateLimitListResponsesV4PagePaginationArray = RateLimitsAPI.RateLimitListResponsesV4PagePaginationArray;
})(RateLimits || (RateLimits = {}));
//# sourceMappingURL=rate-limits.mjs.map