feat(website): Show constructor information (#8540)

This commit is contained in:
Suneet Tipirneni
2022-08-22 03:45:53 -04:00
committed by GitHub
parent dd44e8b6ec
commit e42fd16369
66 changed files with 689 additions and 625 deletions

View File

@@ -91,7 +91,7 @@ export interface RESTOptions {
/**
* Extra information to add to the user agent
*
* @defaultValue ``Node.js ${process.version}``
* @defaultValue `Node.js ${process.version}`
*/
userAgentAppendix: string;
/**

View File

@@ -65,7 +65,7 @@ export interface RequestData {
*/
body?: BodyInit | unknown;
/**
* The {@link https://undici.nodejs.org/#/docs/api/Agent Agent} to use for the request.
* The {@link https://undici.nodejs.org/#/docs/api/Agent | Agent} to use for the request.
*/
dispatcher?: Agent;
/**
@@ -174,7 +174,7 @@ export interface RequestManager {
*/
export class RequestManager extends EventEmitter {
/**
* The {@link https://undici.nodejs.org/#/docs/api/Agent Agent} for all requests
* The {@link https://undici.nodejs.org/#/docs/api/Agent | Agent} for all requests
* performed by this manager.
*/
public agent: Dispatcher | null = null;
@@ -342,7 +342,7 @@ export class RequestManager extends EventEmitter {
* @param hash - The hash for the route
* @param majorParameter - The major parameter for this handler
*
* @private
* @internal
*/
private createHandler(hash: string, majorParameter: string) {
// Create the async request queue to handle requests
@@ -487,7 +487,7 @@ export class RequestManager extends EventEmitter {
* @param endpoint - The raw endpoint to generalize
* @param method - The HTTP method this endpoint is called without
*
* @private
* @internal
*/
private static generateRouteData(endpoint: RouteLike, method: RequestMethod): RouteData {
const majorIdMatch = /^\/(?:channels|guilds|webhooks)\/(\d{16,19})/.exec(endpoint);

View File

@@ -3,13 +3,27 @@ import type { RequestOptions } from '../REST';
import type { HandlerRequestData, RouteData } from '../RequestManager';
export interface IHandler {
/**
* Queues a request to be sent
*
* @param routeId - The generalized api route with literal ids for major parameters
* @param url - The url to do the request on
* @param options - All the information needed to make a request
* @param requestData - Extra data from the user's request needed for errors and additional processing
*/
queueRequest: (
routeId: RouteData,
url: string,
options: RequestOptions,
requestData: HandlerRequestData,
) => Promise<Dispatcher.ResponseData>;
/**
* If the bucket is currently inactive (no pending requests)
*/
// eslint-disable-next-line @typescript-eslint/method-signature-style -- This is meant to be a getter returning a bool
get inactive(): boolean;
/**
* The unique id of the handler
*/
readonly id: string;
}

View File

@@ -30,7 +30,7 @@ const enum QueueType {
*/
export class SequentialHandler implements IHandler {
/**
* The unique id of the handler
* {@inheritDoc IHandler.id}
*/
public readonly id: string;
@@ -87,7 +87,7 @@ export class SequentialHandler implements IHandler {
}
/**
* If the bucket is currently inactive (no pending requests)
* {@inheritDoc IHandler.inactive}
*/
public get inactive(): boolean {
return (
@@ -161,12 +161,7 @@ export class SequentialHandler implements IHandler {
}
/**
* Queues a request to be sent
*
* @param routeId - The generalized api route with literal ids for major parameters
* @param url - The url to do the request on
* @param options - All the information needed to make a request
* @param requestData - Extra data from the user's request needed for errors and additional processing
* {@inheritDoc IHandler.queueRequest}
*/
public async queueRequest(
routeId: RouteData,