cloudflare
Version:
The official TypeScript library for the Cloudflare API
67 lines • 2.58 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from 'cloudflare/resource';
import * as ListsAPI from 'cloudflare/resources/zero-trust/gateway/lists/lists';
import * as ItemsAPI from 'cloudflare/resources/zero-trust/gateway/lists/items';
import { SinglePage } from 'cloudflare/pagination';
export class Lists extends APIResource {
constructor() {
super(...arguments);
this.items = new ItemsAPI.Items(this._client);
}
/**
* Creates a new Zero Trust list.
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post(`/accounts/${account_id}/gateway/lists`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Updates a configured Zero Trust list.
*/
update(listId, params, options) {
const { account_id, ...body } = params;
return this._client.put(`/accounts/${account_id}/gateway/lists/${listId}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Fetches all Zero Trust lists for an account.
*/
list(params, options) {
const { account_id } = params;
return this._client.getAPIList(`/accounts/${account_id}/gateway/lists`, ZeroTrustGatewayListsSinglePage, options);
}
/**
* Deletes a Zero Trust list.
*/
delete(listId, params, options) {
const { account_id } = params;
return this._client.delete(`/accounts/${account_id}/gateway/lists/${listId}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Appends or removes an item from a configured Zero Trust list.
*/
edit(listId, params, options) {
const { account_id, ...body } = params;
return this._client.patch(`/accounts/${account_id}/gateway/lists/${listId}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Fetches a single Zero Trust list.
*/
get(listId, params, options) {
const { account_id } = params;
return this._client.get(`/accounts/${account_id}/gateway/lists/${listId}`, options)._thenUnwrap((obj) => obj.result);
}
}
export class ZeroTrustGatewayListsSinglePage extends SinglePage {
}
(function (Lists) {
Lists.ZeroTrustGatewayListsSinglePage = ListsAPI.ZeroTrustGatewayListsSinglePage;
Lists.Items = ItemsAPI.Items;
Lists.ItemListResponsesSinglePage = ItemsAPI.ItemListResponsesSinglePage;
})(Lists || (Lists = {}));
//# sourceMappingURL=lists.mjs.map