From 65b4f0e3701e9c14c8406ccd0c8f1b509ec1800c Mon Sep 17 00:00:00 2001 From: Grey Himmel Date: Sat, 25 Sep 2021 15:05:42 -0400 Subject: [PATCH] Add color to system JSON representation --- PluralKit.Core/Models/PKSystem.cs | 1 + PluralKit.Core/Models/Patch/SystemPatch.cs | 1 + docs/content/api-documentation.md | 1 + 3 files changed, 3 insertions(+) diff --git a/PluralKit.Core/Models/PKSystem.cs b/PluralKit.Core/Models/PKSystem.cs index edf0b7dc..b2c0d34f 100644 --- a/PluralKit.Core/Models/PKSystem.cs +++ b/PluralKit.Core/Models/PKSystem.cs @@ -72,6 +72,7 @@ namespace PluralKit.Core o.Add("tag", system.Tag); o.Add("avatar_url", system.AvatarUrl.TryGetCleanCdnUrl()); o.Add("banner", system.DescriptionPrivacy.Get(ctx, system.BannerImage).TryGetCleanCdnUrl()); + o.Add("color", system.Color); o.Add("created", system.Created.FormatExport()); // todo: change this to "timezone" o.Add("tz", system.UiTz); diff --git a/PluralKit.Core/Models/Patch/SystemPatch.cs b/PluralKit.Core/Models/Patch/SystemPatch.cs index 199da232..bf4129d4 100644 --- a/PluralKit.Core/Models/Patch/SystemPatch.cs +++ b/PluralKit.Core/Models/Patch/SystemPatch.cs @@ -77,6 +77,7 @@ namespace PluralKit.Core if (o.ContainsKey("tag")) patch.Tag = o.Value("tag").NullIfEmpty(); if (o.ContainsKey("avatar_url")) patch.AvatarUrl = o.Value("avatar_url").NullIfEmpty(); if (o.ContainsKey("banner")) patch.BannerImage = o.Value("banner").NullIfEmpty(); + if (o.ContainsKey("color")) patch.Color = o.Value("color").NullIfEmpty(); if (o.ContainsKey("timezone")) patch.UiTz = o.Value("tz") ?? "UTC"; // legacy: APIv1 uses "tz" instead of "timezone" diff --git a/docs/content/api-documentation.md b/docs/content/api-documentation.md index 5fbbe033..84102551 100644 --- a/docs/content/api-documentation.md +++ b/docs/content/api-documentation.md @@ -55,6 +55,7 @@ A `?` after the column type indicates a nullable parameter (value can be cleared | name | string | Yes | 100-character limit. | | description | string? | Yes | 1000-character limit. | | tag | string? | Yes | | +| color | string? | Yes | 6-char hex (eg. `ff7000`), sans `#`. | | avatar_url | url? | Yes | Not validated server-side. | | banner | url? | Yes | Not validated server-side. | | tz | string? | Yes | Tzdb identifier. Patching with `null` will store `"UTC"`. |