Papupata Documentation

API Reference

class DeclaredAPI

exposed type BodyType

Purpose

Represents the type of the body sent to the API

Usage

The exposed types are used with the typeof operator. See the example below for details.

Although the types are presented as fields on the API, they have no runtime value.

Examples

import { APIDeclaration } from 'papupata'
const api = new APIDeclaration()
const myAPI = api.declarePostAPI('/do-stuff')
  .body<{key: string}>
  .response<string>()

type BodyType = typeof myAPI['BodyType']
// BodyType is now {key: string}