Skip to content

thelinuxlich/zodios-api-shorthand

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A shorthand helper to implement Zodios API endpoints

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published