示例#1
0
 internal EmailNotificationHook(HookType hookType, string id, string name, string description, string externalLink, IReadOnlyList <string> administrators, EmailHookParameter hookParameter)
     : base(hookType, id, name, description, externalLink, administrators)
 {
     HookType      = hookType;
     EmailsToAlert = hookParameter.ToList;
 }
示例#2
0
        internal static WebNotificationHook DeserializeWebNotificationHook(JsonElement element)
        {
            Optional <WebhookHookParameter> hookParameter = default;
            HookType          hookType                = default;
            Optional <string> hookId                  = default;
            string            hookName                = default;
            Optional <string> description             = default;
            Optional <string> externalLink            = default;
            Optional <IReadOnlyList <string> > admins = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("hookParameter"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    hookParameter = WebhookHookParameter.DeserializeWebhookHookParameter(property.Value);
                    continue;
                }
                if (property.NameEquals("hookType"))
                {
                    hookType = new HookType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("hookId"))
                {
                    hookId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("hookName"))
                {
                    hookName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("description"))
                {
                    description = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("externalLink"))
                {
                    externalLink = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("admins"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    admins = array;
                    continue;
                }
            }
            return(new WebNotificationHook(hookType, hookId.Value, hookName, description.Value, externalLink.Value, Optional.ToList(admins), hookParameter.Value));
        }
示例#3
0
 internal EmailHook(HookType hookType, string id, string name, string description, string externalLink, IReadOnlyList <string> administrators, EmailHookParameter hookParameter)
     : base(hookType, id, name, description, externalLink, administrators)
 {
     HookParameter = hookParameter;
     HookType      = hookType;
 }