diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-26 22:08:14 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-26 22:08:14 +1000 |
commit | 1f416b972c6aa0cd4fc43a5790da56f8da21e82c (patch) | |
tree | 8222a04cc63c595bc8b236ceeec89ed2fc2b7580 /src/util/schemas | |
parent | Fix scripts/benchmark/connections.js (diff) | |
download | server-1f416b972c6aa0cd4fc43a5790da56f8da21e82c.tar.xz |
Move schemas to /src/util/schemas
Diffstat (limited to 'src/util/schemas')
45 files changed, 595 insertions, 70 deletions
diff --git a/src/util/schemas/ActivitySchema.ts b/src/util/schemas/ActivitySchema.ts new file mode 100644 index 00000000..d316420e --- /dev/null +++ b/src/util/schemas/ActivitySchema.ts @@ -0,0 +1,60 @@ +import { Activity, Status } from "@fosscord/util"; + +export const ActivitySchema = { + afk: Boolean, + status: String, + $activities: [ + { + name: String, + type: Number, + $url: String, + $created_at: Date, + $timestamps: { + $start: Number, + $end: Number, + }, + $application_id: String, + $details: String, + $state: String, + $emoji: { + $name: String, + $id: String, + $animated: Boolean, + }, + $party: { + $id: String, + $size: [Number, Number], + }, + $assets: { + $large_image: String, + $large_text: String, + $small_image: String, + $small_text: String, + }, + $secrets: { + $join: String, + $spectate: String, + $match: String, + }, + $instance: Boolean, + $flags: String, + + $id: String, + $sync_id: String, + $metadata: { // spotify + $context_uri: String, + album_id: String, + artist_ids: [String], + }, + $session_id: String, + }, + ], + $since: Number, // unix time (in milliseconds) of when the client went idle, or null if the client is not idle +}; + +export interface ActivitySchema { + afk: boolean; + status: Status; + activities?: Activity[]; + since?: number; // unix time (in milliseconds) of when the client went idle, or null if the client is not idle +} \ No newline at end of file diff --git a/src/util/schemas/BackupCodesChallengeSchema.ts b/src/util/schemas/BackupCodesChallengeSchema.ts new file mode 100644 index 00000000..d6b519b7 --- /dev/null +++ b/src/util/schemas/BackupCodesChallengeSchema.ts @@ -0,0 +1,3 @@ +export interface BackupCodesChallengeSchema { + password: string; +} \ No newline at end of file diff --git a/src/util/schemas/BanCreateSchema.ts b/src/util/schemas/BanCreateSchema.ts new file mode 100644 index 00000000..876b2a89 --- /dev/null +++ b/src/util/schemas/BanCreateSchema.ts @@ -0,0 +1,4 @@ +export interface BanCreateSchema { + delete_message_days?: string; + reason?: string; +}; \ No newline at end of file diff --git a/src/util/schemas/BanModeratorSchema.ts b/src/util/schemas/BanModeratorSchema.ts new file mode 100644 index 00000000..8efa2402 --- /dev/null +++ b/src/util/schemas/BanModeratorSchema.ts @@ -0,0 +1,7 @@ +export interface BanModeratorSchema { + id: string; + user_id: string; + guild_id: string; + executor_id: string; + reason?: string | undefined; +}; \ No newline at end of file diff --git a/src/util/schemas/BanRegistrySchema.ts b/src/util/schemas/BanRegistrySchema.ts new file mode 100644 index 00000000..8680d3db --- /dev/null +++ b/src/util/schemas/BanRegistrySchema.ts @@ -0,0 +1,8 @@ +export interface BanRegistrySchema { + id: string; + user_id: string; + guild_id: string; + executor_id: string; + ip?: string; + reason?: string | undefined; +}; \ No newline at end of file diff --git a/src/util/schemas/BulkDeleteSchema.ts b/src/util/schemas/BulkDeleteSchema.ts new file mode 100644 index 00000000..6a71e052 --- /dev/null +++ b/src/util/schemas/BulkDeleteSchema.ts @@ -0,0 +1,3 @@ +export interface BulkDeleteSchema { + messages: string[]; +} \ No newline at end of file diff --git a/src/util/schemas/ChannelModifySchema.ts b/src/util/schemas/ChannelModifySchema.ts new file mode 100644 index 00000000..835ea2d7 --- /dev/null +++ b/src/util/schemas/ChannelModifySchema.ts @@ -0,0 +1,30 @@ +import { ChannelPermissionOverwriteType, ChannelType } from "@fosscord/util"; + +export interface ChannelModifySchema { + /** + * @maxLength 100 + */ + name?: string; + type?: ChannelType; + topic?: string; + icon?: string | null; + bitrate?: number; + user_limit?: number; + rate_limit_per_user?: number; + position?: number; + permission_overwrites?: { + id: string; + type: ChannelPermissionOverwriteType; + allow: string; + deny: string; + }[]; + parent_id?: string; + id?: string; // is not used (only for guild create) + nsfw?: boolean; + rtc_region?: string; + default_auto_archive_duration?: number; + default_reaction_emoji?: string | null; + flags?: number; + default_thread_rate_limit_per_user?: number; + video_quality_mode?: number; +} \ No newline at end of file diff --git a/src/util/schemas/CodesVerificationSchema.ts b/src/util/schemas/CodesVerificationSchema.ts new file mode 100644 index 00000000..e8e2e7b4 --- /dev/null +++ b/src/util/schemas/CodesVerificationSchema.ts @@ -0,0 +1,5 @@ +export interface CodesVerificationSchema { + key: string; + nonce: string; + regenerate?: boolean; +} \ No newline at end of file diff --git a/src/util/schemas/DmChannelCreateSchema.ts b/src/util/schemas/DmChannelCreateSchema.ts new file mode 100644 index 00000000..04b8ff69 --- /dev/null +++ b/src/util/schemas/DmChannelCreateSchema.ts @@ -0,0 +1,4 @@ +export interface DmChannelCreateSchema { + name?: string; + recipients: string[]; +} \ No newline at end of file diff --git a/src/util/schemas/EmojiCreateSchema.ts b/src/util/schemas/EmojiCreateSchema.ts new file mode 100644 index 00000000..8e2a2307 --- /dev/null +++ b/src/util/schemas/EmojiCreateSchema.ts @@ -0,0 +1,6 @@ +export interface EmojiCreateSchema { + name?: string; + image: string; + require_colons?: boolean | null; + roles?: string[]; +} \ No newline at end of file diff --git a/src/util/schemas/EmojiModifySchema.ts b/src/util/schemas/EmojiModifySchema.ts new file mode 100644 index 00000000..cd5b7e3e --- /dev/null +++ b/src/util/schemas/EmojiModifySchema.ts @@ -0,0 +1,4 @@ +export interface EmojiModifySchema { + name?: string; + roles?: string[]; +} \ No newline at end of file diff --git a/src/util/schemas/GuildCreateSchema.ts b/src/util/schemas/GuildCreateSchema.ts new file mode 100644 index 00000000..9b5f7dc2 --- /dev/null +++ b/src/util/schemas/GuildCreateSchema.ts @@ -0,0 +1,14 @@ +import { ChannelModifySchema } from "."; + +export interface GuildCreateSchema { + /** + * @maxLength 100 + */ + name?: string; + region?: string; + icon?: string | null; + channels?: ChannelModifySchema[]; + guild_template_code?: string; + system_channel_id?: string; + rules_channel_id?: string; +} \ No newline at end of file diff --git a/src/util/schemas/GuildTemplateCreateSchema.ts b/src/util/schemas/GuildTemplateCreateSchema.ts new file mode 100644 index 00000000..7caefcb8 --- /dev/null +++ b/src/util/schemas/GuildTemplateCreateSchema.ts @@ -0,0 +1,4 @@ +export interface GuildTemplateCreateSchema { + name: string; + avatar?: string | null; +} \ No newline at end of file diff --git a/src/util/schemas/GuildUpdateWelcomeScreenSchema.ts b/src/util/schemas/GuildUpdateWelcomeScreenSchema.ts new file mode 100644 index 00000000..0022da6e --- /dev/null +++ b/src/util/schemas/GuildUpdateWelcomeScreenSchema.ts @@ -0,0 +1,10 @@ +export interface GuildUpdateWelcomeScreenSchema { + welcome_channels?: { + channel_id: string; + description: string; + emoji_id?: string; + emoji_name?: string; + }[]; + enabled?: boolean; + description?: string; +} \ No newline at end of file diff --git a/src/util/schemas/IdentifySchema.ts b/src/util/schemas/IdentifySchema.ts new file mode 100644 index 00000000..409a03da --- /dev/null +++ b/src/util/schemas/IdentifySchema.ts @@ -0,0 +1,106 @@ +import { ActivitySchema } from "@fosscord/util"; + +export const IdentifySchema = { + token: String, + $intents: BigInt, // discord uses a Integer for bitfields we use bigints tho. | instanceOf will automatically convert the Number to a BigInt + $properties: Object, + // { + // // discord uses $ in the property key for bots, so we need to double prefix it, because instanceOf treats $ (prefix) as a optional key + // $os: String, + // $os_arch: String, + // $browser: String, + // $device: String, + // $$os: String, + // $$browser: String, + // $$device: String, + // $browser_user_agent: String, + // $browser_version: String, + // $os_version: String, + // $referrer: String, + // $$referrer: String, + // $referring_domain: String, + // $$referring_domain: String, + // $referrer_current: String, + // $referring_domain_current: String, + // $release_channel: String, + // $client_build_number: Number, + // $client_event_source: String, + // $client_version: String, + // $system_locale: String, + // $window_manager: String, + // $distro: String, + // }, + $presence: ActivitySchema, + $compress: Boolean, + $large_threshold: Number, + $shard: [BigInt, BigInt], + $guild_subscriptions: Boolean, + $capabilities: Number, + $client_state: { + $guild_hashes: Object, + $highest_last_message_id: String || Number, + $read_state_version: Number, + $user_guild_settings_version: Number, + $user_settings_version: undefined, + $useruser_guild_settings_version: undefined, + }, + $clientState: { + $guildHashes: Object, + $highestLastMessageId: String || Number, + $readStateVersion: Number, + $useruserGuildSettingsVersion: undefined, + $userGuildSettingsVersion: undefined, + }, + $v: Number, + $version: Number, +}; + +export interface IdentifySchema { + token: string; + properties: { + // bruh discord really uses $ in the property key, so we need to double prefix it, because instanceOf treats $ (prefix) as a optional key + os?: string; + os_atch?: string; + browser?: string; + device?: string; + $os?: string; + $browser?: string; + $device?: string; + browser_user_agent?: string; + browser_version?: string; + os_version?: string; + referrer?: string; + referring_domain?: string; + referrer_current?: string; + referring_domain_current?: string; + release_channel?: "stable" | "dev" | "ptb" | "canary"; + client_build_number?: number; + client_event_source?: any; + client_version?: string; + system_locale?: string; + }; + intents?: bigint; // discord uses a Integer for bitfields we use bigints tho. | instanceOf will automatically convert the Number to a BigInt + presence?: ActivitySchema; + compress?: boolean; + large_threshold?: number; + largeThreshold?: number; + shard?: [bigint, bigint]; + guild_subscriptions?: boolean; + capabilities?: number; + client_state?: { + guild_hashes?: any; + highest_last_message_id?: string | number; + read_state_version?: number; + user_guild_settings_version?: number; + user_settings_version?: number; + useruser_guild_settings_version?: number; + }; + clientState?: { + guildHashes?: any; + highestLastMessageId?: string | number; + readStateVersion?: number; + userGuildSettingsVersion?: number; + useruserGuildSettingsVersion?: number; + }; + v?: number; +} diff --git a/src/util/schemas/InviteCreateSchema.ts b/src/util/schemas/InviteCreateSchema.ts new file mode 100644 index 00000000..83ae22dd --- /dev/null +++ b/src/util/schemas/InviteCreateSchema.ts @@ -0,0 +1,11 @@ +export interface InviteCreateSchema { + target_user_id?: string; + target_type?: string; + validate?: string; // ? what is this + max_age?: number; + max_uses?: number; + temporary?: boolean; + unique?: boolean; + target_user?: string; + target_user_type?: number; +} \ No newline at end of file diff --git a/src/util/schemas/LazyRequestSchema.ts b/src/util/schemas/LazyRequestSchema.ts new file mode 100644 index 00000000..e9f2df20 --- /dev/null +++ b/src/util/schemas/LazyRequestSchema.ts @@ -0,0 +1,19 @@ +export interface LazyRequestSchema { + guild_id: string; + channels?: Record<string, [number, number][]>; + activities?: boolean; + threads?: boolean; + typing?: true; + members?: any[]; + thread_member_lists?: any[]; +} + +export const LazyRequestSchema = { + guild_id: String, + $activities: Boolean, + $channels: Object, + $typing: Boolean, + $threads: Boolean, + $members: [] as any[], + $thread_member_lists: [] as any[], +}; diff --git a/src/util/schemas/LoginSchema.ts b/src/util/schemas/LoginSchema.ts new file mode 100644 index 00000000..543d236c --- /dev/null +++ b/src/util/schemas/LoginSchema.ts @@ -0,0 +1,8 @@ +export interface LoginSchema { + login: string; + password: string; + undelete?: boolean; + captcha_key?: string; + login_source?: string; + gift_code_sku_id?: string; +} \ No newline at end of file diff --git a/src/util/schemas/MemberChangeSchema.ts b/src/util/schemas/MemberChangeSchema.ts new file mode 100644 index 00000000..566d7e20 --- /dev/null +++ b/src/util/schemas/MemberChangeSchema.ts @@ -0,0 +1,4 @@ +export interface MemberChangeSchema { + roles?: string[]; + nick?: string; +} \ No newline at end of file diff --git a/src/util/schemas/MemberNickChangeSchema.ts b/src/util/schemas/MemberNickChangeSchema.ts new file mode 100644 index 00000000..ed9fdb7b --- /dev/null +++ b/src/util/schemas/MemberNickChangeSchema.ts @@ -0,0 +1,3 @@ +export interface MemberNickChangeSchema { + nick: string; +} \ No newline at end of file diff --git a/src/util/schemas/MessageAcknowledgeSchema.ts b/src/util/schemas/MessageAcknowledgeSchema.ts new file mode 100644 index 00000000..1e7fb80d --- /dev/null +++ b/src/util/schemas/MessageAcknowledgeSchema.ts @@ -0,0 +1,4 @@ +export interface MessageAcknowledgeSchema { + manual?: boolean; + mention_count?: number; +} \ No newline at end of file diff --git a/src/util/schemas/MessageCreateSchema.ts b/src/util/schemas/MessageCreateSchema.ts new file mode 100644 index 00000000..9d77c485 --- /dev/null +++ b/src/util/schemas/MessageCreateSchema.ts @@ -0,0 +1,33 @@ +import { Embed } from "@fosscord/util"; + +export interface MessageCreateSchema { + type?: number; + content?: string; + nonce?: string; + channel_id?: string; + tts?: boolean; + flags?: string; + embeds?: Embed[]; + embed?: Embed; + // TODO: ^ embed is deprecated in favor of embeds (https://discord.com/developers/docs/resources/channel#message-object) + allowed_mentions?: { + parse?: string[]; + roles?: string[]; + users?: string[]; + replied_user?: boolean; + }; + message_reference?: { + message_id: string; + channel_id: string; + guild_id?: string; + fail_if_not_exists?: boolean; + }; + payload_json?: string; + file?: any; + /** + TODO: we should create an interface for attachments + TODO: OpenWAAO<-->attachment-style metadata conversion + **/ + attachments?: any[]; + sticker_ids?: string[]; +} \ No newline at end of file diff --git a/src/util/schemas/MfaCodesSchema.ts b/src/util/schemas/MfaCodesSchema.ts new file mode 100644 index 00000000..226c43f1 --- /dev/null +++ b/src/util/schemas/MfaCodesSchema.ts @@ -0,0 +1,4 @@ +export interface MfaCodesSchema { + password: string; + regenerate?: boolean; +} \ No newline at end of file diff --git a/src/util/schemas/ModifyGuildStickerSchema.ts b/src/util/schemas/ModifyGuildStickerSchema.ts new file mode 100644 index 00000000..06bf4ffe --- /dev/null +++ b/src/util/schemas/ModifyGuildStickerSchema.ts @@ -0,0 +1,15 @@ +export interface ModifyGuildStickerSchema { + /** + * @minLength 2 + * @maxLength 30 + */ + name: string; + /** + * @maxLength 100 + */ + description?: string; + /** + * @maxLength 200 + */ + tags: string; +} \ No newline at end of file diff --git a/src/util/schemas/PruneSchema.ts b/src/util/schemas/PruneSchema.ts new file mode 100644 index 00000000..60601d81 --- /dev/null +++ b/src/util/schemas/PruneSchema.ts @@ -0,0 +1,6 @@ +export interface PruneSchema { + /** + * @min 0 + */ + days: number; +} \ No newline at end of file diff --git a/src/util/schemas/PurgeSchema.ts b/src/util/schemas/PurgeSchema.ts new file mode 100644 index 00000000..8916be92 --- /dev/null +++ b/src/util/schemas/PurgeSchema.ts @@ -0,0 +1,4 @@ +export interface PurgeSchema { + before: string; + after: string; +} \ No newline at end of file diff --git a/src/util/schemas/RegisterSchema.ts b/src/util/schemas/RegisterSchema.ts new file mode 100644 index 00000000..c0cc3805 --- /dev/null +++ b/src/util/schemas/RegisterSchema.ts @@ -0,0 +1,27 @@ +export interface RegisterSchema { + /** + * @minLength 2 + * @maxLength 32 + */ + username: string; + /** + * @minLength 1 + * @maxLength 72 + */ + password?: string; + consent: boolean; + /** + * @TJS-format email + */ + email?: string; + fingerprint?: string; + invite?: string; + /** + * @TJS-type string + */ + date_of_birth?: Date; // "2000-04-03" + gift_code_sku_id?: string; + captcha_key?: string; + + promotional_email_opt_in?: boolean; +} \ No newline at end of file diff --git a/src/util/schemas/RelationshipPostSchema.ts b/src/util/schemas/RelationshipPostSchema.ts new file mode 100644 index 00000000..3ff6eade --- /dev/null +++ b/src/util/schemas/RelationshipPostSchema.ts @@ -0,0 +1,4 @@ +export interface RelationshipPostSchema { + discriminator: string; + username: string; +} \ No newline at end of file diff --git a/src/util/schemas/RelationshipPutSchema.ts b/src/util/schemas/RelationshipPutSchema.ts new file mode 100644 index 00000000..455f854e --- /dev/null +++ b/src/util/schemas/RelationshipPutSchema.ts @@ -0,0 +1,5 @@ +import { RelationshipType } from "@fosscord/util"; + +export interface RelationshipPutSchema { + type?: RelationshipType; +} \ No newline at end of file diff --git a/src/util/schemas/RoleModifySchema.ts b/src/util/schemas/RoleModifySchema.ts new file mode 100644 index 00000000..adb0c1a6 --- /dev/null +++ b/src/util/schemas/RoleModifySchema.ts @@ -0,0 +1,10 @@ +export interface RoleModifySchema { + name?: string; + permissions?: string; + color?: number; + hoist?: boolean; // whether the role should be displayed separately in the sidebar + mentionable?: boolean; // whether the role should be mentionable + position?: number; + icon?: string; + unicode_emoji?: string; +} \ No newline at end of file diff --git a/src/util/schemas/SelectProtocolSchema.ts b/src/util/schemas/SelectProtocolSchema.ts new file mode 100644 index 00000000..92958e97 --- /dev/null +++ b/src/util/schemas/SelectProtocolSchema.ts @@ -0,0 +1,19 @@ +export interface SelectProtocolSchema { + protocol: "webrtc" | "udp"; + data: + | string + | { + address: string; + port: number; + mode: string; + }; + sdp?: string; + codecs?: { + name: "opus" | "VP8" | "VP9" | "H264"; + type: "audio" | "video"; + priority: number; + payload_type: number; + rtx_payload_type?: number | null; + }[]; + rtc_connection_id?: string; // uuid +} \ No newline at end of file diff --git a/src/util/schemas/TemplateCreateSchema.ts b/src/util/schemas/TemplateCreateSchema.ts new file mode 100644 index 00000000..3f98f692 --- /dev/null +++ b/src/util/schemas/TemplateCreateSchema.ts @@ -0,0 +1,4 @@ +export interface TemplateCreateSchema { + name: string; + description?: string; +} \ No newline at end of file diff --git a/src/util/schemas/TemplateModifySchema.ts b/src/util/schemas/TemplateModifySchema.ts new file mode 100644 index 00000000..3e6efb74 --- /dev/null +++ b/src/util/schemas/TemplateModifySchema.ts @@ -0,0 +1,4 @@ +export interface TemplateModifySchema { + name: string; + description?: string; +} \ No newline at end of file diff --git a/src/util/schemas/TotpDisableSchema.ts b/src/util/schemas/TotpDisableSchema.ts new file mode 100644 index 00000000..05192bfa --- /dev/null +++ b/src/util/schemas/TotpDisableSchema.ts @@ -0,0 +1,3 @@ +export interface TotpDisableSchema { + code: string; +} \ No newline at end of file diff --git a/src/util/schemas/TotpEnableSchema.ts b/src/util/schemas/TotpEnableSchema.ts new file mode 100644 index 00000000..7f6fb5a9 --- /dev/null +++ b/src/util/schemas/TotpEnableSchema.ts @@ -0,0 +1,5 @@ +export interface TotpEnableSchema { + password: string; + code?: string; + secret?: string; +} \ No newline at end of file diff --git a/src/util/schemas/TotpSchema.ts b/src/util/schemas/TotpSchema.ts new file mode 100644 index 00000000..889cb443 --- /dev/null +++ b/src/util/schemas/TotpSchema.ts @@ -0,0 +1,6 @@ +export interface TotpSchema { + code: string, + ticket: string, + gift_code_sku_id?: string | null, + login_source?: string | null, +} \ No newline at end of file diff --git a/src/util/schemas/UserModifySchema.ts b/src/util/schemas/UserModifySchema.ts new file mode 100644 index 00000000..34e0f135 --- /dev/null +++ b/src/util/schemas/UserModifySchema.ts @@ -0,0 +1,19 @@ +export interface UserModifySchema { + /** + * @minLength 1 + * @maxLength 100 + */ + username?: string; + avatar?: string | null; + /** + * @maxLength 1024 + */ + bio?: string; + accent_color?: number; + banner?: string | null; + password?: string; + new_password?: string; + code?: string; + email?: string; + discriminator?: string; +} \ No newline at end of file diff --git a/src/util/schemas/VanityUrlSchema.ts b/src/util/schemas/VanityUrlSchema.ts new file mode 100644 index 00000000..28bf7f2b --- /dev/null +++ b/src/util/schemas/VanityUrlSchema.ts @@ -0,0 +1,7 @@ +export interface VanityUrlSchema { + /** + * @minLength 1 + * @maxLength 20 + */ + code?: string; +} \ No newline at end of file diff --git a/src/util/schemas/VoiceIdentifySchema.ts b/src/util/schemas/VoiceIdentifySchema.ts new file mode 100644 index 00000000..d48de347 --- /dev/null +++ b/src/util/schemas/VoiceIdentifySchema.ts @@ -0,0 +1,12 @@ +export interface VoiceIdentifySchema { + server_id: string; + user_id: string; + session_id: string; + token: string; + video?: boolean; + streams?: { + type: string; + rid: string; + quality: number; + }[]; +} \ No newline at end of file diff --git a/src/util/schemas/VoiceStateUpdateSchema.ts b/src/util/schemas/VoiceStateUpdateSchema.ts new file mode 100644 index 00000000..5f805f4d --- /dev/null +++ b/src/util/schemas/VoiceStateUpdateSchema.ts @@ -0,0 +1,22 @@ +//TODO need more testing when community guild and voice stage channel are working +export interface VoiceStateUpdateSchema { + guild_id?: string; + channel_id?: string; + self_mute: boolean; + self_deaf: boolean; + self_video?: boolean; + preferred_region?: string; + request_to_speak_timestamp?: Date; + suppress?: boolean; +} + +export const VoiceStateUpdateSchema = { + $guild_id: String, + $channel_id: String, + self_mute: Boolean, + self_deaf: Boolean, + $self_video: Boolean, //required in docs but bots don't always send it + $preferred_region: String, + $request_to_speak_timestamp: Date, + $suppress: Boolean, +}; \ No newline at end of file diff --git a/src/util/schemas/VoiceVideoSchema.ts b/src/util/schemas/VoiceVideoSchema.ts new file mode 100644 index 00000000..837ee1e7 --- /dev/null +++ b/src/util/schemas/VoiceVideoSchema.ts @@ -0,0 +1,17 @@ +export interface VoiceVideoSchema { + audio_ssrc: number; + video_ssrc: number; + rtx_ssrc?: number; + user_id?: string; + streams?: { + type: "video" | "audio"; + rid: string; + ssrc: number; + active: boolean; + quality: number; + rtx_ssrc: number; + max_bitrate: number; + max_framerate: number; + max_resolution: { type: string; width: number; height: number; }; + }[]; +} \ No newline at end of file diff --git a/src/util/schemas/WebhookCreateSchema.ts b/src/util/schemas/WebhookCreateSchema.ts new file mode 100644 index 00000000..c32b642d --- /dev/null +++ b/src/util/schemas/WebhookCreateSchema.ts @@ -0,0 +1,8 @@ +// TODO: webhooks +export interface WebhookCreateSchema { + /** + * @maxLength 80 + */ + name: string; + avatar: string; +} \ No newline at end of file diff --git a/src/util/schemas/WidgetModifySchema.ts b/src/util/schemas/WidgetModifySchema.ts new file mode 100644 index 00000000..3c84b3a1 --- /dev/null +++ b/src/util/schemas/WidgetModifySchema.ts @@ -0,0 +1,4 @@ +export interface WidgetModifySchema { + enabled: boolean; // whether the widget is enabled + channel_id: string; // the widget channel id +} \ No newline at end of file diff --git a/src/util/schemas/index.ts b/src/util/schemas/index.ts index 662152dc..f86552f3 100644 --- a/src/util/schemas/index.ts +++ b/src/util/schemas/index.ts @@ -1,2 +1,41 @@ export * from "./Validator"; -export * from "./voice"; \ No newline at end of file +export * from "./SelectProtocolSchema"; +export * from "./LoginSchema"; +export * from "./RegisterSchema"; +export * from "./TotpSchema"; +export * from "./BackupCodesChallengeSchema"; +export * from "./ChannelModifySchema"; +export * from "./InviteCreateSchema"; +export * from "./PurgeSchema"; +export * from "./WebhookCreateSchema"; +export * from "./MessageCreateSchema"; +export * from "./MessageAcknowledgeSchema"; +export * from "./GuildCreateSchema"; +export * from "./BanCreateSchema"; +export * from "./BanModeratorSchema"; +export * from "./BanRegistrySchema"; +export * from "./EmojiCreateSchema"; +export * from "./EmojiModifySchema"; +export * from "./ModifyGuildStickerSchema"; +export * from "./TemplateCreateSchema"; +export * from "./TemplateModifySchema"; +export * from "./VanityUrlSchema"; +export * from "./GuildUpdateWelcomeScreenSchema"; +export * from "./WidgetModifySchema"; +export * from "./MemberChangeSchema"; +export * from "./RoleModifySchema"; +export * from "./GuildTemplateCreateSchema"; +export * from "./DmChannelCreateSchema"; +export * from "./UserModifySchema"; +export * from "./RelationshipPostSchema"; +export * from "./RelationshipPutSchema"; +export * from "./CodesVerificationSchema"; +export * from "./MfaCodesSchema"; +export * from "./TotpDisableSchema"; +export * from "./TotpEnableSchema"; +export * from "./VoiceIdentifySchema"; +export * from "./VoiceStateUpdateSchema"; +export * from "./VoiceVideoSchema"; +export * from "./IdentifySchema"; +export * from "./ActivitySchema"; +export * from "./LazyRequestSchema"; \ No newline at end of file diff --git a/src/util/schemas/voice.ts b/src/util/schemas/voice.ts deleted file mode 100644 index 61c12f92..00000000 --- a/src/util/schemas/voice.ts +++ /dev/null @@ -1,69 +0,0 @@ -export interface VoiceVideoSchema { - audio_ssrc: number; - video_ssrc: number; - rtx_ssrc?: number; - user_id?: string; - streams?: { - type: "video" | "audio"; - rid: string; - ssrc: number; - active: boolean; - quality: number; - rtx_ssrc: number; - max_bitrate: number; - max_framerate: number; - max_resolution: { type: string; width: number; height: number; }; - }[]; -} - -export const VoiceStateUpdateSchema = { - $guild_id: String, - $channel_id: String, - self_mute: Boolean, - self_deaf: Boolean, - self_video: Boolean -}; - -//TODO need more testing when community guild and voice stage channel are working -export interface VoiceStateUpdateSchema { - channel_id: string; - guild_id?: string; - suppress?: boolean; - request_to_speak_timestamp?: Date; - self_mute?: boolean; - self_deaf?: boolean; - self_video?: boolean; -} - -export interface VoiceIdentifySchema { - server_id: string; - user_id: string; - session_id: string; - token: string; - video?: boolean; - streams?: { - type: string; - rid: string; - quality: number; - }[]; -} - -export interface SelectProtocolSchema { - protocol: "webrtc" | "udp"; - data: - | string - | { - address: string; - port: number; - mode: string; - }; - sdp?: string; - codecs?: { - name: "opus" | "VP8" | "VP9" | "H264"; - type: "audio" | "video"; - priority: number; - payload_type: number; - rtx_payload_type?: number | null; - }[]; - rtc_connection_id?: string; // uuid -} \ No newline at end of file |