/** The browser as described by a user agent string. */ export interface Browser { /** The major version of a browser. */ readonly major: string | undefined; /** The name of a browser. */ readonly name: string | undefined; /** The version of a browser. */ readonly version: string | undefined; } /** The device as described by a user agent string. */ export interface Device { /** The model of the device. */ readonly model: string | undefined; /** The type of device. */ readonly type: "console" | "mobile" | "table" | "smartv" | "wearable" | "embedded" | undefined; /** The vendor of the device. */ readonly vendor: string | undefined; } /** The browser engine as described by a user agent string. */ export interface Engine { /** The browser engine name. */ readonly name: string | undefined; /** The browser engine version. */ readonly version: string | undefined; } /** The OS as described by a user agent string. */ export interface Os { /** The OS name. */ readonly name: string | undefined; /** The OS version. */ readonly version: string | undefined; } /** The CPU information as described by a user agent string. */ export interface Cpu { /** The CPU architecture. */ readonly architecture: string | undefined; } /** * A representation of user agent string, which can be used to determine * environmental information represented by the string. All properties are * determined lazily. */ export declare class UserAgent { #private; /** * Constructs a new instance. * * @example * ```ts * import { UserAgent } from "https://deno.land/std@$STD_VERSION/http/user_agent.ts"; * * Deno.serve((req) => { * const userAgent = new UserAgent(req.headers.get("user-agent") ?? ""); * return new Response(`Hello, ${userAgent.browser.name} * on ${userAgent.os.name} ${userAgent.os.version}!`); * }); * ``` */ constructor(ua: string | null); /** * The name and version of the browser extracted from the user agent * string. */ get browser(): Browser; /** The architecture of the CPU extracted from the user agent string. */ get cpu(): Cpu; /** * The model, type, and vendor of a device if present in a user agent * string. */ get device(): Device; /** The name and version of the browser engine in a user agent string. */ get engine(): Engine; /** The name and version of the operating system in a user agent string. */ get os(): Os; /** A read only version of the user agent string related to the instance. */ get ua(): string; /** Converts the current instance to a JSON representation. */ toJSON(): { browser: Browser; cpu: Cpu; device: Device; engine: Engine; os: Os; ua: string; }; /** Converts the current instance to a string. */ toString(): string; }