internal static WebNotificationHook DeserializeWebNotificationHook(JsonElement element) { WebhookHookParameter hookParameter = default; NotificationHookKind hookType = default; Optional <string> hookId = default; string hookName = default; Optional <string> description = default; Optional <string> externalLink = default; Optional <IList <string> > admins = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("hookParameter")) { hookParameter = WebhookHookParameter.DeserializeWebhookHookParameter(property.Value); continue; } if (property.NameEquals("hookType")) { hookType = new NotificationHookKind(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)); }
internal WebNotificationHook(HookType hookType, string id, string name, string description, string externalLink, IReadOnlyList <string> administrators, WebhookHookParameter hookParameter) : base(hookType, id, name, description, externalLink, administrators) { HookType = hookType; Endpoint = new Uri(hookParameter.Endpoint); Username = hookParameter.Username; Password = hookParameter.Password; CertificateKey = hookParameter.CertificateKey; CertificatePassword = hookParameter.CertificatePassword; Headers = hookParameter.Headers; }