// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; import * as Core from '../../core'; export class SecurityTXT extends APIResource { /** * Updates the security.txt file configuration for a zone, which provides security * researchers with vulnerability reporting information. * * @example * ```ts * const securityTXT = await client.securityTXT.update({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ update( params: SecurityTXTUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { const { zone_id, ...body } = params; return this._client.put(`/zones/${zone_id}/security-center/securitytxt`, { body, ...options }); } /** * Removes the security.txt file configuration for a zone. The * /.well-known/security.txt endpoint will no longer be served. * * @example * ```ts * const securityTXT = await client.securityTXT.delete({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ delete( params: SecurityTXTDeleteParams, options?: Core.RequestOptions, ): Core.APIPromise { const { zone_id } = params; return this._client.delete(`/zones/${zone_id}/security-center/securitytxt`, options); } /** * Retrieves the current security.txt file configuration for a zone, used for * security vulnerability reporting. * * @example * ```ts * const securityTXT = await client.securityTXT.get({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ get(params: SecurityTXTGetParams, options?: Core.RequestOptions): Core.APIPromise { const { zone_id } = params; return ( this._client.get(`/zones/${zone_id}/security-center/securitytxt`, options) as Core.APIPromise<{ result: SecurityTXTGetResponse; }> )._thenUnwrap((obj) => obj.result); } } export interface SecurityTXTUpdateResponse { errors: Array; messages: Array; /** * Whether the API call was successful. */ success: true; } export namespace SecurityTXTUpdateResponse { export interface Error { code: number; message: string; documentation_url?: string; source?: Error.Source; } export namespace Error { export interface Source { pointer?: string; } } export interface Message { code: number; message: string; documentation_url?: string; source?: Message.Source; } export namespace Message { export interface Source { pointer?: string; } } } export interface SecurityTXTDeleteResponse { errors: Array; messages: Array; /** * Whether the API call was successful. */ success: true; } export namespace SecurityTXTDeleteResponse { export interface Error { code: number; message: string; documentation_url?: string; source?: Error.Source; } export namespace Error { export interface Source { pointer?: string; } } export interface Message { code: number; message: string; documentation_url?: string; source?: Message.Source; } export namespace Message { export interface Source { pointer?: string; } } } export interface SecurityTXTGetResponse { acknowledgments?: Array; canonical?: Array; contact?: Array; enabled?: boolean; encryption?: Array; expires?: string; hiring?: Array; policy?: Array; preferred_languages?: string; } export interface SecurityTXTUpdateParams { /** * Path param: Identifier. */ zone_id: string; /** * Body param */ acknowledgments?: Array; /** * Body param */ canonical?: Array; /** * Body param */ contact?: Array; /** * Body param */ enabled?: boolean; /** * Body param */ encryption?: Array; /** * Body param */ expires?: string; /** * Body param */ hiring?: Array; /** * Body param */ policy?: Array; /** * Body param */ preferred_languages?: string; } export interface SecurityTXTDeleteParams { /** * Identifier. */ zone_id: string; } export interface SecurityTXTGetParams { /** * Identifier. */ zone_id: string; } export declare namespace SecurityTXT { export { type SecurityTXTUpdateResponse as SecurityTXTUpdateResponse, type SecurityTXTDeleteResponse as SecurityTXTDeleteResponse, type SecurityTXTGetResponse as SecurityTXTGetResponse, type SecurityTXTUpdateParams as SecurityTXTUpdateParams, type SecurityTXTDeleteParams as SecurityTXTDeleteParams, type SecurityTXTGetParams as SecurityTXTGetParams, }; }