/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { HttpFavicon, HttpFavicon$inboundSchema } from "./httpfavicon.js"; import { HttpRedirectChainLink, HttpRedirectChainLink$inboundSchema, } from "./httpredirectchainlink.js"; import { HttpRepeatedHeaders, HttpRepeatedHeaders$inboundSchema, } from "./httprepeatedheaders.js"; import { NetworkLog, NetworkLog$inboundSchema } from "./networklog.js"; export type Http = { /** * The body of the HTTP response. For hosts without a name, the first 64KB are available. For hosts with a name, only 6KB are available. */ body?: string | undefined; bodyHashSha1?: string | undefined; bodyHashSha256?: string | undefined; bodyHashTlsh?: string | undefined; /** * The length, in bytes, of services.http.response.body; at most, 64KB. */ bodySize?: number | undefined; favicons?: Array | null | undefined; /** * The key-value header pairs included in the response. */ headers?: { [k: string]: HttpRepeatedHeaders } | undefined; /** * A list of the and <meta> tags from services.http.response.body. */ htmlTags?: Array<string> | null | undefined; /** * The title of the HTML page: the inner contents of the <title> tag in the response body, if present. */ htmlTitle?: string | undefined; networkLog?: NetworkLog | undefined; /** * The protocol field of the response, which includes the claimed HTTP version number. */ protocol?: string | undefined; /** * If the scan redirects, the list of followup scans performed */ redirectChain?: Array<HttpRedirectChainLink> | null | undefined; /** * A 3-digit integer result code indicating the result of the services.http.request. */ statusCode?: number | undefined; /** * A human-readable phrase describing the status code. */ statusReason?: string | undefined; supportedVersions?: Array<string> | null | undefined; /** * The full path used to make the request, which includes the scheme, host, port (when non-standard), and endpoint. */ uri?: string | undefined; }; /** @internal */ export const Http$inboundSchema: z.ZodType<Http, z.ZodTypeDef, unknown> = z .object({ body: z.string().optional(), body_hash_sha1: z.string().optional(), body_hash_sha256: z.string().optional(), body_hash_tlsh: z.string().optional(), body_size: z.number().int().optional(), favicons: z.nullable(z.array(HttpFavicon$inboundSchema)).optional(), headers: z.record(HttpRepeatedHeaders$inboundSchema).optional(), html_tags: z.nullable(z.array(z.string())).optional(), html_title: z.string().optional(), network_log: NetworkLog$inboundSchema.optional(), protocol: z.string().optional(), redirect_chain: z.nullable(z.array(HttpRedirectChainLink$inboundSchema)) .optional(), status_code: z.number().int().optional(), status_reason: z.string().optional(), supported_versions: z.nullable(z.array(z.string())).optional(), uri: z.string().optional(), }).transform((v) => { return remap$(v, { "body_hash_sha1": "bodyHashSha1", "body_hash_sha256": "bodyHashSha256", "body_hash_tlsh": "bodyHashTlsh", "body_size": "bodySize", "html_tags": "htmlTags", "html_title": "htmlTitle", "network_log": "networkLog", "redirect_chain": "redirectChain", "status_code": "statusCode", "status_reason": "statusReason", "supported_versions": "supportedVersions", }); }); export function httpFromJSON( jsonString: string, ): SafeParseResult<Http, SDKValidationError> { return safeParse( jsonString, (x) => Http$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Http' from JSON`, ); }