internal static OnvifDeviceGetRequest DeserializeOnvifDeviceGetRequest(JsonElement element) { EndpointBase endpoint = default; string methodName = default; Optional <string> apiVersion = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("endpoint")) { endpoint = EndpointBase.DeserializeEndpointBase(property.Value); continue; } if (property.NameEquals("methodName")) { methodName = property.Value.GetString(); continue; } if (property.NameEquals("@apiVersion")) { apiVersion = property.Value.GetString(); continue; } } return(new OnvifDeviceGetRequest(methodName, apiVersion.Value, endpoint)); }
internal static HttpExtension DeserializeHttpExtension(JsonElement element) { EndpointBase endpoint = default; ImageProperties image = default; Optional <SamplingOptions> samplingOptions = default; string type = default; string name = default; IList <NodeInput> inputs = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("endpoint")) { endpoint = EndpointBase.DeserializeEndpointBase(property.Value); continue; } if (property.NameEquals("image")) { image = ImageProperties.DeserializeImageProperties(property.Value); continue; } if (property.NameEquals("samplingOptions")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } samplingOptions = SamplingOptions.DeserializeSamplingOptions(property.Value); continue; } if (property.NameEquals("@type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("inputs")) { List <NodeInput> array = new List <NodeInput>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(NodeInput.DeserializeNodeInput(item)); } inputs = array; continue; } } return(new HttpExtension(type, name, inputs, endpoint, image, samplingOptions.Value)); }
internal static RtspSource DeserializeRtspSource(JsonElement element) { Optional <RtspTransport> transport = default; EndpointBase endpoint = default; string type = default; string name = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("transport")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } transport = new RtspTransport(property.Value.GetString()); continue; } if (property.NameEquals("endpoint")) { endpoint = EndpointBase.DeserializeEndpointBase(property.Value); continue; } if (property.NameEquals("@type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } } return(new RtspSource(type, name, Optional.ToNullable(transport), endpoint)); }
internal static ExtensionProcessorBase DeserializeExtensionProcessorBase(JsonElement element) { if (element.TryGetProperty("@type", out JsonElement discriminator)) { switch (discriminator.GetString()) { case "#Microsoft.VideoAnalyzer.GrpcExtension": return(GrpcExtension.DeserializeGrpcExtension(element)); case "#Microsoft.VideoAnalyzer.HttpExtension": return(HttpExtension.DeserializeHttpExtension(element)); } } EndpointBase endpoint = default; ImageProperties image = default; Optional <SamplingOptions> samplingOptions = default; string type = default; string name = default; IList <NodeInput> inputs = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("endpoint")) { endpoint = EndpointBase.DeserializeEndpointBase(property.Value); continue; } if (property.NameEquals("image")) { image = ImageProperties.DeserializeImageProperties(property.Value); continue; } if (property.NameEquals("samplingOptions")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } samplingOptions = SamplingOptions.DeserializeSamplingOptions(property.Value); continue; } if (property.NameEquals("@type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("inputs")) { List <NodeInput> array = new List <NodeInput>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(NodeInput.DeserializeNodeInput(item)); } inputs = array; continue; } } return(new ExtensionProcessorBase(type, name, inputs, endpoint, image, samplingOptions.Value)); }
internal static CognitiveServicesVisionProcessor DeserializeCognitiveServicesVisionProcessor(JsonElement element) { EndpointBase endpoint = default; Optional <ImageProperties> image = default; Optional <SamplingOptions> samplingOptions = default; SpatialAnalysisOperationBase operation = default; string type = default; string name = default; IList <NodeInput> inputs = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("endpoint")) { endpoint = EndpointBase.DeserializeEndpointBase(property.Value); continue; } if (property.NameEquals("image")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } image = ImageProperties.DeserializeImageProperties(property.Value); continue; } if (property.NameEquals("samplingOptions")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } samplingOptions = SamplingOptions.DeserializeSamplingOptions(property.Value); continue; } if (property.NameEquals("operation")) { operation = SpatialAnalysisOperationBase.DeserializeSpatialAnalysisOperationBase(property.Value); continue; } if (property.NameEquals("@type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("inputs")) { List <NodeInput> array = new List <NodeInput>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(NodeInput.DeserializeNodeInput(item)); } inputs = array; continue; } } return(new CognitiveServicesVisionProcessor(type, name, inputs, endpoint, image.Value, samplingOptions.Value, operation)); }