API client / fetch wrapper for Docuseal, generated using @hey-api/typescript
and @hey-api/fetch
.
Import the package using the Github link (until I get around to publishing on an actual package manager). For instance, in Bun, run:
bun i git+https://github.com/Nmans01/docuseal-openapi.git
I have left the code untouched from how it was generated by @hey-api/typescript
(more info here). To initialize it, simply import and set your client config. Set baseUrl
to https://api.docuseal.co
unless you are self-hosting.
import * as docuseal from "docuseal-openapi";
const apiKey = process.env.DOCUSEAL_SECRET;
docuseal.client.setConfig({
baseUrl: "https://api.docuseal.co",
headers: {
"X-Auth-Token": apiKey
}
});
Every route is exported from the generated code as its own function. By using a * as docuseal
import, all routes are autocomplete-able using the docuseal
object.
- While I am used to route parameters being referred to in most contexts as "params" in shorthand, hey-api refers to route parameter values as "path". Therefore, when calling a route fuction such as
docuseal.getTemplate
, it is important to note that passing in theid
route parameter will look like this:
docuseal.getTemplate({ path: { id: 123 } });