internal ApsAlert CopyAndValidate()

in FirebaseAdmin/FirebaseAdmin/Messaging/ApsAlert.cs [108:140]


        internal ApsAlert CopyAndValidate()
        {
            var copy = new ApsAlert()
            {
                Title = this.Title,
                Subtitle = this.Subtitle,
                Body = this.Body,
                LocKey = this.LocKey,
                LocArgs = this.LocArgs?.ToList(),
                TitleLocKey = this.TitleLocKey,
                TitleLocArgs = this.TitleLocArgs?.ToList(),
                SubtitleLocKey = this.SubtitleLocKey,
                SubtitleLocArgs = this.SubtitleLocArgs?.ToList(),
                ActionLocKey = this.ActionLocKey,
                LaunchImage = this.LaunchImage,
            };
            if (copy.TitleLocArgs?.Any() == true && string.IsNullOrEmpty(copy.TitleLocKey))
            {
                throw new ArgumentException("TitleLocKey is required when specifying TitleLocArgs.");
            }

            if (copy.SubtitleLocArgs?.Any() == true && string.IsNullOrEmpty(copy.SubtitleLocKey))
            {
                throw new ArgumentException("SubtitleLocKey is required when specifying SubtitleLocArgs.");
            }

            if (copy.LocArgs?.Any() == true && string.IsNullOrEmpty(copy.LocKey))
            {
                throw new ArgumentException("LocKey is required when specifying LocArgs.");
            }

            return copy;
        }