Add banner (large) image

This commit is contained in:
spiral
2021-08-02 13:46:12 -04:00
parent 7681978435
commit e144571904
17 changed files with 231 additions and 11 deletions

View File

@@ -10,6 +10,7 @@ namespace PluralKit.Core
public Partial<string?> DisplayName { get; set; }
public Partial<string?> Description { get; set; }
public Partial<string?> Icon { get; set; }
public Partial<string?> BannerImage { get; set; }
public Partial<string?> Color { get; set; }
public Partial<PrivacyLevel> DescriptionPrivacy { get; set; }
@@ -23,6 +24,7 @@ namespace PluralKit.Core
.With("display_name", DisplayName)
.With("description", Description)
.With("icon", Icon)
.With("banner_image", BannerImage)
.With("color", Color)
.With("description_privacy", DescriptionPrivacy)
.With("icon_privacy", IconPrivacy)
@@ -32,7 +34,9 @@ namespace PluralKit.Core
public new void CheckIsValid()
{
if (Icon.Value != null && !MiscUtils.TryMatchUri(Icon.Value, out var avatarUri))
throw new InvalidPatchException("avatar_url");
throw new InvalidPatchException("icon");
if (BannerImage.Value != null && !MiscUtils.TryMatchUri(BannerImage.Value, out var bannerImage))
throw new InvalidPatchException("banner");
if (Color.Value != null && (!Regex.IsMatch(Color.Value, "^[0-9a-fA-F]{6}$")))
throw new InvalidPatchException("color");
}

View File

@@ -11,6 +11,7 @@ namespace PluralKit.Core
public Partial<string> Hid { get; set; }
public Partial<string?> DisplayName { get; set; }
public Partial<string?> AvatarUrl { get; set; }
public Partial<string?> BannerImage { get; set; }
public Partial<string?> Color { get; set; }
public Partial<LocalDate?> Birthday { get; set; }
public Partial<string?> Pronouns { get; set; }
@@ -32,6 +33,7 @@ namespace PluralKit.Core
.With("hid", Hid)
.With("display_name", DisplayName)
.With("avatar_url", AvatarUrl)
.With("banner_image", BannerImage)
.With("color", Color)
.With("birthday", Birthday)
.With("pronouns", Pronouns)
@@ -52,6 +54,8 @@ namespace PluralKit.Core
{
if (AvatarUrl.Value != null && !MiscUtils.TryMatchUri(AvatarUrl.Value, out var avatarUri))
throw new InvalidPatchException("avatar_url");
if (BannerImage.Value != null && !MiscUtils.TryMatchUri(BannerImage.Value, out var bannerImage))
throw new InvalidPatchException("banner");
if (Color.Value != null && (!Regex.IsMatch(Color.Value, "^[0-9a-fA-F]{6}$")))
throw new InvalidPatchException("color");
}

View File

@@ -10,6 +10,7 @@ namespace PluralKit.Core
public Partial<string?> Description { get; set; }
public Partial<string?> Tag { get; set; }
public Partial<string?> AvatarUrl { get; set; }
public Partial<string?> BannerImage { get; set; }
public Partial<string?> Color { get; set; }
public Partial<string?> Token { get; set; }
public Partial<string> UiTz { get; set; }
@@ -29,6 +30,7 @@ namespace PluralKit.Core
.With("description", Description)
.With("tag", Tag)
.With("avatar_url", AvatarUrl)
.With("banner_image", BannerImage)
.With("color", Color)
.With("token", Token)
.With("ui_tz", UiTz)
@@ -46,6 +48,8 @@ namespace PluralKit.Core
{
if (AvatarUrl.Value != null && !MiscUtils.TryMatchUri(AvatarUrl.Value, out var avatarUri))
throw new InvalidPatchException("avatar_url");
if (BannerImage.Value != null && !MiscUtils.TryMatchUri(BannerImage.Value, out var bannerImage))
throw new InvalidPatchException("banner");
if (Color.Value != null && (!Regex.IsMatch(Color.Value, "^[0-9a-fA-F]{6}$")))
throw new InvalidPatchException("color");
}