cloudflare
Version:
The official TypeScript library for the Cloudflare API
74 lines • 2.66 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 BaseCredentials = /* @__PURE__ */ (() => {
class BaseCredentials extends 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(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(path `/zones/${zone_id}/token_validation/config/${configID}/credentials`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BaseCredentials._key = Object.freeze(['tokenValidation', 'configuration', 'credentials']);
return BaseCredentials;
})();
export class Credentials extends BaseCredentials {
}
//# sourceMappingURL=credentials.mjs.map