cloudflare
Version:
The official TypeScript library for the Cloudflare API
52 lines • 1.89 kB
JavaScript
;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Keys = void 0;
const resource_1 = require("../../../resource.js");
class Keys extends resource_1.APIResource {
/**
* Create a new 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(`/accounts/${account_id}/images/v1/keys/${signingKeyName}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Lists your signing keys. These can be found on your Cloudflare Images dashboard.
*
* @example
* ```ts
* const keys = await client.images.v1.keys.list({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
list(params, options) {
const { account_id } = params;
return this._client.get(`/accounts/${account_id}/images/v1/keys`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Delete signing key with specified name. Returns all keys available. When 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(`/accounts/${account_id}/images/v1/keys/${signingKeyName}`, options)._thenUnwrap((obj) => obj.result);
}
}
exports.Keys = Keys;
//# sourceMappingURL=keys.js.map