mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 13:05:32 +09:00
refactor(api): drop ignored location param from thread routes (#3371)
This commit is contained in:
1 parent
c14b7d4cb3
commit
70fd9e6331
6 files changed
+3
-77
No files matched your search
@@ -33,7 +33,6 @@ import {
|
||||
StartThreadFromMessageRequest,
|
||||
StartThreadRequest,
|
||||
ThreadChannelResponse,
|
||||
ThreadLocationQuery,
|
||||
ThreadMemberGetQuery,
|
||||
ThreadMemberListResponse,
|
||||
ThreadMembersListQuery,
|
||||
@@ -389,7 +388,6 @@ export function ThreadController(app: HonoApp) {
|
||||
RateLimitMiddleware(RateLimitConfigs.CHANNEL_THREAD_MEMBER_PUT),
|
||||
LoginRequired,
|
||||
Validator('param', ChannelIdParam),
|
||||
Validator('query', ThreadLocationQuery),
|
||||
OpenAPI({
|
||||
operationId: 'join_thread',
|
||||
summary: 'Join a thread',
|
||||
@@ -415,7 +413,6 @@ export function ThreadController(app: HonoApp) {
|
||||
RateLimitMiddleware(RateLimitConfigs.CHANNEL_THREAD_MEMBER_DELETE),
|
||||
LoginRequired,
|
||||
Validator('param', ChannelIdParam),
|
||||
Validator('query', ThreadLocationQuery),
|
||||
OpenAPI({
|
||||
operationId: 'leave_thread',
|
||||
summary: 'Leave a thread',
|
||||
@@ -474,7 +471,6 @@ export function ThreadController(app: HonoApp) {
|
||||
LoginRequired,
|
||||
SelfThreadMemberAlias('join'),
|
||||
Validator('param', ChannelIdUserIdParam),
|
||||
Validator('query', ThreadLocationQuery),
|
||||
OpenAPI({
|
||||
operationId: 'add_thread_member',
|
||||
summary: 'Add a thread member',
|
||||
@@ -504,7 +500,6 @@ export function ThreadController(app: HonoApp) {
|
||||
LoginRequired,
|
||||
SelfThreadMemberAlias('leave'),
|
||||
Validator('param', ChannelIdUserIdParam),
|
||||
Validator('query', ThreadLocationQuery),
|
||||
OpenAPI({
|
||||
operationId: 'remove_thread_member',
|
||||
summary: 'Remove a thread member',
|
||||
|
||||
@@ -5850,13 +5850,6 @@
|
||||
"required": true,
|
||||
"schema": {"description": "The ID of the channel", "$ref": "#/components/schemas/SnowflakeType"},
|
||||
"description": "The ID of the channel"
|
||||
},
|
||||
{
|
||||
"name": "location",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": {"description": "Accepted and ignored", "type": "string", "maxLength": 100},
|
||||
"description": "Accepted and ignored"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -5915,13 +5908,6 @@
|
||||
"required": true,
|
||||
"schema": {"description": "The ID of the channel", "$ref": "#/components/schemas/SnowflakeType"},
|
||||
"description": "The ID of the channel"
|
||||
},
|
||||
{
|
||||
"name": "location",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": {"description": "Accepted and ignored", "type": "string", "maxLength": 100},
|
||||
"description": "Accepted and ignored"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -6140,13 +6126,6 @@
|
||||
"required": true,
|
||||
"schema": {"description": "The ID of the user", "$ref": "#/components/schemas/SnowflakeType"},
|
||||
"description": "The ID of the user"
|
||||
},
|
||||
{
|
||||
"name": "location",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": {"description": "Accepted and ignored", "type": "string", "maxLength": 100},
|
||||
"description": "Accepted and ignored"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -6212,13 +6191,6 @@
|
||||
"required": true,
|
||||
"schema": {"description": "The ID of the user", "$ref": "#/components/schemas/SnowflakeType"},
|
||||
"description": "The ID of the user"
|
||||
},
|
||||
{
|
||||
"name": "location",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"schema": {"description": "Accepted and ignored", "type": "string", "maxLength": 100},
|
||||
"description": "Accepted and ignored"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -31490,8 +31462,7 @@
|
||||
"maximum": 21600,
|
||||
"description": "Seconds a user has to wait before sending another message (0-21600)",
|
||||
"$ref": "#/components/schemas/Int32Type"
|
||||
},
|
||||
"location": {"description": "Accepted and ignored", "type": "string", "maxLength": 100}
|
||||
}
|
||||
},
|
||||
"required": ["name"]
|
||||
},
|
||||
@@ -36252,8 +36223,7 @@
|
||||
},
|
||||
"description": "The first message of the post",
|
||||
"$ref": "#/components/schemas/ForumThreadMessageRequest"
|
||||
},
|
||||
"location": {"description": "Accepted and ignored", "type": "string", "maxLength": 100}
|
||||
}
|
||||
},
|
||||
"required": ["name", "message"],
|
||||
"x-fluxer-experiment": "channel_threads"
|
||||
@@ -36272,8 +36242,7 @@
|
||||
"invitable": {
|
||||
"description": "Whether non-moderators can add other non-moderators (private threads)",
|
||||
"type": "boolean"
|
||||
},
|
||||
"location": {"description": "Accepted and ignored", "type": "string", "maxLength": 100}
|
||||
}
|
||||
},
|
||||
"required": ["name", "type"]
|
||||
},
|
||||
|
||||
@@ -84,12 +84,6 @@ Joining a locked thread needs an enrolled authenticator while the guild [MFA lev
|
||||
| --- | --- | --- |
|
||||
| channel_id | snowflake | The ID of the thread |
|
||||
|
||||
### Query parameters
|
||||
|
||||
| Field | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| location? | string | A value Fluxer accepts and ignores (max 100 characters) |
|
||||
|
||||
### Response
|
||||
|
||||
| Status | Body | Condition |
|
||||
@@ -131,12 +125,6 @@ Adding to a locked thread needs an enrolled authenticator while the guild [MFA l
|
||||
| channel_id | snowflake | The ID of the thread |
|
||||
| user_id | snowflake | The ID of the user to add |
|
||||
|
||||
### Query parameters
|
||||
|
||||
| Field | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| location? | string | A value Fluxer accepts and ignores (max 100 characters) |
|
||||
|
||||
### Response
|
||||
|
||||
| Status | Body | Condition |
|
||||
@@ -176,12 +164,6 @@ A timed-out member can leave a thread. A member who can no longer view the threa
|
||||
| --- | --- | --- |
|
||||
| channel_id | snowflake | The ID of the thread |
|
||||
|
||||
### Query parameters
|
||||
|
||||
| Field | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| location? | string | A value Fluxer accepts and ignores (max 100 characters) |
|
||||
|
||||
### Response
|
||||
|
||||
| Status | Body | Condition |
|
||||
@@ -219,12 +201,6 @@ Removing a member needs an enrolled authenticator while the guild [MFA level](/h
|
||||
| channel_id | snowflake | The ID of the thread |
|
||||
| user_id | snowflake | The ID of the user to remove |
|
||||
|
||||
### Query parameters
|
||||
|
||||
| Field | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| location? | string | A value Fluxer accepts and ignores (max 100 characters) |
|
||||
|
||||
### Response
|
||||
|
||||
| Status | Body | Condition |
|
||||
|
||||
@@ -184,7 +184,6 @@ Starts a public thread from a message in a guild text channel, or an announcemen
|
||||
| name | string | The name of the thread (1-100 characters) |
|
||||
| auto_archive_duration? | integer | The [auto archive duration](#auto-archive-durations) in minutes (default 4320) |
|
||||
| rate_limit_per_user? | integer | The slowmode interval in seconds (0-21,600) |
|
||||
| location? | string | A value Fluxer accepts and ignores (max 100 characters) |
|
||||
|
||||
`rate_limit_per_user` defaults to the `default_thread_rate_limit_per_user` of the parent, or `0` when the parent has none.
|
||||
|
||||
@@ -252,7 +251,6 @@ The parent type selects the body. Either body can be sent as multipart form data
|
||||
| auto_archive_duration? | integer | The [auto archive duration](#auto-archive-durations) in minutes (default 4320) |
|
||||
| rate_limit_per_user? | integer | The slowmode interval in seconds (0-21,600) |
|
||||
| invitable?<sup>1</sup> | boolean | Whether a member who is not a thread moderator can add members who are not thread moderators (default true) |
|
||||
| location? | string | A value Fluxer accepts and ignores (max 100 characters) |
|
||||
|
||||
<sup>1</sup> Applies only to a private thread
|
||||
|
||||
@@ -266,7 +264,6 @@ The parent type selects the body. Either body can be sent as multipart form data
|
||||
| auto_archive_duration? | integer | The [auto archive duration](#auto-archive-durations) in minutes (default 4320) |
|
||||
| rate_limit_per_user? | integer | The slowmode interval in seconds (0-21,600) |
|
||||
| type?<sup>2</sup> | integer | The thread type (`11` only) |
|
||||
| location? | string | A value Fluxer accepts and ignores (max 100 characters) |
|
||||
|
||||
<sup>1</sup> Required when the channel has `REQUIRE_TAG`. A tag marked `moderated` needs a thread moderator
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ import {z} from 'zod';
|
||||
|
||||
const EXPERIMENT = {experiment: 'channel_threads'} as const;
|
||||
const EMOJI_NAME_MAX_LENGTH = 64;
|
||||
const LOCATION_MAX_LENGTH = 100;
|
||||
|
||||
export const ForumTagRequest = withSchemaMetadata(
|
||||
z.object({
|
||||
@@ -141,7 +140,6 @@ export const StartForumThreadRequest = withSchemaMetadata(
|
||||
.describe('Seconds a user has to wait before sending another message (0-21600)'),
|
||||
applied_tags: AppliedTagsType.optional(),
|
||||
message: ForumThreadMessageRequest.describe('The first message of the post'),
|
||||
location: z.string().max(LOCATION_MAX_LENGTH).optional().describe('Accepted and ignored'),
|
||||
}),
|
||||
EXPERIMENT,
|
||||
);
|
||||
|
||||
@@ -22,7 +22,6 @@ import {
|
||||
import {z} from 'zod';
|
||||
|
||||
const THREAD_MEMBERS_LIST_MAX_LIMIT = 100;
|
||||
const LOCATION_MAX_LENGTH = 100;
|
||||
|
||||
export const ThreadAutoArchiveDurationSchema = createInt32EnumType(
|
||||
[
|
||||
@@ -43,13 +42,10 @@ const ThreadRateLimitPerUserType = Int32Type.max(THREAD_RATE_LIMIT_PER_USER_MAX)
|
||||
'Seconds a user has to wait before sending another message (0-21600)',
|
||||
);
|
||||
|
||||
const LocationType = z.string().max(LOCATION_MAX_LENGTH).optional().describe('Accepted and ignored');
|
||||
|
||||
export const StartThreadFromMessageRequest = z.object({
|
||||
name: ThreadNameType,
|
||||
auto_archive_duration: ThreadAutoArchiveDurationSchema.optional(),
|
||||
rate_limit_per_user: ThreadRateLimitPerUserType.optional(),
|
||||
location: LocationType,
|
||||
});
|
||||
|
||||
export type StartThreadFromMessageRequest = z.infer<typeof StartThreadFromMessageRequest>;
|
||||
@@ -68,15 +64,10 @@ export const StartThreadRequest = z.object({
|
||||
auto_archive_duration: ThreadAutoArchiveDurationSchema.optional(),
|
||||
rate_limit_per_user: ThreadRateLimitPerUserType.optional(),
|
||||
invitable: z.boolean().optional().describe('Whether non-moderators can add other non-moderators (private threads)'),
|
||||
location: LocationType,
|
||||
});
|
||||
|
||||
export type StartThreadRequest = z.infer<typeof StartThreadRequest>;
|
||||
|
||||
export const ThreadLocationQuery = z.object({
|
||||
location: LocationType,
|
||||
});
|
||||
|
||||
export const ThreadMembersListQuery = z.object({
|
||||
with_member: QueryBooleanType.describe('Whether to include a guild member object for each thread member'),
|
||||
after: SnowflakeType.optional().describe('Get thread members after this user ID'),
|
||||
|
||||
Reference in new issue
Block a user