diff options
Diffstat (limited to 'src/util/schemas')
25 files changed, 87 insertions, 93 deletions
diff --git a/src/util/schemas/UserProfileResponse.ts b/src/util/schemas/UserProfileResponse.ts index 4ef6431e..10bbcdbf 100644 --- a/src/util/schemas/UserProfileResponse.ts +++ b/src/util/schemas/UserProfileResponse.ts @@ -16,10 +16,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { PublicConnectedAccount, PublicUserResponse } from ".."; +import { PublicConnectedAccount, PublicUser } from ".."; export interface UserProfileResponse { - user: PublicUserResponse; + user: PublicUser; connected_accounts: PublicConnectedAccount; premium_guild_since?: Date; premium_since?: Date; diff --git a/src/util/schemas/responses/ApplicationDetectableResponse.ts b/src/util/schemas/responses/ApplicationDetectableResponse.ts deleted file mode 100644 index 958b8d43..00000000 --- a/src/util/schemas/responses/ApplicationDetectableResponse.ts +++ /dev/null @@ -1 +0,0 @@ -export type ApplicationDetectableResponse = unknown[]; diff --git a/src/util/schemas/responses/ApplicationEntitlementsResponse.ts b/src/util/schemas/responses/ApplicationEntitlementsResponse.ts deleted file mode 100644 index 1d2b349e..00000000 --- a/src/util/schemas/responses/ApplicationEntitlementsResponse.ts +++ /dev/null @@ -1 +0,0 @@ -export type ApplicationEntitlementsResponse = unknown[]; diff --git a/src/util/schemas/responses/ApplicationSkusResponse.ts b/src/util/schemas/responses/ApplicationSkusResponse.ts deleted file mode 100644 index 8d577c92..00000000 --- a/src/util/schemas/responses/ApplicationSkusResponse.ts +++ /dev/null @@ -1 +0,0 @@ -export type ApplicationSkusResponse = unknown[]; diff --git a/src/util/schemas/responses/ApplicationsResponse.ts b/src/util/schemas/responses/ApplicationsResponse.ts deleted file mode 100644 index fef3fbde..00000000 --- a/src/util/schemas/responses/ApplicationsResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Application } from "../../entities"; - -export type ApplicationsResponse = Application[]; diff --git a/src/util/schemas/responses/ChannelInvitesResponse.ts b/src/util/schemas/responses/ChannelInvitesResponse.ts deleted file mode 100644 index c50d033c..00000000 --- a/src/util/schemas/responses/ChannelInvitesResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Invite } from "../../entities"; - -export type ChannelInvitesResponse = Invite[]; diff --git a/src/util/schemas/responses/ChannelMessagesResponse.ts b/src/util/schemas/responses/ChannelMessagesResponse.ts deleted file mode 100644 index 65b7dab5..00000000 --- a/src/util/schemas/responses/ChannelMessagesResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Message } from "../../entities"; - -export type ChannelMessagesResponse = Message[]; diff --git a/src/util/schemas/responses/ChannelPinsResponse.ts b/src/util/schemas/responses/ChannelPinsResponse.ts deleted file mode 100644 index 7a1b8d43..00000000 --- a/src/util/schemas/responses/ChannelPinsResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Message } from "../../entities"; - -export type ChannelPinsResponse = Message[]; diff --git a/src/util/schemas/responses/ChannelWebhooksResponse.ts b/src/util/schemas/responses/ChannelWebhooksResponse.ts deleted file mode 100644 index 84f49dce..00000000 --- a/src/util/schemas/responses/ChannelWebhooksResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Webhook } from "../../entities"; - -export type ChannelWebhooksResponse = Webhook[]; diff --git a/src/util/schemas/responses/DiscoveryCategoriesResponse.ts b/src/util/schemas/responses/DiscoveryCategoriesResponse.ts deleted file mode 100644 index c23f4f88..00000000 --- a/src/util/schemas/responses/DiscoveryCategoriesResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Categories } from "../../entities"; - -export type DiscoveryCategoriesResponse = Categories[]; diff --git a/src/util/schemas/responses/GeneralConfigurationResponse.ts b/src/util/schemas/responses/GeneralConfigurationResponse.ts deleted file mode 100644 index 4feaa32d..00000000 --- a/src/util/schemas/responses/GeneralConfigurationResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { GeneralConfiguration } from "../../config"; - -export type GeneralConfigurationResponse = GeneralConfiguration; diff --git a/src/util/schemas/responses/GuildChannelsResponse.ts b/src/util/schemas/responses/GuildChannelsResponse.ts deleted file mode 100644 index 3321455d..00000000 --- a/src/util/schemas/responses/GuildChannelsResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Channel } from "../../entities"; - -export type GuildChannelsResponse = Channel[]; diff --git a/src/util/schemas/responses/GuildEmojisResponse.ts b/src/util/schemas/responses/GuildEmojisResponse.ts deleted file mode 100644 index cea6fd55..00000000 --- a/src/util/schemas/responses/GuildEmojisResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Emoji } from "../../entities"; - -export type GuildEmojisResponse = Emoji[]; diff --git a/src/util/schemas/responses/GuildInvitesResponse.ts b/src/util/schemas/responses/GuildInvitesResponse.ts deleted file mode 100644 index cf9ed9cc..00000000 --- a/src/util/schemas/responses/GuildInvitesResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Invite } from "../../entities"; - -export type GuildInvitesResponse = Invite[]; diff --git a/src/util/schemas/responses/GuildMembersResponse.ts b/src/util/schemas/responses/GuildMembersResponse.ts deleted file mode 100644 index 8d14fd9e..00000000 --- a/src/util/schemas/responses/GuildMembersResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Member } from "../../entities"; - -export type GuildMembersResponse = Member[]; diff --git a/src/util/schemas/responses/GuildResponse.ts b/src/util/schemas/responses/GuildResponse.ts deleted file mode 100644 index 00035243..00000000 --- a/src/util/schemas/responses/GuildResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Guild } from "../../entities"; - -export type GuildResponse = Guild & { joined_at: string }; diff --git a/src/util/schemas/responses/GuildRolesResponse.ts b/src/util/schemas/responses/GuildRolesResponse.ts deleted file mode 100644 index a064cddb..00000000 --- a/src/util/schemas/responses/GuildRolesResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Role } from "../../entities"; - -export type GuildRolesResponse = Role[]; diff --git a/src/util/schemas/responses/GuildStickersResponse.ts b/src/util/schemas/responses/GuildStickersResponse.ts deleted file mode 100644 index a02f3e55..00000000 --- a/src/util/schemas/responses/GuildStickersResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Sticker } from "../../entities"; - -export type GuildStickersResponse = Sticker[]; diff --git a/src/util/schemas/responses/GuildTemplatesResponse.ts b/src/util/schemas/responses/GuildTemplatesResponse.ts deleted file mode 100644 index e975fe43..00000000 --- a/src/util/schemas/responses/GuildTemplatesResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Template } from "../../entities"; - -export type GuildTemplatesResponse = Template[]; diff --git a/src/util/schemas/responses/GuildVoiceRegionsResponse.ts b/src/util/schemas/responses/GuildVoiceRegionsResponse.ts index c17e2f5d..8190d5fd 100644 --- a/src/util/schemas/responses/GuildVoiceRegionsResponse.ts +++ b/src/util/schemas/responses/GuildVoiceRegionsResponse.ts @@ -5,5 +5,3 @@ export interface GuildVoiceRegion { deprecated: boolean; optimal: boolean; } - -export type GuildVoiceRegionsResponse = GuildVoiceRegion[]; diff --git a/src/util/schemas/responses/LimitsConfigurationResponse.ts b/src/util/schemas/responses/LimitsConfigurationResponse.ts deleted file mode 100644 index f40ab918..00000000 --- a/src/util/schemas/responses/LimitsConfigurationResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { LimitsConfiguration } from "../../config"; - -export type LimitsConfigurationResponse = LimitsConfiguration; diff --git a/src/util/schemas/responses/StickerPacksResponse.ts b/src/util/schemas/responses/StickerPacksResponse.ts deleted file mode 100644 index 4f382df0..00000000 --- a/src/util/schemas/responses/StickerPacksResponse.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { StickerPack } from "../../entities"; - -export type StickerPacksResponse = StickerPack[]; diff --git a/src/util/schemas/responses/TypedResponses.ts b/src/util/schemas/responses/TypedResponses.ts new file mode 100644 index 00000000..cb238401 --- /dev/null +++ b/src/util/schemas/responses/TypedResponses.ts @@ -0,0 +1,84 @@ +import { GeneralConfiguration, LimitsConfiguration } from "../../config"; +import { DmChannelDTO } from "../../dtos"; +import { + Application, + BackupCode, + Categories, + Channel, + Emoji, + Guild, + Invite, + Member, + Message, + PrivateUser, + PublicUser, + Role, + Sticker, + StickerPack, + Template, + Webhook, +} from "../../entities"; +import { GuildVoiceRegion } from "./GuildVoiceRegionsResponse"; + +// removes internal properties from the guild class +export type APIGuild = Omit< + Guild, + | "afk_channel" + | "template" + | "owner" + | "public_updates_channel" + | "rules_channel" + | "system_channel" + | "widget_channel" +>; + +export type APIPublicUser = PublicUser; +export type APIPrivateUser = PrivateUser; + +export type APIGuildArray = APIGuild[]; + +export type APIDMChannelArray = DmChannelDTO[]; + +export type APIBackupCodeArray = BackupCode[]; + +export interface UserUpdateResponse extends APIPrivateUser { + newToken?: string; +} + +export type ApplicationDetectableResponse = unknown[]; + +export type ApplicationEntitlementsResponse = unknown[]; + +export type ApplicationSkusResponse = unknown[]; + +export type APIApplicationArray = Application[]; + +export type APIInviteArray = Invite[]; + +export type APIMessageArray = Message[]; + +export type APIWebhookArray = Webhook[]; + +export type APIDiscoveryCategoryArray = Categories[]; + +export type APIGeneralConfiguration = GeneralConfiguration; + +export type APIChannelArray = Channel[]; + +export type APIEmojiArray = Emoji[]; + +export type APIMemberArray = Member[]; + +export type GuildWithJoinedAt = Guild & { joined_at: string }; + +export type APIRoleArray = Role[]; + +export type APIStickerArray = Sticker[]; + +export type APITemplateArray = Template[]; + +export type APIGuildVoiceRegion = GuildVoiceRegion[]; + +export type APILimitsConfiguration = LimitsConfiguration; + +export type APIStickerPackArray = StickerPack[]; diff --git a/src/util/schemas/responses/UserResponse.ts b/src/util/schemas/responses/UserResponse.ts deleted file mode 100644 index 95f73649..00000000 --- a/src/util/schemas/responses/UserResponse.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { DmChannelDTO } from "../../dtos"; -import { BackupCode, Guild, PrivateUser, PublicUser } from "../../entities"; - -export type PublicUserResponse = PublicUser; -export type PrivateUserResponse = PrivateUser; - -export interface UserUpdateResponse extends PrivateUserResponse { - newToken?: string; -} - -export type UserGuildsResponse = Guild[]; - -export type UserChannelsResponse = DmChannelDTO[]; - -export type UserBackupCodesResponse = BackupCode[]; diff --git a/src/util/schemas/responses/index.ts b/src/util/schemas/responses/index.ts index 282c4a41..d8b7fd57 100644 --- a/src/util/schemas/responses/index.ts +++ b/src/util/schemas/responses/index.ts @@ -1,34 +1,17 @@ export * from "./APIErrorOrCaptchaResponse"; export * from "./APIErrorResponse"; -export * from "./ApplicationDetectableResponse"; -export * from "./ApplicationEntitlementsResponse"; -export * from "./ApplicationSkusResponse"; -export * from "./ApplicationsResponse"; export * from "./BackupCodesChallengeResponse"; export * from "./CaptchaRequiredResponse"; -export * from "./ChannelInvitesResponse"; -export * from "./ChannelPinsResponse"; -export * from "./ChannelWebhooksResponse"; export * from "./DiscoverableGuildsResponse"; -export * from "./DiscoveryCategoriesResponse"; export * from "./GatewayBotResponse"; export * from "./GatewayResponse"; -export * from "./GeneralConfigurationResponse"; export * from "./GenerateRegistrationTokensResponse"; export * from "./GuildBansResponse"; -export * from "./GuildChannelsResponse"; export * from "./GuildCreateResponse"; export * from "./GuildDiscoveryRequirements"; -export * from "./GuildEmojisResponse"; -export * from "./GuildInvitesResponse"; -export * from "./GuildMembersResponse"; export * from "./GuildMessagesSearchResponse"; export * from "./GuildPruneResponse"; export * from "./GuildRecommendationsResponse"; -export * from "./GuildResponse"; -export * from "./GuildRolesResponse"; -export * from "./GuildStickersResponse"; -export * from "./GuildTemplatesResponse"; export * from "./GuildVanityUrl"; export * from "./GuildVoiceRegionsResponse"; export * from "./GuildWidgetJsonResponse"; @@ -36,18 +19,16 @@ export * from "./GuildWidgetSettingsResponse"; export * from "./InstanceDomainsResponse"; export * from "./InstancePingResponse"; export * from "./InstanceStatsResponse"; -export * from "./LimitsConfigurationResponse"; export * from "./LocationMetadataResponse"; export * from "./MemberJoinGuildResponse"; export * from "./OAuthAuthorizeResponse"; -export * from "./StickerPacksResponse"; export * from "./Tenor"; export * from "./TokenResponse"; +export * from "./TypedResponses"; export * from "./UpdatesResponse"; export * from "./UserNoteResponse"; export * from "./UserProfileResponse"; export * from "./UserRelationshipsResponse"; export * from "./UserRelationsResponse"; -export * from "./UserResponse"; export * from "./WebAuthnCreateResponse"; export * from "./WebhookCreateResponse"; |