# ApiBase | pokemon-rogue-battle
Documentation for pokemon-rogue-battle

# Class ApiBase`Abstract`

#### Hierarchy (View Summary)

- ApiBase
  - PokerogueAccountApi
  - PokerogueAdminApi
  - PokerogueApi
  - PokerogueDailyApi
  - PokerogueSavedataApi
  - PokerogueSessionSavedataApi
  - PokerogueSystemSavedataApi

- Defined in src/plugins/api/api-base.ts:6

##### Index

### Constructors

constructor

### Properties

base
ERR_GENERIC

### Methods

doFetch
doGet
doPost
toUrlSearchParams

## Constructors

### constructor

- new ApiBase(base: string): ApiBase

  #### Parameters

  - base: string

  #### Returns ApiBase

  - Defined in src/plugins/api/api-base.ts:15

## Properties

### `Protected` `Readonly` base

base: string

- Defined in src/plugins/api/api-base.ts:11

### `Readonly` ERR_GENERIC

ERR_GENERIC: string = "There was an error"

- Defined in src/plugins/api/api-base.ts:9

## Methods

### `Protected` doFetch

- doFetch(path: string, config: RequestInit): Promise<Response>

  A generic request helper.

  #### Parameters

  - path: string

    The path to send the request to.

  - config: RequestInit

    The request RequestInit | Configuration.

  #### Returns Promise<Response>

  - Defined in src/plugins/api/api-base.ts:65

### `Protected` doGet

- doGet(path: string): Promise<Response>

  Send a GET request.

  #### Parameters

  - path: string

    The path to send the request to.

  #### Returns Promise<Response>

  - Defined in src/plugins/api/api-base.ts:25

### `Protected` doPost

- doPost< D = undefined>(
  path: string,
  bodyData?: D ,
  dataType?: DataType,
  ): Promise<Response>

  Send a POST request.

  #### Type Parameters

  - D = undefined

  #### Parameters

  - path: string

    THe path to send the request to.

  - `Optional` bodyData: D

    The body-data to send.

  - dataType: DataType = "json"

    The data-type of the bodyData.

  #### Returns Promise<Response>

  - Defined in src/plugins/api/api-base.ts:35

### `Protected` toUrlSearchParams

- toUrlSearchParams< D extends Record<string, any>>(data: D ): URLSearchParams

  Helper to transform data to URLSearchParams Any key with a value of `undefined` will be ignored. Any key with a value of `null` will be included.

  #### Type Parameters

  - D extends Record<string, any>

  #### Parameters

  - data: D

    the data to transform to URLSearchParams

  #### Returns URLSearchParams

  a URLSearchParams representaton of data

  - Defined in src/plugins/api/api-base.ts:86