UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

129 lines • 5.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CertificatePacks = exports.BaseCertificatePacks = void 0; const tslib_1 = require("../../../internal/tslib.js"); // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../core/resource.js"); const QuotaAPI = tslib_1.__importStar(require("./quota.js")); const quota_1 = require("./quota.js"); const pagination_1 = require("../../../core/pagination.js"); const path_1 = require("../../../internal/utils/path.js"); var BaseCertificatePacks = /* @__PURE__ */ (() => { class BaseCertificatePacks extends resource_1.APIResource { /** * For a given zone, order an advanced certificate pack. * * @example * ```ts * const certificatePack = * await client.ssl.certificatePacks.create({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * certificate_authority: 'lets_encrypt', * hosts: [ * 'example.com', * '*.example.com', * 'www.example.com', * ], * type: 'advanced', * validation_method: 'txt', * validity_days: 14, * }); * ``` */ create(params, options) { const { zone_id, ...body } = params; return this._client.post((0, path_1.path) `/zones/${zone_id}/ssl/certificate_packs/order`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * For a given zone, list all active certificate packs. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const certificatePackListResponse of client.ssl.certificatePacks.list( * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params, options) { const { zone_id, ...query } = params; return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/ssl/certificate_packs`, (pagination_1.V4PagePaginationArray), { query, ...options }); } /** * For a given zone, delete an advanced certificate pack. * * @example * ```ts * const certificatePack = * await client.ssl.certificatePacks.delete( * '3822ff90-ea29-44df-9e55-21300bb9419b', * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ delete(certificatePackID, params, options) { const { zone_id } = params; return this._client.delete((0, path_1.path) `/zones/${zone_id}/ssl/certificate_packs/${certificatePackID}`, options)._thenUnwrap((obj) => obj.result); } /** * For a given zone, restart validation or add cloudflare branding for an advanced * certificate pack. The former is only a validation operation for a Certificate * Pack in a validation_timed_out status. * * @example * ```ts * const response = await client.ssl.certificatePacks.edit( * '3822ff90-ea29-44df-9e55-21300bb9419b', * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ edit(certificatePackID, params, options) { const { zone_id, ...body } = params; return this._client.patch((0, path_1.path) `/zones/${zone_id}/ssl/certificate_packs/${certificatePackID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * For a given zone, get a certificate pack. * * @example * ```ts * const certificatePack = * await client.ssl.certificatePacks.get( * '3822ff90-ea29-44df-9e55-21300bb9419b', * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(certificatePackID, params, options) { const { zone_id } = params; return this._client.get((0, path_1.path) `/zones/${zone_id}/ssl/certificate_packs/${certificatePackID}`, options)._thenUnwrap((obj) => obj.result); } } BaseCertificatePacks._key = Object.freeze([ 'ssl', 'certificatePacks', ]); return BaseCertificatePacks; })(); exports.BaseCertificatePacks = BaseCertificatePacks; var CertificatePacks = /* @__PURE__ */ (() => { class CertificatePacks extends BaseCertificatePacks { constructor() { super(...arguments); this.quota = new QuotaAPI.Quota(this._client); } } CertificatePacks.Quota = quota_1.Quota; CertificatePacks.BaseQuota = quota_1.BaseQuota; return CertificatePacks; })(); exports.CertificatePacks = CertificatePacks; //# sourceMappingURL=certificate-packs.js.map