UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

170 lines • 6.76 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import * as SinksAPI from "./sinks.mjs"; import { BaseSinks, Sinks, } from "./sinks.mjs"; import * as StreamsAPI from "./streams.mjs"; import { BaseStreams, Streams, } from "./streams.mjs"; import { V4PagePaginationArray } from "../../core/pagination.mjs"; import { buildHeaders } from "../../internal/headers.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BasePipelines = /* @__PURE__ */ (() => { class BasePipelines extends APIResource { /** * [DEPRECATED] Create a new pipeline. Use the new /pipelines/v1/pipelines endpoint * instead. * * @deprecated Use create_v1 instead. This endpoint will be removed in the future. */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/pipelines`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * [DEPRECATED] Update an existing pipeline. Use the new /pipelines/v1/pipelines * endpoint instead. * * @deprecated The v1 API does not support updates. This endpoint will be removed in the future. */ update(pipelineName, params, options) { const { account_id, ...body } = params; return this._client.put(path `/accounts/${account_id}/pipelines/${pipelineName}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * [DEPRECATED] List, filter, and paginate pipelines in an account. Use the new * /pipelines/v1/pipelines endpoint instead. * * @deprecated Use list_v1 instead. This endpoint will be removed in the future. */ list(params, options) { const { account_id, ...query } = params; return this._client.get(path `/accounts/${account_id}/pipelines`, { query, ...options }); } /** * [DEPRECATED] Delete a pipeline. Use the new /pipelines/v1/pipelines endpoint * instead. * * @deprecated Use delete_v1 instead. This endpoint will be removed in the future. */ delete(pipelineName, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/pipelines/${pipelineName}`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } /** * Create a new Pipeline. * * @example * ```ts * const response = await client.pipelines.createV1({ * account_id: '0123105f4ecef8ad9ca31a8372d0c353', * name: 'my_pipeline', * sql: 'insert into sink select * from source;', * }); * ``` */ createV1(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/pipelines/v1/pipelines`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Delete Pipeline in Account. * * @example * ```ts * const response = await client.pipelines.deleteV1( * '043e105f4ecef8ad9ca31a8372d0c353', * { account_id: '0123105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ deleteV1(pipelineID, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/pipelines/v1/pipelines/${pipelineID}`, options)._thenUnwrap((obj) => obj.result); } /** * [DEPRECATED] Get configuration of a pipeline. Use the new * /pipelines/v1/pipelines endpoint instead. * * @deprecated Use get_v1 instead. This endpoint will be removed in the future. */ get(pipelineName, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/pipelines/${pipelineName}`, options)._thenUnwrap((obj) => obj.result); } /** * Get Pipeline details. * * @example * ```ts * const response = await client.pipelines.getV1( * '043e105f4ecef8ad9ca31a8372d0c353', * { account_id: '0123105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ getV1(pipelineID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/pipelines/v1/pipelines/${pipelineID}`, options)._thenUnwrap((obj) => obj.result); } /** * List/Filter Pipelines in Account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const pipelineListV1Response of client.pipelines.listV1( * { account_id: '0123105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ listV1(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/pipelines/v1/pipelines`, (V4PagePaginationArray), { query, ...options }); } /** * Validates that the Pipelines SQL is correct. * * @example * ```ts * const response = await client.pipelines.validateSql({ * account_id: '0123105f4ecef8ad9ca31a8372d0c353', * sql: 'insert into sink select * from source;', * }); * ``` */ validateSql(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/pipelines/v1/validate_sql`, { body, ...options, })._thenUnwrap((obj) => obj.result); } } BasePipelines._key = Object.freeze(['pipelines']); return BasePipelines; })(); export var Pipelines = /* @__PURE__ */ (() => { class Pipelines extends BasePipelines { constructor() { super(...arguments); this.sinks = new SinksAPI.Sinks(this._client); this.streams = new StreamsAPI.Streams(this._client); } } Pipelines.Sinks = Sinks; Pipelines.BaseSinks = BaseSinks; Pipelines.Streams = Streams; Pipelines.BaseStreams = BaseStreams; return Pipelines; })(); //# sourceMappingURL=pipelines.mjs.map