Skip to content

Commit

Permalink
docs: update to reflect recent changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ckohen committed May 2, 2023
1 parent e87e5d7 commit c0dccd6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
19 changes: 19 additions & 0 deletions packages/rest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,25 @@ try {
}
```

Send a basic message in an edge environment:

```js
import { REST } from '@discordjs/rest';
import { Routes } from 'discord-api-types/v10';

const rest = new REST({ version: '10', makeRequest: fetch }).setToken(TOKEN);

try {
await rest.post(Routes.channelMessages(CHANNEL_ID), {
body: {
content: 'A message via REST from the edge!',
},
});
} catch (error) {
console.error(error);
}
```

## Links

- [Website][website] ([source][website-source])
Expand Down
3 changes: 2 additions & 1 deletion packages/rest/src/lib/REST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ export interface RESTOptions {
invalidRequestWarningInterval: number;
/**
* The method called to perform the actual HTTP request given a url and web `fetch` options
* For example, to use global fetch, simply provide `makeRequest: fetch`
*
* @defaultValue `fetch`
* @defaultValue `undici.request`
*/
makeRequest(url: string, init: RequestInit): Promise<ResponseLike>;
/**
Expand Down

0 comments on commit c0dccd6

Please sign in to comment.