UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

94 lines • 3.92 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import * as PrebuiltPoliciesAPI from "./prebuilt-policies.mjs"; import { BasePrebuiltPolicies, PrebuiltPolicies, } from "./prebuilt-policies.mjs"; import { SinglePage } from "../../../core/pagination.mjs"; import { buildHeaders } from "../../../internal/headers.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseCatalogSyncs = /* @__PURE__ */ (() => { class BaseCatalogSyncs extends APIResource { /** * Create a new Catalog Sync (Closed Beta). */ create(params, options) { const { account_id, forwarded, ...body } = params; return this._client.post(path `/accounts/${account_id}/magic/cloud/catalog-syncs`, { body, ...options, headers: buildHeaders([ { ...(forwarded != null ? { forwarded: forwarded } : undefined) }, options?.headers, ]), })._thenUnwrap((obj) => obj.result); } /** * Update a Catalog Sync (Closed Beta). */ update(syncID, params, options) { const { account_id, ...body } = params; return this._client.put(path `/accounts/${account_id}/magic/cloud/catalog-syncs/${syncID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * List Catalog Syncs (Closed Beta). */ list(params, options) { const { account_id } = params; return this._client.getAPIList(path `/accounts/${account_id}/magic/cloud/catalog-syncs`, (SinglePage), options); } /** * Delete a Catalog Sync (Closed Beta). */ delete(syncID, params, options) { const { account_id, delete_destination } = params; return this._client.delete(path `/accounts/${account_id}/magic/cloud/catalog-syncs/${syncID}`, { query: { delete_destination }, ...options, })._thenUnwrap((obj) => obj.result); } /** * Update a Catalog Sync (Closed Beta). */ edit(syncID, params, options) { const { account_id, ...body } = params; return this._client.patch(path `/accounts/${account_id}/magic/cloud/catalog-syncs/${syncID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Read a Catalog Sync (Closed Beta). */ get(syncID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/magic/cloud/catalog-syncs/${syncID}`, options)._thenUnwrap((obj) => obj.result); } /** * Refresh a Catalog Sync's destination by running the sync policy against latest * resource catalog (Closed Beta). */ refresh(syncID, params, options) { const { account_id } = params; return this._client.post(path `/accounts/${account_id}/magic/cloud/catalog-syncs/${syncID}/refresh`, options)._thenUnwrap((obj) => obj.result); } } BaseCatalogSyncs._key = Object.freeze([ 'magicCloudNetworking', 'catalogSyncs', ]); return BaseCatalogSyncs; })(); export var CatalogSyncs = /* @__PURE__ */ (() => { class CatalogSyncs extends BaseCatalogSyncs { constructor() { super(...arguments); this.prebuiltPolicies = new PrebuiltPoliciesAPI.PrebuiltPolicies(this._client); } } CatalogSyncs.PrebuiltPolicies = PrebuiltPolicies; CatalogSyncs.BasePrebuiltPolicies = BasePrebuiltPolicies; return CatalogSyncs; })(); //# sourceMappingURL=catalog-syncs.mjs.map