Table of Contents

Class ApiResponse

Namespace
Google.GenAI
Assembly
Google.GenAI.dll

The API response contains a response to a call to the GenAI APIs. This class is abstract and implements IDisposable for resource management.

public abstract class ApiResponse : IDisposable, IAsyncDisposable
Inheritance
ApiResponse
Implements
Derived
Inherited Members

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Dispose(bool)

Releases the unmanaged resources used by the ApiResponse and optionally releases the managed resources. Subclasses must override this method to provide their specific cleanup logic.

protected void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

DisposeAsync()

Asynchronously disposes the response.

public virtual ValueTask DisposeAsync()

Returns

ValueTask

A ValueTask that represents the asynchronous dispose operation.

DisposeManagedResources()

protected virtual void DisposeManagedResources()

GetEntity()

Gets the HTTP content of the response.

public abstract HttpContent GetEntity()

Returns

HttpContent

GetHeaders()

Gets the headers of the HTTP response. This uses the .NET standard HttpResponseHeaders collection.

public abstract HttpResponseHeaders GetHeaders()

Returns

HttpResponseHeaders