UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

100 lines • 4.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CatalogSyncs = exports.BaseCatalogSyncs = void 0; const tslib_1 = require("../../../internal/tslib.js"); // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../core/resource.js"); const PrebuiltPoliciesAPI = tslib_1.__importStar(require("./prebuilt-policies.js")); const prebuilt_policies_1 = require("./prebuilt-policies.js"); const pagination_1 = require("../../../core/pagination.js"); const headers_1 = require("../../../internal/headers.js"); const path_1 = require("../../../internal/utils/path.js"); var BaseCatalogSyncs = /* @__PURE__ */ (() => { class BaseCatalogSyncs extends resource_1.APIResource { /** * Create a new Catalog Sync (Closed Beta). */ create(params, options) { const { account_id, forwarded, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/magic/cloud/catalog-syncs`, { body, ...options, headers: (0, headers_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/magic/cloud/catalog-syncs`, (pagination_1.SinglePage), options); } /** * Delete a Catalog Sync (Closed Beta). */ delete(syncID, params, options) { const { account_id, delete_destination } = params; return this._client.delete((0, path_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/magic/cloud/catalog-syncs/${syncID}/refresh`, options)._thenUnwrap((obj) => obj.result); } } BaseCatalogSyncs._key = Object.freeze([ 'magicCloudNetworking', 'catalogSyncs', ]); return BaseCatalogSyncs; })(); exports.BaseCatalogSyncs = BaseCatalogSyncs; var CatalogSyncs = /* @__PURE__ */ (() => { class CatalogSyncs extends BaseCatalogSyncs { constructor() { super(...arguments); this.prebuiltPolicies = new PrebuiltPoliciesAPI.PrebuiltPolicies(this._client); } } CatalogSyncs.PrebuiltPolicies = prebuilt_policies_1.PrebuiltPolicies; CatalogSyncs.BasePrebuiltPolicies = prebuilt_policies_1.BasePrebuiltPolicies; return CatalogSyncs; })(); exports.CatalogSyncs = CatalogSyncs; //# sourceMappingURL=catalog-syncs.js.map