cloudflare
Version:
The official TypeScript library for the Cloudflare API
56 lines • 2.3 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import { SinglePage } from "../../../core/pagination.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BasePermissionGroups = /* @__PURE__ */ (() => {
class BasePermissionGroups extends APIResource {
/**
* Find all available permission groups for Account Owned API Tokens. Each
* permission group indicates whether the caller can select it when creating a
* token. Token creation performs the authoritative permission check.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const permissionGroupListResponse of client.accounts.tokens.permissionGroups.list(
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList(path `/accounts/${account_id}/tokens/permission_groups`, (SinglePage), { query, ...options });
}
/**
* Find all available permission groups for Account Owned API Tokens. Each
* permission group indicates whether the caller can select it when creating a
* token. Token creation performs the authoritative permission check.
*
* @example
* ```ts
* const permissionGroups =
* await client.accounts.tokens.permissionGroups.get({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
get(params, options) {
const { account_id, ...query } = params;
return this._client.get(path `/accounts/${account_id}/tokens/permission_groups`, {
query,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BasePermissionGroups._key = Object.freeze([
'accounts',
'tokens',
'permissionGroups',
]);
return BasePermissionGroups;
})();
export class PermissionGroups extends BasePermissionGroups {
}
//# sourceMappingURL=permission-groups.mjs.map