feat(website): render @defaultValue blocks (#8527)

feat(website): render @defaultValue blocks
This commit is contained in:
Suneet Tipirneni
2022-08-19 12:24:55 -04:00
committed by GitHub
parent 47f2990b89
commit 8028813825
5 changed files with 30 additions and 24 deletions

View File

@@ -15,7 +15,7 @@ export interface BaseImageURLOptions {
/** /**
* The extension to use for the image URL * The extension to use for the image URL
* *
* @default 'webp' * @defaultValue `'webp'`
*/ */
extension?: ImageExtension; extension?: ImageExtension;
/** /**
@@ -41,7 +41,7 @@ export interface MakeURLOptions {
/** /**
* The extension to use for the image URL * The extension to use for the image URL
* *
* @default 'webp' * @defaultValue `'webp'`
*/ */
extension?: string | undefined; extension?: string | undefined;
/** /**

View File

@@ -25,45 +25,45 @@ export interface RESTOptions {
agent: Dispatcher; agent: Dispatcher;
/** /**
* The base api path, without version * The base api path, without version
* @default 'https://discord.com/api' * @defaultValue `'https://discord.com/api'`
*/ */
api: string; api: string;
/** /**
* The authorization prefix to use for requests, useful if you want to use * The authorization prefix to use for requests, useful if you want to use
* bearer tokens * bearer tokens
* *
* @default 'Bot' * @defaultValue `'Bot'`
*/ */
authPrefix: 'Bot' | 'Bearer'; authPrefix: 'Bot' | 'Bearer';
/** /**
* The cdn path * The cdn path
* *
* @default 'https://cdn.discordapp.com' * @defaultValue 'https://cdn.discordapp.com'
*/ */
cdn: string; cdn: string;
/** /**
* Additional headers to send for all API requests * Additional headers to send for all API requests
* *
* @default {} * @defaultValue `{}`
*/ */
headers: Record<string, string>; headers: Record<string, string>;
/** /**
* The number of invalid REST requests (those that return 401, 403, or 429) in a 10 minute window between emitted warnings (0 for no warnings). * The number of invalid REST requests (those that return 401, 403, or 429) in a 10 minute window between emitted warnings (0 for no warnings).
* That is, if set to 500, warnings will be emitted at invalid request number 500, 1000, 1500, and so on. * That is, if set to 500, warnings will be emitted at invalid request number 500, 1000, 1500, and so on.
* *
* @default 0 * @defaultValue `0`
*/ */
invalidRequestWarningInterval: number; invalidRequestWarningInterval: number;
/** /**
* How many requests to allow sending per second (Infinity for unlimited, 50 for the standard global limit used by Discord) * How many requests to allow sending per second (Infinity for unlimited, 50 for the standard global limit used by Discord)
* *
* @default 50 * @defaultValue `50`
*/ */
globalRequestsPerSecond: number; globalRequestsPerSecond: number;
/** /**
* The extra offset to add to rate limits in milliseconds * The extra offset to add to rate limits in milliseconds
* *
* @default 50 * @defaultValue `50`
*/ */
offset: number; offset: number;
/** /**
@@ -72,50 +72,50 @@ export interface RESTOptions {
* (e.g. `/channels` to match any route starting with `/channels` such as `/channels/:id/messages`) * (e.g. `/channels` to match any route starting with `/channels` such as `/channels/:id/messages`)
* for which to throw {@link RateLimitError}s. All other request routes will be queued normally * for which to throw {@link RateLimitError}s. All other request routes will be queued normally
* *
* @default null * @defaultValue `null`
*/ */
rejectOnRateLimit: string[] | RateLimitQueueFilter | null; rejectOnRateLimit: string[] | RateLimitQueueFilter | null;
/** /**
* The number of retries for errors with the 500 code, or errors * The number of retries for errors with the 500 code, or errors
* that timeout * that timeout
* *
* @default 3 * @defaultValue `3`
*/ */
retries: number; retries: number;
/** /**
* The time to wait in milliseconds before a request is aborted * The time to wait in milliseconds before a request is aborted
* *
* @default 15_000 * @defaultValue `15_000`
*/ */
timeout: number; timeout: number;
/** /**
* Extra information to add to the user agent * Extra information to add to the user agent
* *
* @default `Node.js ${process.version}` * @defaultValue ``Node.js ${process.version}``
*/ */
userAgentAppendix: string; userAgentAppendix: string;
/** /**
* The version of the API to use * The version of the API to use
* *
* @default '10' * @defaultValue `'10'`
*/ */
version: string; version: string;
/** /**
* The amount of time in milliseconds that passes between each hash sweep. (defaults to 4h) * The amount of time in milliseconds that passes between each hash sweep. (defaults to 4h)
* *
* @default 14_400_000 * @defaultValue `14_400_000`
*/ */
hashSweepInterval: number; hashSweepInterval: number;
/** /**
* The maximum amount of time a hash can exist in milliseconds without being hit with a request (defaults to 24h) * The maximum amount of time a hash can exist in milliseconds without being hit with a request (defaults to 24h)
* *
* @default 86_400_000 * @defaultValue `86_400_000`
*/ */
hashLifetime: number; hashLifetime: number;
/** /**
* The amount of time in milliseconds that passes between each hash sweep. (defaults to 1h) * The amount of time in milliseconds that passes between each hash sweep. (defaults to 1h)
* *
* @default 3_600_000 * @defaultValue `3_600_000`
*/ */
handlerSweepInterval: number; handlerSweepInterval: number;
} }

View File

@@ -50,13 +50,13 @@ export interface RequestData {
/** /**
* If this request needs the `Authorization` header * If this request needs the `Authorization` header
* *
* @default true * @defaultValue `true`
*/ */
auth?: boolean; auth?: boolean;
/** /**
* The authorization prefix to use for this request, useful if you use this with bearer tokens * The authorization prefix to use for this request, useful if you use this with bearer tokens
* *
* @default 'Bot' * @defaultValue `'Bot'`
*/ */
authPrefix?: 'Bot' | 'Bearer'; authPrefix?: 'Bot' | 'Bearer';
/** /**
@@ -92,7 +92,7 @@ export interface RequestData {
/** /**
* If this request should be versioned * If this request should be versioned
* *
* @default true * @defaultValue `true`
*/ */
versioned?: boolean; versioned?: boolean;
} }

View File

@@ -40,6 +40,10 @@ export function DeprecatedBlock({ children }: { children: ReactNode }): JSX.Elem
); );
} }
export function DefaultValueBlock({ children }: { children: ReactNode }): JSX.Element {
return <Block title="Default value">{children}</Block>;
}
export function RemarksBlock({ children }: { children: ReactNode }): JSX.Element { export function RemarksBlock({ children }: { children: ReactNode }): JSX.Element {
return <Block title="Remarks">{children}</Block>; return <Block title="Remarks">{children}</Block>;
} }
@@ -52,6 +56,8 @@ export function BlockComment({ children, tagName, index }: BlockCommentProps): J
return <DeprecatedBlock>{children}</DeprecatedBlock>; return <DeprecatedBlock>{children}</DeprecatedBlock>;
case StandardTags.remarks.tagNameWithUpperCase: case StandardTags.remarks.tagNameWithUpperCase:
return <RemarksBlock>{children}</RemarksBlock>; return <RemarksBlock>{children}</RemarksBlock>;
case StandardTags.defaultValue.tagNameWithUpperCase:
return <DefaultValueBlock>{children}</DefaultValueBlock>;
case StandardTags.typeParam.tagNameWithUpperCase: case StandardTags.typeParam.tagNameWithUpperCase:
case StandardTags.param.tagNameWithUpperCase: case StandardTags.param.tagNameWithUpperCase:
return <Text>{children}</Text>; return <Text>{children}</Text>;

View File

@@ -112,17 +112,17 @@ export interface OptionalWebSocketManagerOptions {
identifyProperties: GatewayIdentifyProperties; identifyProperties: GatewayIdentifyProperties;
/** /**
* The gateway version to use * The gateway version to use
* @default '10' * @defaultValue `'10'`
*/ */
version: string; version: string;
/** /**
* The encoding to use * The encoding to use
* @default 'json' * @defaultValue `'json'`
*/ */
encoding: Encoding; encoding: Encoding;
/** /**
* The compression method to use * The compression method to use
* @default null (no compression) * @defaultValue `null` (no compression)
*/ */
compression: CompressionMethod | null; compression: CompressionMethod | null;
/** /**
@@ -187,7 +187,7 @@ export class WebSocketManager extends AsyncEventEmitter<ManagerShardEventsMap> {
/** /**
* Strategy used to manage shards * Strategy used to manage shards
* @default SimpleManagerToShardStrategy * @defaultValue `SimpleManagerToShardStrategy`
*/ */
private strategy: IShardingStrategy = new SimpleShardingStrategy(this); private strategy: IShardingStrategy = new SimpleShardingStrategy(this);