discord-openapi-client
v0.0.5
Published
Autogenerated OpenAPI client for discord
Downloads
5
Readme
discord-openapi-client
[!WARNING] This is work in progress.
Autogenerated OpenAPI client for Discord, generated from discord/discord-api-spec.
This should contain almost everything you will need to interact with the Discord API, atleast whatever their OpenAPI spec has.
There are absolutely no dependencies apart from the presence of fetch()
, which should just be supported in all modern runtimes. I would also recommend using a bundler if you're using this in size-constraint environments like Cloudflare Workers, as this package is quite big.
Usage
[!NOTE] This package is ESM only.
Install package:
# @antfu/ni
ni discord-openapi-client
Import:
import {
getUser /* Import functions you need */,
getGetUserUrl /* functions that will return the absolute url string */,
} from "discord-openapi-client";
All mutation functions are available under prefixes: get
, update
, delete
, etc.
If you just need the URL with proper URL encoding, those are suffixed with Url
, which will return the absolute API URL.
Types for responses, params, 200s are available respectively.
Building
- Install dependencies with pnpm
- Clone
discord/discord-api-spec
asopenapi
- Run
pnpm build
why?
I was bored