#nullable enable using System.Text.RegularExpressions; using NodaTime; namespace PluralKit.Core { public class MemberPatch: PatchObject { public Partial Name { get; set; } public Partial DisplayName { get; set; } public Partial AvatarUrl { get; set; } public Partial Color { get; set; } public Partial Birthday { get; set; } public Partial Pronouns { get; set; } public Partial Description { get; set; } public Partial ProxyTags { get; set; } public Partial KeepProxy { get; set; } public Partial MessageCount { get; set; } public Partial AllowAutoproxy { get; set; } public Partial Visibility { get; set; } public Partial NamePrivacy { get; set; } public Partial DescriptionPrivacy { get; set; } public Partial PronounPrivacy { get; set; } public Partial BirthdayPrivacy { get; set; } public Partial AvatarPrivacy { get; set; } public Partial MetadataPrivacy { get; set; } public override UpdateQueryBuilder Apply(UpdateQueryBuilder b) => b .With("name", Name) .With("display_name", DisplayName) .With("avatar_url", AvatarUrl) .With("color", Color) .With("birthday", Birthday) .With("pronouns", Pronouns) .With("description", Description) .With("proxy_tags", ProxyTags) .With("keep_proxy", KeepProxy) .With("message_count", MessageCount) .With("allow_autoproxy", AllowAutoproxy) .With("member_visibility", Visibility) .With("name_privacy", NamePrivacy) .With("description_privacy", DescriptionPrivacy) .With("pronoun_privacy", PronounPrivacy) .With("birthday_privacy", BirthdayPrivacy) .With("avatar_privacy", AvatarPrivacy) .With("metadata_privacy", MetadataPrivacy); public new void CheckIsValid() { if (AvatarUrl.Value != null && !MiscUtils.TryMatchUri(AvatarUrl.Value, out var avatarUri)) throw new InvalidPatchException("avatar_url"); if (Color.Value != null && (!Regex.IsMatch(Color.Value, "^[0-9a-fA-F]{6}$"))) throw new InvalidPatchException("color"); } } }