Skip to main content

Response

Namespace: Wisej.AI

Assembly: Wisej.AI

Represents a response that can be initialized with a stream or a string and provides methods to read its content.

public class Response

Constructors

Response(stream)

Initializes a new instance of the Response class with the specified stream.

NameTypeDescription
streamStreamThe stream to initialize the response with.

Throws:

Response(response)

Initializes a new instance of the Response class with the specified string.

NameTypeDescription
responseStringThe string to initialize the response with.

Throws:

Properties

Stream

Stream: Gets a copy of the underlying stream.

The returned stream is a copy of the original stream, allowing for independent reading without affecting the original stream's position.

Methods

ReadBufferAsync()

Asynchronously reads the content of the response as a byte array.

Returns: Task<Byte[]>. A task that represents the asynchronous read operation. The task result contains the content of the response as a byte array.

This method reads the entire content of the stream and returns it as a byte array.

ReadContentAsync()

Asynchronously reads the content of the response as a string.

Returns: Task<String>. A task that represents the asynchronous read operation. The task result contains the content of the response as a string.

This method reads the entire content of the stream and returns it as a string.