Skip to main content Link Search Menu Expand Document (external link)

Fetch overview

Added in v0.0.1


Table of contents


combinator

map

Signature

export declare const map: <E, A, B, E2 = E>(
  request: (fetch: Fetch<E2>) => Promise<Either<E, A>>,
  fn: (res: Either<E, A>) => B
) => (fetch: Fetch<E2>) => Promise<B>

Added in v0.0.1

constructor

fetch

Signature

export declare const fetch: (
  url: string | URL,
  init?: RequestInit
) => <E>(fetch: Fetch<E>) => Promise<HttpResponseEither<HttpError | E>>

Added in v0.0.1

fetch_

Signature

export declare const fetch_: (
  url: string | URL,
  init?: RequestInit | undefined
) => <E>(fetch: Fetch<E>) => Promise<Either<HttpError | E, Response>>

Added in v0.0.1

model

Adapter (interface)

Signature

export interface Adapter {
  (url: string | URL | HttpRequest, init?: RequestInit): Promise<Either<HttpError, Response>>
}

Added in v0.0.1

Fetch (type alias)

Signature

export type Fetch<E> = (...args: Parameters<Adapter>) => Promise<Either<E | HttpError, Response>>

Added in v0.0.1