Skip to content

Commit dfe5040

Browse files
committed
fix: Allow null in all optional parameters in REST API
1 parent 819ed3c commit dfe5040

11 files changed

Lines changed: 57 additions & 53 deletions

File tree

src/mastodon/rest/v1/accounts.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ export interface CreateAccountParams {
3333
/** The language of the confirmation email that will be sent */
3434
readonly locale: string;
3535
/** Text that will be reviewed by moderators if registrations require manual approval. */
36-
readonly reason?: string;
36+
readonly reason?: string | null;
3737
/** String (Date), required if the server has a minimum age requirement. */
38-
readonly dateOfBirth?: string;
38+
readonly dateOfBirth?: string | null;
3939
/** https://github.com/mastodon/mastodon/pull/25342 */
40-
readonly timeZone?: string;
40+
readonly timeZone?: string | null;
4141
}
4242

4343
export interface UpdateCredentialsParams {
4444
/** Whether the account should be shown in the profile directory. */
45-
readonly discoverable?: boolean;
45+
readonly discoverable?: boolean | null;
4646
/** Whether the account has a bot flag. */
47-
readonly bot?: boolean;
47+
readonly bot?: boolean | null;
4848
/** The display name to use for the profile. */
4949
readonly displayName?: string | null;
5050
/** The account bio. */
@@ -69,9 +69,9 @@ export interface UpdateCredentialsParams {
6969

7070
export interface MuteAccountParams {
7171
/** Mute notifications in addition to statuses? Defaults to true. */
72-
readonly notifications?: boolean;
72+
readonly notifications?: boolean | null;
7373
/** Duration to mute in seconds. Defaults to 0 (indefinite). */
74-
readonly duration?: number;
74+
readonly duration?: number | null;
7575
}
7676

7777
export interface CreateAccountNoteParams {

src/mastodon/rest/v1/admin/accounts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ export type AccountActionType = keyof AccountActionRegistry;
4747

4848
export interface CreateActionParams {
4949
/** Type of action to be taken. Enumerable oneOf: `none` `disable` `silence` `suspend` */
50-
readonly type?: AccountActionType;
50+
readonly type?: AccountActionType | null;
5151
/** ID of an associated report that caused this action to be taken */
52-
readonly reportId?: string;
52+
readonly reportId?: string | null;
5353
/** ID of a preset warning */
5454
readonly warningPresetId?: string | null;
5555
/** Additional text for clarification of why this action was taken */

src/mastodon/rest/v1/admin/domain-blocks.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ export interface CreateDomainBlockParams {
77
/** The domain to block federation required*/
88
readonly domain: string;
99
/** Whether to apply a silence, suspend, or noop to the domain?*/
10-
readonly severity?: Admin.DomainBlockSeverity;
10+
readonly severity?: Admin.DomainBlockSeverity | null;
1111
/** Whether media attachments should be rejected*/
12-
readonly rejectMedia?: boolean;
12+
readonly rejectMedia?: boolean | null;
1313
/** Whether reports from this domain should be rejected*/
14-
readonly rejectReports?: boolean;
14+
readonly rejectReports?: boolean | null;
1515
/** A private note about this domain block, visible only to admins*/
1616
readonly privateComment?: string | null;
1717
/** A public note about this domain block, optionally shown on the about page*/
1818
readonly publicComment?: string | null;
1919
/** Whether to partially censor the domain when shown in public*/
20-
readonly obfuscate?: boolean;
20+
readonly obfuscate?: boolean | null;
2121
}
2222

2323
export interface ListDomainBlocksParams {
24-
readonly limit?: number;
24+
readonly limit?: number | null;
2525
}
2626

2727
export type UpdateDomainBlockParams = Omit<CreateDomainBlockParams, "domain">;

src/mastodon/rest/v1/emails.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { type Method } from "../../method.js";
33

44
export interface CreateConfirmationParams {
55
/** If provided, updates the unconfirmed user’s email before resending the confirmation email. */
6-
readonly email?: string;
6+
readonly email?: string | null;
77
}
88

99
export interface EmailsConfirmationResource {

src/mastodon/rest/v1/lists.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export interface CreateListParams {
88
/** The title of the list to be created. */
99
readonly title: string;
1010
/** https://github.com/mastodon/mastodon/pull/22048/files */
11-
readonly exclusive?: boolean;
11+
readonly exclusive?: boolean | null;
1212
}
1313

1414
export type UpdateListParams = CreateListParams;

src/mastodon/rest/v1/markers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface FetchMarkersParams {
1212
* String enum anyOf `home`, `notifications`.
1313
* If not provided, an empty object will be returned.
1414
*/
15-
readonly timeline?: readonly MarkerTimeline[];
15+
readonly timeline?: readonly MarkerTimeline[] | null;
1616
}
1717

1818
export type CreateMarkersParams = {

src/mastodon/rest/v1/statuses.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export interface CreateStatusParamsWithStatus extends CreateStatusParamsBase {
6666
/** Text content of the status. If `media_ids` is provided, this becomes optional. Attaching a `poll` is optional while `status` is provided. */
6767
readonly status: string;
6868
/** Array of Attachment ids to be attached as media. If provided, `status` becomes optional, and `poll` cannot be used. */
69-
readonly mediaIds?: never;
69+
readonly mediaIds?: never | null;
7070
readonly poll?: CreateStatusPollParam | null;
7171
}
7272

@@ -76,7 +76,7 @@ export interface CreateStatusParamsWithMediaIds extends CreateStatusParamsBase {
7676
/** Text content of the status. If `media_ids` is provided, this becomes optional. Attaching a `poll` is optional while `status` is provided. */
7777

7878
readonly status?: string | null;
79-
readonly poll?: never;
79+
readonly poll?: never | null;
8080
}
8181

8282
export type CreateStatusParams =
@@ -101,7 +101,7 @@ interface UpdateStatusMediaAttribute {
101101

102102
export type UpdateStatusParams = CreateStatusParams & {
103103
/** https://github.com/mastodon/mastodon/pull/20878 */
104-
readonly mediaAttributes?: readonly UpdateStatusMediaAttribute[];
104+
readonly mediaAttributes?: readonly UpdateStatusMediaAttribute[] | null;
105105
};
106106

107107
export interface ReblogStatusParams {
@@ -111,7 +111,7 @@ export interface ReblogStatusParams {
111111

112112
export interface TranslateStatusParams {
113113
/** String (ISO 639 language code). The status content will be translated into this language. Defaults to the user’s current locale. */
114-
readonly lang?: string;
114+
readonly lang?: string | null;
115115
}
116116

117117
export interface Statuses$SelectContextResource {

src/mastodon/rest/v1/trends.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { type DefaultPaginationParams } from "../../resource.js";
99

1010
export interface ListTrendsParams {
1111
/** Maximum number of results to return. Defaults to 10. */
12-
readonly limit?: number;
12+
readonly limit?: number | null;
1313
}
1414

1515
export interface TrendsStatusesResource {

src/mastodon/rest/v2/filters.ts

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,38 @@ export interface CreateFilterParams {
2121
/** Integer. How many seconds from now should the filter expire? */
2222
readonly expiresIn?: number | null;
2323

24-
readonly keywordsAttributes?: {
25-
/** String. A keyword to be added to the newly-created filter group. */
26-
readonly keyword?: string | null;
27-
/** Boolean. Whether the keyword should consider word boundaries. */
28-
readonly wholeWord?: boolean | null;
29-
}[];
24+
readonly keywordsAttributes?:
25+
| {
26+
/** String. A keyword to be added to the newly-created filter group. */
27+
readonly keyword?: string | null;
28+
/** Boolean. Whether the keyword should consider word boundaries. */
29+
readonly wholeWord?: boolean | null;
30+
}[]
31+
| null;
3032
}
3133

3234
export interface UpdateFilterParams {
3335
/** String. The name of the filter group. */
34-
readonly title?: string;
36+
readonly title?: string | null;
3537
/** Array of String. Where the filter should be applied. Specify at least one of home, notifications, public, thread, account. */
3638
readonly context?: readonly FilterContext[] | null;
3739
/** String. The policy to be applied when the filter is matched. Specify warn or hide. */
3840
readonly filterAction?: FilterAction | null;
3941
/** Integer. How many seconds from now should the filter expire? */
4042
readonly expiresIn?: number | null;
4143

42-
readonly keywordsAttributes?: readonly {
43-
/** String. Provide the ID of an existing keyword to modify it, instead of creating a new keyword. */
44-
readonly id?: string | null;
45-
/** String. A keyword to be added to the newly-created filter group. */
46-
readonly keyword?: string | null;
47-
/** Boolean. Whether the keyword should consider word boundaries. */
48-
readonly wholeWord?: boolean | null;
49-
/** Boolean. If true, will remove the keyword with the given ID */
50-
readonly _destroy?: boolean | null;
51-
}[];
44+
readonly keywordsAttributes?:
45+
| readonly {
46+
/** String. Provide the ID of an existing keyword to modify it, instead of creating a new keyword. */
47+
readonly id?: string | null;
48+
/** String. A keyword to be added to the newly-created filter group. */
49+
readonly keyword?: string | null;
50+
/** Boolean. Whether the keyword should consider word boundaries. */
51+
readonly wholeWord?: boolean | null;
52+
/** Boolean. If true, will remove the keyword with the given ID */
53+
readonly _destroy?: boolean | null;
54+
}[]
55+
| null;
5256
}
5357

5458
export interface CreateFilterKeywordParams {

src/mastodon/rest/v2/media.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface CreateMediaAttachmentParams {
1515

1616
export interface CreateMediaAttachmentExtraParams {
1717
/** Wait resolving promise for the media to be uploaded. Defaults to `false` */
18-
readonly skipPolling?: boolean;
18+
readonly skipPolling?: boolean | null;
1919
}
2020

2121
export interface MediaAttachmentsResource {

0 commit comments

Comments
 (0)