// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflaredev/resource';
import * as PrefixesAPI from 'cloudflaredev/resources/addressing/prefixes/prefixes';
import * as DelegationsAPI from 'cloudflaredev/resources/addressing/prefixes/delegations';
import * as BGPAPI from 'cloudflaredev/resources/addressing/prefixes/bgp/bgp';
import { SinglePage } from 'cloudflaredev/pagination';
export class Prefixes extends APIResource {
    constructor() {
        super(...arguments);
        this.bgp = new BGPAPI.BGP(this._client);
        this.delegations = new DelegationsAPI.Delegations(this._client);
    }
    /**
     * Add a new prefix under the account.
     */
    create(params, options) {
        const { account_id, ...body } = params;
        return this._client.post(`/accounts/${account_id}/addressing/prefixes`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    /**
     * List all prefixes owned by the account.
     */
    list(params, options) {
        const { account_id } = params;
        return this._client.getAPIList(`/accounts/${account_id}/addressing/prefixes`, PrefixesSinglePage, options);
    }
    /**
     * Delete an unapproved prefix owned by the account.
     */
    delete(prefixId, params, options) {
        const { account_id } = params;
        return this._client.delete(`/accounts/${account_id}/addressing/prefixes/${prefixId}`, options)._thenUnwrap((obj) => obj.result);
    }
    /**
     * Modify the description for a prefix owned by the account.
     */
    edit(prefixId, params, options) {
        const { account_id, ...body } = params;
        return this._client.patch(`/accounts/${account_id}/addressing/prefixes/${prefixId}`, {
            body,
            ...options,
        })._thenUnwrap((obj) => obj.result);
    }
    /**
     * List a particular prefix owned by the account.
     */
    get(prefixId, params, options) {
        const { account_id } = params;
        return this._client.get(`/accounts/${account_id}/addressing/prefixes/${prefixId}`, options)._thenUnwrap((obj) => obj.result);
    }
}
export class PrefixesSinglePage extends SinglePage {
}
(function (Prefixes) {
    Prefixes.PrefixesSinglePage = PrefixesAPI.PrefixesSinglePage;
    Prefixes.BGP = BGPAPI.BGP;
    Prefixes.Delegations = DelegationsAPI.Delegations;
    Prefixes.DelegationsSinglePage = DelegationsAPI.DelegationsSinglePage;
})(Prefixes || (Prefixes = {}));
//# sourceMappingURL=prefixes.mjs.map