zodios-api-shorthand

1.2.6 • Public • Published

Why?

This library is a helper to shorten the Zodios API definition, so instead of writing:

makeApi([
  {
    method: "get",
    name: "getTransactions",
    path: "/v1/transactions",
    parameters: [
      {
        type: "Query",
        name: "limit",
        schema: z.number(),
      },
      {
        type: "Query",
        name: "offset",
        schema: z.number(),
      },
    ],
    response: z.string(),
  },
]);

You can write:

api({
  "GET transactions": {
    path: "/v1/transactions",
    queries: {
      limit: z.number(),
      offset: z.number(),
    },
    response: z.string(),
  },
});

Instructions

Check out src/index.test.ts about usage

Readme

Keywords

Package Sidebar

Install

npm i zodios-api-shorthand

Weekly Downloads

1

Version

1.2.6

License

MIT

Unpacked Size

11.3 kB

Total Files

7

Last publish

Collaborators

  • thelinuxlich