Katman
Integrations

OpenAPI Client

Consume any OpenAPI endpoint as a typed Katman client.

Use OpenAPILink to consume any OpenAPI-described API through the Katman client interface. Bring your own spec — Katman maps operations to procedure calls.

Setup

import {  } from "katman/client/openapi"
import {  } from "katman/client"
import type {  } from "./petstore.types" // generated types

const  = <>({
  : [
    new ({
      : "https://petstore.example.com",
      : import("./petstore.json"),
    }),
  ],
})

const  = await .pets.list()
const  = await .pets.get({ : "1" })

Inline spec

Pass the spec object directly if you already have it:

import  from "./petstore.json"

new OpenAPILink({
  : "https://petstore.example.com",
  ,
})

Custom headers

new OpenAPILink({
  : "https://api.example.com",
  : import("./spec.json"),
  : () => ({
    : `Bearer ${getToken()}`,
  }),
})

What's next?

On this page