# Class HttpResponseType

Used with TwinfinityApiClient.get to convert responses to correct data. See TwinfinityApiClient.get for an example.

##### Index

### Properties

arrayBuffer
blob
empty
json
text
default

### Methods

arrayBuffer
blob
json
status
text

## Properties

### `Readonly` arrayBuffer

arrayBuffer: (r: Response) => TypedResponse<ArrayBuffer>

Converts an array buffer Response to <ArrayBuffer>.

### `Readonly` blob

blob: (r: Response) => TypedResponse<Blob>

Converts a blob Response to <Blob>.

### `Readonly` empty

empty: (r: Response) => TypedResponse<undefined>

Converts an empty Response to <undefined>.

### `Readonly` json

json: <T>(r: Response) => TypedResponse<T>

Converts a JSON Response to TypedResponse.

### `Readonly` text

text: (r: Response) => TypedResponse<string>

Converts a text Response to <string>.

### `Static` `Readonly` default

default: HttpResponseType = ...

By default, TypedResponse.value conversion methods only assign TypedResponse.value when Response.status === `200`

## Methods

### `Static` arrayBuffer

- arrayBuffer(r: Response): TypedResponse<ArrayBuffer>

  Converts an array buffer Response to <ArrayBuffer>.

  #### Parameters

  - r: Response

  #### Returns TypedResponse<ArrayBuffer>

### `Static` blob

- blob(r: Response): TypedResponse<Blob>

  Converts a blob Response to <Blob>.

  #### Parameters

  - r: Response

  #### Returns TypedResponse<Blob>

### `Static` json

- json<T>(r: Response): TypedResponse<T>

  Converts a JSON Response to TypedResponse.

  #### Type Parameters

  - T

  #### Parameters

  - r: Response

  #### Returns TypedResponse<T>

### `Static` status

- status(statuses: number[]): HttpResponseType

  Default is that TypedResponse.value is only valid if Response.status === `200` for responses sent into arrayBuffer, json, text and blob. Call this method to create a custom HttpResponseType where TypedResponse.value can be assigned for other status values as well. Example: A conflict response may still contain data which should be assigned to TypedResponse.value.

  #### Parameters

  - statuses: number[]

  #### Returns HttpResponseType

### `Static` text

- text(r: Response): TypedResponse<string>

  Converts a text Response to <string>.

  #### Parameters

  - r: Response

  #### Returns TypedResponse<string>