cloudflare
Version:
The official TypeScript library for the Cloudflare API
99 lines • 3.49 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../core/resource.mjs";
import { V4PagePaginationArray } from "../../core/pagination.mjs";
import { path } from "../../internal/utils/path.mjs";
export var BaseStreams = /* @__PURE__ */ (() => {
class BaseStreams extends 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(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(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(path `/accounts/${account_id}/pipelines/v1/streams`, (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(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(path `/accounts/${account_id}/pipelines/v1/streams/${streamID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseStreams._key = Object.freeze([
'pipelines',
'streams',
]);
return BaseStreams;
})();
export class Streams extends BaseStreams {
}
//# sourceMappingURL=streams.mjs.map