Skip to content

Commit c05998d

Browse files
authoredJul 2, 2024··
fix(RESTAPIPollCreate): optional properties (#1022)
1 parent f50ae60 commit c05998d

File tree

8 files changed

+52
-20
lines changed

8 files changed

+52
-20
lines changed
 

‎deno/payloads/v10/poll.ts

+4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@ export interface APIPoll {
2222
expiry: string;
2323
/**
2424
* Whether a user can select multiple answers
25+
*
26+
* @default false
2527
*/
2628
allow_multiselect: boolean;
2729
/**
2830
* The layout type of the poll
31+
*
32+
* @default PollLayoutType.Default
2933
*/
3034
layout_type: PollLayoutType;
3135
/**

‎deno/payloads/v9/poll.ts

+4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@ export interface APIPoll {
2222
expiry: string;
2323
/**
2424
* Whether a user can select multiple answers
25+
*
26+
* @default false
2527
*/
2628
allow_multiselect: boolean;
2729
/**
2830
* The layout type of the poll
31+
*
32+
* @default PollLayoutType.Default
2933
*/
3034
layout_type: PollLayoutType;
3135
/**

‎deno/rest/v10/poll.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,19 @@ export interface RESTGetAPIPollAnswerVotersQuery {
2020
/**
2121
* https://discord.com/developers/docs/resources/poll#poll-create-request-object-poll-create-request-object-structure
2222
*/
23-
export interface RESTAPIPollCreate extends Omit<APIPoll, 'answers' | 'expiry' | 'results'> {
24-
/**
25-
* Number of hours the poll should be open for, up to 7 days
26-
*/
27-
duration: number;
23+
export interface RESTAPIPollCreate
24+
extends Omit<APIPoll, 'allow_multiselect' | 'answers' | 'expiry' | 'layout_type' | 'results'>,
25+
Partial<Pick<APIPoll, 'allow_multiselect' | 'layout_type'>> {
2826
/**
2927
* Each of the answers available in the poll, up to 10
3028
*/
3129
answers: Omit<APIPollAnswer, 'answer_id'>[];
30+
/**
31+
* Number of hours the poll should be open for, up to 32 days
32+
*
33+
* @default 24
34+
*/
35+
duration?: number;
3236
}
3337

3438
/**

‎deno/rest/v9/poll.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,19 @@ export interface RESTGetAPIPollAnswerVotersQuery {
2020
/**
2121
* https://discord.com/developers/docs/resources/poll#poll-create-request-object-poll-create-request-object-structure
2222
*/
23-
export interface RESTAPIPollCreate extends Omit<APIPoll, 'answers' | 'expiry' | 'results'> {
24-
/**
25-
* Number of hours the poll should be open for, up to 7 days
26-
*/
27-
duration: number;
23+
export interface RESTAPIPollCreate
24+
extends Omit<APIPoll, 'allow_multiselect' | 'answers' | 'expiry' | 'layout_type' | 'results'>,
25+
Partial<Pick<APIPoll, 'allow_multiselect' | 'layout_type'>> {
2826
/**
2927
* Each of the answers available in the poll, up to 10
3028
*/
3129
answers: Omit<APIPollAnswer, 'answer_id'>[];
30+
/**
31+
* Number of hours the poll should be open for, up to 32 days
32+
*
33+
* @default 24
34+
*/
35+
duration?: number;
3236
}
3337

3438
/**

‎payloads/v10/poll.ts

+4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@ export interface APIPoll {
2222
expiry: string;
2323
/**
2424
* Whether a user can select multiple answers
25+
*
26+
* @default false
2527
*/
2628
allow_multiselect: boolean;
2729
/**
2830
* The layout type of the poll
31+
*
32+
* @default PollLayoutType.Default
2933
*/
3034
layout_type: PollLayoutType;
3135
/**

‎payloads/v9/poll.ts

+4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@ export interface APIPoll {
2222
expiry: string;
2323
/**
2424
* Whether a user can select multiple answers
25+
*
26+
* @default false
2527
*/
2628
allow_multiselect: boolean;
2729
/**
2830
* The layout type of the poll
31+
*
32+
* @default PollLayoutType.Default
2933
*/
3034
layout_type: PollLayoutType;
3135
/**

‎rest/v10/poll.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,19 @@ export interface RESTGetAPIPollAnswerVotersQuery {
2020
/**
2121
* https://discord.com/developers/docs/resources/poll#poll-create-request-object-poll-create-request-object-structure
2222
*/
23-
export interface RESTAPIPollCreate extends Omit<APIPoll, 'answers' | 'expiry' | 'results'> {
24-
/**
25-
* Number of hours the poll should be open for, up to 7 days
26-
*/
27-
duration: number;
23+
export interface RESTAPIPollCreate
24+
extends Omit<APIPoll, 'allow_multiselect' | 'answers' | 'expiry' | 'layout_type' | 'results'>,
25+
Partial<Pick<APIPoll, 'allow_multiselect' | 'layout_type'>> {
2826
/**
2927
* Each of the answers available in the poll, up to 10
3028
*/
3129
answers: Omit<APIPollAnswer, 'answer_id'>[];
30+
/**
31+
* Number of hours the poll should be open for, up to 32 days
32+
*
33+
* @default 24
34+
*/
35+
duration?: number;
3236
}
3337

3438
/**

‎rest/v9/poll.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,19 @@ export interface RESTGetAPIPollAnswerVotersQuery {
2020
/**
2121
* https://discord.com/developers/docs/resources/poll#poll-create-request-object-poll-create-request-object-structure
2222
*/
23-
export interface RESTAPIPollCreate extends Omit<APIPoll, 'answers' | 'expiry' | 'results'> {
24-
/**
25-
* Number of hours the poll should be open for, up to 7 days
26-
*/
27-
duration: number;
23+
export interface RESTAPIPollCreate
24+
extends Omit<APIPoll, 'allow_multiselect' | 'answers' | 'expiry' | 'layout_type' | 'results'>,
25+
Partial<Pick<APIPoll, 'allow_multiselect' | 'layout_type'>> {
2826
/**
2927
* Each of the answers available in the poll, up to 10
3028
*/
3129
answers: Omit<APIPollAnswer, 'answer_id'>[];
30+
/**
31+
* Number of hours the poll should be open for, up to 32 days
32+
*
33+
* @default 24
34+
*/
35+
duration?: number;
3236
}
3337

3438
/**

0 commit comments

Comments
 (0)
Please sign in to comment.