# Class Network

deprecated

- Defined in jamespot-user-api/src/util/network.ts:32

##### Index

### Constructors

constructor

### Methods

fetch
get
getHostname
getUrl
maybePostToken
post
postCSRF
postCSRFWithFile
postFile
postFormData
postToken
postWithFile
token
tokenCSRF
_formatPostOptions
serializeFormData

## Constructors

### constructor

- new Network(window: WindowInterface, action?: string): Network

  #### Parameters

  - window: WindowInterface
  - action: string = 'api-front'

  #### Returns Network

  - Defined in jamespot-user-api/src/util/network.ts:36

## Methods

### fetch

- fetch<T, U = BaseMessages>(
  __namedParameters: Body,
  signal?: AbortSignal | null,
  ): Promise<ApiWrapper<T, U>>

  #### Type Parameters

  - T
  - U = BaseMessages

  #### Parameters

  - __namedParameters: Body
  - `Optional` signal: AbortSignal | null

  #### Returns Promise<ApiWrapper<T, U>>

  - Defined in jamespot-user-api/src/util/network.ts:100

### get

- get<T, U = BaseMessages>(
  o: string,
  f: string,
  urlParams?: Record<string, string>,
  signal?: AbortSignal | null,
  ): Promise<ApiWrapper<T, U>>

  #### Type Parameters

  - T
  - U = BaseMessages

  #### Parameters

  - o: string
  - f: string
  - `Optional` urlParams: Record<string, string>
  - `Optional` signal: AbortSignal | null

  #### Returns Promise<ApiWrapper<T, U>>

  - Defined in jamespot-user-api/src/util/network.ts:108

### getHostname

- getHostname(): Promise<string>

  #### Returns Promise<string>

  - Defined in jamespot-user-api/src/util/network.ts:64

### getUrl

- getUrl(
  o: string,
  f: string,
  urlParams?: Record<string, string>,
  ): Promise<string>

  #### Parameters

  - o: string
  - f: string
  - `Optional` urlParams: Record<string, string>

  #### Returns Promise<string>

  - Defined in jamespot-user-api/src/util/network.ts:46

### maybePostToken

- maybePostToken<
  T,
  U = BaseMessages,
  P extends MaybeWithToken<OF> = MaybeWithToken<OF>,
  >(
  body: P,
  signal?: AbortSignal,
  ): Promise<ApiWrapper<T, U>>

  #### Type Parameters

  - T
  - U = BaseMessages
  - P extends MaybeWithToken<OF> = MaybeWithToken<OF>

  #### Parameters

  - body: P
  - `Optional` signal: AbortSignal

  #### Returns Promise<ApiWrapper<T, U>>

  - Defined in jamespot-user-api/src/util/network.ts:215

### post

- post<T, U = BaseMessages>(
  body: Body,
  signal?: AbortSignal,
  ): Promise<ApiWrapper<T, U>>

  #### Type Parameters

  - T
  - U = BaseMessages

  #### Parameters

  - body: Body
  - `Optional` signal: AbortSignal

  #### Returns Promise<ApiWrapper<T, U>>

  - Defined in jamespot-user-api/src/util/network.ts:127

### postCSRF

- postCSRF<T, U = BaseMessages>(
  body: Body,
  signal?: AbortSignal,
  ): Promise<ApiWrapper<T, U>>

  #### Type Parameters

  - T
  - U = BaseMessages

  #### Parameters

  - body: Body
  - `Optional` signal: AbortSignal

  #### Returns Promise<ApiWrapper<T, U>>

  - Defined in jamespot-user-api/src/util/network.ts:205

### postCSRFWithFile

- postCSRFWithFile<R>(
  body: Body,
  signal?: AbortSignal,
  ): Promise<ApiWrapper<R, BaseMessages>>

  #### Type Parameters

  - R

  #### Parameters

  - body: Body
  - `Optional` signal: AbortSignal

  #### Returns Promise<ApiWrapper<R, BaseMessages>>

  - Defined in jamespot-user-api/src/util/network.ts:198

### postFile

- postFile(
  body: FormData,
  signal?: AbortSignal,
  ): Promise<
  { response: ApiWrapper<jFileLittle, BaseMessages>; token: string },
  >

  Handles jFile upload, creating a file on the platform

  #### Parameters

  - body: FormData
  - `Optional` signal: AbortSignal

  #### Returns Promise<{ response: ApiWrapper<jFileLittle, BaseMessages>; token: string }>

  - Defined in jamespot-user-api/src/util/network.ts:147

### postFormData

- postFormData<T, U = BaseMessages>(
  url: string,
  body: FormData,
  signal?: AbortSignal,
  ): Promise<ApiWrapper<T, U>>

  #### Type Parameters

  - T
  - U = BaseMessages

  #### Parameters

  - url: string
  - body: FormData
  - `Optional` signal: AbortSignal

  #### Returns Promise<ApiWrapper<T, U>>

  - Defined in jamespot-user-api/src/util/network.ts:131

### postToken

- postToken<T, U = BaseMessages>(
  body: Body,
  signal?: AbortSignal,
  ): Promise<ApiWrapper<T, U>>

  #### Type Parameters

  - T
  - U = BaseMessages

  #### Parameters

  - body: Body
  - `Optional` signal: AbortSignal

  #### Returns Promise<ApiWrapper<T, U>>

  - Defined in jamespot-user-api/src/util/network.ts:211

### postWithFile

- postWithFile<R>(
  body: Body,
  signal?: AbortSignal,
  ): Promise<ApiWrapper<R, BaseMessages>>

  Handles file upload without creating a jFile on the platform

  #### Type Parameters

  - R

  #### Parameters

  - body: Body
  - `Optional` signal: AbortSignal

  #### Returns Promise<ApiWrapper<R, BaseMessages>>

  - Defined in jamespot-user-api/src/util/network.ts:191

### token

- token(signal?: AbortSignal): Promise<ApiWrapper<string, BaseMessages>>

  #### Parameters

  - `Optional` signal: AbortSignal

  #### Returns Promise<ApiWrapper<string, BaseMessages>>

  - Defined in jamespot-user-api/src/util/network.ts:226

### tokenCSRF

- tokenCSRF(): Promise<ApiWrapper<string, BaseMessages>>

  #### Returns Promise<ApiWrapper<string, BaseMessages>>

  - Defined in jamespot-user-api/src/util/network.ts:230

### `Static`_formatPostOptions

- _formatPostOptions(body: object): RequestInit

  #### Parameters

  - body: object

  #### Returns RequestInit

  - Defined in jamespot-user-api/src/util/network.ts:41

### `Static` serializeFormData

- serializeFormData(data: Record<string, unknown>): FormData

  #### Parameters

  - data: Record<string, unknown>

  #### Returns FormData

  - Defined in jamespot-user-api/src/util/network.ts:167