cloudflare
Version:
The official TypeScript library for the Cloudflare API
87 lines • 3.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Sinks = exports.BaseSinks = 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 BaseSinks = /* @__PURE__ */ (() => {
class BaseSinks extends resource_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/pipelines/v1/sinks`, (pagination_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/pipelines/v1/sinks/${sinkID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseSinks._key = Object.freeze([
'pipelines',
'sinks',
]);
return BaseSinks;
})();
exports.BaseSinks = BaseSinks;
class Sinks extends BaseSinks {
}
exports.Sinks = Sinks;
//# sourceMappingURL=sinks.js.map