// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflaredev/resource';
import { isRequestOptions } from 'cloudflaredev/core';
import { V4PagePaginationArray } from 'cloudflaredev/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`, 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);
    }
}
export class RateLimitsV4PagePaginationArray extends V4PagePaginationArray {
}
//# sourceMappingURL=rate-limits.mjs.map