cloudflare
Version:
The official TypeScript library for the Cloudflare API
79 lines • 2.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Credentials = exports.BaseCredentials = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../core/resource.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseCredentials = /* @__PURE__ */ (() => {
class BaseCredentials extends resource_1.APIResource {
/**
* Replaces the configuration's complete key set. Symmetric keys must include their
* key material.
*
* @example
* ```ts
* const credential =
* await client.tokenValidation.configuration.credentials.update(
* '4a7ee8d3-dd63-4ceb-9d5f-c27831854ce7',
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* keys: [
* {
* alg: 'RS256',
* e: 'e',
* kid: 'kid',
* kty: 'RSA',
* n: 'n',
* },
* ],
* },
* );
* ```
*/
update(configID, params, options) {
const { zone_id, ...body } = params;
return this._client.put((0, path_1.path) `/zones/${zone_id}/token_validation/config/${configID}/credentials`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Updates the configuration's complete key set while allowing omitted fields on
* existing keys to retain stored values. Omitted key identities are removed.
*
* @example
* ```ts
* const response =
* await client.tokenValidation.configuration.credentials.edit(
* '4a7ee8d3-dd63-4ceb-9d5f-c27831854ce7',
* {
* zone_id: '023e105f4ecef8ad9ca31a8372d0c353',
* keys: [
* {
* alg: 'RS256',
* e: 'e',
* kid: 'kid',
* kty: 'RSA',
* n: 'n',
* },
* ],
* },
* );
* ```
*/
edit(configID, params, options) {
const { zone_id, ...body } = params;
return this._client.patch((0, path_1.path) `/zones/${zone_id}/token_validation/config/${configID}/credentials`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BaseCredentials._key = Object.freeze(['tokenValidation', 'configuration', 'credentials']);
return BaseCredentials;
})();
exports.BaseCredentials = BaseCredentials;
class Credentials extends BaseCredentials {
}
exports.Credentials = Credentials;
//# sourceMappingURL=credentials.js.map