0.4.2 • Published 2 years ago

yasdk v0.4.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

YASDK

Yet another TypeScript OpenAPI SDK generator

const sdk = createSdk(API_URL);

const res = await sdk.runSomeOperation({
  parameters: {/* ... */}, // Checked
  body: {/* ... */}, // Checked
  headers: {
    accept: 'application/json', // Checked (and optional)
    'content-type': 'application/json', // Checked (and optional)
  },
});

switch (res.code) {
  case 200:
    res.data; // Narrowed (based on code and `accept` header)
  // ...
}

Quickstart

  1. Add this package as devDependency:
npm i -D yasdk
  1. Run it on your OpenAPI definition file, typically via a NPM script:
yasdk -i resources/openapi.yaml -o src/sdk.gen.ts
  1. Import the SDK:
import {createSdk} from './sdk.gen';

Options

SDKs support the following options at creation time:

  • headers, headers sent with all requests
  • options, options set on all requests
  • fetch, custom fetch implementation
  • defaultContentType, default content-type used as 'content-type' and 'accept' headers when omitted
  • encoders, request body encoders
  • decoders, response decoders
  • coercer, unexpected response content-type handler
0.3.20

2 years ago

0.3.22

2 years ago

0.3.21

2 years ago

0.3.19

2 years ago

0.3.18

2 years ago

0.3.17

2 years ago

0.3.16

2 years ago

0.3.15

2 years ago

0.3.14

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.4.2

2 years ago

0.3.13

2 years ago

0.3.12

2 years ago

0.3.11

2 years ago

0.3.10

2 years ago

0.3.9

2 years ago

0.3.8

2 years ago

0.3.7

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.30

2 years ago

0.2.29

2 years ago

0.2.28

2 years ago

0.2.27

2 years ago

0.2.26

2 years ago

0.2.25

2 years ago

0.2.24

2 years ago

0.2.23

2 years ago

0.2.22

2 years ago

0.2.21

2 years ago

0.2.20

2 years ago

0.2.19

2 years ago

0.2.18

2 years ago

0.2.17

2 years ago

0.2.16

2 years ago

0.2.15

2 years ago

0.2.14

2 years ago

0.2.13

2 years ago

0.2.12

2 years ago

0.2.11

2 years ago

0.2.10

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago