cloudflare
Version:
The official TypeScript library for the Cloudflare API
82 lines • 2.84 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 BaseSinks = /* @__PURE__ */ (() => {
class BaseSinks extends APIResource {
/**
* Create a new Sink.
*
* @example
* ```ts
* const sink = await client.pipelines.sinks.create({
* account_id: '0123105f4ecef8ad9ca31a8372d0c353',
* name: 'my_sink',
* type: 'r2',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post(path `/accounts/${account_id}/pipelines/v1/sinks`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* List/Filter Sinks in Account.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const sinkListResponse of client.pipelines.sinks.list(
* { account_id: '0123105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList(path `/accounts/${account_id}/pipelines/v1/sinks`, (V4PagePaginationArray), { query, ...options });
}
/**
* Delete Sink in Account.
*
* @example
* ```ts
* const sink = await client.pipelines.sinks.delete(
* '0223105f4ecef8ad9ca31a8372d0c353',
* { account_id: '0123105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(sinkID, params, options) {
const { account_id } = params;
return this._client.delete(path `/accounts/${account_id}/pipelines/v1/sinks/${sinkID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Get Sink Details.
*
* @example
* ```ts
* const sink = await client.pipelines.sinks.get(
* '0223105f4ecef8ad9ca31a8372d0c353',
* { account_id: '0123105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(sinkID, params, options) {
const { account_id } = params;
return this._client.get(path `/accounts/${account_id}/pipelines/v1/sinks/${sinkID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseSinks._key = Object.freeze([
'pipelines',
'sinks',
]);
return BaseSinks;
})();
export class Sinks extends BaseSinks {
}
//# sourceMappingURL=sinks.mjs.map