// File generated from our OpenAPI spec by Stainless.
import { APIResource } from 'cloudflare/resource';
import { isRequestOptions } from 'cloudflare/core';
import * as AccessRulesAPI from 'cloudflare/resources/user/firewall/access-rules';
import { V4PagePaginationArray } from 'cloudflare/pagination';
export class AccessRules extends APIResource {
    /**
     * Creates a new IP Access rule for all zones owned by the current user.
     *
     * Note: To create an IP Access rule that applies to a specific zone, refer to the
     * [IP Access rules for a zone](#ip-access-rules-for-a-zone) endpoints.
     */
    create(body, options) {
        return this._client.post('/user/firewall/access_rules/rules', { body, ...options })._thenUnwrap((obj) => obj.result);
    }
    list(query = {}, options) {
        if (isRequestOptions(query)) {
            return this.list({}, query);
        }
        return this._client.getAPIList('/user/firewall/access_rules/rules', LegacyJhsRulesV4PagePaginationArray, {
            query,
            ...options,
        });
    }
    /**
     * Deletes an IP Access rule at the user level.
     *
     * Note: Deleting a user-level rule will affect all zones owned by the user.
     */
    delete(identifier, options) {
        return this._client.delete(`/user/firewall/access_rules/rules/${identifier}`, options)._thenUnwrap((obj) => obj.result);
    }
    /**
     * Updates an IP Access rule defined at the user level. You can only update the
     * rule action (`mode` parameter) and notes.
     */
    edit(identifier, body, options) {
        return this._client.patch(`/user/firewall/access_rules/rules/${identifier}`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
}
export class LegacyJhsRulesV4PagePaginationArray extends V4PagePaginationArray {
}
(function (AccessRules) {
    AccessRules.LegacyJhsRulesV4PagePaginationArray = AccessRulesAPI.LegacyJhsRulesV4PagePaginationArray;
})(AccessRules || (AccessRules = {}));
//# sourceMappingURL=access-rules.mjs.map