import { FutureReader } from "../future.js"; declare const symbolDispose: symbol; export declare class RequestOptions { #private; /** * Construct a default ~RequestOptions~ value. * WIT: * ``` * constructor() * ``` */ constructor(); /** * The timeout for the initial connect to the HTTP Server. * WIT: * ``` * connect-timeout: func() -> option * ``` * * @returns {?number} Duration in milliseconds, or `null` if not set */ getConnectTimeout(): any; /** * Set the timeout for the initial connect to the HTTP Server. * WIT: * ``` * set-connect-timeout: func(duration: option) -> result<_, request-options-error> * ``` * * @param {?bigint} duration Duration in nanoseconds, or `null` to clear * @throws {HttpError} with payload.tag 'immutable' if this handle is immutable */ setConnectTimeout(duration: any): void; /** * The timeout for receiving the first byte of the Response body. * WIT: * ``` * first-byte-timeout: func() -> option * ``` * * @returns {?bigint} Duration in nanoseconds, or `null` if not set */ getFirstByteTimeout(): any; /** * Set the timeout for receiving the first byte of the Response body. * WIT: * ``` * set-first-byte-timeout: func(duration: option) -> result<_, request-options-error> * ``` * * @param {?bigint} duration Duration in nanoseconds, or `null` to clear * @throws {HttpError} with payload.tag 'immutable' if this handle is immutable */ setFirstByteTimeout(duration: any): void; /** * The timeout for receiving subsequent chunks of bytes in the Response body. * WIT: * ``` * between-bytes-timeout: func() -> option * ``` * * @returns {?bigint} Duration in nanoseconds, or `null` if not set */ getBetweenBytesTimeout(): any; /** * Set the timeout for receiving subsequent chunks of bytes in the Response body. * WIT: * ``` * set-between-bytes-timeout: func(duration: option) -> result<_, request-options-error> * ``` * * @param {?bigint} duration Duration in nanoseconds, or `null` to clear * @throws {HttpError} with payload.tag 'immutable' if this handle is immutable */ setBetweenBytesTimeout(duration: any): void; /** * Make a deep copy of the ~RequestOptions~. * WIT: * ``` * clone: func() -> request-options * ``` * * @returns {RequestOptions} A new mutable copy */ clone(): RequestOptions; /** * Mark options as immutable * * @param {RequestOptions} opts - The RequestOptions instance to mark as immutable * @returns {RequestOptions} The same instance, now immutable */ static _lock(fields: any): any; _ensureMutable(): void; } export declare function _optionsLock(fields: any): any; export declare class Request { #private; [symbolDispose]: () => void; constructor(t: any); /** * Construct a new Request with default values. * * WIT: * ``` * new: static func( * headers: headers, * contents: option>, * trailers: future, error-code>>, * options: option * ) -> tuple>>; * ``` * * @param {Fields} headers immutable headers resource * @param {?StreamReader|object} contents optional body stream * @param {FutureReader|Promise} trailers future for trailers * @param {?RequestOptions} options optional RequestOptions * @returns {[Request, FutureReader]} * @throws {HttpError} with payload.tag 'invalid-argument' for invalid arguments * */ static new(headers: any, contents: any, trailers: any, options: any): [Request, FutureReader]; /** * Get the Method for the Request. * * WIT: * ``` * method: func() -> method; * ``` * * @returns {method} */ getMethod(): { tag: string; }; /** * Set the Method for the Request. * * WIT: * ``` * set-method: func(method: method) -> result; * ``` * * @param {method} method * @throws {HttpError} with payload.tag 'invalid-syntax' if method is invalid */ setMethod(method: any): void; /** * Get the HTTP Path and Query. * * WIT: * ``` * path-with-query: func() -> option; * ``` * * @returns {?string} */ getPathWithQuery(): any; /** * Set the HTTP Path and Query. * * WIT: * ``` * set-path-with-query: func(path-with-query: option) -> result; * ``` * * @param {?string} pathWithQuery * @throws {HttpError} with payload.tag 'invalid-syntax' if invalid URI component */ setPathWithQuery(pathWithQuery: any): void; /** * Get the HTTP Scheme. * * WIT: * ``` * scheme: func() -> option; * ``` * * @returns {?scheme} */ getScheme(): any; /** * Set the HTTP Scheme. * * WIT: * ``` * set-scheme: func(scheme: option) -> result; * ``` * * @param {?scheme} scheme * @throws {HttpError} with payload.tag 'invalid-syntax' if invalid scheme */ setScheme(scheme: any): void; /** * Get the authority for the target URI. * * WIT: * ``` * authority: func() -> option; * ``` * * @returns {?string} */ getAuthority(): any; /** * Set the authority for the target URI. * * WIT: * ``` * set-authority: func(authority: option) -> result; * ``` * * @param {?string} authority * @throws {HttpError} with payload.tag 'invalid-syntax' if invalid authority */ setAuthority(authority: any): void; /** * Get the associated request-options resource. * * WIT: * ``` * options: func() -> option; * ``` * * @returns {?RequestOptions} */ getOptions(): any; /** * Get the headers resource (immutable). * * WIT: * ``` * headers: func() -> headers; * ``` * * @returns {Fields} */ getHeaders(): any; /** * Get body stream and trailers future, consuming the resource. * * WIT: * ``` * consume-body: static func(this: request, res: future>) * -> tuple, future, error-code>>>; * ``` * * @param {Request} request - The request to consume. * @param {FutureReader} res - A future for communicating errors. * @returns {[StreamReader, FutureReader]} A tuple of [body stream, trailers future]. * @throws {HttpError} with payload.tag 'invalid-state' if body already open or consumed. */ static consumeBody(request: any, res: any): any[]; _resolve(result: any): void; } export declare function _schemeToString(scheme: any): any; export {};