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

HttpApiSchema overview

Added in v1.0.0


Table of contents


annotations

AnnotationEmptyDecodeable

Signature

export declare const AnnotationEmptyDecodeable: typeof AnnotationEmptyDecodeable

Added in v1.0.0

AnnotationEncoding

Signature

export declare const AnnotationEncoding: typeof AnnotationEncoding

Added in v1.0.0

AnnotationMultipart

Signature

export declare const AnnotationMultipart: typeof AnnotationMultipart

Added in v1.0.0

AnnotationStatus

Signature

export declare const AnnotationStatus: typeof AnnotationStatus

Added in v1.0.0

annotations

Signature

export declare const annotations: <A>(
  annotations: Schema.Annotations.Schema<NoInfer<A>> & { readonly status?: number | undefined }
) => Schema.Annotations.Schema<A>

Added in v1.0.0

getEmptyDecodeable

Signature

export declare const getEmptyDecodeable: (ast: AST.AST) => boolean

Added in v1.0.0

getEncoding

Signature

export declare const getEncoding: (ast: AST.AST) => Encoding

Added in v1.0.0

getMultipart

Signature

export declare const getMultipart: (ast: AST.AST) => boolean

Added in v1.0.0

getStatus

Signature

export declare const getStatus: (ast: AST.AST, defaultStatus: number) => number

Added in v1.0.0

empty response

Accepted

Signature

export declare const Accepted: Accepted

Added in v1.0.0

Accepted (interface)

Signature

export interface Accepted extends Void$ {
  readonly _: unique symbol
}

Added in v1.0.0

Created

Signature

export declare const Created: Created

Added in v1.0.0

Created (interface)

Signature

export interface Created extends Void$ {
  readonly _: unique symbol
}

Added in v1.0.0

Empty

Signature

export declare const Empty: (status: number) => typeof Schema.Void

Added in v1.0.0

NoContent

Signature

export declare const NoContent: NoContent

Added in v1.0.0

NoContent (interface)

Signature

export interface NoContent extends Void$ {
  readonly _: unique symbol
}

Added in v1.0.0

asEmpty

Signature

export declare const asEmpty: {
  <S extends Schema.Schema.Any>(options: {
    readonly status: number
    readonly decode: LazyArg<Schema.Schema.Type<S>>
  }): (self: S) => asEmpty<S>
  <S extends Schema.Schema.Any>(
    self: S,
    options: { readonly status: number; readonly decode?: LazyArg<Schema.Schema.Type<S>> }
  ): asEmpty<S>
}

Added in v1.0.0

asEmpty (interface)

Signature

export interface asEmpty<S extends Schema.Schema.Any> extends Schema.transform<typeof Schema.Void, S> {}

Added in v1.0.0

encoding

Encoding (interface)

Signature

export interface Encoding {
  readonly kind: "Json" | "UrlParams" | "Uint8Array" | "Text"
  readonly contentType: string
}

Added in v1.0.0

Encoding (namespace)

Added in v1.0.0

Validate (type alias)

Signature

export type Validate<A extends Schema.Schema.Any, Kind extends Encoding["kind"]> = Kind extends "Json"
  ? {}
  : Kind extends "UrlParams"
    ? [A["Encoded"]] extends [Readonly<Record<string, string | undefined>>]
      ? {}
      : `'UrlParams' kind can only be encoded to 'Record<string, string | undefined>'`
    : Kind extends "Uint8Array"
      ? [A["Encoded"]] extends [Uint8Array]
        ? {}
        : `'Uint8Array' kind can only be encoded to 'Uint8Array'`
      : Kind extends "Text"
        ? [A["Encoded"]] extends [string]
          ? {}
          : `'Text' kind can only be encoded to 'string'`
        : never

Added in v1.0.0

Text

Signature

export declare const Text: (options?: { readonly contentType?: string }) => typeof Schema.String

Added in v1.0.0

Uint8Array

Signature

export declare const Uint8Array: (options?: { readonly contentType?: string }) => typeof Schema.Uint8ArrayFromSelf

Added in v1.0.0

withEncoding

Signature

export declare const withEncoding: {
  <A extends Schema.Schema.Any, Kind extends Encoding["kind"]>(
    options: { readonly kind: Kind; readonly contentType?: string | undefined } & Encoding.Validate<A, Kind>
  ): (self: A) => A
  <A extends Schema.Schema.Any, Kind extends Encoding["kind"]>(
    self: A,
    options: { readonly kind: Kind; readonly contentType?: string | undefined } & Encoding.Validate<A, Kind>
  ): A
}

Added in v1.0.0

multipart

Multipart

Signature

export declare const Multipart: <S extends Schema.Schema.Any>(self: S) => Multipart<S>

Added in v1.0.0

Multipart (interface)

Signature

export interface Multipart<S extends Schema.Schema.Any>
  extends Schema.Schema<
    Schema.Schema.Type<S> & Brand<MultipartTypeId>,
    Schema.Schema.Encoded<S>,
    Schema.Schema.Context<S>
  > {}

Added in v1.0.0

MultipartTypeId

Signature

export declare const MultipartTypeId: typeof MultipartTypeId

Added in v1.0.0

MultipartTypeId (type alias)

Signature

export type MultipartTypeId = typeof MultipartTypeId

Added in v1.0.0

params

PathParams (interface)

Signature

export interface PathParams extends Schema.Record$<typeof Schema.String, typeof Schema.String> {}

Added in v1.0.0

reflection

getStatusError

Signature

export declare const getStatusError: <A extends Schema.Schema.All>(self: A) => number

Added in v1.0.0

getStatusErrorAST

Signature

export declare const getStatusErrorAST: (ast: AST.AST) => number

Added in v1.0.0

getStatusSuccess

Signature

export declare const getStatusSuccess: <A extends Schema.Schema.Any>(self: A) => number

Added in v1.0.0

getStatusSuccessAST

Signature

export declare const getStatusSuccessAST: (ast: AST.AST) => number

Added in v1.0.0

isVoid

Signature

export declare const isVoid: (ast: AST.AST) => boolean

Added in v1.0.0

utils

UnionUnify

Signature

export declare const UnionUnify: <A extends Schema.Schema.All, B extends Schema.Schema.All>(
  self: A,
  that: B
) => Schema.Schema<A["Type"] | B["Type"], A["Encoded"] | B["Encoded"], A["Context"] | B["Context"]>

Added in v1.0.0