diff --git a/assets/openapi.json b/assets/openapi.json index 0e1b4fa..c1df064 100644 --- a/assets/openapi.json +++ b/assets/openapi.json @@ -977,6 +977,62 @@ "view_nsfw_guilds" ] }, + "StickersResponse": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StickerResponse" + } + }, + "StickerResponse": { + "type": "object", + "properties": { + "id": { + "description": "A Twitter-like snowflake, except the epoch is 2015-01-01T00:00:00.000Z\n```\nIf we have a snowflake '266241948824764416' we can represent it as binary:\n\n64 22 17 12 0\n 000000111011000111100001101001000101000000 00001 00000 000000000000\n number of ms since Discord epoch worker pid increment\n```", + "type": "string" + }, + "pack_id": { + "description": "A Twitter-like snowflake, except the epoch is 2015-01-01T00:00:00.000Z\n```\nIf we have a snowflake '266241948824764416' we can represent it as binary:\n\n64 22 17 12 0\n 000000111011000111100001101001000101000000 00001 00000 000000000000\n number of ms since Discord epoch worker pid increment\n```", + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string", + "nullable": true + }, + "tags": { + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/StickerType" + }, + "format_type": { + "$ref": "#/components/schemas/StickerFormatType" + }, + "available": { + "type": "boolean" + }, + "guild_id": { + "description": "A Twitter-like snowflake, except the epoch is 2015-01-01T00:00:00.000Z\n```\nIf we have a snowflake '266241948824764416' we can represent it as binary:\n\n64 22 17 12 0\n 000000111011000111100001101001000101000000 00001 00000 000000000000\n number of ms since Discord epoch worker pid increment\n```", + "type": "string" + }, + "user": { + "$ref": "#/components/schemas/PartialUser" + }, + "sort_value": { + "type": "integer" + } + }, + "required": [ + "description", + "format_type", + "id", + "name", + "tags", + "type" + ] + }, "IdentifySchema": { "type": "object", "properties": { @@ -3161,12 +3217,6 @@ "$ref": "#/components/schemas/Channel" } }, - "APIEmojiArray": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Emoji" - } - }, "APIMemberArray": { "type": "array", "items": { @@ -3185,12 +3235,6 @@ "flags": { "type": "integer" }, - "mute": { - "type": "boolean" - }, - "deaf": { - "type": "boolean" - }, "nick": { "type": "string" }, @@ -3201,6 +3245,12 @@ "pending": { "type": "boolean" }, + "deaf": { + "type": "boolean" + }, + "mute": { + "type": "boolean" + }, "premium_since": { "type": "integer" }, @@ -3425,12 +3475,6 @@ "$ref": "#/components/schemas/Role" } }, - "APIStickerArray": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Sticker" - } - }, "APITemplateArray": { "type": "array", "items": { @@ -3474,12 +3518,6 @@ "user" ] }, - "APIStickerPackArray": { - "type": "array", - "items": { - "$ref": "#/components/schemas/StickerPack" - } - }, "APIConnectionsConfiguration": { "type": "object" }, @@ -11740,12 +11778,6 @@ "flags": { "type": "integer" }, - "mute": { - "type": "boolean" - }, - "deaf": { - "type": "boolean" - }, "nick": { "type": "string" }, @@ -11756,6 +11788,12 @@ "pending": { "type": "boolean" }, + "deaf": { + "type": "boolean" + }, + "mute": { + "type": "boolean" + }, "premium_since": { "type": "integer" }, @@ -11993,6 +12031,92 @@ } } }, + "PartialUser": { + "type": "object", + "properties": { + "id": { + "description": "A Twitter-like snowflake, except the epoch is 2015-01-01T00:00:00.000Z\n```\nIf we have a snowflake '266241948824764416' we can represent it as binary:\n\n64 22 17 12 0\n 000000111011000111100001101001000101000000 00001 00000 000000000000\n number of ms since Discord epoch worker pid increment\n```", + "type": "string" + }, + "username": { + "type": "string" + }, + "discriminator": { + "type": "string" + }, + "global_name": { + "type": "string", + "nullable": true + }, + "avatar": { + "type": "string", + "nullable": true + }, + "avatar_decoration_data": { + "anyOf": [ + { + "$ref": "#/components/schemas/AvatarDecorationData" + }, + { + "type": "null" + } + ] + }, + "collectibles": { + "anyOf": [ + { + "$ref": "#/components/schemas/Collectibles" + }, + { + "type": "null" + } + ] + }, + "display_name_styles": { + "anyOf": [ + { + "$ref": "#/components/schemas/DisplayNameStyle" + }, + { + "type": "null" + } + ] + }, + "primary_guild": { + "anyOf": [ + { + "$ref": "#/components/schemas/PrimaryGuild" + }, + { + "type": "null" + } + ] + }, + "bot": { + "type": "boolean" + }, + "system": { + "type": "boolean" + }, + "banner": { + "type": "string", + "nullable": true + }, + "accent_color": { + "type": "integer", + "nullable": true + }, + "public_flags": { + "type": "integer" + } + }, + "required": [ + "avatar", + "discriminator", + "id", + "username" + ] + }, "Classification": { "type": "object", "properties": { @@ -12880,92 +13004,6 @@ "type" ] }, - "PartialUser": { - "type": "object", - "properties": { - "id": { - "description": "A Twitter-like snowflake, except the epoch is 2015-01-01T00:00:00.000Z\n```\nIf we have a snowflake '266241948824764416' we can represent it as binary:\n\n64 22 17 12 0\n 000000111011000111100001101001000101000000 00001 00000 000000000000\n number of ms since Discord epoch worker pid increment\n```", - "type": "string" - }, - "username": { - "type": "string" - }, - "discriminator": { - "type": "string" - }, - "global_name": { - "type": "string", - "nullable": true - }, - "avatar": { - "type": "string", - "nullable": true - }, - "avatar_decoration_data": { - "anyOf": [ - { - "$ref": "#/components/schemas/AvatarDecorationData" - }, - { - "type": "null" - } - ] - }, - "collectibles": { - "anyOf": [ - { - "$ref": "#/components/schemas/Collectibles" - }, - { - "type": "null" - } - ] - }, - "display_name_styles": { - "anyOf": [ - { - "$ref": "#/components/schemas/DisplayNameStyle" - }, - { - "type": "null" - } - ] - }, - "primary_guild": { - "anyOf": [ - { - "$ref": "#/components/schemas/PrimaryGuild" - }, - { - "type": "null" - } - ] - }, - "bot": { - "type": "boolean" - }, - "system": { - "type": "boolean" - }, - "banner": { - "type": "string", - "nullable": true - }, - "accent_color": { - "type": "integer", - "nullable": true - }, - "public_flags": { - "type": "integer" - } - }, - "required": [ - "avatar", - "discriminator", - "id", - "username" - ] - }, "HubGuild": { "type": "object", "properties": { @@ -16435,6 +16473,40 @@ ] } }, + "/users/@me/billing/location-info/": { + "get": { + "security": [ + { + "bearer": [] + } + ], + "responses": { + "default": { + "description": "No description available" + } + }, + "tags": [ + "users" + ] + } + }, + "/users/@me/billing/country-code/": { + "get": { + "security": [ + { + "bearer": [] + } + ], + "responses": { + "default": { + "description": "No description available" + } + }, + "tags": [ + "users" + ] + } + }, "/users/@me/applications/{application_id}/entitlements/": { "get": { "security": [ @@ -17109,7 +17181,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIStickerPackArray" + "$ref": "#/components/schemas/StickersResponse" } } } @@ -19742,7 +19814,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/APIStickerArray" + "$ref": "#/components/schemas/StickersResponse" } } } diff --git a/assets/schemas.json b/assets/schemas.json index 1458afd..a3fe6de 100644 --- a/assets/schemas.json +++ b/assets/schemas.json @@ -995,6 +995,67 @@ ], "$schema": "http://json-schema.org/draft-07/schema#" }, + "StickersResponse": { + "type": "array", + "items": { + "$ref": "#/definitions/StickerResponse" + }, + "$schema": "http://json-schema.org/draft-07/schema#" + }, + "StickerResponse": { + "type": "object", + "properties": { + "id": { + "description": "A Twitter-like snowflake, except the epoch is 2015-01-01T00:00:00.000Z\n```\nIf we have a snowflake '266241948824764416' we can represent it as binary:\n\n64 22 17 12 0\n 000000111011000111100001101001000101000000 00001 00000 000000000000\n number of ms since Discord epoch worker pid increment\n```", + "type": "string" + }, + "pack_id": { + "description": "A Twitter-like snowflake, except the epoch is 2015-01-01T00:00:00.000Z\n```\nIf we have a snowflake '266241948824764416' we can represent it as binary:\n\n64 22 17 12 0\n 000000111011000111100001101001000101000000 00001 00000 000000000000\n number of ms since Discord epoch worker pid increment\n```", + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": [ + "null", + "string" + ] + }, + "tags": { + "type": "string" + }, + "type": { + "$ref": "#/definitions/StickerType" + }, + "format_type": { + "$ref": "#/definitions/StickerFormatType" + }, + "available": { + "type": "boolean" + }, + "guild_id": { + "description": "A Twitter-like snowflake, except the epoch is 2015-01-01T00:00:00.000Z\n```\nIf we have a snowflake '266241948824764416' we can represent it as binary:\n\n64 22 17 12 0\n 000000111011000111100001101001000101000000 00001 00000 000000000000\n number of ms since Discord epoch worker pid increment\n```", + "type": "string" + }, + "user": { + "$ref": "#/definitions/PartialUser" + }, + "sort_value": { + "type": "integer" + } + }, + "additionalProperties": false, + "required": [ + "description", + "format_type", + "id", + "name", + "tags", + "type" + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, "IdentifySchema": { "type": "object", "properties": { @@ -3330,13 +3391,6 @@ }, "$schema": "http://json-schema.org/draft-07/schema#" }, - "APIEmojiArray": { - "type": "array", - "items": { - "$ref": "#/definitions/Emoji" - }, - "$schema": "http://json-schema.org/draft-07/schema#" - }, "APIMemberArray": { "type": "array", "items": { @@ -3357,12 +3411,6 @@ "flags": { "type": "integer" }, - "mute": { - "type": "boolean" - }, - "deaf": { - "type": "boolean" - }, "nick": { "type": "string" }, @@ -3373,6 +3421,12 @@ "pending": { "type": "boolean" }, + "deaf": { + "type": "boolean" + }, + "mute": { + "type": "boolean" + }, "premium_since": { "type": "integer" }, @@ -3609,13 +3663,6 @@ }, "$schema": "http://json-schema.org/draft-07/schema#" }, - "APIStickerArray": { - "type": "array", - "items": { - "$ref": "#/definitions/Sticker" - }, - "$schema": "http://json-schema.org/draft-07/schema#" - }, "APITemplateArray": { "type": "array", "items": { @@ -3663,13 +3710,6 @@ ], "$schema": "http://json-schema.org/draft-07/schema#" }, - "APIStickerPackArray": { - "type": "array", - "items": { - "$ref": "#/definitions/StickerPack" - }, - "$schema": "http://json-schema.org/draft-07/schema#" - }, "APIConnectionsConfiguration": { "type": "object", "additionalProperties": false, @@ -12407,12 +12447,6 @@ "flags": { "type": "integer" }, - "mute": { - "type": "boolean" - }, - "deaf": { - "type": "boolean" - }, "nick": { "type": "string" }, @@ -12423,6 +12457,12 @@ "pending": { "type": "boolean" }, + "deaf": { + "type": "boolean" + }, + "mute": { + "type": "boolean" + }, "premium_since": { "type": "integer" }, @@ -12677,6 +12717,102 @@ "additionalProperties": false, "$schema": "http://json-schema.org/draft-07/schema#" }, + "PartialUser": { + "type": "object", + "properties": { + "id": { + "description": "A Twitter-like snowflake, except the epoch is 2015-01-01T00:00:00.000Z\n```\nIf we have a snowflake '266241948824764416' we can represent it as binary:\n\n64 22 17 12 0\n 000000111011000111100001101001000101000000 00001 00000 000000000000\n number of ms since Discord epoch worker pid increment\n```", + "type": "string" + }, + "username": { + "type": "string" + }, + "discriminator": { + "type": "string" + }, + "global_name": { + "type": [ + "null", + "string" + ] + }, + "avatar": { + "type": [ + "null", + "string" + ] + }, + "avatar_decoration_data": { + "anyOf": [ + { + "$ref": "#/definitions/AvatarDecorationData" + }, + { + "type": "null" + } + ] + }, + "collectibles": { + "anyOf": [ + { + "$ref": "#/definitions/Collectibles" + }, + { + "type": "null" + } + ] + }, + "display_name_styles": { + "anyOf": [ + { + "$ref": "#/definitions/DisplayNameStyle" + }, + { + "type": "null" + } + ] + }, + "primary_guild": { + "anyOf": [ + { + "$ref": "#/definitions/PrimaryGuild" + }, + { + "type": "null" + } + ] + }, + "bot": { + "type": "boolean" + }, + "system": { + "type": "boolean" + }, + "banner": { + "type": [ + "null", + "string" + ] + }, + "accent_color": { + "type": [ + "null", + "integer" + ] + }, + "public_flags": { + "type": "integer" + } + }, + "additionalProperties": false, + "required": [ + "avatar", + "discriminator", + "id", + "username" + ], + "$schema": "http://json-schema.org/draft-07/schema#" + }, "Classification": { "type": "object", "properties": { @@ -13642,102 +13778,6 @@ ], "$schema": "http://json-schema.org/draft-07/schema#" }, - "PartialUser": { - "type": "object", - "properties": { - "id": { - "description": "A Twitter-like snowflake, except the epoch is 2015-01-01T00:00:00.000Z\n```\nIf we have a snowflake '266241948824764416' we can represent it as binary:\n\n64 22 17 12 0\n 000000111011000111100001101001000101000000 00001 00000 000000000000\n number of ms since Discord epoch worker pid increment\n```", - "type": "string" - }, - "username": { - "type": "string" - }, - "discriminator": { - "type": "string" - }, - "global_name": { - "type": [ - "null", - "string" - ] - }, - "avatar": { - "type": [ - "null", - "string" - ] - }, - "avatar_decoration_data": { - "anyOf": [ - { - "$ref": "#/definitions/AvatarDecorationData" - }, - { - "type": "null" - } - ] - }, - "collectibles": { - "anyOf": [ - { - "$ref": "#/definitions/Collectibles" - }, - { - "type": "null" - } - ] - }, - "display_name_styles": { - "anyOf": [ - { - "$ref": "#/definitions/DisplayNameStyle" - }, - { - "type": "null" - } - ] - }, - "primary_guild": { - "anyOf": [ - { - "$ref": "#/definitions/PrimaryGuild" - }, - { - "type": "null" - } - ] - }, - "bot": { - "type": "boolean" - }, - "system": { - "type": "boolean" - }, - "banner": { - "type": [ - "null", - "string" - ] - }, - "accent_color": { - "type": [ - "null", - "integer" - ] - }, - "public_flags": { - "type": "integer" - } - }, - "additionalProperties": false, - "required": [ - "avatar", - "discriminator", - "id", - "username" - ], - "$schema": "http://json-schema.org/draft-07/schema#" - }, "HubGuild": { "type": "object", "properties": { diff --git "a/src/api/routes/guilds/\043guild_id/stickers.ts" "b/src/api/routes/guilds/\043guild_id/stickers.ts" index 857713d..aa3b76b 100644 --- "a/src/api/routes/guilds/\043guild_id/stickers.ts" +++ "b/src/api/routes/guilds/\043guild_id/stickers.ts" @@ -29,7 +29,7 @@ route({ responses: { 200: { - body: "APIStickerArray", + body: "StickersResponse", }, 403: { body: "APIErrorResponse", diff --git a/src/api/routes/sticker-packs/index.ts b/src/api/routes/sticker-packs/index.ts index b5b08cf..ce4f214 100644 --- a/src/api/routes/sticker-packs/index.ts +++ b/src/api/routes/sticker-packs/index.ts @@ -27,7 +27,7 @@ route({ responses: { 200: { - body: "APIStickerPackArray", + body: "StickersResponse", }, }, }), diff --git a/src/schemas/api/guilds/Sticker.ts b/src/schemas/api/guilds/Sticker.ts index 116d72f..212baad 100644 --- a/src/schemas/api/guilds/Sticker.ts +++ b/src/schemas/api/guilds/Sticker.ts @@ -1,3 +1,23 @@ +import { Snowflake } from "../../Identifiers"; +import { PartialUser } from "../users"; + +export type StickersResponse = StickerResponse[]; +export interface StickerResponse { + id: Snowflake; + pack_id?: Snowflake; + name: string; + description: string | null; + tags: string; + type: StickerType; + format_type: StickerFormatType; + available?: boolean; + guild_id?: Snowflake; + // Only filled for Get Guild Sticker(/s) + user?: PartialUser; + // Only filled in for sticker packs + sort_value?: number; +} + export enum StickerType { STANDARD = 1, GUILD = 2, diff --git a/src/schemas/responses/TypedResponses.ts b/src/schemas/responses/TypedResponses.ts index 13143a9..9d5d612 100644 --- a/src/schemas/responses/TypedResponses.ts +++ b/src/schemas/responses/TypedResponses.ts @@ -25,15 +25,10 @@ // TODO: remove this entire file! // removes internal properties from the guild class export type APIGuild = Omit; - 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 { @@ -41,29 +36,16 @@ } export type ApplicationDetectableResponse = unknown[]; - export type ApplicationEntitlementsResponse = unknown[]; - export type ApplicationSkusResponse = unknown[]; - export type APIApplicationArray = Application[]; - export type APIBansArray = GuildBansResponse[]; - 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 APIPublicMember = PublicMember; @@ -72,17 +54,10 @@ } export type APIRoleArray = Role[]; - -export type APIStickerArray = Sticker[]; - export type APITemplateArray = Template[]; - export type APIGuildVoiceRegion = GuildVoiceRegion[]; - export type APILimitsConfiguration = LimitsConfiguration; -export type APIStickerPackArray = StickerPack[]; - export type APIConnectionsConfiguration = Record< string, { diff --git a/src/util/entities/Attachment.ts b/src/util/entities/Attachment.ts index 9dc9c3a..4dced10 100644 --- a/src/util/entities/Attachment.ts +++ b/src/util/entities/Attachment.ts @@ -17,7 +17,6 @@ */ import { BeforeRemove, Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm"; -import { URL } from "url"; import { deleteFile } from "../util"; import { BaseClass } from "./BaseClass"; import { getUrlSignature, NewUrlUserSignatureData, NewUrlSignatureData } from "../Signing";