Skip to content

Commit

Permalink
feat(Invites): document target_application & correct property names
Browse files Browse the repository at this point in the history
BREAKING CHANGE: This renames `target_user_type` to `target_type`,
the actual value the API expects.

Reference: discord/discord-api-docs@1b4e363
  • Loading branch information
vladfrangu committed Apr 10, 2021
1 parent bb3cb04 commit 97c8ab3
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 32 deletions.
14 changes: 9 additions & 5 deletions deno/gateway/v8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -879,17 +879,21 @@ export interface GatewayInviteCreateDispatchData {
*/
max_uses: number;
/**
* The target user for this invite
* The type of user target for this voice channel invite
*
* See https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
*/
target_type?: InviteTargetUserType;
/**
* The user whose stream to display for this voice channel stream invite
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
target_user?: APIUser;
/**
* The type of user target for this invite
*
* See https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
* The embedded application to open for this voice channel embedded application invite
*/
target_user_type?: InviteTargetUserType;
target_application?: Partial<APIApplication>;
/**
* Whether or not the invite is temporary (invited users will be kicked on disconnect unless they're assigned a role)
*/
Expand Down
20 changes: 13 additions & 7 deletions deno/payloads/v8/invite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import type { APIPartialChannel } from './channel.ts';
import type { APIPartialGuild } from './guild.ts';
import type { APIApplication } from './oauth2.ts';
import type { APIUser } from './user.ts';

/**
Expand Down Expand Up @@ -33,23 +34,27 @@ export interface APIInvite {
*/
inviter?: APIUser;
/**
* The target user for this invite
* The type of user target for this voice channel invite
*
* See https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
*/
target_type?: InviteTargetUserType;
/**
* The user whose stream to display for this voice channel stream invite
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
target_user?: APIUser;
/**
* The type of user target for this invite
*
* See https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
* The embedded application to open for this voice channel embedded application invite
*/
target_user_type?: InviteTargetUserType;
target_application?: Partial<APIApplication>;
/**
* Approximate count of online members (only present when `target_user` is set)
* Approximate count of online members, returned from the `GET /invites/<code>` endpoint when `with_counts` is `true`
*/
approximate_presence_count?: number;
/**
* Approximate count of total members
* Approximate count of total members, returned from the `GET /invites/<code>` endpoint when `with_counts` is `true`
*/
approximate_member_count?: number;
}
Expand All @@ -59,6 +64,7 @@ export interface APIInvite {
*/
export enum InviteTargetUserType {
STREAM = 1,
EMBEDDED_APPLICATION,
}

/**
Expand Down
16 changes: 12 additions & 4 deletions deno/rest/v8/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,21 @@ export interface RESTPostAPIChannelInviteJSONBody {
*/
unique?: boolean;
/**
* The target user id for this invite
* The type of target user for this voice channel invite
*/
target_user_id?: string;
target_type?: InviteTargetUserType;
/**
* The type of target user for this invite
* The id of the user whose stream to display for this invite
* - Required if `target_type` is 1
* - The user must be streaming in the channel
*/
target_user_type?: InviteTargetUserType;
target_user_id?: Snowflake;
/**
* The id of the embedded application to open for this invite
* - Required if `target_type` is 2
* - The application must have the `EMBEDDED` flag
*/
target_application_id?: Snowflake;
}

/**
Expand Down
14 changes: 9 additions & 5 deletions gateway/v8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -879,17 +879,21 @@ export interface GatewayInviteCreateDispatchData {
*/
max_uses: number;
/**
* The target user for this invite
* The type of user target for this voice channel invite
*
* See https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
*/
target_type?: InviteTargetUserType;
/**
* The user whose stream to display for this voice channel stream invite
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
target_user?: APIUser;
/**
* The type of user target for this invite
*
* See https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
* The embedded application to open for this voice channel embedded application invite
*/
target_user_type?: InviteTargetUserType;
target_application?: Partial<APIApplication>;
/**
* Whether or not the invite is temporary (invited users will be kicked on disconnect unless they're assigned a role)
*/
Expand Down
20 changes: 13 additions & 7 deletions payloads/v8/invite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import type { APIPartialChannel } from './channel';
import type { APIPartialGuild } from './guild';
import type { APIApplication } from './oauth2';
import type { APIUser } from './user';

/**
Expand Down Expand Up @@ -33,23 +34,27 @@ export interface APIInvite {
*/
inviter?: APIUser;
/**
* The target user for this invite
* The type of user target for this voice channel invite
*
* See https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
*/
target_type?: InviteTargetUserType;
/**
* The user whose stream to display for this voice channel stream invite
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
target_user?: APIUser;
/**
* The type of user target for this invite
*
* See https://discord.com/developers/docs/resources/invite#invite-object-target-user-types
* The embedded application to open for this voice channel embedded application invite
*/
target_user_type?: InviteTargetUserType;
target_application?: Partial<APIApplication>;
/**
* Approximate count of online members (only present when `target_user` is set)
* Approximate count of online members, returned from the `GET /invites/<code>` endpoint when `with_counts` is `true`
*/
approximate_presence_count?: number;
/**
* Approximate count of total members
* Approximate count of total members, returned from the `GET /invites/<code>` endpoint when `with_counts` is `true`
*/
approximate_member_count?: number;
}
Expand All @@ -59,6 +64,7 @@ export interface APIInvite {
*/
export const enum InviteTargetUserType {
STREAM = 1,
EMBEDDED_APPLICATION,
}

/**
Expand Down
16 changes: 12 additions & 4 deletions rest/v8/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,21 @@ export interface RESTPostAPIChannelInviteJSONBody {
*/
unique?: boolean;
/**
* The target user id for this invite
* The type of target user for this voice channel invite
*/
target_user_id?: string;
target_type?: InviteTargetUserType;
/**
* The type of target user for this invite
* The id of the user whose stream to display for this invite
* - Required if `target_type` is 1
* - The user must be streaming in the channel
*/
target_user_type?: InviteTargetUserType;
target_user_id?: Snowflake;
/**
* The id of the embedded application to open for this invite
* - Required if `target_type` is 2
* - The application must have the `EMBEDDED` flag
*/
target_application_id?: Snowflake;
}

/**
Expand Down

0 comments on commit 97c8ab3

Please sign in to comment.