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

Request overview

Contextual wrappers around @effect/io/Request

Added in v1.0.0


Table of contents


constructors

Request

Construct a Request implementation to be utilized from the Effect Context.

Signature

export declare const Request: RequestConstructor

Added in v1.0.0

Request (namespace)

Added in v1.0.0

Error (type alias)

Extract the Error of a Request

Signature

export type Error<T> = R.Request.Error<Req<T>>

Added in v1.0.0

Identifier (type alias)

Extract the Identifier of a Request

Signature

export type Identifier<T> = T extends Request<infer Id, infer _, infer __> ? Id : never

Added in v1.0.0

Input (type alias)

Extract the Input of a Request

Signature

export type Input<T> = T extends Request<infer _, infer Input, infer __> ? Input : never

Added in v1.0.0

InputArg (type alias)

Extract the InputArg of a Request

Signature

export type InputArg<T> = [keyof Input<T>] extends [never] ? [Input<T>?] : [Input<T>]

Added in v1.0.0

Req (type alias)

Extract the Request of a Request

Signature

export type Req<T> = T extends Request<infer _, infer __, infer Req> ? Req : never

Added in v1.0.0

Success (type alias)

Extract the Success of a Request

Signature

export type Success<T> = R.Request.Success<Req<T>>

Added in v1.0.0

RequestConstructor (interface)

Construct a Request implementation to be utilized from the Effect Context.

Signature

export interface RequestConstructor {
  <Input, Req extends R.Request<any, any>>(
    makeRequest: (input: Input) => Req
  ): {
    <const Id extends IdentifierFactory<any>>(id: Id): Request<IdentifierOf<Id>, Input, Req>
    <const Id>(id: Id): Request<IdentifierOf<Id>, Input, Req>
  }

  /**
   * Construct a tagged Request implementation to be utilized from the Effect Context.
   * @since 1.0.0
   * @category constructors
   */
  readonly tagged: <Req extends R.Request<any, any> & { readonly _tag: string }>(
    tag: Req["_tag"]
  ) => {
    <const Id extends IdentifierFactory<any>>(
      id: Id
    ): Request<IdentifierOf<Id>, Compact<Omit<Req, "_tag" | typeof R.RequestTypeId>>, Req>
    <const Id>(id: Id): Request<IdentifierOf<Id>, Compact<Omit<Req, "_tag" | typeof R.RequestTypeId>>, Req>
  }
  /**
   * Construct a Request implementation to be utilized from the Effect Context.
   * @since 1.0.0
   * @category constructors
   */
  readonly of: <Req extends R.Request<any, any>>() => {
    <const Id extends IdentifierFactory<any>>(
      id: Id
    ): Request<IdentifierOf<Id>, Compact<Omit<Req, typeof R.RequestTypeId>>, Req>
    <const Id>(id: Id): Request<IdentifierOf<Id>, Compact<Omit<Req, typeof R.RequestTypeId>>, Req>
  }
}

Added in v1.0.0

models

Request (interface)

Contextual wrappers around @effect/io/Request

Signature

export interface Request<I, Input, Req extends R.Request<any, any>>
  extends Fn<I, (requests: Req) => Effect<R.Request.Success<Req>, R.Request.Error<Req>>> {
  /**
   * Make the request using the provided impleemtation from the Effect Context.
   * @since 1.0.0
   */
  readonly make: (...input: SimplifyInputArg<Input>) => Effect<R.Request.Success<Req>, R.Request.Error<Req>, I>
}

Added in v1.0.0