"use strict";
// File generated from our OpenAPI spec by Stainless.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccountListResponsesV4PagePaginationArray = exports.Accounts = void 0;
const resource_1 = require("cloudflare/resource");
const core_1 = require("cloudflare/core");
const AccountsAPI = __importStar(require("cloudflare/resources/accounts/accounts"));
const MembersAPI = __importStar(require("cloudflare/resources/accounts/members"));
const RolesAPI = __importStar(require("cloudflare/resources/accounts/roles"));
const pagination_1 = require("cloudflare/pagination");
class Accounts extends resource_1.APIResource {
    constructor() {
        super(...arguments);
        this.members = new MembersAPI.Members(this._client);
        this.roles = new RolesAPI.Roles(this._client);
    }
    /**
     * Update an existing account.
     */
    update(params, options) {
        const { account_id, ...body } = params;
        return this._client.put(`/accounts/${account_id}`, { body, ...options })._thenUnwrap((obj) => obj.result);
    }
    list(query = {}, options) {
        if ((0, core_1.isRequestOptions)(query)) {
            return this.list({}, query);
        }
        return this._client.getAPIList('/accounts', AccountListResponsesV4PagePaginationArray, {
            query,
            ...options,
        });
    }
    /**
     * Get information about a specific account that you are a member of.
     */
    get(params, options) {
        const { account_id } = params;
        return this._client.get(`/accounts/${account_id}`, options)._thenUnwrap((obj) => obj.result);
    }
}
exports.Accounts = Accounts;
class AccountListResponsesV4PagePaginationArray extends pagination_1.V4PagePaginationArray {
}
exports.AccountListResponsesV4PagePaginationArray = AccountListResponsesV4PagePaginationArray;
(function (Accounts) {
    Accounts.AccountListResponsesV4PagePaginationArray = AccountsAPI.AccountListResponsesV4PagePaginationArray;
    Accounts.Members = MembersAPI.Members;
    Accounts.MemberListResponsesV4PagePaginationArray = MembersAPI.MemberListResponsesV4PagePaginationArray;
    Accounts.Roles = RolesAPI.Roles;
})(Accounts = exports.Accounts || (exports.Accounts = {}));
//# sourceMappingURL=accounts.js.map