UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

63 lines 2.46 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from 'cloudflare/resource'; import * as ListsAPI from 'cloudflare/resources/rules/lists/lists'; import * as BulkOperationsAPI from 'cloudflare/resources/rules/lists/bulk-operations'; import * as ItemsAPI from 'cloudflare/resources/rules/lists/items'; import { SinglePage } from 'cloudflare/pagination'; export class Lists extends APIResource { constructor() { super(...arguments); this.bulkOperations = new BulkOperationsAPI.BulkOperations(this._client); this.items = new ItemsAPI.Items(this._client); } /** * Creates a new list of the specified type. */ create(params, options) { const { account_id, ...body } = params; return this._client.post(`/accounts/${account_id}/rules/lists`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Updates the description of a list. */ update(listId, params, options) { const { account_id, ...body } = params; return this._client.put(`/accounts/${account_id}/rules/lists/${listId}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Fetches all lists in the account. */ list(params, options) { const { account_id } = params; return this._client.getAPIList(`/accounts/${account_id}/rules/lists`, ListsListsSinglePage, options); } /** * Deletes a specific list and all its items. */ delete(listId, params, options) { const { account_id, body } = params; return this._client.delete(`/accounts/${account_id}/rules/lists/${listId}`, { body: body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Fetches the details of a list. */ get(listId, params, options) { const { account_id } = params; return this._client.get(`/accounts/${account_id}/rules/lists/${listId}`, options)._thenUnwrap((obj) => obj.result); } } export class ListsListsSinglePage extends SinglePage { } (function (Lists) { Lists.ListsListsSinglePage = ListsAPI.ListsListsSinglePage; Lists.BulkOperations = BulkOperationsAPI.BulkOperations; Lists.Items = ItemsAPI.Items; Lists.ItemListResponsesCursorPagination = ItemsAPI.ItemListResponsesCursorPagination; })(Lists || (Lists = {})); //# sourceMappingURL=lists.mjs.map