Skip to content

Commit

Permalink
fix(RESTAPIPollCreate): optional properties (#1022)
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidx authored Jul 2, 2024
1 parent f50ae60 commit c05998d
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 20 deletions.
4 changes: 4 additions & 0 deletions deno/payloads/v10/poll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ export interface APIPoll {
expiry: string;
/**
* Whether a user can select multiple answers
*
* @default false
*/
allow_multiselect: boolean;
/**
* The layout type of the poll
*
* @default PollLayoutType.Default
*/
layout_type: PollLayoutType;
/**
Expand Down
4 changes: 4 additions & 0 deletions deno/payloads/v9/poll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ export interface APIPoll {
expiry: string;
/**
* Whether a user can select multiple answers
*
* @default false
*/
allow_multiselect: boolean;
/**
* The layout type of the poll
*
* @default PollLayoutType.Default
*/
layout_type: PollLayoutType;
/**
Expand Down
14 changes: 9 additions & 5 deletions deno/rest/v10/poll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,19 @@ export interface RESTGetAPIPollAnswerVotersQuery {
/**
* https://discord.com/developers/docs/resources/poll#poll-create-request-object-poll-create-request-object-structure
*/
export interface RESTAPIPollCreate extends Omit<APIPoll, 'answers' | 'expiry' | 'results'> {
/**
* Number of hours the poll should be open for, up to 7 days
*/
duration: number;
export interface RESTAPIPollCreate
extends Omit<APIPoll, 'allow_multiselect' | 'answers' | 'expiry' | 'layout_type' | 'results'>,
Partial<Pick<APIPoll, 'allow_multiselect' | 'layout_type'>> {
/**
* Each of the answers available in the poll, up to 10
*/
answers: Omit<APIPollAnswer, 'answer_id'>[];
/**
* Number of hours the poll should be open for, up to 32 days
*
* @default 24
*/
duration?: number;
}

/**
Expand Down
14 changes: 9 additions & 5 deletions deno/rest/v9/poll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,19 @@ export interface RESTGetAPIPollAnswerVotersQuery {
/**
* https://discord.com/developers/docs/resources/poll#poll-create-request-object-poll-create-request-object-structure
*/
export interface RESTAPIPollCreate extends Omit<APIPoll, 'answers' | 'expiry' | 'results'> {
/**
* Number of hours the poll should be open for, up to 7 days
*/
duration: number;
export interface RESTAPIPollCreate
extends Omit<APIPoll, 'allow_multiselect' | 'answers' | 'expiry' | 'layout_type' | 'results'>,
Partial<Pick<APIPoll, 'allow_multiselect' | 'layout_type'>> {
/**
* Each of the answers available in the poll, up to 10
*/
answers: Omit<APIPollAnswer, 'answer_id'>[];
/**
* Number of hours the poll should be open for, up to 32 days
*
* @default 24
*/
duration?: number;
}

/**
Expand Down
4 changes: 4 additions & 0 deletions payloads/v10/poll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ export interface APIPoll {
expiry: string;
/**
* Whether a user can select multiple answers
*
* @default false
*/
allow_multiselect: boolean;
/**
* The layout type of the poll
*
* @default PollLayoutType.Default
*/
layout_type: PollLayoutType;
/**
Expand Down
4 changes: 4 additions & 0 deletions payloads/v9/poll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ export interface APIPoll {
expiry: string;
/**
* Whether a user can select multiple answers
*
* @default false
*/
allow_multiselect: boolean;
/**
* The layout type of the poll
*
* @default PollLayoutType.Default
*/
layout_type: PollLayoutType;
/**
Expand Down
14 changes: 9 additions & 5 deletions rest/v10/poll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,19 @@ export interface RESTGetAPIPollAnswerVotersQuery {
/**
* https://discord.com/developers/docs/resources/poll#poll-create-request-object-poll-create-request-object-structure
*/
export interface RESTAPIPollCreate extends Omit<APIPoll, 'answers' | 'expiry' | 'results'> {
/**
* Number of hours the poll should be open for, up to 7 days
*/
duration: number;
export interface RESTAPIPollCreate
extends Omit<APIPoll, 'allow_multiselect' | 'answers' | 'expiry' | 'layout_type' | 'results'>,
Partial<Pick<APIPoll, 'allow_multiselect' | 'layout_type'>> {
/**
* Each of the answers available in the poll, up to 10
*/
answers: Omit<APIPollAnswer, 'answer_id'>[];
/**
* Number of hours the poll should be open for, up to 32 days
*
* @default 24
*/
duration?: number;
}

/**
Expand Down
14 changes: 9 additions & 5 deletions rest/v9/poll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,19 @@ export interface RESTGetAPIPollAnswerVotersQuery {
/**
* https://discord.com/developers/docs/resources/poll#poll-create-request-object-poll-create-request-object-structure
*/
export interface RESTAPIPollCreate extends Omit<APIPoll, 'answers' | 'expiry' | 'results'> {
/**
* Number of hours the poll should be open for, up to 7 days
*/
duration: number;
export interface RESTAPIPollCreate
extends Omit<APIPoll, 'allow_multiselect' | 'answers' | 'expiry' | 'layout_type' | 'results'>,
Partial<Pick<APIPoll, 'allow_multiselect' | 'layout_type'>> {
/**
* Each of the answers available in the poll, up to 10
*/
answers: Omit<APIPollAnswer, 'answer_id'>[];
/**
* Number of hours the poll should be open for, up to 32 days
*
* @default 24
*/
duration?: number;
}

/**
Expand Down

0 comments on commit c05998d

Please sign in to comment.