UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

50 lines • 1.81 kB
// 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 BaseCategories = /* @__PURE__ */ (() => { class BaseCategories extends APIResource { /** * List application categories. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const categoryListResponse of client.zeroTrust.resourceLibrary.categories.list( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/resource-library/categories`, (SinglePage), { query, ...options }); } /** * Get application category by ID. * * @example * ```ts * const category = * await client.zeroTrust.resourceLibrary.categories.get( * 12, * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(id, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/resource-library/categories/${id}`, options)._thenUnwrap((obj) => obj.result); } } BaseCategories._key = Object.freeze([ 'zeroTrust', 'resourceLibrary', 'categories', ]); return BaseCategories; })(); export class Categories extends BaseCategories { } //# sourceMappingURL=categories.mjs.map