Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(website): render @defaultValue blocks #8527

Merged
merged 1 commit into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/rest/src/lib/CDN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface BaseImageURLOptions {
/**
* The extension to use for the image URL
*
* @default 'webp'
* @defaultValue `'webp'`
*/
extension?: ImageExtension;
/**
Expand All @@ -41,7 +41,7 @@ export interface MakeURLOptions {
/**
* The extension to use for the image URL
*
* @default 'webp'
* @defaultValue `'webp'`
*/
extension?: string | undefined;
/**
Expand Down
30 changes: 15 additions & 15 deletions packages/rest/src/lib/REST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,45 +25,45 @@ export interface RESTOptions {
agent: Dispatcher;
/**
* The base api path, without version
* @default 'https://discord.com/api'
* @defaultValue `'https://discord.com/api'`
*/
api: string;
/**
* The authorization prefix to use for requests, useful if you want to use
* bearer tokens
*
* @default 'Bot'
* @defaultValue `'Bot'`
*/
authPrefix: 'Bot' | 'Bearer';
/**
* The cdn path
*
* @default 'https://cdn.discordapp.com'
* @defaultValue 'https://cdn.discordapp.com'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to put the quotes

*/
cdn: string;
/**
* Additional headers to send for all API requests
*
* @default {}
* @defaultValue `{}`
*/
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).
* 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;
/**
* 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;
/**
* The extra offset to add to rate limits in milliseconds
*
* @default 50
* @defaultValue `50`
*/
offset: number;
/**
Expand All @@ -72,50 +72,50 @@ export interface RESTOptions {
* (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
*
* @default null
* @defaultValue `null`
*/
rejectOnRateLimit: string[] | RateLimitQueueFilter | null;
/**
* The number of retries for errors with the 500 code, or errors
* that timeout
*
* @default 3
* @defaultValue `3`
*/
retries: number;
/**
* The time to wait in milliseconds before a request is aborted
*
* @default 15_000
* @defaultValue `15_000`
*/
timeout: number;
/**
* Extra information to add to the user agent
*
* @default `Node.js ${process.version}`
* @defaultValue ``Node.js ${process.version}``
*/
userAgentAppendix: string;
/**
* The version of the API to use
*
* @default '10'
* @defaultValue `'10'`
*/
version: string;
/**
* 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;
/**
* 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;
/**
* 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;
}
Expand Down
6 changes: 3 additions & 3 deletions packages/rest/src/lib/RequestManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ export interface RequestData {
/**
* If this request needs the `Authorization` header
*
* @default true
* @defaultValue `true`
*/
auth?: boolean;
/**
* The authorization prefix to use for this request, useful if you use this with bearer tokens
*
* @default 'Bot'
* @defaultValue `'Bot'`
*/
authPrefix?: 'Bot' | 'Bearer';
/**
Expand Down Expand Up @@ -92,7 +92,7 @@ export interface RequestData {
/**
* If this request should be versioned
*
* @default true
* @defaultValue `true`
*/
versioned?: boolean;
}
Expand Down
6 changes: 6 additions & 0 deletions packages/website/src/components/tsdoc/BlockComment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
return <Block title="Remarks">{children}</Block>;
}
Expand All @@ -52,6 +56,8 @@ export function BlockComment({ children, tagName, index }: BlockCommentProps): J
return <DeprecatedBlock>{children}</DeprecatedBlock>;
case StandardTags.remarks.tagNameWithUpperCase:
return <RemarksBlock>{children}</RemarksBlock>;
case StandardTags.defaultValue.tagNameWithUpperCase:
return <DefaultValueBlock>{children}</DefaultValueBlock>;
case StandardTags.typeParam.tagNameWithUpperCase:
case StandardTags.param.tagNameWithUpperCase:
return <Text>{children}</Text>;
Expand Down
8 changes: 4 additions & 4 deletions packages/ws/src/ws/WebSocketManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,17 @@ export interface OptionalWebSocketManagerOptions {
identifyProperties: GatewayIdentifyProperties;
/**
* The gateway version to use
* @default '10'
* @defaultValue `'10'`
*/
version: string;
/**
* The encoding to use
* @default 'json'
* @defaultValue `'json'`
*/
encoding: Encoding;
/**
* The compression method to use
* @default null (no compression)
* @defaultValue `null` (no compression)
*/
compression: CompressionMethod | null;
/**
Expand Down Expand Up @@ -187,7 +187,7 @@ export class WebSocketManager extends AsyncEventEmitter<ManagerShardEventsMap> {

/**
* Strategy used to manage shards
* @default SimpleManagerToShardStrategy
* @defaultValue `SimpleManagerToShardStrategy`
*/
private strategy: IShardingStrategy = new SimpleShardingStrategy(this);

Expand Down