Discovery schemas
2 files changed, 165 insertions, 3 deletions
diff --git a/extra/admin-api/Models/Spacebar.Models.Api/DiscoverableGuild.cs b/extra/admin-api/Models/Spacebar.Models.Api/DiscoverableGuild.cs
new file mode 100644
index 00000000..334facd9
--- /dev/null
+++ b/extra/admin-api/Models/Spacebar.Models.Api/DiscoverableGuild.cs
@@ -0,0 +1,109 @@
+using System.Diagnostics;
+using System.Text.Json.Serialization;
+using Spacebar.Models.Generic;
+
+namespace Spacebar.Models.Api;
+
+[DebuggerDisplay("{Id} ({Name})")]
+public class DiscoverableGuild {
+ [JsonPropertyName("id"), JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
+ public required long Id { get; set; }
+
+ [JsonPropertyName("name")]
+ public string Name { get; set; }
+
+ [JsonPropertyName("icon")]
+ public string? Icon { get; set; }
+
+ [JsonPropertyName("description")]
+ public string? Description { get; set; }
+
+ [JsonPropertyName("banner")]
+ public string? Banner { get; set; }
+
+ [JsonPropertyName("discovery_splash")]
+ public string? DiscoverySplash { get; set; }
+
+ [JsonPropertyName("emojis")]
+ public List<Emoji> Emojis { get; set; }
+
+ [JsonPropertyName("emoji_count")]
+ public int EmojiCount { get; set; }
+
+ [JsonPropertyName("features")]
+ public List<string> Features { get; set; }
+
+ [JsonPropertyName("preferred_locale")]
+ public string PreferredLocale { get; set; }
+
+ [JsonPropertyName("premium_subscription_count")]
+ public int PremiumSubscriptionCount { get; set; }
+
+ [JsonPropertyName("splash")]
+ public string? Splash { get; set; }
+
+ [JsonPropertyName("stickers")]
+ public List<Sticker> Stickers { get; set; }
+
+ [JsonPropertyName("sticker_count")]
+ public int StickerCount { get; set; }
+
+ [JsonPropertyName("vanity_url_code")]
+ public string? VanityUrlCode { get; set; }
+
+ [JsonPropertyName("approximate_member_count")]
+ public int ApproximateMemberCount { get; set; }
+
+ [JsonPropertyName("approximate_presence_count")]
+ public int ApproximatePresenceCount { get; set; }
+
+ [JsonPropertyName("auto_removed")]
+ public bool AutoRemoved { get; set; }
+
+ [JsonPropertyName("primary_category_id")]
+ public short PrimaryCategoryId { get; set; }
+
+ [JsonPropertyName("primary_category")]
+ public DiscoveryCategory PrimaryCategory { get; set; }
+
+ [JsonPropertyName("keywords")]
+ public List<string> Keywords { get; set; }
+
+ [JsonPropertyName("is_published")]
+ public bool IsPublished { get; set; }
+
+ [JsonPropertyName("reasons_to_join")]
+ public List<DiscoveryReason> ReasonsToJoin { get; set; }
+
+ [JsonPropertyName("social_links")]
+ public List<string> SocialLinks { get; set; }
+
+ [JsonPropertyName("about")]
+ public string About { get; set; }
+
+ [JsonPropertyName("category_ids")]
+ public List<short> CategoryIds { get; set; }
+
+ [JsonPropertyName("categories")]
+ public List<DiscoveryCategory> Categories { get; set; }
+
+ [JsonPropertyName("created_at")]
+ public DateTime CreatedAt { get; set; }
+
+ [JsonPropertyName("nsfw_properties")]
+ public DiscoveryNsfwProperties NsfwProperties { get; set; }
+}
+
+public class DiscoveryCategory {
+ public short Id { get; set; }
+ public string Name { get; set; }
+ public bool IsPrimary { get; set; }
+}
+
+public class DiscoveryReason {
+
+}
+
+public class DiscoveryNsfwProperties {
+
+}
diff --git a/src/schemas/responses/DiscoverableGuildsResponse.ts b/src/schemas/responses/DiscoverableGuildsResponse.ts
index 711c10cd..6eb3de8d 100644
--- a/src/schemas/responses/DiscoverableGuildsResponse.ts
+++ b/src/schemas/responses/DiscoverableGuildsResponse.ts
@@ -16,12 +16,65 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-// TODO: remove dependency on entities
-import { Guild } from "@spacebar/database";
+import { Snowflake, StickerResponse } from "@spacebar/schemas";
+import { EmojiResponse } from "@spacebar/schemas/api/guilds/Emoji";
export interface DiscoverableGuildsResponse {
total: number;
- guilds: Guild[];
+ guilds: DiscoverableGuild[];
offset: number;
limit: number;
}
+
+export interface DiscoverableGuild {
+ id: Snowflake;
+ name: string;
+ icon: string | null;
+ description: string | null;
+ banner: string | null;
+ splash: string | null;
+ discovery_splash: string | null;
+ features: string[];
+ vanity_url_code: string | null;
+ preferred_locale: string;
+ premium_subscription_count: number;
+ approximate_member_count: number;
+ approximate_presence_count: number;
+ emojis?: EmojiResponse[];
+ emoji_count?: number;
+ stickers?: StickerResponse[];
+ sticker_count?: number;
+ auto_removed: boolean;
+ primary_category_id: number;
+ primary_category?: DiscoveryCategory;
+ keywords: string[];
+ is_published: boolean;
+ reasons_to_join?: DiscoveryReason[];
+ social_links?: string[];
+ about?: string | null;
+ category_ids?: Snowflake[];
+ categories?: DiscoveryCategory[];
+ created_at?: string;
+ nsfw_properties?: DiscoveryNsfwProperties | null;
+}
+
+export interface DiscoveryCategory {
+ id: number;
+ name: string;
+ is_primary: boolean;
+}
+
+export interface DiscoveryReason {
+ reason: string;
+ emoji_id?: Snowflake;
+ emoji_name?: string;
+}
+
+export interface DiscoveryNsfwProperties {
+ channels?: Snowflake[];
+ channel_banned_keywords?: { [id: Snowflake]: string[] };
+ name?: string;
+ name_banned_keywords?: string[];
+ description?: string;
+ description_banned_keywords?: string[];
+}
|