discord-api-types
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "discord-api-types", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Discord API typings that are kept up to date for use in bot library creation.", | ||
@@ -31,3 +31,3 @@ "main": "default/index.js", | ||
"engines": { | ||
"node": ">12" | ||
"node": ">=12" | ||
}, | ||
@@ -51,3 +51,3 @@ "devDependencies": { | ||
"type": "git", | ||
"url": "https://github.com/vladfrangu/discord-api-types" | ||
"url": "https://github.com/discordjs/discord-api-types" | ||
}, | ||
@@ -54,0 +54,0 @@ "husky": { |
@@ -1,24 +0,48 @@ | ||
# Discord API Types | ||
<div style="text-align:center;"><h1>Discord API Types</h1></div> | ||
Simple type defitions for the [Discord API](https://discord.com/developers/docs/intro) | ||
[![GitHub](https://img.shields.io/github/license/discordjs/discord-api-types)](https://github.com/discordjs/discord-api-types/blob/main/LICENSE.md) | ||
[![npm](https://img.shields.io/npm/v/discord-api-types?color=crimson&logo=npm)](https://www.npmjs.com/package/discord-api-types) | ||
[![Patreon Donate](https://img.shields.io/badge/patreon-donate-brightgreen.svg?label=Donate%20with%20Patreon&logo=patreon&colorB=F96854&link=https://www.patreon.com/vladfrangu)](https://www.patreon.com/vladfrangu) | ||
[![Ko-fi Donate](https://img.shields.io/badge/kofi-donate-brightgreen.svg?label=Donate%20with%20Ko-fi&logo=ko-fi&colorB=F16061&link=https://ko-fi.com/wolfgalvlad&logoColor=FFFFFF)](https://ko-fi.com/wolfgalvlad) | ||
## How it's done | ||
Simple type definitions for the [Discord API](https://discord.com/developers/docs/intro). | ||
## Installation | ||
Install with [npm](https://www.npmjs.com/) / [yarn](https://yarnpkg.com) / [pnpm](https://pnpm.js.org/): | ||
```sh | ||
npm install discord-api-types | ||
yarn add discord-api-types | ||
pnpm add discord-api-types | ||
``` | ||
## Project Structure | ||
The exports of each API version is split into three main parts: | ||
- Everything exported with the `API` prefix represents a payload you may get from the REST API *or* the Gateway | ||
- Everything exported with the `Gateway` prefix represents data that ONLY comes from or is directly referred to the Gateway | ||
- Everything exported with the `REST` prefix represents data that ONLY comes from or is directly reffered to the REST API | ||
- For endpoint options, they will follow the following structure: `REST<HTTP Method><Type><Query|<JSON|FormData>Body|Result>` where the type represents what it will return | ||
- If a type ends with `Result`, then it represents the expected result by calling it's accompanying route | ||
- Types that are exported as `never` usually mean the result will be a `204 No Content`, so you can safely ignore it. This does **not** account for errors | ||
- Anything else that is miscellaneous will be exported based on what it represents (for example the REST route object) | ||
- There may be exported things from all versions - common throughout all API versions - that will simply be exported as is and are present in the `common` directory. They will still be prefixed with `REST` or `Gateway` accordingly. | ||
- Everything exported with the `API` prefix represents a payload you may get from the REST API *or* the Gateway. | ||
**Warning**: This package documents just KNOWN (and documented) properties. Anything that isn't documented will NOT be added to this package (unless said properties are already PR'd to Discord's [API Documentation repository](https://github.com/discord/discord-api-docs) or known through other means and have received the green light to be used) | ||
- Everything exported with the `Gateway` prefix represents data that ONLY comes from or is directly related to the Gateway. | ||
## How to use | ||
- Everything exported with the `REST` prefix represents data that ONLY comes from or is directly related to the REST API. | ||
You can require / import the module directly, which will give you the latest types as of the current API version. This is considered the `default` version and may break at any point in time. | ||
- For endpoint options, they will follow the following structure: `REST<HTTP Method><Type><Query|(JSON|FormData)Body|Result>` where the type represents what it will return. | ||
- For example, `RESTPostAPIChannelMessageJSONBody` or `RESTGetAPIGatewayBotInfoResult`. | ||
- If a type ends with `Result`, then it represents the expected result by calling its accompanying route. | ||
- Types that are exported as `never` usually mean the result will be a `204 No Content`, so you can safely ignore it. This does **not** account for errors. | ||
- Anything else that is miscellaneous will be exported based on what it represents (for example the `REST` route object). | ||
- There may be types exported that are identical for all versions. These will be exported as is and can be found in the `common` directory. They will still be prefixed accordingly as described above. | ||
**Warning**: This package documents just KNOWN (and documented) properties. Anything that isn't documented will NOT be added to this package (unless said properties are in an open Pull Request to Discord's [API Documentation repository](https://github.com/discord/discord-api-docs) or known through other means *and have received the green light to be used*). For clarification's sake, this means that properties that are only known through the process of datamining and have not yet been confirmed in a way as described will NOT be included. | ||
## Usage | ||
You can `require` / `import` the module directly, which will give you the latest types as of the current API version. This is considered the `default` version and will be updated according to Discord's default API version; this means it may break at any point in time. | ||
> We **strongly recommend** you use a version when importing this module! This will prevent breaking changes when updating the module. | ||
@@ -31,7 +55,7 @@ | ||
```ts | ||
// TypeScript support | ||
// TypeScript/ES Module support | ||
import { APIUserData } from 'discord-api-types' | ||
``` | ||
You may also add the API version you want to use by appending `/v*`, where the * represends the API version | ||
You should instead consider adding the API version you want to target by appending `/v*`, where the `*` represends the API version. | ||
@@ -43,4 +67,4 @@ ```js | ||
```ts | ||
// TypeScript support | ||
// TypeScript/ES Module support | ||
import { APIUserData } from 'discord-api-types/v6'; | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
230723
69