///
import { IncomingMessage } from "http";
import { ClientHttp2Stream } from "http2";
import { InvokeFunction, InvokeMethod } from "../client";
import { HttpHandlerOptions } from "../http";
import { SdkStream } from "../serde";
import { BrowserRuntimeStreamingBlobPayloadInputTypes, NodeJsRuntimeStreamingBlobPayloadInputTypes, StreamingBlobPayloadInputTypes } from "../streaming-payload/streaming-blob-payload-input-types";
import { NarrowedInvokeFunction, NarrowedInvokeMethod } from "./client-method-transforms";
import { Transform } from "./type-transform";
/**
* @public
*
* Creates a type with a given client type that narrows payload blob output
* types to SdkStream.
*
* This can be used for clients with the NodeHttpHandler requestHandler,
* the default in Node.js when not using HTTP2.
*
* Usage example:
* ```typescript
* const client = new YourClient({}) as NodeJsClient;
* ```
*/
export type NodeJsClient = NarrowPayloadBlobTypes, ClientType>;
/**
* @public
* Variant of NodeJsClient for node:http2.
*/
export type NodeJsHttp2Client = NarrowPayloadBlobTypes, ClientType>;
/**
* @public
*
* Creates a type with a given client type that narrows payload blob output
* types to SdkStream.
*
* This can be used for clients with the FetchHttpHandler requestHandler,
* which is the default in browser environments.
*
* Usage example:
* ```typescript
* const client = new YourClient({}) as BrowserClient;
* ```
*/
export type BrowserClient = NarrowPayloadBlobTypes, ClientType>;
/**
* @public
*
* Variant of BrowserClient for XMLHttpRequest.
*/
export type BrowserXhrClient = NarrowPayloadBlobTypes, ClientType>;
/**
* @public
*
* @deprecated use NarrowPayloadBlobTypes.
*
* Narrow a given Client's blob payload outputs to the given type T.
*/
export type NarrowPayloadBlobOutputType = {
[key in keyof ClientType]: [
ClientType[key]
] extends [
InvokeFunction
] ? NarrowedInvokeFunction : [
ClientType[key]
] extends [
InvokeMethod
] ? NarrowedInvokeMethod : ClientType[key];
};
/**
* @public
*
* Narrow a Client's blob payload input and output types to I and O.
*/
export type NarrowPayloadBlobTypes = {
[key in keyof ClientType]: [
ClientType[key]
] extends [
InvokeFunction
] ? NarrowedInvokeFunction, OutputTypes, ConfigType> : [
ClientType[key]
] extends [
InvokeMethod
] ? NarrowedInvokeMethod, FunctionOutputTypes> : ClientType[key];
};