internal EventHandler(string urlTemplate, string userEventPattern, IList <string> systemEvents, UpstreamAuthSettings auth) { UrlTemplate = urlTemplate; UserEventPattern = userEventPattern; SystemEvents = systemEvents; Auth = auth; }
internal static EventHandler DeserializeEventHandler(JsonElement element) { string urlTemplate = default; Optional <string> userEventPattern = default; Optional <IList <string> > systemEvents = default; Optional <UpstreamAuthSettings> auth = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("urlTemplate")) { urlTemplate = property.Value.GetString(); continue; } if (property.NameEquals("userEventPattern")) { userEventPattern = property.Value.GetString(); continue; } if (property.NameEquals("systemEvents")) { 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()); } systemEvents = array; continue; } if (property.NameEquals("auth")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } auth = UpstreamAuthSettings.DeserializeUpstreamAuthSettings(property.Value); continue; } } return(new EventHandler(urlTemplate, userEventPattern.Value, Optional.ToList(systemEvents), auth.Value)); }