public WebPubSubHubData(WebPubSubHubProperties properties) { if (properties == null) { throw new ArgumentNullException(nameof(properties)); } Properties = properties; }
private async Task <WebPubSubHub> CreateDefaultWebPubSubHub(WebPubSubHubCollection collection, string name) { IList <Models.EventHandler> eventHandlers = new List <Models.EventHandler>() { new Models.EventHandler("http://example.com/api/{hub}/{event}") { SystemEvents = { "none" }, Auth = new UpstreamAuthSettings(), }, }; var webPubSubHubProperties = new WebPubSubHubProperties(eventHandlers, "Deny"); WebPubSubHubData data = new WebPubSubHubData(webPubSubHubProperties) { }; var hub = await collection.CreateOrUpdateAsync(true, name, data); return(hub.Value); }
internal static WebPubSubHubData DeserializeWebPubSubHubData(JsonElement element) { Optional <SystemData> systemData = default; WebPubSubHubProperties properties = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("systemData")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString()); continue; } if (property.NameEquals("properties")) { properties = WebPubSubHubProperties.DeserializeWebPubSubHubProperties(property.Value); continue; } if (property.NameEquals("id")) { id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } } return(new WebPubSubHubData(id, name, type, systemData, properties)); }
internal WebPubSubHubData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, WebPubSubHubProperties properties) : base(id, name, type) { SystemData = systemData; Properties = properties; }