openapi-autowrapper

1.0.0 • Public • Published

openapi-autowrapper

This is a tool to dynamically build wrappers for OpenAPI/Swagger compatible APIs, it uses fetch() internally so it will work in the browser as well as node, though so you'll need an 18+ copy of node for that feature.

Optinally you can initialize it with {dev:true} for in-console prettyprinted documentation. image

Usage

import autowrapper from 'openapi-autowrapper'

an example using the automatic1111 openapi

let api = await autowrapper('http://localhost:7860') //autowrapper() defaults to 'http://localhost:5000' if called without parameters
let response = await api['/sdapi/v1/txt2img'].GET({prompt: 'an angel with a shotgun'}) //nightcore remix
///////
> response
> {
    images: ['iVBORw0KGgoAAAANSUhEUgA...'], 
    info: {prompt: 'an angel with a shotgun', all_prompts: Array(1), negative_prompt: '', all_negative_prompts: Array(1), seed: 1802462605,},
    parameters: {enable_hr: false, denoising_strength: 0, firstphase_width: 0, firstphase_height: 0, hr_scale: 2,}
}

Readme

Keywords

Package Sidebar

Install

npm i openapi-autowrapper

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

9.32 kB

Total Files

5

Last publish

Collaborators

  • thot_experiment