---
url: >-
  https://game-engine-io.github.io/enginex-frontend-sdk/reference/api/@getenginex/sdk/extension/interfaces/ExtensionTransport.md
---
[Reference](../../../../index.md) / [@getenginex/sdk/extension](../index.md) / ExtensionTransport

# ExtensionTransport

Transport of an SDK client, for product packages (`@getenginex/sdk-igaming`,
`@getenginex/sdk-predictions`). Every request goes through the same session, token renewal,
tenant, locale, timeout, hooks, validation and `dispose()` of the app's client: a product package
never creates its own session, tenant or transport.

## Methods

### reportError()

> **reportError**(`error`, `ctx`): [`EnginexError`](../../classes/EnginexError.md)

Normalizes `error` into `EnginexError` and calls `onError` exactly once: for failures that the package's method
detects **after** a successful response (e.g. the response carried neither a URL
nor game HTML). Returns the error for the method to throw — the same object handed to the hook.

#### Parameters

##### error

`unknown`

##### ctx

[`ExtensionErrorContext`](ExtensionErrorContext.md)

#### Returns

[`EnginexError`](../../classes/EnginexError.md)

#### Example

```ts
if (!launch.url && !launch.html) {
  throw transport.reportError(new Error('launch without URL or HTML'), { method: 'POST', path: '/casino/launch' })
}
```

#### Throws

Never throws. The returned error can be identified with `isEnginexError` (prefer it over
`instanceof EnginexError`, which fails between the CJS files of the main entry and the extension entry).

***

### request()

> **request**<`T`>(`spec`): `Promise`<`T`>

Makes a request and returns the response decoded by the `schema`.

#### Type Parameters

##### T

`T`

#### Parameters

##### spec

[`ExtensionRequestSpec`](ExtensionRequestSpec.md)<`T`>

#### Returns

`Promise`<`T`>

#### Example

```ts
const game = await transport.request({ method: 'GET', path: '/casino/games/g-1', schema: gameSchema(), options })
```

#### Throws

The same error as a core method: HTTP/gateway, `UNAUTHENTICATED`,
`NETWORK_ERROR`, `TIMEOUT`, `ABORTED`, `VALIDATION_ERROR` or `CONFIGURATION_ERROR` (including
after `dispose()` and with `auth`, `validation` or `perPageParam` outside the contract, before
any `fetch`). `onError` is called exactly once with that same object. Identify the error
with `isEnginexError(error, code)`, not with `instanceof EnginexError`: in CommonJS, the main
entry and the extension entry are separate files, each with its own copy of the class.

***

### requestPage()

> **requestPage**<`T`>(`spec`): `Promise`<[`Page`](../../interfaces/Page.md)<`T`>>

Makes a paginated listing and returns a [Page](../../interfaces/Page.md).

#### Type Parameters

##### T

`T`

#### Parameters

##### spec

[`ExtensionPageRequestSpec`](ExtensionPageRequestSpec.md)<`T`>

#### Returns

`Promise`<[`Page`](../../interfaces/Page.md)<`T`>>

#### Example

```ts
const page = await transport.requestPage({ method: 'GET', path: '/casino/games', item: gameSchema(), page: 1 })
```

#### Throws

As in [ExtensionTransport.request](#request) (use `isEnginexError`, not
`instanceof`).
