1.2.6 • Published 1 year ago

@sern/poster v1.2.6

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Poster

REST API client for managing discord application commands.

features

  • Optionally typed responses
    • view an example here
  • Typed options
  • Simple! (sort of)
  • ClojureScript + Typescript
    • I'm sorry.

usage

import poster from '@sern/poster';

const send = await poster.client("token", "appid");

const req = await send("global/get-all", { 
    //options
});

console.log(await req.json());

Mappings

This package is pretty simple. Create a new client and call one of the "endpoints"

EndpointMethodPath
global/get-allGET/applications/{application.id}/commands
global/getGET/applications/{application.id}/commands/{command.id}
global/postPOST/applications/{application.id}/commands
global/editPATCH/applications/{application.id}/commands/{command.id}
global/deleteDELETE/applications/{application.id}/commands/{command.id}
global/putPUT/applications/{application.id}/commands
guild/get-allGET/applications/{application.id}/guilds/{guild.id}/commands
guild/postPOST/applications/{application.id}/guilds/{guild.id}/commands
guild/getGET/applications/{application.id}/guilds/{guild.id}/commands/{command.id}
guild/editPATCH/applications/{application.id}/guilds/{guild.id}/commands/{command.id}
guild/deleteDELETE/applications/{application.id}/guilds/{guild.id}/commands/{command.id}
guild/putPUT/applications/{application.id}/guilds/{guild.id}/commands
application/meGET/applications/@me

Documentation for these routes are specified in the discord api documentation, starting here.

Extra

For fully typed responses (which i do not recommend), cast your response. An example exists here. Also I don't know if they work for every single type, if they dont, I will fix it if it is a serious issue.

Developing

git clone https://github.com/sern-handler/tools.git
cd tools
yarn
cd packages/poster
yarn run gen-discord-types
yarn build:debug
1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.0

1 year ago

1.2.1

1 year ago

1.1.0

1 year ago

1.0.0

2 years ago