From ea95995857e197af4d2d44eaa580a6d14e2882c9 Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Wed, 13 Dec 2023 14:23:17 -0600 Subject: [PATCH] MORE --- packages/poster/README.md | 11 +++++++++-- packages/poster/test/spec.ts | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/poster/README.md b/packages/poster/README.md index 68fc44f..09ff54d 100644 --- a/packages/poster/README.md +++ b/packages/poster/README.md @@ -4,7 +4,7 @@ REST API client for managing discord application commands. ## features - Optionally typed responses - - view an example (here)[../poster/test/spec.ts] + - view an example [here](../poster/test/spec.ts) - Typed options - Simple! (sort of) - ClojureScript + Typescript @@ -17,7 +17,7 @@ import poster from '@sern/poster'; const send = poster.client("token", "appid"); const req = await send("global/get-all", { - + //options }); console.log(await req.json()); @@ -44,3 +44,10 @@ This package is pretty simple. Create a new client and call one of the "endpoint Documentation for these routes are specified in the discord api documentation, starting [here.](https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands) + +## Extra +For fully typed responses (which i do not recommend), cast your response. +An example exists [here] (../poster/test/spec.ts). 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. + + + diff --git a/packages/poster/test/spec.ts b/packages/poster/test/spec.ts index 2653a82..5e2e5fe 100644 --- a/packages/poster/test/spec.ts +++ b/packages/poster/test/spec.ts @@ -6,7 +6,7 @@ const send = poster.client("token", "appid"); const req = await send("global/get-all", { -}) as TypedResponse; +}) as TypedResponse; //cast for full typed safety if(poster.isOk(req)) { req.json().then(s => s?.map(v => v.name))