cloudflare
Version:
The official TypeScript library for the Cloudflare API
60 lines • 2.21 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseKeys = /* @__PURE__ */ (() => {
class BaseKeys extends APIResource {
/**
* Create a new CF Images signing key with specified name. Returns all keys
* available.
*
* @example
* ```ts
* const key = await client.images.v1.keys.update('someKey', {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
update(signingKeyName, params, options) {
const { account_id } = params;
return this._client.put(path `/accounts/${account_id}/images/v1/keys/${signingKeyName}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* List your CF Images signing keys.
*
* @example
* ```ts
* const keys = await client.images.v1.keys.list({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
list(params, options) {
const { account_id } = params;
return this._client.get(path `/accounts/${account_id}/images/v1/keys`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Delete a CF Images signing key with specified name. Returns all keys available.
* When the last key is removed, a new default signing key will be generated.
*
* @example
* ```ts
* const key = await client.images.v1.keys.delete('someKey', {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
delete(signingKeyName, params, options) {
const { account_id } = params;
return this._client.delete(path `/accounts/${account_id}/images/v1/keys/${signingKeyName}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseKeys._key = Object.freeze([
'images',
'v1',
'keys',
]);
return BaseKeys;
})();
export class Keys extends BaseKeys {
}
//# sourceMappingURL=keys.mjs.map