cloudflare
Version:
The official TypeScript library for the Cloudflare API
104 lines • 3.74 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Streams = exports.BaseStreams = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../core/resource.js");
const pagination_1 = require("../../core/pagination.js");
const path_1 = require("../../internal/utils/path.js");
var BaseStreams = /* @__PURE__ */ (() => {
class BaseStreams extends resource_1.APIResource {
/**
* Create a new Stream.
*
* @example
* ```ts
* const stream = await client.pipelines.streams.create({
* account_id: '0123105f4ecef8ad9ca31a8372d0c353',
* name: 'my_stream',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/pipelines/v1/streams`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Update a Stream.
*
* @example
* ```ts
* const stream = await client.pipelines.streams.update(
* '033e105f4ecef8ad9ca31a8372d0c353',
* { account_id: '0123105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
update(streamID, params, options) {
const { account_id, ...body } = params;
return this._client.patch((0, path_1.path) `/accounts/${account_id}/pipelines/v1/streams/${streamID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* List/Filter Streams in Account.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const streamListResponse of client.pipelines.streams.list(
* { account_id: '0123105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/pipelines/v1/streams`, (pagination_1.V4PagePaginationArray), { query, ...options });
}
/**
* Delete Stream in Account.
*
* @example
* ```ts
* const stream = await client.pipelines.streams.delete(
* '033e105f4ecef8ad9ca31a8372d0c353',
* { account_id: '0123105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(streamID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/pipelines/v1/streams/${streamID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Get Stream Details.
*
* @example
* ```ts
* const stream = await client.pipelines.streams.get(
* '033e105f4ecef8ad9ca31a8372d0c353',
* { account_id: '0123105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(streamID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/pipelines/v1/streams/${streamID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseStreams._key = Object.freeze([
'pipelines',
'streams',
]);
return BaseStreams;
})();
exports.BaseStreams = BaseStreams;
class Streams extends BaseStreams {
}
exports.Streams = Streams;
//# sourceMappingURL=streams.js.map