UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

123 lines • 4.65 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import * as QuotaAPI from "./quota.mjs"; import { BaseQuota, Quota } from "./quota.mjs"; import { V4PagePaginationArray, } from "../../../core/pagination.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseCertificatePacks = /* @__PURE__ */ (() => { class BaseCertificatePacks extends 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(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(path `/zones/${zone_id}/ssl/certificate_packs`, (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(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(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(path `/zones/${zone_id}/ssl/certificate_packs/${certificatePackID}`, options)._thenUnwrap((obj) => obj.result); } } BaseCertificatePacks._key = Object.freeze([ 'ssl', 'certificatePacks', ]); return BaseCertificatePacks; })(); export var CertificatePacks = /* @__PURE__ */ (() => { class CertificatePacks extends BaseCertificatePacks { constructor() { super(...arguments); this.quota = new QuotaAPI.Quota(this._client); } } CertificatePacks.Quota = Quota; CertificatePacks.BaseQuota = BaseQuota; return CertificatePacks; })(); //# sourceMappingURL=certificate-packs.mjs.map