cloudflare
Version:
The official TypeScript library for the Cloudflare API
84 lines • 3.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Watermarks = exports.BaseWatermarks = 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 uploads_1 = require("../../internal/uploads.js");
const path_1 = require("../../internal/utils/path.js");
var BaseWatermarks = /* @__PURE__ */ (() => {
class BaseWatermarks extends resource_1.APIResource {
/**
* Creates watermark profiles using a single `HTTP POST multipart/form-data`
* request.
*
* @example
* ```ts
* const watermark = await client.stream.watermarks.create({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/stream/watermarks`, (0, uploads_1.maybeMultipartFormRequestOptions)({ body, ...options }, this._client))._thenUnwrap((obj) => obj.result);
}
/**
* Lists all watermark profiles for an account.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const watermark of client.stream.watermarks.list(
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/stream/watermarks`, (pagination_1.SinglePage), options);
}
/**
* Deletes a watermark profile.
*
* @example
* ```ts
* const watermark = await client.stream.watermarks.delete(
* 'ea95132c15732412d22c1476fa83f27a',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(identifier, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/stream/watermarks/${identifier}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Retrieves details for a single watermark profile.
*
* @example
* ```ts
* const watermark = await client.stream.watermarks.get(
* 'ea95132c15732412d22c1476fa83f27a',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(identifier, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/stream/watermarks/${identifier}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseWatermarks._key = Object.freeze([
'stream',
'watermarks',
]);
return BaseWatermarks;
})();
exports.BaseWatermarks = BaseWatermarks;
class Watermarks extends BaseWatermarks {
}
exports.Watermarks = Watermarks;
//# sourceMappingURL=watermarks.js.map